vendredi 16 octobre 2009

encodage avec mencoder pour Archos 605

# -*- coding: utf-8 -*-

import os, os.path

startDir = "/home/fabien/Bureau/blender"
#startDir = "/media/disk/fabien/Bureau/Photos/_00Mariage_Marie_et_Samuel"

Quote='"'

directories = [startDir]
while len(directories)>0:
directory = directories.pop()
for name in os.listdir(directory):
fullpath = os.path.join(directory,name)
if os.path.isfile(fullpath):
(shortname, extension) = os.path.splitext(name)
#print extension
if extension==".avi" and "_enco.avi" not in shortname:
passe_one="mencoder "+Quote+str(fullpath)+Quote+" \
-vf scale -zoom -xy 720 \
-ffourcc DX50 \
-oac mp3lame -lameopts mode=3:vbr=2:q=6 \
-ovc lavc -lavcopts \
vcodec=mpeg4:vbitrate=1200:lumi_mask=0:dark_mask=0:vme=4:vfdct=0:idct=0:vhq:v4mv:vpass=1:turbo -o /dev/null"
print
print "passe une"
print passe_one,"...."
print fullpath
print
print
os.system(passe_one)
#print "_______________________",fullpath[-:3]
print
new_name=fullpath+"_enco.avi"


passe_two="mencoder "+Quote+str(fullpath)+Quote+" \
-vf scale -zoom -xy 720 \
-ffourcc DX50 \
-oac mp3lame -lameopts mode=3:vbr=2:q=6 \
-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1200:lumi_mask=0:dark_mask=0:vme=4:vfdct=0:idct=0:vhq:v4mv:vpass=2 \
-o "+Quote+str(new_name)+Quote
print
print "passe deux"
print passe_two,"...."
print fullpath
print
print

os.system(passe_two)

elif os.path.isdir(fullpath):
directories.append(fullpath) # It's a directory, store it.