Created
January 5, 2015 14:18
-
-
Save eeichinger/d93dd1c395a74b0d1407 to your computer and use it in GitHub Desktop.
Wrap raw AAC files in MP4 container and copy ID3v2 tags to MP4 metadata
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
#!/bin/bash | |
# Wrap raw AAC files in MP4 container and copy ID3v2 tags to MP4 metadata. Original files are not touched, new files appear besides them with .m4a extension | |
# requires MP4Box and kid3 (install via homebrew. You may need to install MP4Box manually from http://gpac.wp.mines-telecom.fr/downloads/gpac-nightly-builds/. Homebrew had troubles installing mp4box. The executable is found inside the osmo4.app, see below) | |
# kid3 also has problems with full qualified filepaths as well as spaces in the filenames | |
for fic in Music/**/*.aac | |
do | |
echo processing $fic | |
extension="${fic##*.}" | |
filename=$(basename "$fic") | |
fullname="${fic%.*}" | |
# echo has extension ${extension} | |
# echo has name ${filename} | |
# echo has fullname ${fullname} | |
rm convertaac2m4a.* 2>/dev/null | |
rm "$fullname.m4a" 2>/dev/null | |
cp "${fic}" convertaac2m4a.aac | |
/Applications/Osmo4.app/Contents/MacOS/MP4Box -add "$fic#audio" convertaac2m4a.m4a | |
bash -c "/opt/homebrew-cask/Caskroom/kid3/3.1.2/kid3.app/Contents/MacOS/kid3-cli -c \"select convertaac2m4a.aac\" -c \"copy 2\" -c \"select convertaac2m4a.m4a\" -c \"paste 2\"" | |
cp convertaac2m4a.m4a "${fullname}.m4a" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment