It is better to call subprocess.call
in another way.
The preferred way is:
subprocess.call(['ffmpeg', '-i', 'test%d0.png', 'output.avi'])
Alternatively:
subprocess.call('ffmpeg -i test%d0.png output.avi', shell=True)
You can find the reasons for this in the manual. I quote:
args is required for all calls and should be a string, or a sequence
of program arguments. Providing a sequence of arguments is generally
preferred, as it allows the module to take care of any required
escaping and quoting of arguments (e.g. to permit spaces in file
names). If passing a single string, either shell must be True (see
below) or else the string must simply name the program to be executed
without specifying any arguments.
commands
module is a big warning: Deprecated since version 2.6: Thecommands
module has been removed in Python 3. Use thesubprocess
module instead. Heed it. – Martijn Pieters♦ May 25 '13 at 9:28os.chdir()
andsubprocess.check_output(['ffmpeg', '-i', 'image%d0.png', 'output.avi'])
instead, or usesubprocess.call()
if you are more in the exit code and / or do not need the command output at all. – Martijn Pieters♦ May 25 '13 at 9:31call
to change directories. Useos.chdir()
instead. – Martijn Pieters♦ May 25 '13 at 9:38os.chdir('C://Users/Alex/Dropbox/code stuff/test/') subprocess.call('ffmpeg -i image%d0.png output.avi')
Still doesn't seem to work, I think that it forgets the dir it is in? – Coolcrab May 25 '13 at 9:42