August 3

Linux: Combine MP4/M4V Files

You may want to combine multiple mp4/m4v video files into one continuous video. In order to do this, you need to install the gpac library of programs onto Ubuntu. Open up Terminal and run:

sudo apt-get install gpac

This will install the gpac library. One of the programs included with it is MP4Box, which you can use to concatenate the video files. If you are using 64 bit Linux or get an error like MP4Box: error while loading shared libraries: libgpac.so: cannot open shared object file: No such file or directory, then you need to link the shared library to /usr/lib: (I did not run into this issue -nh)

sudo ln -s /usr/local/lib64/libgpac.so /usr/lib/libgpac.so

Now to convert your files, add -cat filename.mp4 for each of your files to this command, with -new combinedfile.mp4 as your output, combined file:

MP4Box -cat vid1.mp4 -cat vid2.mp4 -cat vid3.mp4 -new combinedfile.mp4

Once the process finishes, your combined video file will be in combinedfile.mp4.

By: A. Martin


Copyright 2021. All rights reserved.

Posted August 3, 2013 by Timothy Conrad in category "Linux

About the Author

If I were to describe myself with one word it would be, creative. I am interested in almost everything which keeps me rather busy. Here you will find some of my technical musings. Securely email me using - PGP: 4CB8 91EB 0C0A A530 3BE9 6D76 B076 96F1 6135 0A1B