Skip to main content
Concatenate two or more video clips into a single output. The concat filter re-encodes on the fly so it works even when the clips have different codecs, resolutions, or frame rates.

Code

How the FFmpeg command works

  • -i {{in_1}} -i {{in_2}} — two input videos (add more with in_3, in_4, etc.)
  • concat=n=2:v=1:a=1 — concatenate 2 inputs, each contributing 1 video stream + 1 audio stream
  • [v][a] — named outputs for the concatenated streams
  • -map "[v]" -map "[a]" — route concatenated streams to the output
  • -c:v libx264 -c:a aac — re-encode (required by the concat filter)
  • {{out_1}} — output file
For N videos, add -i {{in_N}} per input, update n=N, and extend the stream-selection list: [0:v][0:a][1:v][1:a]...[N-1:v][N-1:a]. If all clips share the same codec/resolution/framerate, the demuxer approach (concat as a protocol, no re-encode) is faster — but requires a concat list file.

Response