kkroening / ffmpeg-python

Python bindings for FFmpeg - with complex filtering support
Apache License 2.0
10k stars 886 forks source link

How to use segment and segment_time to split video stream #266

Open mostafasayed33 opened 5 years ago

mostafasayed33 commented 5 years ago

I use this command to get stream from URL and split it every 30 seconds and save it to a new file. is it available in ffmpeg-python to do the same. I tried to find any documentation but I failed to find the documentation

ffmpeg -i url/to/stream -c copy -flags +global_header -f segment -segment_time 30 -segment_format_options movflags=+faststart -reset_timestamps 1 video_%d.mp4

plizmol commented 5 years ago

As said in documentation

Any supplied keyword arguments are passed to ffmpeg verbatim

So you can just pass segment and segment_time args to ffmpeg.output ffmpeg.input('url/to/stream').output('video_%d.mp4', f='segment', segment_time='30', ...)

shaantanu314 commented 4 months ago

Thanks!! Was searching for this for a long time