Using Python to call Mencoder with some arguments

Posted by Manu on Stack Overflow See other posts from Stack Overflow or by Manu
Published on 2009-07-07T05:28:54Z Indexed on 2010/04/21 0:23 UTC
Read the original article Hit count: 517

Filed under:
|
|

Hello, I'll start by saying that I am very, very new to Python.

I used to have a Windows/Dos batch file in order to launch Mencoder with the right set of parameters, without having to type them each time.

Things got messy when I tried to improve my script, and I decided that it would be a good opportunity to try coding something in python.

I've come up with that :

#!/usr/bin/python
import sys, os

#Path to mencoder
mencoder = "C:\Program Files\MPlayer-1.0rc2\mencoder.exe"
infile = "holidays.avi"
outfile = "holidays (part1).avi"
startTime = "00:48:00"
length = "00:00:15"

commande = "%s %s -ovc copy -oac copy -ss %s -endpos %s -o %s"
os.system(commande % (mencoder, infile, startTime, length, outfile))

#Pause
raw_input()

But that doesn't work, windows complains that "C:\Program" is not recognized command.

I've trying putting some "\"" here and there, but that didn't help.

© Stack Overflow or respective owner

Related posts about python

Related posts about Windows