Liquidsoap 0.9.2 : Streaming to Shoutcast

Streaming to Shoutcast

Although LiquidSoap is primarily aimed at streaming to Icecast servers (that provide much more features than Shoutcast), it is also able to stream to Shoutcast, thanks to libshout.

output.shoutcast.mp3

You can use the function output.shoutcast.mp3 to feed your server with audio data:

source = single("audiofile.ogg")

output.shoutcast.mp3(host="shoutcast.example.org",
                     port=8000, password="changeme",
                     source)
Grab the code!

The options of output.shoutcast.mp3 are the same as those of output.icecast.mp3, except for mount that does not exist in the Shoutcast world, and protocol, which is forced to ICY. This means you can set the bitrate, the samplerate, etc as you see fit. Don't forget to set your station's name / genre / description / website. Important note : you cannot set AIM / ICQ / IRC contacts, due to a limitation within libshout.

The function is defined in utils.liq. You need to compile LiquidSoap with lame support, so that it can encode to MP3.

Shoutcast as relay

A side note for those of you who feel they “need” to use Shoutcast for non-technical reasons (such as their stream directory service...): you can still benefit from Icecast's power by streaming to an Icecast server, and then relaying it through a Shoutcast server.

In order to do that, you have to alias the root mountpoint (“/”) to your MP3 mountpoint in your Icecast server configuration, like this:

<alias source="/" dest="/mystream.mp3" />

Be careful that Icecast often aliases the status page (/status.xsl) with the /. In this case, comment out the status page alias before inserting yours.