-
-
Save pltb/244899d900a1b0305467f50e32133cc3 to your computer and use it in GitHub Desktop.
FLAC -> ALAC convesion script with downsampling to 16bit/44100kHz
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 bash | |
set -e | |
f2a () { | |
if [ -z $1 ]; then | |
echo "usage: $0 dir" | |
return 1 | |
fi | |
for file in "$1"/*.flac; do | |
echo -n "." | |
ffmpeg -i "$file" -sample_fmt s16p -map 0:a -ar 44100 -acodec alac "${file%.*}.m4a" | |
done | |
} | |
f2a $1 |
Was first using this script, then changed it to only use afconvert
, but then decided to simply use ffmpeg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To make the usage more convenient, I've also made it available as a shell command (I use
.zsh
):.zshrc
:Then I could call it from the shell like this:
f2a <directory with flacs>
A brief explanation of the
ffmpeg
args:-map 0:a
– to only include audio streams (e.g. when there's a cover stream in the source flac)-sample_fmt s16p -ar 44100
– output sample rate / discretisation level adjustment