using ffmpeg command line with python's subprocess module
Alain Ketterlin
alain at dpt-info.u-strasbg.fr
Tue Dec 3 04:33:09 EST 2013
Ben Finney <ben+python at benfinney.id.au> writes:
> 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.
Just in case (it may not be relevant to the current discussion): it may
not be a file, it will more probably be a FIFO (i.e., not seekable).
Here is the relevant part of the manual page:
| Process Substitution
| Process substitution is supported on systems that support named
| pipes (FIFOs) or the /dev/fd method of naming open files. It
| takes the form of <(list) or >(list). The process list is run
| with its input or output connected to a FIFO or some file in
| /dev/fd. The name of this file is passed as an argument to the
| current command as the result of the expansion.
-- Alain.
More information about the Python-list
mailing list