duncan­lock­.net

I recently needed to convert some FLAC music files from the increasingly common 48 bit encoding, down to 16 bit at 44100 kHz, so that they’ll play on my Sonos. Here’s how to do it:

If you don’t already have sox installed, do this to install it:

$ sudo apt-get install sox

Then run this to do the conversion, in the folder with music in:

$ mkdir resampled
$ for flac in *.flac; do sox -S "${flac}" -r 44100 -b 16 ./resampled/"${flac}"; done

And that’s it - it will convert all the .flac files in that folder to 16 bit at 44100 kHz and put the result into the ./resampled subfolder, preserving the metadata.

Continue reading “How to convert FLAC files from 24/48 bit to 16 bit on Ubuntu Linux”

I recently needed to convert some Apple Lossless music files to FLAC. Here’s how to do it:

If you don’t already have ffmpeg or libav-tools installed, do this:

$ sudo apt-get install libav-tools

Then run this to do the conversion, in the folder with music in:

$ for f in *.m4a; do avconv -i "$f" "${f%.m4a}.flac"; done

And that’s it - it will convert all the .m4a files in that folder to .flac files, preserving the metadata. You can now delete the .m4a files if you want:

$ rm ./*.m4a
Continue reading “How to convert Apple Lossless/ALAC/.m4a files to FLAC with avconv, on Ubuntu Linux”