Question

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
Was it helpful?

Solution

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', ....
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top