Created
February 28, 2019 17:20
-
-
Save lordsutch/9882b84543bfbf8b7e8033c029451366 to your computer and use it in GitHub Desktop.
Script to encode the Anthem digital soundtrack to AAC for iTunes etc. Can be readily adapted to other WAV albums.
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
#!/usr/bin/env python3 | |
# Get 'fdkaac' from https://github.com/nu774/fdkaac (or Homebrew etc.) | |
import glob | |
import subprocess | |
import sys | |
import os | |
def convert_file(filename, trackcount): | |
base, ext = os.path.splitext(filename) | |
outfile = f'{base}.m4a' | |
track, title = base.split('-', 1) | |
print(f'Converting track {track} ({title})', file=sys.stderr) | |
subprocess.run(['fdkaac', '-o', outfile, | |
'-m', '5', '--moov-before-mdat', | |
'--artist', 'Sarah Schachner', | |
'--album-artist', 'Sarah Schachner', | |
'--album', 'Anthem (Original Soundtrack)', | |
'--title', title, | |
'--genre', 'Soundtracks', | |
'--date', '2019', | |
'--composer', 'Sarah Schachner', | |
'--track', f'{track}/{trackcount}', | |
'--disk', '1/1', | |
filename]) | |
subprocess.run(['mp4art', '--add', 'Anthem-AlbumArt-1000x1000.jpg', '-z', | |
outfile]) | |
files = tuple(glob.glob('*.wav')) | |
trackcount = len(files) | |
for filename in files: | |
convert_file(filename, trackcount) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment