Combine MP4/M4V Files in Linux/Ubuntu

(0 votes, average 0 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: libgpac.so: 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/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.

Partner Links:
 
Related Articles

» How to Determine Which Programs are Using Which Ports

Sometimes a program is using a particular port, preventing another program from capturing and using it. It can be difficult to trace down which process exactly is using the port. Fortunately, there are a couple helpful utilities which can link each process with the port(s) it is using.WindowsOn Windows, download and run . It will display a table of the currently running processes and the ports they are using. It is possible to sort by process name or the port number to make it easy to find the...

» Fix 'Build Path' Error or Missing File in Eclipse Project

Sometimes the Eclipse IDE will refuse to build a project - citing a missing resource or file or just a generic "build path" error. If the resource is not missing but in the folder where it should be, the build path may just need to be refreshed. If you encounter a build error when trying to run a project, try these steps to resolve it:Make all files in the project read-write. To do so, go to the Eclipse workspace in the file manager (e.g. Windows Explorer, Finder, or Nautilus), right-click on...

» How to Count the Number of Files in a Directory in Linux

Counting the number of files in a directory from a Linux command line is easy.  The following command will return the number of files in the current directory and all subdirectories: $> find directory_name -type f -follow | wc -l  This will count all files and files in subdirectories, but not the subdirectories themselves.  To find all the files in only the current directory, you can use: $> find directory_name -type f -maxdepth 1 -follow | wc -l  If you would like to...