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:


Discover more from OutlyerNet

Subscribe to get the latest posts to your email.

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top