Last active
December 18, 2015 10:39
-
-
Save natcl/5769795 to your computer and use it in GitHub Desktop.
ffmpeg batch convert script in python
This file contains hidden or 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 sys | |
path = sys.argv[1] | |
input_format = ['.' + x for x in sys.argv[2].split()] | |
output_format = '.' + sys.argv[3] | |
args = sys.argv[4] | |
files = [os.path.join(path,f) for f in os.listdir(path) if os.path.splitext(f.lower())[1] in input_format] | |
print files | |
print input_format | |
print output_format | |
print args | |
for f in files: | |
os.system('ffmpeg %s -i "%s" "%s%s"' % (args, f, f, output_format)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment