FFmpeg Concat Demuxer Text File Format

This guide explains how to properly format the input text file required by the FFmpeg concat demuxer to join multiple video or audio files. You will learn the exact syntax rules, how to handle file paths, and how to use optional directives like duration and inpoint to control your media stream.

Basic Syntax Rules

The text file is a simple plain text document (usually named inputs.txt or filelist.txt) where you list the media assets you want to concatenate in chronological order.

  1. The file Directive: Every media file must be preceded by the word file, followed by a space, and the path to the file enclosed in single quotes.
  2. Comments: Lines starting with # are ignored and can be used for comments.
  3. Line Breaks: Each instruction must be on its own line.

Here is a basic example of a text file:

# This is a comment listing the videos to merge
file 'input1.mp4'
file 'input2.mp4'
file 'input3.mp4'

Handling Paths and Special Characters

Advanced Directives (Optional)

You can add extra parameters below each file line to fine-tune how FFmpeg processes the stream.

Example using advanced parameters:

file 'video1.mp4'
inpoint 5.0
outpoint 15.5

file 'video2.mp4'
inpoint 0.0
outpoint 10.0

How to Run the FFmpeg Command

Once your text file is saved (for example, as list.txt), run the following command in your terminal to concatenate the files without re-encoding:

ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4