I like my music to be in MP3 v0, meaning the data has a variable bitrate of between 200-300 kbit/s. It makes for tiny MP3s that are in my opinion almost indistinguishable from ‘pure’ CD quality, sound-wise.
However, to get music in that format is not always possible, so my music directory has become littered with FLACs. Converting them all to v0 the simple way means the poor old NAS will have a hard time keeping up with other tasks. Enter flac2mp3.sh:
It recursively searches a given directory for FLACs that don’t have an MP3 with the same name yet, converts them to MP3 v0 and while doing that, limits the amount of CPU muscle it needs, so the NAS can continue doing its NAS-y business.
Note that it will also keep the old FLACs in place, just in case something went wrong converting them. From time to time, I check and delete them using this Python script.
As usual, this was tested on the Netgear ReadyNAS 102 and should run on any UNIX system providing it has the necessary packages.
- Install the packages: lame, flac and cpulimit.
- In the script, set CPU_LIMIT to your favourite CPU percentage.
- Run the script by doing:
Tip: make a cron job out of it that runs every hour:
crontab -e <editor opens, add line:> 0 1 * * * /home/a-schwarzenegger/flac2mp3.sh /data/mymusic/ >> /var/log/flac2mp3.log 2>&1