Ali Gangji

Convert FLAC files to MP3 with flac and lame

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: , , , ,

42 Responses to “Convert FLAC files to MP3 with flac and lame”

  1. Bijan Says:
    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 :)

  2. Ali Gangji Says:
    July 27th, 2009 at 4:53 pm

    thanks Bijan

  3. ERNEST Says:
    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….

  4. LONNIE Says:
    December 20th, 2010 at 2:02 pm

    abilify side effects in children

    Buydrugs without prescription…

  5. CURTIS Says:
    December 21st, 2010 at 3:09 am

    buy viagra canada

    Buygeneric drugs…

  6. ARMANDO Says:
    December 25th, 2010 at 1:19 am

    abilify and siezures

    Buynow…

  7. DAVE Says:
    December 27th, 2010 at 12:18 pm

    Accutane@official.site” rel=”nofollow”>.

    Buywithout prescription…

  8. EUGENE Says:
    December 28th, 2010 at 5:54 pm

    Advair@official.site” rel=”nofollow”>.

    Buynow it…

  9. JOSHUA Says:
    December 29th, 2010 at 6:30 am

    Aldactone@official.site” rel=”nofollow”>.

    Buygeneric drugs…

  10. KELLY Says:
    December 30th, 2010 at 12:03 pm

    Ampicillin@official.site” rel=”nofollow”>.

    Buynow it…

  11. LARRY Says:
    December 31st, 2010 at 3:49 am

    ..

    Buygeneric drugs…

  12. RICK Says:
    January 1st, 2011 at 6:22 pm

    Clonidine@official.site” rel=”nofollow”>…

    Buynow…

  13. RICK Says:
    January 2nd, 2011 at 6:28 am

    celexa@canada.now” rel=”nofollow”>.

    Buynow…

  14. JULIAN Says:
    January 3rd, 2011 at 11:46 pm

    abilify@anxiety.now” rel=”nofollow”>.

    Buygeneric drugs…

  15. LEE Says:
    January 9th, 2011 at 3:44 am

    i@am.pregnant.how.often.can.i.take.25mg.of.phenergan.safely” rel=”nofollow”>…

    Buygeneric drugs…

  16. CLINTON Says:
    February 5th, 2011 at 5:31 am

    Zocor

    Buygeneric meds…

  17. STUART Says:
    February 6th, 2011 at 9:47 am

    zestoretic co-q10

    Buywithout prescription…

  18. SHAWN Says:
    February 6th, 2011 at 11:37 am

    Clindamycin

    Buywithout prescription…

  19. REGINALD Says:
    February 7th, 2011 at 1:23 am

    dog zyrtec

    Buygeneric drugs…

  20. SHAWN Says:
    February 7th, 2011 at 8:43 am

    Xalatan

    Buywithout prescription…

  21. STUART Says:
    February 7th, 2011 at 2:04 pm

    Vytorin

    Buynow…

  22. ALFONSO Says:
    March 3rd, 2011 at 1:06 am

    Zyvox

    Buydrugs without prescription…

  23. DAVE Says:
    March 3rd, 2011 at 2:19 am

    Zyrtec

    Buyno prescription…

  24. JONATHAN Says:
    March 3rd, 2011 at 4:35 pm
  25. ADAM Says:
    March 4th, 2011 at 8:01 am

    Zyrtec

    Buygeneric meds…

  26. CHAD Says:
    March 4th, 2011 at 8:42 am

    Zyprexa

    Buydrugs without prescription…

  27. CHRIS Says:
    March 5th, 2011 at 1:03 am

    Rogaine

    Buygeneric meds…

  28. JEREMIAH Says:
    March 5th, 2011 at 4:43 am

    Pyridium

    Buygeneric drugs…

  29. MIGUEL Says:
    March 5th, 2011 at 11:29 am
  30. DOUG Says:
    March 6th, 2011 at 6:33 am

    dermatological side effects of rogaine

    Buywithout prescription…

  31. JEFF Says:
    March 6th, 2011 at 12:07 pm

    Prozac

    Buynow it…

  32. TERRANCE Says:
    March 9th, 2011 at 3:34 am

    howard county purim carnival 2010

    Buyno prescription…

  33. STEVEN Says:
    March 10th, 2011 at 7:34 pm

    Retin A

    Buygeneric meds…

  34. ROBERTO Says:
    March 11th, 2011 at 2:24 am

    low dose haldol and paxil

    Buygeneric drugs…

  35. MATTHEW Says:
    March 29th, 2011 at 12:28 am

    Tetracycline@Tetracycline.Tetracycline” rel=”nofollow”>…

    Buyno prescription…

  36. CLAUDE Says:
    March 29th, 2011 at 9:31 am

    Tri@Cyclen.now” rel=”nofollow”>…

    Buyno prescription…

  37. GEORGE Says:
    March 29th, 2011 at 5:57 pm

    Soma@Soma.Soma” rel=”nofollow”>.

    Buyno prescription…

  38. SAM Says:
    March 30th, 2011 at 11:27 am

    Purim@Purim.Purim” rel=”nofollow”>…

    Buygeneric drugs…

  39. EDGAR Says:
    March 30th, 2011 at 7:57 pm

    Singulair@Singulair.Singulair” rel=”nofollow”>…

    Buygeneric pills…

  40. TYRONE Says:
    March 30th, 2011 at 9:41 pm

    Prozac@Prozac.Prozac” rel=”nofollow”>.

    Buygeneric pills…

  41. KARL Says:
    March 30th, 2011 at 10:08 pm

    Cymbalta@Cymbalta.Cymbalta” rel=”nofollow”>.

    Buyit now…

  42. REX Says:
    March 31st, 2011 at 8:29 pm

    Prozac@Prozac.Prozac” rel=”nofollow”>..

    Buyit now…

Leave a Reply