using ffmpeg command line with python's subprocess module

Ben Finney ben+python at benfinney.id.au
Mon Dec 2 16:19:21 EST 2013


Chris Angelico <rosuav at gmail.com> writes:

> On Mon, Dec 2, 2013 at 10:34 PM, iMath <redstone-cold at 163.com> wrote:
> > 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.

Not standard input, no. What it does is create a temporary file to
contain the result, and inserts that file name on the command line. This
is good for programs that require an actual file, not standard input.

So the above usage seems right to me: the ‘ffmpeg -i FOO’ option is
provided with a filename dynamically created by Bash, referring to a
temporary file that contains the output of the subshell.

-- 
 \     “Welchen Teil von ‘Gestalt’ verstehen Sie nicht?  [What part of |
  `\                ‘gestalt’ don't you understand?]” —Karsten M. Self |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list