using ffmpeg command line with python's subprocess module

Chris Angelico rosuav at
Mon Dec 2 12:40:52 CET 2013

On Mon, Dec 2, 2013 at 10:34 PM, iMath <redstone-cold at> wrote:
> I have few wav files that I can use either of the following command line mentioned here
>  to concatenate
> ffmpeg -f concat -i <(for f in ./*.wav; do echo "file '$f'"; done) -c copy output.wav
> ffmpeg -f concat -i <(printf "file '%s'\n" ./*.wav) -c copy output.wav
> ffmpeg -f concat -i <(find . -name '*.wav' -printf "file '%p'\n") -c copy output.wav

In bash, the <(...) notation is like piping: it executes the command
inside the parentheses and uses that as standard input to ffmpeg. So
if you work out what the commands are doing (it looks like they emit a
line saying "file '...'" for each .wav file in the current directory,
possibly including subdirectories) and replicate that in Python, you
should be able to make it cross-platform.


More information about the Python-list mailing list