Thomas De Reyck's Blog

Trimming Video with FFmpeg

You can use the following command to trim video:

ffmpeg -ss 00:00:30.0 -i input.mkv -c copy -t 00:00:10.0 output.mkv

-ss indicates at what timestamp to start. You can also specify only seconds.
-t indicates how long the fragment you want to keep is.

Alternatively, you can use the following:

ffmpeg -ss 00:00:30.0 -to 00:00:40.0 -i input.mkv -c copy output.mkv

-to indicates the end timestamp. Must precede input file. See man ffmpeg.

You can find out the correct timestamps with ffplay:

ffplay -vf "drawtext=text='%{pts\:hms}':box=1:x=(w-tw)/2:y=h-(2*lh)" input.mkv

You can also use the timestamp from other video players, but beware, there might be discrepancies that build up as time passes!

#FFmpeg #Video Editing