473,386 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 2370
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
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.