Combine MP4/M4V Files in Linux/Ubuntu

(1 vote, average 5.00 out of 5)

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: cannot open shared object file: No such file or directory, then you need to link the shared library to /usr/lib:

sudo ln -s /usr/local/lib64/ /usr/lib/


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.

Partner Links:
Related Articles

» How to Use a Linux (or Mac OS X) Terminal

Every computer hobbyist, at some point, learns to use Linux.  The transition from using a UI based interface in Windows or Mac to performing many functions through the terminal can be a jarring experience for many people.  Many users find the terminal difficult to use and inferior to navigating a UI.  However, the Linux terminal is an extremely powerful device that many learn to love and use often.  Here is a basic introduction to get your feet wet with a terminal.  It...

» Grant Write Access to CIFS Mount As A Regular User

Often you may want a cifs/smbfs (Samba) mount on Linux to be writeable by normal users. If it is the case that you can write to the mounted filesystem as root but not as a normal user (Permission Denied), then you may need to adjust your mount options in /etc/fstab. The key mount options are file_mode and dir_mode, which override the default file and directory permissions for Samba shares. By manually setting these values, you can grant read/write access to normal users on the local...

» Mount a WebDAV filesystem (like on Linux using davfs2

You can easily mount a WebDAV filesystem on Linux so that you can access the files just like they were on your local computer. One way to do is to install the davfs2 package (this is the Ubuntu/Debian package name, though it should be similar for other distros). Once you have installed it, add an entry to /etc/davfs2/secrets with your login credentials for the WebDAV account. For, the command would look like this:sudo echo “ username password” >>...