How to splice sections of a video with avconv

avconvffmpegvideo editing

I have figured out so far that you can cut a section from a video with avconv with a command like this (cuts from 1:00-3:00):

avconv -ss 00:01:00 -i "input.avi" -t 00:02:00 -c:v libx264 -crf 23 "output.mp4"

But how would I cut two (or more) sections from the video and combine them into one video? For example, taking 1:00-3:00 as above, plus 8:00-10:00, making a final 4 minute video.

I guess I can do them separately then concatenate them, but is there a simpler way?

Best Answer

I believe you will have to cut separate chunks, then concatenate them. Don't use cat for that, as timecodes will be all over the place.

If the video chunks are mp4, use mp4box (from the gpac package) for concatenation:

mp4box -cat vid1.mp4 -cat vid2.mp4 ... -cat vidN.mp4 -new vid1-N.mp4
Related Question