How to launch Handbrake via python?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • houstonkv
    New Member
    • Sep 2010
    • 4

    How to launch Handbrake via python?

    Hi
    I'd like to start by saying that I am very very new to python, and even newer to handbrake.
    currently I have a folder of folders of video files that I would like to convert to iphone4 videos, so far my script goes through the folder makes a list of the folders then goes through the folder find the ones with a .avi and (with your help) will launch handbrake and encode the desired video.

    Code:
    import os
    
    path2="C:\\"
    os.chdir(path2)
    List=list()
    path="C:\Users\HoustonWKV\Downloads\Complee!!\TV"
    dirList=os.listdir(path)
    for fname in dirList:   
        List.append(fname)
    
    for folder_name in List:
        path=os.path.abspath('Users\\HoustonWKV\\Downloads\\Complee!!\\TV\\'+folder_name)
        print path
    
        dirlist=os.listdir(path)
        for file_name in dirlist:
            
            file = file_name
            file= os.path.splitext( file )
            
            if file[1]== '.avi':
    	    path3='C:\\Program Files (x86)\\Handbrake'
    	    os.chdir(path3)
    #copy error
    #this is the desired cli 
    #"./HandBrakeCLI -i"+ path +"-o C:\  -e x264 -q 20.0 -a 1 -E faac -B 128 -6 dpl2 -R Auto -D 0.0 -f mp4 -X 480 -m -x cabac=0:ref=2:me=umh:bframes=0:weightp=0:subme=6:8x8dct=0:trellis=0"
    any help would be great!
    Thank you
Working...