How to have a fallback playlist when there is no source
Kris Taylor, http://www.wickedhouseparty.org
The reason I am writing this is because after what appeared to be endless searching of the forums I couldnt find what I was looking for.
You see, our radio station is an non-profit electronic musician service, so our broadcasters need to connect at their scheduled times. There isnt a live show at all times, though we are working towards that.
We have lots of content on our website uploaded by users, many of them broadcasters, and the idea was to stream a playlist when there was no source.
This led me to searching the forums and heading full tilt in the wrong direction, things like SC_TRANS and PHP scripting and Java and ...
Well a lot of wrong directions. The solution is much simpler. I figured since this shoutcast thing is free software, I'd do my part for the community and just write this mini-novel about our in-house solution to what appeared to be a difficult problem to solve but was rather quite easy.
So you want to start an internet radio station, broadcasting 24 hours per day, seven days per week. Out of the box, you've got two options with Shoutcast; broadcast an M3U or PLS playlist
of songs looping forever, or come up with live
content of some kind that will go forever ( a rather daunting task ).
Due to the ease of connectivity of the internet, you may seek to find people to start shows over the net, there are lots of DJs out there with great ideas who can connect to your server and broadcast.
This is where your problem gets a bit more daunting; if you are around to manually start things again its ok, but you may want this thing to somewhat run itself. Like if a broadcasters feed dies, it picks up where it left off.
The Shoutcast DNAS allows for a looping MP3 file to play when there is no source, like a technical difficulty or "this steram is currently unavailable" message. It doesnt allow for a directory or playlist
to be played when there is no source- and if you're trying to set up something like us this drives you wild.
On Windows machines, the SC_TRANS descriptions you may have read about in the forums probably wont work for you unless you have access to a port of some kind that I couldnt find.
Locally Hosted Station w/ internal and external network.
This configuration is probably one of the best types of configurations for broadcasting from your local connection. Broadcasting information from the internet over your local connection publishes your IP address and may draw attacks from those of low moral fibre who may just "experiment" to see how secure your system is.
In this configuration, you have a main computer which is connected to the internet, utilizing proxy software to share the internet connection and throw up a rigid firewall. Proxy-Firewall configuration is too much to be explained here.
The computer has two network cards, one connected to the internet and one connected to the internal LAN hub. This computer is running the shoutcast DNAS.
"Behind" this firewall machine, there is another machine running Winamp.
You can tune your DNAS and Shoutcast settings somewhat to make the system VERY stable in this configuration.
In your DNAS config settings, there is a setting called AutoDumpSourceTime. This is the setting that causes the DNAS to dump listeners if there is no source. You would typically want to set this setting to double the amount of time your Shoutcast source Automatic Recconnection on Connection failure. A good setting I use is 30 seconds AutoDumpSourceTime and 15 seconds Automatic Reconnection on Failure.
It's important not to set the Shoutcast Automatic Reconnection value too low. If you set it to 0, 1 or even sometimes 2, it will hammer your DNAS, choking your feed like a mini DOS attack. Your DNAS is caching a buffer, so dont worry listeners really wont notice if theres a little hiccup in the process.
That second machine running winamp is set up with a big playlist
, and is set to simply play and loop the playlist
, and connect to the server. Most of the time it will be playing. When one of your broadcasters or yourself want to pick up the station and stream live
, you have to kick it off using the web administration Administration panel of Shoutcast at http://serveriport
This configuration is brutally resilient. Recently, on of our broadcasters had a problem and was being kicked by the DNAS for No data, she kicked the playlist
server count 'em 10 times - connecting to the DNAS each time and getting kicked after 30 seconds... each time th playlist
server picked up the feed again then she would kick again.
None of the listeners were dropped. They only noticed a bit of jitter.
Locally Hosted Station, one machine only
This configuration is basically one machine. It would be best to configure a sort of software firewall on the machine for security purposes that the DNAS will work through.
In this configuration, start the DNAS, then run Winamp on the same machine, use the same configurations as above.
This could in theory be as resilient than the first configuation, but we're dealing with Bill Gates software here, so IMO reliability is only accomplished by each computer only doing one thing at a time. :-D
Remotely Hosted Station
The remotely hosted station (for example, one of the pay services out there) is a bit trickier. You will need to have either the flexibility to play with the DNAS settings or an admin that will take the time to help you get things right.
Theres nothing for you to do other than have the computer running winamp and the playlist
set to connect and play the playlist
indefinitely. I'd reccomend a computer you dont use for your own broadcasts, so its all automatic.
What gives? How do you kick the playlist then?
I know I havent gotten to that yet. But nows the time.
In this example I am using some terms; the "server" DNAS is obviously the machine running the DNAS. The "playlist
server" is the machine running winamp trying to connect to the DNAS 24/7, not neccesarily running the DNAS.
When one of your broadcasters is ready to go on, they need to use the Shoutcast Admin login - so you need to have a base level of trust with them - to go in and kick the feed.
If you were broadcasting from http://radio.site.com:1230/listen.pls
then your admin site is http://radio.site.com:1230
* On a side note here, if you are giving out your Admin password to your broadcasters, you may want to change it at least weekly. Just a good practice so your password doesnt get around or stale.
In the Shoutcast administration panel, the current source is displayed, beside it there is a little KICK link. Thats what you or your broadcasters have to click in order to punt the playlist
But whoa, slow down. Its very important that the shoutcast dsp is up, tested, and ready to go at this point. Once you click kick, immediately hit connect on the Shoutcast DSP of the oncoming broadcaster, or the playlist
will just pick up the feed again.
Remember as well, doublecheck your bitrates and samplerate frequencies!
If you mismatch (your playlist
is at 24kbps and the oncoming broadcaster is 48kbps for example), the listeners wont be dropped but they will be playing the higher bitrate audio at a lower bitrate. Meaning what? Music that sounds like a 45 record being played at 33. (That can be caused by other things like samplerate problems with an audiocard so if you searched the forums and found this you've probably come to the wrong place).
Make sure everybody and the playlist
server are all set to one and the same frequencies and bitrates or you will get nothing but problems.
If you're broadcasting locally, I'd reccomend that you look at the above configuration and set up a small lan, with a proxy & firewall server running the DNAS and your personal machine, your broadcast machine, and the playlist
server and any other hardware on an internal network. This isnt exactly that easy but there are a lot of resources online that can help you do it - http://www.ositis.com
has some good online help resources for this.
If you dont have the machines to spare and want to do it locally all on one, this should work.
If you're broadcasting remote, I would really reccomend a second machine do the playlist
serving. For example, you want to play a video game, listen to an MP3 or anything, your playlist
server will need to be shut down or messed with so you can do those tasks.
Hopefully this helps and I dont get to mambo-flamed for some little semantics in my message. I wish I found a simple thing like this instead of having to figure it out all by myself - and you dont have to since you found this.
Other Shoutcasting experts, if you have a SIMPLE non scripting way of doing this same thing, please explain it here in LAYMANS terms in this thread so users hunting for this type of thing can not only find my explanation but yours as well.
Cheers & Shoutouts to other Shoutcast broadcasters