Mass .flac --> .mp3 transcoding: How to write a shell script that preserves ID3 tag information?
#!/bin/sh
file="$1"
outfile=${file%.flac}.mp3
eval $(metaflac --export-tags-to - "$file" | sed "s/=\(.*\)/='\1'/")
flac -cd "$file" | lame --preset fast extreme \
--add-id3v2 --tt "$TITLE" --ta "$ARTIST" --tl "$ALBUM" \
--ty "$DATE" --tn "$TRACKNUMBER" --tg "$GENRE" \
- "$outfile"