Logitech Squeezebox: on-the-fly transcoding Apple Lossless to MP3

Thu 25 February 2010

My Logitech Squeezebox Duet has been given me problems for as long as I have had it. Internet radio plays just fine. However my own music collection only plays with intermittent interruptions. As my music collection is all in Apple Lossless format and the Logitech Player only supports the audio formats PCM (raw), MP3 and Flac I figured my music was converted to PCM by the server on my Mac before being streamed to the player. PCM is as big as audio files can get, hence I was likely looking at a bandwidth issue.

Initially I looked at the following things to remedy the problem:

  • buffer settings on the player
  • different wireless channels to minimize interference
  • converting my library to MP3 or Flac

Buffer settings on the player were non-existent. Changing wireless channels would have been futile as the channel I was using, was only used by me and the only one that wasn’t next to another used channel. I was hesitant to convert my library to a lossy format. Flac was out of the question as I needed to be able to play my music on my iPod as well. So in the end I just left things as they were.

However lately things had been getting worse so I started looking for another option. I was then that I found out that the Squeezebox server is able to transcode music on-the-fly to pretty much any format with the proper software installed. To have my music transcoded to MP3 all I needed to do was install Lame (an excellent MP3 encoder).

Installing Lame

On OS X the best way to install Unix tools/programs is MacPorts. With MacPorts installed, installing Lame is a simple matter of running:

$ sudo port install lame

Letting the Squeezebox server find Lame

Unfortunately the Squeezebox server could not find the Lame executable installed by MacPorts. The Windows and Linux instructions for transcoding instruct the user to install the Lame executable in the Squeezebox’ bin directory. We can achieve the same effect by creating a symbolic link to the Lame executable from the Squeezebox bin directory.

As it turns out the Squeezebox’ bin directory is:

/Library/PreferencePanes/Squeezebox.prefPane/Contents/server/Bin/darwin

The following command creates the symbolic link in the above directory:

$ cd /Library/PreferencePanes/Squeezebox.prefPane/Contents/server/Bin/darwin
$ ln -s `which lame` .

The directory listening (ls -la) should now display:

rwxr-xr-x 15 Guest _guest 510 Feb 25 13:33 .
drwxr-xr-x 4 Guest _guest 136 Feb 22 21:40 ..
-rwxr-xr-x 1 Guest _guest 71584 Feb 22 21:39 alac
-rwxr-xr-x 1 Guest _guest 911664 Feb 22 21:39 faad
-rwxr-xr-x 1 Guest _guest 1087116 Feb 22 21:39 flac
-rwxr-xr-x 1 Guest _guest 8422 Feb 22 21:39 itartwork.scpt
lrwxr-xr-x 1 root _guest 19 Feb 25 13:33 lame -> /opt/local/bin/lame
-rwxr-xr-x 1 Guest _guest 306080 Feb 22 21:39 mac
-rwxr-xr-x 1 Guest _guest 63936 Feb 22 21:39 mov123
-rwxr-xr-x 1 Guest _guest 10243572 Feb 22 21:39 mysqld
-rwxr-xr-x 1 Guest _guest 118 Feb 22 21:39 openprefs.scpt
-rwxr-xr-x 1 Guest _guest 418 Feb 22 21:39 restart-server.sh
-rwxr-xr-x 1 Guest _guest 930 Feb 22 21:39 signalupdate.scpt
-rwxr-xr-x 1 Guest _guest 8163888 Feb 22 21:39 sox
-rwxr-xr-x 1 Guest _guest 539300 Feb 22 21:39 wvunpack

Note the entry with lame -> /opt/local/bin/lame.

Stopping and starting the Squeezebox server from the Preference Pane is all that’s left for the Squeezebox to find the Lame executable.

Enable transcoding

The last thing to do is letting the Squeezebox server know we want to transcode our music on-the-fly.

Do the following:

  • http://localhost:9000
  • Click on “Settings” (lower right corner)
  • Select the “Player” tab
  • Select “Squeezebox” from the drop down menu
  • Select “Audio from the second drop down menu
  • Set bitrame limiting to a value other than “No Limit”, e.g. “160 kbps”
  • Set the Lame quality level, e.g. “4″
  • Click Apply (lower right corner)
/static/images/2010/squeezebox_server_audio_settings.png

Voila on-the-fly transcoding your Apple Lossless music to MP3 is in place. If you still have interruptions, lower the bitrate. If your server is strained for CPU you can lower the Lame quality level (== higher number).

IMPORTANT if you ever upgrade the Logitech Squeezebox server to a newer version you should verify that the symbolic link to lame is still in place. I have found it to be removed on most server upgrades.

Comments