Simple FLAC to MP3 shell script
For unix-like systems (Mac OS X, Linux). A simple shell script to convert flac to lame mp3.
Install flac, lame and id3tool
#!/bin/bash for a in *.flac do OUTLAME=`echo "$a" | sed s/\.flac$/.mp3/g` ARTIST=`metaflac "$a" --show-tag=ARTIST | sed s/.*=//g` ALBUM=`metaflac "$a" --show-tag=ALBUM | sed s/.*=//g` TITLE=`metaflac "$a" --show-tag=TITLE | sed s/.*=//g` GENRE=`metaflac "$a" --show-tag=GENRE | sed s/.*=//g` TRACKNUMBER=`metaflac "$a" --show-tag=TRACKNUMBER | sed s/.*=//g` YEAR=`metaflac "$a" --show-tag=DATE | sed s/.*=//g` flac -c -d "$a" | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$OUTLAME" id3tool --set-title="$TITLE" --set-track="${TRACKNUMBER:-0}" --set-artist="$ARTIST" --set-album="$ALBUM" --set-year="$YEAR" --set-genre="${GENRE:-12}" "$OUTLAME" done |
Edit: Apparently this has been done before…
http://pastebin.com/f641a9b21