Created
August 17, 2015 23:47
-
-
Save thibmaek/0e29020541bd8a3f7c47 to your computer and use it in GitHub Desktop.
Convert FLAC to AAC | MP3
This file contains hidden or 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
function _audio() { | |
case $1 in | |
--mp3|*) local CODEC=libmp3lame;local FILENAME=mp3;; | |
--aac) local CODEC=libvo_aacenc;local FILENAME=aac;; | |
esac | |
case $2 in | |
256|*) local BITRATE=256k;; | |
320) local BITRATE=320k;; | |
esac | |
for FILE in *.flac; do | |
ffmpeg -i "$FILE" -c:a $CODEC -b:a $BITRATE "`basename "$FILE" .flac`.$FILENAME" || break; | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
_audio
The quickest way to encode FLAC files to lossy formats using a simple I/O ffmpeg task.
You can install ffmpeg with
brew install ffmpeg
orsudo apt-get install ffmpeg
Options
--mp3
: Encodes the input as MP3 using lame.--aac
: Encodes the input as AAC using libvo_aacenc. Due to the experimental nature of AAC encoding in ffmpeg this isn't really stable (no cover art e.g) and only to use if you really want it.256
: Second option that you can pass trough, encodes as 256kbps.320
: Same as above but 320kbpsDefaults
Just running
_audio
in a shell will output a 256kbps MP3. My personal preference is_audio --aac
oraudio 320