Merging Avi and Mpg Video's

Howto Merge two or more Mpg or Avi Video's Together

Below are examples of command line tools that concatenate or append Video formats together, the merging is accomplished using the command called cat. This common unix tool is extremely versatile with many uses not related to the function we intend for it. The easiest way to demonstrate a use for cat is a practical application of it's use.

#> cat movie2.mpg > movie1.mpg

Actually many files can be merged this way not just mpg's text files also and many others. Alternatively you can right the same command above to create a new third file rather than append to an existing file thus.

#> cat movie1.mpg movie2.mpg > newcreatedmovie.mpg

The advantage of the above is that no original files are altered in the creation of a new extended video file format. However the positioning of each video in the chain in both commands are important otherwise you could have the end video sequence at the beginning and the beginning at the end. It is also important to remember that the use of such tools means that Video editing is at a very basic level.

The creation of one merged file from two old files is very easy using mpg video formats, as no further file manipulation is required. In other words if you now try to run the video created in a player it will run successfully, provided both original files are not corrupted. Try this approach now with avi file formats and you get something different, only the first part of the avi video created will play. This then gives you the same original file but now it may approach something twice it's original size.

#> cat movie1.avi movie2.avi > new_movie.avi

The above process did not fail, rather it is a two step process you just haven't yet completed it yet. The newly created file needs to be re-indexed.

#> mencoder -forceidx -oac copy -ovc copy new_movie.avi -o movie.avi