using ffmpeg command line with python's subprocess module

iMath redstone-cold at 163.com
Mon Dec 2 20:15:42 EST 2013


在 2013年12月3日星期二UTC+8上午5时19分21秒,Ben Finney写道:
> 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

so is there any way to create a temporary file by Python here ?



More information about the Python-list mailing list