By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,923 Members | 1,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,923 IT Pros & Developers. It's quick & easy.

How to launch Handbrake via python?

P: 4
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.

Expand|Select|Wrap|Line Numbers
  1. import os
  2.  
  3. path2="C:\\"
  4. os.chdir(path2)
  5. List=list()
  6. path="C:\Users\HoustonWKV\Downloads\Complee!!\TV"
  7. dirList=os.listdir(path)
  8. for fname in dirList:   
  9.     List.append(fname)
  10.  
  11. for folder_name in List:
  12.     path=os.path.abspath('Users\\HoustonWKV\\Downloads\\Complee!!\\TV\\'+folder_name)
  13.     print path
  14.  
  15.     dirlist=os.listdir(path)
  16.     for file_name in dirlist:
  17.  
  18.         file = file_name
  19.         file= os.path.splitext( file )
  20.  
  21.         if file[1]== '.avi':
  22.         path3='C:\\Program Files (x86)\\Handbrake'
  23.         os.chdir(path3)
  24. #copy error
  25. #this is the desired cli 
  26. #"./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"
  27.  
  28.  
any help would be great!
Thank you
Mar 11 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.