I am trying to start a ffmpeg subprocess

the following command works perfectly

ffmpeg -f alsa -r 16000 -i hw:2,0 -f video4linux2 -s 800x600 -i /dev/video0 -r 30 -f avi -vcodec mpeg4 -vtag xvid -qscale 0 -acodec libmp3lame -ab 96k /home/Desktop/output.avi

when I try this

process = subprocess.Popen(['ffmpeg', '-f alsa', '-r 16000', '-i hw:2,0', '-f video4linux2', '-s 800x600', '-i /dev/video0', '-r 30', '-f avi', '-vcodec mpeg4', '-vtag xvid', '-qscale 0', '-acodec libmp3lame', '-ab 96k', '/home/Desktop/output.avi')])

I get this error

Unrecognized option 'f alsa'.
Error splitting the argument list: Option not found
有帮助吗?

解决方案

As the error states:

Unrecognized option 'f alsa'.

So each argument needs to be it's own array element:

process = subprocess.Popen(['ffmpeg', '-f', 'alsa', '-r', '16000', ....
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top