Last active
May 7, 2019 07:19
-
-
Save stefanJi/25346e6780720c879f10d9162b32b0af to your computer and use it in GitHub Desktop.
mp3 to aac
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
# install ffmpeg with aac model in mac | |
# brew tap varenc/ffmpeg | |
# brew tap-pin varenc/ffmpeg | |
# brew options ffmpeg | |
# brew install ffmpeg --with-fdk-aac --HEAD | |
# Useage: ./mp3Toaac.sh path-mp3-audios-dir/ | |
# will cover all mp3 audios to aac audio. | |
echo "$1" | |
doConvert() { | |
input=$1 | |
output=$2 | |
ffmpeg -i $input -c:a libfdk_aac -b:a 64k -ac 1 $output | |
} | |
target_extension="mp3" | |
for item in "$1"/* | |
do | |
fileName="${item%%.*}" | |
extension="${item#*.}" | |
if [ $extension = $target_extension ] | |
then | |
aacFile="$fileName.aac" | |
echo "convert [$item] to [$aacFile]" | |
doConvert $item $aacFile | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment