43
loading...
This website collects cookies to deliver better user experience
ffmpeg -ss 00:00:00 -i "input.mkv" -to 00:10:00 -c copy "output.mkv" -avoid_negative_ts 1
-i
stand for 'input', this typically is followed by a file."input.mkv"
is the name of the file for your input.-ss
is the time offset. In this example, it's placed before the -i (input option). This is done intentionally, but this may need to played around with. Doing SS's are forced to split on i-frames, and there's a lot of posts about how to use this in certain scenarios. For example, if you notice you have a couple seconds of audio before your video starts (video freezing) you might need to choose a different configuration or cut the video at the start of an i-frame. You can use ffprobe
or just experiment to try and figure that out.00:00:00
This represents our starting time in the file. There's some documentation regarding the format of time duration.-to
this is used to specify time duration. In our example this is placed between two time durations00:10:00
Time duration, since this is after the -to
this is the ending time.-c copy
specifies the codec to encode. In this example, we're copying the video and audio codecs."output.mkv"
specifies the output file-avoid_negative_ts 1
This ensures the time base is correct, however I have seen some online forums suggesting this may make it not start on a keyframe..txt
to reference our files we want to combine, and make use of ffmpeg filters. This is simply to show the diversity of the software; you can reference the files directly as well, though in this example, it would be a tad more complex, as it would require a complex filter, and while there are more complicated methods using filtergraphs, etc., we want to keep it simple. This tutorial assumes you have two videos that are essentially the same encoding, # of streams, etc.Example.txt
file 'Example1.mkv'
file 'Example2.mkv'
file
is case sensitive!ffmpeg -f concat -i Example.txt -c copy output.mkv
-f
specifies a filter, short for -filter
concat
specifies using the concatenate filter. Documentation
-i
Same as before, this is the input.Example.txt
We created this above. This is our input
and ultimately maps out to our actual files.-c copy
copies all codecsoutput.mkv
specifies the output file