Joining H.264/AAC video files

It is possible to join H.264/AAC video files without re-enconding, if you convert them to an MPEG transport stream (TS). This format supports concatenation. Of course, the video files need to have the same height and width, aspect ratio,…

Using ffmpeg:

ffmpeg -i 01.m4v -c copy -bsf:v h264_mp4toannexb 01.ts
ffmpeg -i 02.m4v -c copy -bsf:v h264_mp4toannexb 02.ts
ffmpeg -i concat:"01.ts|02.ts" -c copy -bsf:a aac_adtstoasc join.m4v
rm 01.ts 02.ts

The bitstream filters take care of container requirements.

One thought on “Joining H.264/AAC video files

  1. Pingback: Splitting and merging of .m4v video files with ffmpeg | Thinking too much

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>