ffmpeg: gapless video splitting and concatenation
December 2016
For instance you have a big video file and want to split it onto several parts all.mpg
. Splitting it on 1 sec parts:
ffmpeg -i all.mp4 -ss 0 -t 1 first-1-sec.mp4 ffmpeg -i all.mp4 -ss 1 -t 1 first-2-sec.mp4 ffmpeg -i all.mp4 -ss 2 -t 1 first-3-sec.mp4
After this you can want to check the result by combining these files together in one:
One alternative is:
ffmpeg -i "concat:first-1-sec.mp4|first-2-sec.mp4|first-3-sec.mp4" -c copy blah.mp4
But it works for me not always. So there’s also another one:
- Creating files.txt:
file first-1-sec.mp4 file first-2-sec.mp4 file first-3-sec.mp4
- Running
ffmpeg -f concat -i files.txt blah.mp4
And here we’re!
Leave a Reply