ffmpeg hangs when executed from python

Andrew English andrew.english at gmail.com
Wed Apr 30 06:30:37 CEST 2008


I have tried a few methods of executing ffmpeg from within python and it has
hanged every time.  Two of the configurations I tried are:

def convertFileToFlash(filename):
    commandString = "./convertasftoswf.sh " + getSaveDirectory() + " " +
filename
    logging.debug("RUNNING: " + commandString)
    results = commands.getstatusoutput(commandString)
    logging.debug(results)

convertasftoswf.sh:

#!/bin/sh

mencoder ${1}${2} -o ${1}outputfile.avi -ovc xvid -xvidencopts
bitrate=280:max_bframes=0 -oac mp3lame -lameopts mode=0:cbr:br=128 -vf-add
scale=320:240,expand=320:240 -vf-add harddup -ofps 25.00 -srate 44100

chmod 777 ${1}outputfile.avi

ffmpeg -i ${1}outputfile.avi ${1}${2}.swf

Also, I tried running each of the commands (mencoder and ffmpeg) separately
with the commands.getstatusoutput from within python.

Then mencoder call always runs without a problem and the ffmpeg always
hangs.  Running the shell script directly from the command line works as
expected.

Any ideas about why ffmpeg would hang in that situation?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080430/1af73b94/attachment.html>


More information about the Python-list mailing list