John's Corner

Join video files

This tip covers how to join two or more video files into a single MP4 or other video file.

Video files can be tricky to join into a single properly constituted video file, especially if the files have different bit rates. MP4s can be particularly tricky and third party MP4 joining software doesn't always produce good results. However, with some well known video tools, you can take charge. The recommended tools are FFmpeg and Xmedia Recode (XMR).

XMR provides an extensive GUI with FFmpeg at the back end. However, XMR doesn't support joining files, so this is where you can use FFmpeg manually to complete the job.

Follow these steps:

  1. Start by loading your files into XMR. This will allow you to see details of the video and audio contained in each file. You can use XMR to preview the files and if necessary, trim the video to get smooth join points
  2. Use ffmpeg to convert each of the files to an MPEG transport stream. Use the command below, changing the input filename to suit:
    ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts input1.ts
  3. Repeat for the subsequent files
    ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts input2.ts
  4. Join the transport streams, adding any additional files to the concat component as required:
    ffmpeg -i "concat:input1.ts|input2.ts" -c copy output.mp4
  5. Test the final file in your favourite player. In particular, check the join points and total playing time.

Return to Tips and Tricks

John's Corner