Convert WAV music library to FLAC on command line and achieve best quality

command lineconversionflacmusicwav

I would like to produce (nearly) perfect FLAC files by verifying/checking all conversion steps. I'm hoping to do this in a single command, although a short bash script would be acceptable as a second choice.

I am on Kubuntu 12.04 and I installed flac 1.2.1.

Here is my starting point:

find ~/Music -type f -iname "*.wav" | while read fn; do flac --keep-foreign-metadata --ogg --verify "$fn"; done

How can I improve this?

If shntool is recommended, how would I include it?

How would I include checksum comparisons?

How can I make FLAC test the integrity of each file?

A working example is appreciated.

BTW, I took a look at perfect-flac-encode, but it is too complicated for me. I don't even fully understand the first sentence of the project's description! The installation steps also look too complex. If there is a similar project that might fit my needs, please let me know.

Best Answer

Both WAV and FLAC formats are lossless, which means they do not lose any quality from an original music CD. WAV however is uncompressed, while FLAC uses a lossless compression mechanism (pretty much like a ZIP lossless compression) specifically designed for efficient packing of audio data. FLAC files can then be played with your favorite player, just like ordinary MP3's.

If you already have WAV files, then you simply need to convert them to FLAC (and not worry about losing quality). You can either use CLI via SoX (although other solutions exist, like flac itself):

sox track_01.wav track_01.flac

Or use a clean and intuitive GUI like SoundConverter. In Preferences set output format to FLAC, choose compression speed (it does NOT affect quality, only resulting file size), then add files or a directory and start the conversion process.

enter image description here


Once the conversion is done, you can check that no quality was lost by using soxi (comes with SoX):

soxi track_01.wav 
soxi track_01.flac

The FLAC file size will be smaller though.

An even better way to check the technical data of an audio file is MediaInfo. See:

Related Question