Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two halves of a single show in two .MP4 files, encoded in H264. I would like to join them without re-encoding.

Is this possible?

I managed to create a joined video as a Quicktime file (.mov) using Quicktime Pro, but then Quicktime Pro will not convert it back to .MP4 without re-encoding. This may be because looking inside the .mov file, the two H264 videos are in there still separated as individual "objects".

I am also struggling with MPEG StreamClip without reaching a real solution. But I may have missed something.

Note that I do not have the same issue with MPEG2 files. I can export them to a .MPEG container or a .TS file for example, and then I can join them without re-encoding using MPEG Streamclip.

Any suggestion welcome, preferably using Mac software.

share|improve this question
Of course the videos need to have the same aspects to be joined without re-encoding (same size, bitrate, etc.). You should be able to do it in VirtualDubMOD: open the MP4, then Append Segment. – Synetech Mar 10 '11 at 6:06
ffmpeg -i q.mp4 -c copy -bsf h264_mp4toannexb q.ts

ffmpeg -i r.mp4 -c copy -bsf h264_mp4toannexb r.ts

ffmpeg -i "concat:q.ts|r.ts" -c copy -bsf aac_adtstoasc qr.mp4

How to concatenate flv file into one

share|improve this answer
I'm also using the current ffmpeg version from MacPorts (0.7.11 at this time). For the first two commands, use -vcodec copy -vbsf h264_mp4toannexb instead of -c copy -bsf h264_mp4toannexb. For the third command, use -vcodec copy -acodec copy instead of -c copy. – Sean Jun 20 '12 at 1:09
If the commands don't work for you, try upgrading to a non-ancient version of FFmpeg. They offer static builds for every major OS: – slhck Feb 4 '13 at 19:19
What if it is m4v (non-h264 mp4), what bsf should be used? – Edison Jun 12 '13 at 23:12
Modern Ubuntu Linux, and likely others, substitutes avconv for ffmpeg. Same args. – Scott Hepler Mar 26 '14 at 21:29

MP4Box will do this for you:

MP4Box -cat File01.m4v -cat File02.m4v File-joined.m4v

MP4Box is cross-platform and works on OSX, however I tried this on Ubuntu Linux with H264 videos created by Handbrake for the iPhone 4S.

This works quite fast as the files are not re-encoded.

share|improve this answer
Works great. Use sudo apt-get install gpac to install it. You can use this command line if you have many files to join: MP4Box $(for file in single*m4v; do echo -cat $file; done) joined.m4v – guettli Nov 5 '15 at 14:54
up vote 2 down vote accepted

The Quicktime MP4 Codec choice has a "pass through" mode.

Here is a full detailed recipe to join two MP4 H264 videos, using Quicktime. Note that Quicktime X is not advanced enough yet, so use Quicktime 7 (an optional install with Snow Leopard):

  1. Open the two H264 videos in Quicktime 7. Let's suppose they are named video1.mp4 and video2.mp4.
  2. Working on video1.mp4, Select All, then Copy.
  3. Switch to video2.mp4, make sure the "cursor" is at the beginning of the video, then Paste. This inserts the content of video1.mp4 at the front of video2.mp4.
  4. This step is probably optional. "Save As" the modified video2.mp4. You will be able to save in .mov format only. I saved as a self-contained movie, but I suppose a reference movie would work too. I used the filename "".
  5. Select "Export" in the file menu to export to the joined H264 file. The "Export" to select is "Movie to MPEG-4". The preset is not important, I chose "LAN/Intranet". The preset is not important because we override it in the next step.
  6. Click on "Options" to reach the settings dialog. In the Video pane, "Video Format" is selected to be "H.264". Click on the menu, select "Pass Through". As expected, all the other options will get disabled.
  7. Click OK, then Save, and watch your joined file be saved at the speed of your hard disk.

You could alternatively use SimpleMovieX, a shareware video editor which exactly advertises this as a feature.

share|improve this answer

I think this should be possible, although the two parts might need to be the "same" certain ways (resolution, etc) in order for the join to work. This sounds like it will probably be the case with your situation.

You could try this tool: ... I have not used it but it specifically lists joining files as part of its feature set and H.264 is one of the supported encodings.

share|improve this answer
Thanks for the link. I could not try it as the site says this program does not support Snow Leopard. Moreover, I just found a working solution using Quicktime only (see my answer). Also, though I don't know in this case, some tools advertise joining video file but do so with full re-encoding, which is at best misleading. – jdmuys Apr 23 '10 at 6:12
My apologies; I misread that bit on the site. Glad you found a simpler approach -- it did seem strange that it would be necessary to get a special tool for this. – Zac Thompson Apr 23 '10 at 7:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .