FFmpeg-fconcat: Unable to Read File List from Command Line Pipe?
If you're trying to utilize the FFmpeg concat demuxer using a file list provided through a command line pipe, you might have encountered issues with FFmpeg not being able to read the file list. This article will provide a detailed explanation of the FFmpeg concat demuxer, alternatives to using a pipe for providing the file list, and relevant resources for further reading.
Understanding FFmpeg concat demuxer
The FFmpeg concat demuxer is a powerful tool that allows users to concatenate input files, either by specifying a text file that contains a list of input files or by providing the list directly in the command line. This can be particularly useful when working with a large number of video or audio files that need to be combined into a single output file.
To use the FFmpeg concat demuxer, you can create a text file (for example, files.txt) that contains a list of input files, each on a separate line:
Then, you can use the following FFmpeg command to concatenate the input files:
Issues with using a pipe for the file list
While some examples and older web postings might suggest using a pipe to provide the list of input files directly in the command line, FFmpeg might not always be able to read the file list from the pipe. In particular, the following command might not work:
This is because FFmpeg expects the file list to be provided through a seekable input, and a pipe is not necessarily seekable. Therefore, it is recommended to use a text file for the file list instead of a pipe.
Alternative: Using process substitution
If you still prefer to provide the file list directly in the command line instead of using a text file, you can use process substitution, which is supported in some shells (e.g., Bash). Process substitution creates a seekable input that FFmpeg can read from:
- The FFmpeg concat demuxer allows users to concatenate input files by specifying a file list.
- While providing the file list through a pipe might seem attractive, it can lead to issues with FFmpeg not being able to read the file list. Instead, consider using a text file for the file list.
- If you still prefer to provide the file list directly in the command line, you can use process substitution (supported in some shells) to create a seekable input for FFmpeg.