473,588 Members | 2,513 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.Pope n(["ffmpeg.exe -i video.mpg", "-f mjpeg -ss 5 -vframes 1 -s 160x120 -an video.gif"], shell=True, stdout=subproce ss.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 2385
placid <Bu****@gmail.c omwrote:
>import subprocess
p = subprocess.Pope n(["ffmpeg.exe -i video.mpg", "-f mjpeg -ss 5 -vframes 1 -s 160x120 -an video.gif"], shell=True, stdout=subproce ss.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.Pope n(args, shell=True, stdout=subproce ss.PIPE)

or

args = ['ffmpeg.exe', '-i', 'video.mpg', '-f', 'mjpeg', '', '-ss', '5', '-vframes', '1', '-s', '160x120', '-an', 'video.gif']
p = subprocess.Pope n(args, shell=True, stdout=subproce ss.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
3090
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
2963
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 cancelled with a threading.Event. My problem is that the subprocess.Popen constructor doesn't seem to support file-like objects (only file objects with fileno()).
6
1725
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 snippet: p = subprocess.Popen(nmake,stderr=subprocess.PIPE,stdout=subprocess.PIPE, \ universal_newlines=True, bufsize=1)
3
5496
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 of pywin32, but my trouble exists with either option: import subprocess process = subprocess.Popen(, stderr=subprocess.STDOUT, stdout=subprocess.PIPE) stat = process.wait() print process.stdout.read()
5
14305
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 consistently gets an "invalid operand" IOError when write() is called on the pipe. So I switched to subprocess. It works fine when executed "normally" (e.g. "python progname.py"), but when bundled by py2exe, it always does this:
3
2618
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 Solaris box, uname -a returns SunOS unicom5 5.8 Generic_117350-26 sun4u sparc SUNW,Sun-Fire-V210
12
4519
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 finished, and if it is look at its output. I may want to send a signal at some point to kill the process. This seems straightforward, but it doesn't seem to be working. Here's my test case:
1
5083
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, .... stderr=subprocess.PIPE) "'y' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n" As you can see, Windows is interpreting that "&" as separating two commands, instead of being part of the single argument...
25
2758
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 object itself is a subprocess, not a "popen". It seems that it would be more accurate to just name the class Subprocess, can anyone explain why this is not the case? Thank you.
3
2131
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 variable with a return code, i.e. 0 in this case. How can I actually capture the data returned from subprocess.call, rather than just the return code? I'd like to have the output variable contain the uptime string in this case. Any help
0
7860
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8222
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8223
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6634
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5726
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3847
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3883
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.