Last active
January 26, 2019 11:38
-
-
Save Trucido/8f23d5b886626681f1093039507a77c8 to your computer and use it in GitHub Desktop.
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
# | |
# Note: For libfdk_aac requires ffmpeg built with `--enable-libfdk-aac' and not `--enable-gpl', | |
# On Debian-based distros the package from www.deb-multimedia.org repos compiles it as such. | |
# TODO: probably easier in something python based like this https://github.com/Eloston/misc-programs/tree/master/flac_to_ogg | |
ff_flac2aac() ( | |
{ [ -n "${ZSH_VERSION-}" ] && emulate -L zsh -o nullglob; }; local f i of 2>/dev/null | |
if [ $# != 0 ]; then | |
if ([ -d "${1}" ] && [ $# -eq 1 ]); then { cd "${1}" || return; } | |
elif ([ -f "$1" ] && [ $# -eq 1 ]); then { f="${1}"; } | |
elif ([ $# -gt 1 ]); then { for i in "$@";do f+=("${i}");done; } | |
fi | |
fi | |
if [ -n "$f" ] | |
then for i in "${f[@]}";do of="${i/.flac/.m4a}"; ffmpeg -i "${i}" -vn -c:a libfdk_aac -b:a 256k -f mp4 -y "${of}";done # AAC LC | |
else for i in *.flac;do of="${i/.flac/.m4a}"; ffmpeg -i "${i}" -vn -c:a libfdk_aac -b:a 256k -f mp4 -y "${of}";done # AAC LC | |
fi # Note: CBR valid bitrates: 6k,24k,32k,40k,48k,56k,64k,80k,96k,112k,128k,160k,192k,256k,320k,448k | |
# of="${i/.flac/.m4a}"; ffmpeg -i "${i}" -vn -c:a libfdk_aac -profile:a aac_he -b:a 192k -f mp4 -y "${of}";done # AAC HE v1 | |
# of="${i/.flac/.m4a}"; ffmpeg -i "${i}" -vn -c:a libfdk_aac -profile:a aac_he_v2 -b:a 128k -f mp4 -y "${of}";done # AAC HE v2 | |
) | |
ff_flac2aac "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment