<?sphp $this->text('pagetitle') ?>
Home of the Squeezebox™ & Transporter® network music players.

Stream to Icecast

From SqueezeboxWiki

Jump to: navigation, search


Streaming from Slimserver to Icecast using MuSE - Basic HowTo v 1.0

Having documented attempts to use VLC as a method of streaming SlimServer output to an Icecast streaming server and encountering some severe difficulties concerning password-protecting the Slimserver without terminally breaking the stream, I looked for another method of achieving the same goal, namely to make content played out of a Slimserver accessible to a large number of people by relaying it via an external server such as that offered by streaming server providers. My main intent was to make the Slimserver stream accessible to residents of Second Life, for example to perform DJ sessions at clubs in-world, but of course the stream can be listened to with any player that can decode an Icecast stream.

The challenge is that while Slimserver can generate an mp3 stream that can be played on a regular software player (typically by pointing at http://slimserver-ip:9000/stream.mp3), the stream has some unusual characteristics that make it impossible to relay it direct with an Icecast server: it drops out after 30-60 seconds.

The solution is to play the stream with something and then stream from that. The clunky solution would be to run a player and then capture the soundcard output to stream to the remote server, with something like Simplecast. A nicer solution would be to use an application that does the playing and grabbing for you.

MuSE (Multiple Streaming Engine) from http://muse.dyne.org/ does this. And instead of using the Icecast server in relay mode (where the Icecast server receives the stream and relays it), as with the VLC solution documented elsewhere, MuSE pushes a stream conventionally to Icecast. This can be important as some streaming server providers do not give you the ability to control the stream relaying mode and configuration: this means that if you want to stream from different places with different IP addresses using stream relay, you can’t access the settings and have to ask for the provider to change them for you - annoying and inconvenient. The MuSE solution avoids this by pushing the stream to the Icecast server in its normal mode, so it doesn't matter where you do it from.


There are some caveats:

First, MuSe is only available for Mac and Linux systems at present, although there is a self-contained ‘dyne:bolic’ disc you can download for booting on a PC.

Second, as with the VLC streaming technique, you will be in trouble if you play a file on Slimserver which has a data rate that is less than the maximum bitrate defined in the Player Settings for the player being used by MuSE. In this case it will play the file in garbled form at high speed and if you put something sensible in the playlist after it then MuSE falls over and you’re off the air. The solution required for this is for the mp3 stream supplied to a player by Slimserver to be able to have a defined bitrate, rather than a defined MAXIMUM bitrate - perhaps the Slimserver developer community can look into this.

Basic MuSE configuration

There are two sides of MuSE to set up, and the tutorial at http://muse.dyne.org/?open=tutorial is helpful for this. You need to configure the streaming settings and you need to configure MuSE to play the Slimserver mp3 stream.

Configure the streaming settings by: a. Setting the parameters for the output stream such as quality, number of channels, digital word length (aka ‘bitrate’, which is ambiguous in this context) and sample rate. b. Entering the Icecast server details given by your provider. These will include the host/server IP or hostname; port; mountpoint and some stream info to be displayed remotely.

Defining the output stream

Access the stream output dialog by pressing the plug-socket button in the MuSE interface, top left to bring up the Add Server dialog. I have not yet got the Ogg/Vorbis streaming setup to work with Icecast so I will assume instead that we’ll use LAME to generate an MP3 stream - click the ‘Lame Streaming (MP3)’ tab.

The upper half of the dialog defines the parameters of the stream to be fed to the remote server. Many streaming server providers will give you up to 128kb/s so there is no need to configure the streaming data for faster than that. Indeed, 96kb/s is fine for many applications. Drag the Quality slider up until you get the value you want. You probably want to set the mode to stereo unless you are streaming old 78s. A ‘bitrate’ (word length) of 16 bits is the same as CD and fine for streaming audio at this kind of data rate. 44100 Hz sample frequency is also CD quality and probably a good idea - but set the ‘bitrate’, ‘frequency’ and ‘quality’ to give you a good balance of audio quality versus bandwidth.

You can also highpass and lowpass filter the audio to minimise artefacts and optimise the stream. You may find the ‘auto’ works fine.

A Profile button allows you to save your settings here so you don’t have to type everything in again when MuSE crashes (for example).

Entering the Icecast server details

The lower half of the dialog allows you to enter the remote server data as supplied by your server provider. Enter the hostname or IP address, port number, mount point (of the form “/name” - “/live” is typical and the default), and give your stream a name and description. The space for a URL is also provided - this will appear, for example, in iTunes and ought to go somewhere useful. Also set up the login info by selecting the type of login and the password as supplied.

Again you can save a profile here. Clicking ‘Connect’ will cause MuSE to attempt to stream to the remote server. You will see a message telling you it has done so.

Note that you may need to ensure that there is a suitable hole in your firewall to allow this access. However in many cases, as you are actually ‘pushing’ the data to the remote server, you may not have to worry.

Playing the Slimserver stream

Now let’s play the stream from your Slimserver. Note that Slimserver and MuSE do not have to be on the same machine.

The second button from the left in the MuSE interface - a document with a jigsaw piece or something on it - brings up a Channel window. If you already have Channel 1 open you don’t need to click it again. Right-click in the channel window’s white area and choose URL. In the resulting box, enter something of the form ‘http://slimserverip:9000/stream.mp3’ where ‘slimserverip is the IP address of, you guessed it, your Slimserver machine.

You can actually build complete playlists here, by the way, by loading files direct from your music library - and by having, say, two channels open you can fade one up and another down and essentially not use Slimserver at all.

I found that I could not get this to work simply by adding the Slimserver stream URL. Only by right-clicking and adding it AGAIN could I get it to play. Goodness knows why. Make sure that you select “Continuous” in the button bottom-right of the window. Double-clicking on the item in the list will play it, or you can select it and click the play button above the window.

Clicking play will cause the player section of MuSe to connect to your Slimserver and in the Slimserver web interface you will see a Player with the IP address of your MuSe machine. You can rename this in Server Settings for this player. You can also check the maximum bitrate for the stream - I have almost all FLAC files in my library so the maximum bitrate will define what rate LAME converts these to mp3 and streams them out to MuSE. See caveat above.

Final touches

If you want to listen to the output on the MuSE machine, click the loudspeaker button in the MuSE interface. Note that there is also a Microphone button here, and this allows you to bring in audio from your sound card if you want to make announcements over your stream.

In addition, as you can bring in audio from your sound card or audio interface here, you can alternatively bring in a live mix from your mixing console (or even simply different soundcard/audio interface inputs) and thus stream a live act... And indeed, as mentioned above, you don’t actually need Slimserver if the MuSe player will play back files from your library directly and you don’t want access to Slimserver’s comprehensive search and playlist-management capabilities. But these are not the purpose oif this document.

Clicking the little bargraph button brings up a couple of speed dials - regrettably not actual bargraph VU meters - one giving you the volume level and the other the data rate of the outgoing stream - useful for checking things are actually working. If your volume dial is wiggling, you’re sending audio; if the data rate dial is reading something, you’re streaming it.

You should now be on the air. Logging into your Icecast server address with a web browser will show you that there is actually a stream there and you can listen to it.

If you are streaming into Second Life (which is what I wanted this setup to do) then you can plug the Icecast server address into the media access URL for the land or give the URL to your venue manager. It will be of the form ‘http://icecast-ip:port/mount’ where ‘icecast-ip’ is the hostname or IP address of the Icecast server; ‘port’ is the port number supplied by your provider; and ‘mount’ is the mountpoint similarly provided.

Server provision for Second Life

Looking for an affordable, supportive and efficient server provider specialising in streaming into Second Life? I recommend a Streaming Live Audio Server from Jamie Otis. Find him in Search, bring up his profile, and check his Picks for the location of his in-world store where you can order a server and pay for it on the spot - L$4000 per month for up to 100 listeners at up to 128kb/s.


I hope this helps anyone attempting to stream their Slimserver to a wider audience.