Wednesday 29 February 2012

Concatenating video files

A simple way to put two video files together:

mencoder -oac copy -ovc copy -o output.mkv input1.avi input2.avi

Of course, you can change the extension of output to your preferred container, like m4a. The input can also be anything that mencoder can read, depending on your codecs. To give more details, "-oac copy" means that the output audio will be copied, so not re-encoded. I guess you can easily figure out what "-ovc copy" means then. You may also want to add the -idx option to allow seeking:

mencoder -idx -oac copy -ovc copy -o output.mkv input1.avi input2.avi

Note that you can have an arbitrary number of input files, just list them one after the other. On Ubuntu, mencoder can be installed with sudo apt-get install mencoder, but you already knew that...

No comments:

Post a Comment