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.
ffmpeg -ss 1:00 -to 2:00 -i input.mkv -c copy output.mkv-ss 1:00(before-i): start reading input at time 1:00-to 2:00: stop reading input at time 2:00-c copyuse the original encoding
ffmpeg -i input.mkv -t 1:00 -c copy output.mkv-t 1:00: limit output duration to one minute
First create a file list in concat.txt.
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'
Consider inpoint and outpoint the same way as -ss and -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.
ffmpeg -i input.mkv -filter:v "crop=width:height:x:y" -c:a copy output.mkvxandyare the coordinates of the top left of the crop area-c:a copy: copy the audio stream