Convert FLAC files to MP3 with flac and lame
Posted by Ali Gangji | Filed under command line
Flac files are just dandy, and I’m happy to use them. Sometimes, however, you might need mp3 files instead. Particularly if a friend of yours asks you to make him an mp3 cd out of some albums you only have in FLAC format. So what to do? well it’s easy enough to do from the command line, provided you have flac and lame installed.
first create a file called flac2mp3 somewhere in your path.
copy the following into it:
#!/bin/bash
FLAC=$1
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
cat tmp.tmp
. ./tmp.tmp
rm tmp.tmp
flac -dc "$FLAC" | lame -b 192 -h --tt "$Title" \
--tn "$Tracknumber" \
--tg "$Genre" \
--ty "$Date" \
--ta "$Artist" \
--tl "$Album" \
--add-id3v2 \
- "$MP3"
Now just enter the directory with your flac files and run the following:
for file in *.flac; do $(flac2mp3 "$file"); done
That’s it! wasn’t that easy? good ol’ ‘nix.
Tags: code, flac, lame, mp3, scripts

July 27th, 2009 at 5:29 am
http://www.tech-faq.com/convert-flac-to-mp3.shtml
This assumes you’re already using winamp. If you’re not, i suggest you start
Of course, thats a windows guide. Just to go along with your linux guide
July 27th, 2009 at 4:53 pm
thanks Bijan
December 6th, 2010 at 9:47 am
buy@Amoxicillin.com” rel=”nofollow”>.…
Buy:Viagra Super Active+.Viagra Soft Tabs.Viagra Professional.Maxaman.Tramadol.Cialis Super Active+.Super Active ED Pack.Cialis.VPXL.Soma.Cialis Professional.Levitra.Viagra Super Force.Cialis Soft Tabs.Viagra.Propecia.Zithromax….
December 20th, 2010 at 2:02 pm
abilify side effects in children…
Buydrugs without prescription…
December 21st, 2010 at 3:09 am
buy viagra canada…
Buygeneric drugs…
December 25th, 2010 at 1:19 am
abilify and siezures…
Buynow…
December 27th, 2010 at 12:18 pm
Accutane@official.site” rel=”nofollow”>.…
Buywithout prescription…
December 28th, 2010 at 5:54 pm
Advair@official.site” rel=”nofollow”>.…
Buynow it…
December 29th, 2010 at 6:30 am
Aldactone@official.site” rel=”nofollow”>.…
Buygeneric drugs…
December 30th, 2010 at 12:03 pm
Ampicillin@official.site” rel=”nofollow”>.…
Buynow it…
December 31st, 2010 at 3:49 am
..…
Buygeneric drugs…
January 1st, 2011 at 6:22 pm
Clonidine@official.site” rel=”nofollow”>……
Buynow…
January 2nd, 2011 at 6:28 am
celexa@canada.now” rel=”nofollow”>.…
Buynow…
January 3rd, 2011 at 11:46 pm
abilify@anxiety.now” rel=”nofollow”>.…
Buygeneric drugs…
January 9th, 2011 at 3:44 am
i@am.pregnant.how.often.can.i.take.25mg.of.phenergan.safely” rel=”nofollow”>……
Buygeneric drugs…
February 5th, 2011 at 5:31 am
Zocor…
Buygeneric meds…
February 6th, 2011 at 9:47 am
zestoretic co-q10…
Buywithout prescription…
February 6th, 2011 at 11:37 am
Clindamycin…
Buywithout prescription…
February 7th, 2011 at 1:23 am
dog zyrtec…
Buygeneric drugs…
February 7th, 2011 at 8:43 am
Xalatan…
Buywithout prescription…
February 7th, 2011 at 2:04 pm
Vytorin…
Buynow…
March 3rd, 2011 at 1:06 am
Zyvox…
Buydrugs without prescription…
March 3rd, 2011 at 2:19 am
Zyrtec…
Buyno prescription…
March 3rd, 2011 at 4:35 pm
can you take zoloft and blood pressure medication together…
Buynow…
March 4th, 2011 at 8:01 am
Zyrtec…
Buygeneric meds…
March 4th, 2011 at 8:42 am
Zyprexa…
Buydrugs without prescription…
March 5th, 2011 at 1:03 am
Rogaine…
Buygeneric meds…
March 5th, 2011 at 4:43 am
Pyridium…
Buygeneric drugs…
March 5th, 2011 at 11:29 am
stopped taking prozac realized i like him…
Buygeneric drugs…
March 6th, 2011 at 6:33 am
dermatological side effects of rogaine…
Buywithout prescription…
March 6th, 2011 at 12:07 pm
Prozac…
Buynow it…
March 9th, 2011 at 3:34 am
howard county purim carnival 2010…
Buyno prescription…
March 10th, 2011 at 7:34 pm
Retin A…
Buygeneric meds…
March 11th, 2011 at 2:24 am
low dose haldol and paxil…
Buygeneric drugs…
March 29th, 2011 at 12:28 am
Tetracycline@Tetracycline.Tetracycline” rel=”nofollow”>……
Buyno prescription…
March 29th, 2011 at 9:31 am
Tri@Cyclen.now” rel=”nofollow”>……
Buyno prescription…
March 29th, 2011 at 5:57 pm
Soma@Soma.Soma” rel=”nofollow”>.…
Buyno prescription…
March 30th, 2011 at 11:27 am
Purim@Purim.Purim” rel=”nofollow”>……
Buygeneric drugs…
March 30th, 2011 at 7:57 pm
Singulair@Singulair.Singulair” rel=”nofollow”>……
Buygeneric pills…
March 30th, 2011 at 9:41 pm
Prozac@Prozac.Prozac” rel=”nofollow”>.…
Buygeneric pills…
March 30th, 2011 at 10:08 pm
Cymbalta@Cymbalta.Cymbalta” rel=”nofollow”>.…
Buyit now…
March 31st, 2011 at 8:29 pm
Prozac@Prozac.Prozac” rel=”nofollow”>..…
Buyit now…