Merge multiple mp4/m4v files

Here is a simple way to merge two mp4/m4v files into one:

MP4Box -cat file1 -cat file2 -new outputfile

It will go off and read the video and audio for the first file and then the second and then produce a single file.
Here is an example where I wanted to join Part 1 and Part 2 of Ben Hur into 1 file.

$ MP4Box -cat "Ben.Hur.1959.Part.I.mp4" -cat "Ben.Hur.1959.Part.II.mp4" -new Ben.Hur.1959.mp4
 IsoMedia import - track ID 1 - Video (size 718 x 374)
 IsoMedia import - track ID 2 - Audio (SR 48000 - 2 channels)
 IsoMedia import - track ID 3 - VobSub (size 720 x 576)
 IsoMedia import - track ID 4 - media type "text:text"
 IsoMedia import - track ID 1 - Video (size 718 x 374)
 IsoMedia import - track ID 2 - Audio (SR 48000 - 2 channels)
 IsoMedia import - track ID 3 - VobSub (size 720 x 576)
 IsoMedia import - track ID 4 - media type "text:text"
 Saving to Ben.Hur.1959.mp4: 0.500 secs Interleaving

If you don’t have the MP4Box command available on your system you will need to do the following to install it.

$ sudo apt-get install gpac

One comment

  1. grishnak · January 3, 2015

    Thanks very much! Simple, quick and effective.

    Like

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s