Combine MP4/M4V Files in Linux/Ubuntu

by Andrew Martin @

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.



One thought on “Combine MP4/M4V Files in Linux/Ubuntu”

  1. These commands DO NOT WORK, typed it exactly and the terminal keeps giving back = “Error appending 1.mp4: Requested URL is not valid or cannot be found”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s