Quick tip: Concatenating video files (with no quality loss)

Concatenation of video files can be done quickly from the command-line, video files must "match" (e.g. a movie formerly split into parts) i.e. they must use the same codec and parameters, this methods won't work as expected with random files.

  • AVI files: Use mencoder with multiple inputs
    $ mencoder -oac copy -ovc copy -o output.avi input1.avi input2.avi [...]
  • MPEG files: They can either be concatenated directly:
    $ cat input1.mpg input2.mpg > output.mpg
    Or the mencoder method, which I prefer, can be used (note the output format must now be set):
    $ mencoder -oac copy -ovc copy -of mpeg -o output.mpg input1.mpg input2.mpg [...]
  • Quirks and other formats:
    • The mencoder method won't work for multi-audio files
    • mencoder has worse support for other formats, they might require an intermediate transmuxing to avi.

I'll update this post if I find better ways or alternatives to do this.


References:


Please note: New comments won't appear immediately, they have to be manually approved (usually done quickly).

Leave a Reply

Your email address will not be published. Required fields are marked *