Created
February 22, 2020 19:28
-
-
Save rrroyal/c32f5059197c923efbe639a743c3e58d to your computer and use it in GitHub Desktop.
ZSH script used to convert FLAC files to ALAC using ffmpeg, preserving respective 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
#!/usr/bin/env zsh | |
if [[ "$1" == "" ]]; then | |
echo "No directory specified! Using \`pwd\`." | |
location=`pwd` | |
else | |
location="$1" | |
fi | |
if [[ "$2" != "" ]] ; then | |
map="$2" | |
else | |
map="0" | |
fi | |
for file in $location/**/*.flac; do | |
ffmpeg -i "$file" -map $map:0 -acodec alac "${file%.flac}.m4a" | |
if [[ "$?" == 0 ]]; then | |
rm "$file" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment