By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,763 Members | 1,616 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,763 IT Pros & Developers. It's quick & easy.

subprocess module

P: n/a
Hi all,

ive been trying to create a thumbnail using the ffmpeg converter
running the ffmpeg.exe using the subprocess module with the following
code
>>import subprocess
p = subprocess.Popen(["ffmpeg.exe -i video.mpg", "-f mjpeg -ss 5 -vframes 1 -s 160x120 -an video.gif"], shell=True, stdout=subprocess.PIPE)
but the ffmpeg complains about the input file being corrupter, whereas
when i run the same command via the command shell (cmd.exe) it works.
Does anyone know what the problem is?
Cheers

Jul 27 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
placid <Bu****@gmail.comwrote:
>import subprocess
p = subprocess.Popen(["ffmpeg.exe -i video.mpg", "-f mjpeg -ss 5 -vframes 1 -s 160x120 -an video.gif"], shell=True, stdout=subprocess.PIPE)

but the ffmpeg complains about the input file being corrupter, whereas
when i run the same command via the command shell (cmd.exe) it works.
Does anyone know what the problem is?
Here is an idea to try: I would say you've mixed up the two styles of
passing arguments, either pass

args = "ffmpeg.exe -i video.mpg -f mjpeg -ss 5 -vframes 1 -s 160x120 -an video.gif"
p = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE)

or

args = ['ffmpeg.exe', '-i', 'video.mpg', '-f', 'mjpeg', '', '-ss', '5', '-vframes', '1', '-s', '160x120', '-an', 'video.gif']
p = subprocess.Popen(args, shell=True, stdout=subprocess.PIPE)

If you mix the two styles then you are probably heading for trouble
with argument quoting.

--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Jul 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.