Install Subsonic media streaming server on a Raspberry Pi

Edit: There are also instructions for building a Subsonic Raspberry Pi using Java 8 here. The main benefits of that method are a faster UI, better performance and the ability to use the Jukebox mode of Subsonic to play music through the headphone jack of the Pi itself rather than through the web interface.

Subsonic is great. It can play music and video of most formats through a web interface and there are apps available for most mobile platforms so you can take all your media with you anywhere.

I wanted to install Subsonic on a Raspberry Pi as it would give a low-cost and low power platform for my media streaming. Ideal!

Searching around the web there are a few mentions of Subsonic and Raspberry Pi but no clear instructions and certainly nothing that mentions some of the issues I found.

I started off with a clean Raspbian install on an 8GB SD card. If you want instructions for how to set this up, take a look at the Raspberry Pi wiki here. (At the time of writing the latest Raspbian image was dated 2012-08-16).

Once I’d booted the fresh Raspberry Pi and used ssh to log on my first step was to create a new user. This user will be running the Subsonic process so for security purposes I didn’t grant root access.

sudo adduser [subsonic_user]

Subsonic needs Java to run so I installed that next (these next few steps are detailed on the Subsonic website).

sudo apt-get install openjdk-6-jre

I then downloaded the subsonic .deb package with wget and installed it. I downloaded the latest beta version which at the time of writing was 4.7.beta3 but you can find the latest stable version or the latest beta version on the Subsonic download page. Make sure you follow the download links to SourceForge  until you see a ‘Direct Link’. Right click that link and select ‘Copy Link’. You can then right-click the ssh window to paste the URL there.

wget [right-click paste url] -O subsonic.deb
sudo dpkg -i subsonic.x.x.deb [downloaded file]

As the Subsonic page says, the user for the subsonic process should be changed for security.

sudo nano /etc/default/subsonic

Edit the SUBSONIC_USER line at the bottom.

SUBSONIC_USER=[subsonic_user we created earlier]

Save the file and restart the Subsonic process to make the changes.

sudo service subsonic restart

 

This is where I found my first issue.

I have a lot of music that is in FLAC format. In order to play music through the web interface, Subsonic transcodes the files from FLAC to mp3. To do this it uses a program called ffmpeg. The ffmpeg version which Subsonic installs by default doesn’t work correctly on the ARM architecture processor of the Raspberry Pi so in order for transcoding to work properly, I found that I needed to replace ffmpeg with an ARM compiled version.

Luckily this is really straight forward.

sudo apt-get install ffmpeg

This installs ffmpeg to the /usr/bin folder but Subsonic can’t use it from there so we need to copy it to the correct folder.

sudo rm /var/subsonic/transcode/ffmpeg
sudo cp /usr/bin/ffmpeg /var/subsonic/transcode

I repeated the above steps for the lame transcoder which Subsonic also uses. Just repeat the install, remove and copy steps but replace ‘ffmpeg’ with ‘lame’.

Edit: I recently had some trouble with the transcoding failing every now and again. Checking the ‘Transcoding’ section of the Subsonic settings revealed that some of the enabled transcodings were set to use ‘Audioffmpeg’.

I changed these to refer to ‘ffmpeg’ and the transcoding worked again.

You should now find that transcoding works properly on Subsonic. You can fire up Subsonic by opening a web browser and typing in http://[ip address of Raspberry Pi]:4040. If you log in and go to Settings>Network you can ask Subsonic to configure your router and give you a subsonic.org sub-domain so you can get access to your Raspberry Pi Subsonic server from anywhere.

I’d also recommend using the donate function as this is a great piece of software.