Created
October 1, 2013 00:37
-
-
Save klynch/6772392 to your computer and use it in GitHub Desktop.
An old script I found lying around to convert FLAC files to MP3
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 | |
lame_opts=" --vbr-new -V 2 -B 256 " | |
for x in "${@}" | |
do | |
FLAC=${x} | |
MP3="${FLAC%.flac}.mp3" | |
[ -r "$FLAC" ] || { echo can not read file \"$FLAC\" >&1 ; exit 1 ; } ; | |
metaflac --export-tags-to=- "$FLAC" | sed 's/=\(.*\)/="\1"/' > tmp.tmp | |
. ./tmp.tmp | |
rm tmp.tmp | |
echo "Converting ${FLAC} to MP3 format" | |
flac -c -d "$FLAC" | lame ${lame_opts} \ | |
--tt "$TITLE" \ | |
--tn "$TRACKNUMBER" \ | |
--tg "$GENRE" \ | |
--ty "$DATE" \ | |
--tc "$COMMENT" \ | |
--ta "$ARTIST" \ | |
--tl "$ALBUM" \ | |
--add-id3v2 \ | |
- "$MP3" | |
done |
It is a shell script. Just download and run it from a terminal like so "bash flac2mp3.sh file.flac". You will need to install flac and the lame encoder installed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what is this code? applescript? how to do that? please tell me the steps. :)