Trim videos using FFMPEG

Last Updated: June 3, 2022

So you have some long video that you wish to trim down to just a few minutes somewhere in the middle without adding or doing anything else to that video. For such a simple task, there is no need to mess with some fancy video editor. The only tool you will need for this is FFmpeg, which can be downloaded from here:

Very useful utility application to have around that is capable of many things, but for our purposes here we are only interested in trimming a particular video to some specified interval.

Once you have ffmpeg downloaded and available for use from your command line, you are then ready to use the form below to generate the exact command that trims your video down to precise timeline.

Two commands will be given:
First command will only trim the video and do nothing else. And it is very fast.
The second command does same as the above, PLUS it will re-encode the video which is sometimes needed, however it will take much more time depending on the exact length of the segment you are trying to extract.


ffmpeg -i "" -ss s -t s -c copy cut.mp4
ffmpeg -i "" -ss s -t s -c:v libx264 -c:a aac -strict experimental -b:a 128k cut.mp4
ffmpeg -i "" -ss s -t s -c:v libx264 -crf 21 -preset faster -pix_fmt yuv420p -maxrate 5000K -bufsize 5000K -vf "scale=if(gte(iw\,ih)\,min(1920\,iw)\,-2):if(lt(iw\,ih)\,min(1920\,ih)\,-2)" -movflags +faststart -c:a aac -b:a 160k "cut.mp4"