Joining H264 *without* re-encoding

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

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

ffmpeg -i 'concat:f1.ts|f2.ts' -c copy -bsf aac_adtstoasc f3.mp4

How to concatenate flv file into one


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.


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 "video.mov".
  5. Select "Export" in the file menu to export video.mov 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.