Use the concat protocol
The `concat` protocol is the one-line version of the `concat` demuxer. It uses the `concat:` URL scheme to specify the input files, separated by `|`. It is the right tool for a quick join without a list file.
The command
ffmpeg -i "concat:a.mp4|b.mp4|c.mp4" -c copy out.mp4What it does
The command opens the three files in order, demuxes the streams, and writes them to the output. The output is the exact concatenation of the inputs, container and all. The protocol is a shortcut for the demuxer, so the same rules apply: all inputs must share the same codec, resolution, frame rate, and sample rate. The protocol is most useful in shell scripts, where a list file is overkill.
Requirements
Input files that all share the same codec, resolution, frame rate, and sample rate. The protocol is a shortcut for the demuxer, so the same rules apply. The filenames must be separated by `|`, and the entire URL must be quoted to prevent the shell from interpreting the `|` as a pipe.
Things to avoid
- Mixing codecs in the input list. The protocol will demux each file, but the muxer will fail or produce a malformed file.
- Forgetting to quote the URL. The shell will interpret the `|` as a pipe, and the command will fail with a confusing error.
- Using the protocol with absolute paths on Windows. The protocol uses `|` as a separator, which is not valid in Windows paths. Use forward slashes or relative paths.
- Expecting the protocol to re-sync audio. If the inputs have different audio timestamps, the output will have a gap or overlap.