Good command line tool for converting to and from FLAC audio format

audioconversionsoftware-rec

Ideally, I want to convert from MP3 to FLAC and back. I also need to be able to script this.

Best Answer

The fundamental tool for sound format conversions and simple transformations is SoX, the Swiss Army knife of sound-processing programs.

sox foo.mp3 foo.flac

If you're running Debian, support for writing MP3 in sox is broken in lenny and squeeze (and as far as I know the same problem affects Ubuntu 10.04 and 10.10). This bug was fixed in early March 2011, so grabbing the latest source (or grabbing a binary for sox 14.3.1-1build1 or newer) and recompiling it should work.

An alternative for encoding to .mp3 is lame. It doesn't read .flac, but you can use sox or flac to convert from .flac to .wav and then lame from .wav to .mp3.

flac -d foo.flac -c | lame - foo.mp3
Related Question