Transcoding FLAC to MP3

Having my entire record collection in a fully lossless format with properly scanned cover art has taken some time. Now that it is done I sometimes want to use the music in players that do not support FLAC or where I want to keep down the size of the files.

I have tried a number of existing solutions but none of them worked the way I wanted. Since I keep my music on a headless server I wanted a non-GUI solution. Also, since my main playing environment is based on Slimserver there are a number of features that give other players some headache – one such thing is that many of my genre tags contain multiple genres, separated by semicolon. I also wanted the tagged file to include the cover art and to work on both Windows Media Player and iTunes.

My current solution is based on a Bash script (attached) and includes the following features:

  • Incremental transcoding so it doesn’t have to run through the entire library (which may well take weeks)
  • Ability to skip a certain folder – in my case I have skipped the compilations for now since iTunes makes it messy otherwise
  • Fixes filenames so that they don’t include any non-ASCII characters

To run the script a rather updated Linux version is needed. I first started writing the script on Ubuntu 6.06 (Dapper) but realised after a while that the reason that I just couldn’t get the Unicode characters in the tags to work was not due to me but some bug in the id3lib. Currently I am running this on Ubuntu 7.10 (Gutsy).

Attachments