How to play SHOUTcast streams with Subsonic
Posted: Sat Mar 10, 2012 11:23 pm
*** This has worked great for me with Subsonic v4.5. I have not been able to get this working in Subsonic v4.6 ***
*** If somebody figures out how to make this work in v4.6, I'd love to know the solution ***
I use my Subsonic server primarily in Jukebox mode, but this also works for streaming via flash player. The disadvantage to using this method is that SHOUTcast playlists must be downloaded to your Subsonic server. This is, however, better than the alternative of not being able to stream SHOUTcast stations via Subsonic.
This is achieved by using a program (mpg123) to convert the SHOUTcast stream to raw PCM, then using LAME to re-encode the PCM audio back to mp3 in real-time. Playlists are saved locally as ".radio" files so that they show up in the web interface as ordinary music files, and so they don't conflict with the way Subsonic handles .pls files (as playlists).
These instructions are for Debian.
Step 1: Download mpg123
- Code: Select all
apt-get install mpg123
Step 2: Symlink mpg123 into the Subsonic transcode directory
- Code: Select all
ln -s /usr/bin/mpg123 /var/subsonic/transcode/mpg123
Step 3: Go into Subsonic Settings -> Transcoding and add a new transcoding option:
- Code: Select all
Name: radio > mp3
Convert from: radio
Convert to: mp3
Step 1: mpg123 -q -s -@ %s
Step 2: lame -b %b --tt %t --ta %l --tl %l -r -S --resample 44.1 - -
Step 4: Enable this transcoding option under Settings -> Players
Step 5: Add ".radio" to the Music mask field under Settings -> General
Subsonic should now transcode ".radio" files into a format that can be streamed through any of its players. ".radio" files are simply .pls files that have been saved locally. You can change the extension to whatever you want as long as you also change the extension in the above steps. I chose to use ".radio" as to not conflict with .pls (playlists) that Subsonic already recognizes.
--------------------
Now you can download .pls files (SHOUTcast stream playlists), rename them to ".radio", and place them in an accessible folder on your Subsonic server.
For instance, on my server, I have a directory "/inet-radio" that I've added into Settings -> Media folders. I can either copy .pls files from my computer into that folder and rename them, or I can use a tool like wget to download playlists directly to the folder.
Here's an example of using wget to download the Digitally Imported Vocal Trance pls file, and place it into my inet-radio folder with the proper .radio extension.
- Code: Select all
wget --output-document /inet-radio/Vocal-Trance.radio http://listen.di.fm/public3/vocaltrance.pls
These playlists now show up in Subsonic just like any other audio file. They will play in both Jukebox and flash player modes. I've also successfully streamed stations to my Android phone using the Subsonic mobile app.