FFmpeg Concat Demuxer vs Concat Filter Performance

When combining multiple video files in FFmpeg, choosing between the concat demuxer and the concat filter is the most critical decision affecting rendering speed, CPU utilization, and output quality. This article compares the performance profiles of both methods, explaining why the demuxer offers near-instantaneous, lossless stitching, while the filter provides maximum format compatibility at the cost of high computational overhead and potential quality loss.

The Concat Demuxer: High Speed, Low Resource Usage

The concat demuxer operates at the container level. It reads a list of input files from a text file and copies the packets sequentially into a new output file without touching the underlying compressed data.

  • Processing Speed: Extremely fast. Because it performs a stream copy (-c copy) rather than re-encoding, processing speed is limited only by your storage drive's read and write speeds. It can merge hours of video in a matter of seconds.
  • Resource Utilization: Minimal CPU and memory usage. Since there is no decoding or encoding taking place, the CPU remains largely idle.
  • Video Quality: 100% lossless. Because the compressed bitstream is copied directly, no generation loss occurs.
  • Limitation: The input files must have identical parameters, including the same codecs, timebases, resolutions, aspect ratios, and pixel formats. If they do not match, the output file will likely be corrupted or unplayable.

The Concat Filter: High Compatibility, High Resource Usage

The concat filter operates at the filtergraph level. It requires FFmpeg to completely decode the input video and audio streams, pass the raw uncompressed frames to the filter to be joined, and then re-encode the combined stream into the destination format.

  • Processing Speed: Extremely slow compared to the demuxer. The speed is determined entirely by the efficiency of your chosen encoder (e.g., x264, x265) and the resolution/framerate of the video.
  • Resource Utilization: Highly intensive. Both the CPU and GPU (if hardware acceleration is used) will run at or near maximum capacity to handle the simultaneous decoding, filtering, and re-encoding.
  • Video Quality: Subject to generation loss. Re-encoding the video introduces compression artifacts unless you encode to a lossless format, which results in massive file sizes.
  • Advantage: Unmatched flexibility. The filter can successfully merge videos with different resolutions, codecs, frame rates, and audio layouts. It automatically handles the conversion processes during the re-encoding phase.

Performance Summary Table

Metric Concat Demuxer Concat Filter
Operation Level Container (Stream Copy) Codec (Decode -> Filter -> Encode)
Speed Near-instantaneous Slow (limited by encoder speed)
CPU/GPU Load Negligible Very High
Output Quality Lossless (no change to original pixels) Lossy (degraded by re-encoding)
Input Constraints Must be identical codecs/parameters Can be completely different formats

When to Use Each Method

Use the concat demuxer when you are stitching together clips from the same source, such as segments split by a camera, segments of a recorded livestream, or TS video chunks.

Use the concat filter when you need to merge videos from different sources (like a mix of MP4, AVI, and MKV files), or when you want to apply transitions, overlays, or watermarks during the joining process.