Stream-copy concat needs every input to share the same codec, resolution, and time base. In the real world, the clips you want to join come from different cameras, screen recordings, and downloaded sources, and they almost never match. The filter-graph concat handles that by re-encoding everything to a common output.

The command

ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "[0:v][0:a][1:v][1:a] concat=n=2:v=1:a=1 [v][a]" -map "[v]" -map "[a]" output.mp4

What it does

FFmpeg's concat filter takes N video and N audio inputs and produces one video and one audio output. Here, n=2:v=1:a=1 means 2 inputs, 1 video stream out, 1 audio stream out. The [0:v][0:a][1:v][1:a] argument specifies the order: video of input 0, audio of input 0, video of input 1, audio of input 1. The -map flags then route the filter outputs to the muxer.

When to use it

For any time the inputs are not byte-compatible: different resolutions, different codecs, different frame rates, different audio sample rates. The filter handles all of it. The trade-off is that everything is re-encoded, which costs time and quality.

Video and audio requirements

Any decodable inputs. The output uses H.264 video and AAC audio by default. Pick a target resolution, frame rate, and audio sample rate that suits the deliverable. Mismatched frame rates between inputs are a common source of stutter; normalize with -fps_mode vfr or the scale and fps filters before the concat.

Things to avoid

  • Forgetting to declare all inputs on the command line. The filter sees only the streams you wire in. If you pass -i input3.mp4 but do not list [2:v][2:a], the third input is silently dropped.
  • Using the stream-copy concat when inputs differ. It will fail; this filter is the recovery path.
  • Expecting the output to preserve the source quality. Re-encoding always loses a generation. For two-generation workflows (edit, then transcode), accept the loss or work from the originals.
  • Forgetting to scale and pad mixed resolutions. A 1080p and a 720p input concat'd together need one of them resized, or the result will be a single resolution chosen by the first input and the second input will be cropped or letterboxed implicitly.