Skip to content

Instantly share code, notes, and snippets.

@yevgenko yevgenko/bulk_avconvert.py
Last active May 13, 2017

Embed
What would you like to do?
##
# Converts MTS files into m4v in a bulk
# with avconvert tool
#
# Usage:
# create directories ./in and ./out
# put files into in directory
# run the command:
# python bulk_convert.py
##
from os import walk
from subprocess import call
files = []
input_path = './in'
output_path = './out'
for (dirpath, dirnames, filenames) in walk(input_path):
files.extend(filenames)
break
for filename in files:
call(["avconvert", "--preset", "PresetAppleM4V1080pHD", "--source", "{0}/{1}".format(input_path, filename), "--output", "{0}/{1}.m4v".format(output_path, filename)])
# uncomment the following line
# when need to test on single/first file
# break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.