SoX vs. ffmpeg to take a 24-bit FLAC to 16-bit WAV?

I need to write a shell script to turn a bunch of 24-bit FLAC files into VBR MP3 files with a particular quality setting. I’m thinking I should not use ffmpeg to do this in one step, because as Koz has said, it’s best to downsample to 16 bits before encoding an MP3. So I’m thinking my first step should be to go from 24-bit flac to 16-bit wav, and then my second step should be to encode the wav to mp3. I know how to use the LAME command-line utility for the second step, but what about the first step? It seems like ffmpeg or sox would do it, but would one or the other be better?

On the one hand, I read somewhere that codecs’ built-in downsampling routines are low-quality, so one should use a separate downsampler. And sox seems to use libsamplerate, while I assume ffmpeg uses the codecs’ built-in routines. On the other hand, sox’s package says it “doesn’t do anything very well”, so I figure I should be wary.

Thanks for any advice.

Never mind… I now realize I wasn’t even using the word “downsample” correctly… (what’s the word for changing bit depth, anyway?) And I figured out how to do this with SoX and it sounds fine to my ears. So I think I’m okay. But I won’t delete my original post, just in case anyone has more interesting insight to offer, as is often the case around here. --Allen

Not really answering your question, but thought you may be interested.
By default Audacity uses libresample, but may be compiled to use libsamplerate.

Note that there was a bug in Audacity that only allowed the slower high quality setting to be used (reducing multi-track performance in Audacity), but this has now been fixed in cvs. I wrote a bit about it here: