I often want to do something that I believe is non-trivial in ffmpeg, only to discover that it is actually very simple, if only I had known how to do it. I even end up writing wrappers to do simple things, because I keep forgetting what to do. However, this file is my new solution: simply write my own documentation for things I would occasionally like to do.
Trimming video between two timecodes
ffmpeg -ss 1:00 -to 2:00 -i input.mkv -c copy output.mkv
-i): start reading input at time 1:00
-to 2:00: stop reading input at time 2:00
-c copyuse the original encoding
Trimming video to a given duration
ffmpeg -i input.mkv -t 1:00 -c copy output.mkv
-t 1:00: limit output duration to one minute
Concatenating (parts of) videos together
First create a file list in
Full syntax here.
file 'input1.mkv' inpoint 1:00 outpoint 2:00 file 'input2.mkv' inpoint 0:30 outpoint 1:30 file 'input3.mkv' file 'input4.mkv'
outpoint the same way as
-to above. Now,
ffmpeg -f concat -safe 0 -i concat.txt -c copy output.mkv
-safe 0: stop the demuxer from rejecting 'unsafe' file paths. Not always necessary, obviously. See the documentation.