H.264 – How to Join H264 Files Without Re-encoding

.mp4h.264mpeg4video

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.

Best Answer

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

Related Question