Converting flac to mp3

Any recommendations for converting flac to mp3 files?

I did come acrorss this thread on the FreeBSD mailing list but I can't see how to convert flac to wav which is supposed to be the first step.
 
Sometimes it really is an issue of just looking a little more careful. How about audio/flac123? From its description:

Code:
Flac123 is a  console-line Free Lossless Audio Codec (flac) audio player.
It implements mpg123's 'Remote Control' interface and has the ability to
output to a wav file or stdout.

WWW: http://flac-tools.sf.net
That's the first thing I'd try.
 
As that page's author, though, it doesn't deal with flac to mp3. I would just try ffmpeg.
ffmpeg -i myfile.flac myfile.mp3

fernandel I'm glad you've found that page helpful. I have to do some editing on it one of these days, to try to make it less meandering, but don't know when I'll have time.
 
As scottro suggested, ffmpeg is probably the tool you want, because it usually preserves the metadata from the flac file and transfers it to the mp3-file. Just be mindful of the bit-rate setting of ffmpeg, that I think is less than optimal by default.

But for a more simple solution, you can pipe the decoded audio directly to lame:
flac -c -d "$infile" | lame -b 192 -h --replaygain-accurate - "$outfile"

Transferring the metadata is an exercise using metaflac before encoding to mp3, but easy to script.
 
The basic idea of any conversion with these compressed audio formats: source format -> uncompressed PCM (wav) -> destination format. The uncompressed PCM (wav) is the only universal format that every tool understands so the first step is always uncompressing the source file to PCM and whatever is done then is done on the uncompressed data. You don't have to store the uncompressed data into a temporary file, the example above uses piping of the uncompressed PCM into a compressor program (lame).

Do note that uncompressing a flac file doesn't lose any quality because flac is a lossless codec meaning that uncompressing a flac file will always give you back the original wav file bit by bit accurately. However as soon as you compress the uncompressed PCM output with an MP3 compressor there will be a significant loss of quality that can't be ever recovered because MP3 is by design a lossy codec.
 
Back
Top