Created
September 17, 2017 17:13
-
-
Save aceakash/38de61ba663509d8bfd60319b6c4fd7c to your computer and use it in GitHub Desktop.
Convert audio in MKV files to AC3. Required Python 3.6
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 subprocess | |
all_dir_contents = os.listdir() | |
mkv_files = [file for file in all_dir_contents if file.endswith('.mkv') and not file.endswith('.converted.mkv') ] | |
for mkv in mkv_files: | |
print('========== Starting ' + mkv + ' ===========') | |
out_file_name = mkv[:-4] + '.converted.mkv' | |
subprocess.run(['ffmpeg', '-i', mkv, '-map', '0', '-vcodec', 'copy', | |
'-scodec', 'copy', '-acodec', 'ac3', '-b:a', '384k', out_file_name]) | |
subprocess.run(['rm', mkv]) | |
print('////////// Finished ' + mkv + ' ///////////') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment