How to create a clip from an mp4-file quickly?

Question:

I have a web app that lets users download a clip from a mp4-file specified before. Currently I use ffmpeg via python like this:

os.system('ffmpeg -i original_video -ss {start} -t {duration} result_video')

Processing 10 minutes of 720p video with this method also takes a few minutes (during the execution, ffmpeg displays speed=3x on average). Does this mean processing 10 minutes of video takes 3minutes & 20 seconds as I understand it?

Is this slow of a performance expected? Can I improve it by using an other filetype than mp4?

Asked By: Moritz Groß

||

Answers:

Sadly, speeding up the video will not make the download faster. The download speed depends on your processing power, the quality of the video, and of coarse the format. You could attempt to test it with different formats or search it up on google I’m sure other people have already tested them. Hope this helps 🙂

Answered By: Ennomic Gazer

It’s taking a long time because you’re re-encoding the output video when you don’t have to. Add the -c:v copy -c:a copy options and it will be much faster.

os.system(f'ffmpeg -i original_video -ss {start} -t {duration} -c:v copy -c:a copy result_video')
Answered By: WyattBlue