473,513 Members | 2,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

subprocess module

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
1 2376
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
3076
by: Michael McGarry | last post by:
Hi, I am just starting to use Python. Does Python have all the regular expression features of Perl? Is Python missing any features available in Perl? Thanks, Michael
4
2953
by: Nicolas Fleury | last post by:
Hi, I want to use the subprocess module (or any standard Python module) to run a process: - which stdout and stderr can each be redirected to any file-like object (no fileno function). - can be...
6
1720
by: Uri Nix | last post by:
Hi all, I've been trying to use (Python 2.4 on WinXP) the subprocess module to execute a shell command (nmake in this case), and pass its output to a higher level. Using the following...
3
5492
by: Darren Dale | last post by:
I'm a developer on the matplotlib project, and I am having trouble with the subprocess module on windows (Python 2.4.2 on winXP). No trouble to report with linux. I need to use _subprocess instead...
5
14302
by: Grant Edwards | last post by:
I'm trying to use the py-gnuplot module on windows, and have been unable to get it to work reliably under Win2K and WinXP. By default, it uses popen(gnuplotcmd,'w'), but in some situations that...
3
2606
by: Lee | last post by:
Has anyone ran into this problem? I've done extensive googling and research and I cannot seem to find the answer. I downloaded the source for 2.5.1 from python.org compiled and installed it on a...
12
4509
by: bhunter | last post by:
Hi, I've used subprocess with 2.4 several times to execute a process, wait for it to finish, and then look at its output. Now I want to spawn the process separately, later check to see if it's...
1
5078
by: Steven Bethard | last post by:
I'm having trouble using the subprocess module on Windows when my command line includes special characters like "&" (ampersand):: .... stdout=subprocess.PIPE, .... ...
25
2747
by: Jeremy Banks | last post by:
Hi. I wondered if anyone knew the rationale behind the naming of the Popen class in the subprocess module. Popen sounds like the a suitable name for a function that created a subprocess, but the...
3
2126
by: topazcode | last post by:
I am using the subprocess module to run some shell commands on a Linux system: import subprocess output = subprocess.call('''ssh server1 "uptime"''', shell=True) The above assigns the output...
0
7264
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7166
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7386
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7543
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5689
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5094
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.