Created
October 3, 2014 16:06
-
-
Save monty5811/ce8115bdee150664f7df to your computer and use it in GitHub Desktop.
Handbrake batch convert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
handbrakePath = "" | |
tmpFolder = "" | |
outputFolder = "" | |
if os.path.isdir(outputFolder): | |
pass | |
else: | |
os.mkdir(outputFolder) | |
if os.path.isdir(tmpFolder): | |
pass | |
else: | |
os.mkdir(tmpFolder) | |
for mkv in [x for x in os.listdir(os.getcwd()) if x.endswith('.mkv')]: | |
# call handbrake to run conversion | |
subprocess.call([os.path.join(handbrakePath, "HandBrakeCLI"), | |
"--preset", "High Profile", | |
"-i", mkv, | |
"-o", os.path.join(outputFolder, mkv)]) | |
# move file to tmp folder | |
os.rename(os.path.join(os.getcwd(), mkv), | |
os.path.join(os.getcwd(), tmpFolder, mkv)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment