Converting *.flac to *.mp3
flac is an audio format (Free Lossless Audio Codec) that is excellent for archiving, but few if any portable players will be able to play it, so a method to convert to mp3 is shown below.
convert .flac to .mp3
flac -cd "FILENAME.flac" | lame -h - "FILENAME.mp3"
flac: -c is output to console, -d is decode
lame: -h is shorthand for “-q 2″ and -q is quality (in this case a high quality), “-” is input from console
same but for all .flac files in a directory
for FILE in *.flac; do $(flac -cd "$FILE" | lame -h - "${FILE%.flac}.mp3"); done
same options in a bash for loop, the ${FILE%.flac} strips “.flac” from the name
Notes:
id3 options for lame:
–tt <title> –ta <artist> –tl <album> –ty <year> –tc <comment> –tn <track> –tg <genre>
will automatically add an id3v1 or id3v2 as needed (choice is based on the size of the fields),
“–add-id3v2″ “–id3v2-only” “–id3v1-only” can be used to modify choice.
more complicated operations are beyond the scope of this article, but I’d suggest using K3B.
enasykek:
thanks much, guy
8 May 2008, 5:31 am