Created
June 29, 2012 18:04
-
-
Save elrond1999/3019676 to your computer and use it in GitHub Desktop.
Python script to convert H264 MKV to MP4 with AAC without recoding. Very fast as the video is just copied. Requires FFMpeg in the same path as the script.
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 sys | |
import time | |
import multiprocessing | |
import subprocess | |
import os.path | |
path = os.path.dirname(sys.argv[0]) | |
def convert(arg): | |
global path | |
basename=os.path.splitext(os.path.basename(arg)) | |
dest="g:\\Stuff\%s.mp4" % (basename[0]) | |
cmd='%s\\ffmpeg.exe -i "%s" -f mp4 -vcodec copy -acodec libfaac -b:a 112k -ac 2 -y "%s"' % (path, arg, dest) | |
print cmd | |
return subprocess.call(cmd, shell=False) | |
if __name__ == '__main__': | |
#count = multiprocessing.cpu_count() | |
count = 4 | |
pool = multiprocessing.Pool(processes=count) | |
print pool.map(convert, sys.arg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Syntax error at #23 line.