Concatenate Videos with Different Audio Channels in FFmpeg

This article explains how to successfully concatenate two video files with different audio channel layouts—such as merging a video with stereo audio and another with 5.1 surround sound—using FFmpeg. You will learn the exact command-line syntax and how the filter graph works to standardize audio channels before merging.

When you attempt to concatenate two videos with different audio channel layouts using FFmpeg’s basic concat demuxer, the command will often fail or result in an output file with corrupted, silent, or out-of-sync audio. To resolve this, you must use FFmpeg’s filter_complex engine to standardize the audio channel layouts of both files before merging them.

Here is the recommended command to concatenate two videos and standardize their audio to stereo:

ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex \
"[0:a]aformat=channel_layouts=stereo[a1]; \
 [1:a]aformat=channel_layouts=stereo[a2]; \
 [0:v][a1][1:v][a2]concat=n=2:v=1:a=1[outv][outa]" \
-map "[outv]" -map "[outa]" output.mp4

How the Command Works

If you prefer to standardize the audio to a 5.1 surround sound layout instead of stereo, simply change channel_layouts=stereo to channel_layouts=5.1 for both audio inputs in the filter chain.