instance1 / video.py
ChandimaPrabath's picture
fixed ui
5c6ae28
raw
history blame
607 Bytes
from ffmpy import FFmpeg
def ffmpeg_stream(file_url,token, output="tmp/cache/output.mp4"):
try:
# Set up the FFmpeg command with quality options
ff = FFmpeg(
inputs={
file_url: None
},
outputs={
f'{output}': '-c:v libx264 -crf 23 -preset medium -c:a aac -b:a 192k'
},
global_options= f'-headers "Authorization: Bearer {token}"'
)
# Run the command
ff.run()
except Exception as e:
print(f"Error using FFmpeg to stream file: {e}")
return None