Created
September 24, 2014 17:43
-
-
Save fbentele/7e91768250392f72862f to your computer and use it in GitHub Desktop.
Flac2mp3
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
#!/bin/bash | |
# by K-Soft! 05/24/2012 with parts from | |
# http://bash.cyberciti.biz/multimedia/linux-unix-bsd-convert-flac-to-mp3/ | |
# convert flac to mp3 and writes id3 tags | |
# usage: flactomp3 /path/to/my/awesome/music/ | |
# requires FLAC, ID3, LAME | |
# change quality -V 0-9 | |
IFS=$'\t' | |
if [ $# -eq 0 ] ; then | |
echo 'No arguments provided, usage: flactomp3 /my/awesome/music/' | |
exit 0 | |
fi | |
for flacfile in $1*.flac | |
do | |
outf=${flacfile%.flac}.mp3 | |
eval "$( | |
metaflac "$flacfile" --show-tag=ARTIST \ | |
--show-tag=TITLE \ | |
--show-tag=ALBUM \ | |
--show-tag=GENRE \ | |
--show-tag=TRACKNUMBER \ | |
--show-tag=DATE | sed 's/=\(.*\)/="\1"/' | |
)" | |
flac -c -d "$flacfile" | lame -m j -q 0 --vbr-new -V 0 -s 44.1 - "$outf" | |
id3 -t "$TITLE" -T "${TRACKNUMBER:-0}" -a "$ARTIST" -A "$ALBUM" -y "$DATE" -g "${GENRE:-12}" "$outf" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment