goal: create my own shoutcast-like audio streaming server
apps used: icecast and ezstream
Just got a hold of a vps i finally can play with, w00t. And it’s just now that I had the time to do something with it. I’m thinking of migrating this blog there one of these days. The first thing I’ve thought of doing is setting up my own online radio station. The first app that came to mind was shoutcast(link shoutcast.com). But it’s not opensource =/. Googling around, I discovered icecast(link icecast.org). There are 2 major components in an online radio station: a streaming server(which is icecast) and a source client(there are various apps that be used for this). The soure client may reside on a computer different to the streaming server, but in my setup they’re gonna be on the same machine
The 1st one is where your listeners will connect to listen to the music you’ll be broadcasting, the latter is what you’ll use to broadcast your content. Think of it this way, the stream server is the radio station 95.5. Whenever you want to listen to this station you turn on your radio and jog the dial to that station. The source client is your dj, he speaks stuff and plays songs on air. He uses the radio station as his medium to let the listeners hear what he has on playing. Also the dj doesn’t have to be physically present in the radio station’s bldg to be able to broadcast through the radio station itself. Basically that’s how it works, although it can do more than what I intend it to do. At this time I only want to be broadcasting a specific playlist.
First step was to install icecast, I downloaded the source rpm from:
Ran rpmbuild –rebuild against the .src.rpm file and installed the needed dependencies. Once done building it, installed it, edited the config file and ended up with this config
<source-password>xtremeleetpassw0rd</source-password>#for source client
<alias source=”/” dest=”/status.xsl”/>
After config was done, ran icecast with:
icecast -bc /etc/icecast.xml
Set up of 1st component is done, now comes the 2nd part which is installing a source client app. I chose to use ezstream because I uh, I like the name that’s why. The source code can be downloaded here.
./configure, make, then make install. I then had to create a config file for ezstream, sample configs can be found in /usr/local/share/examples/ezstream. I copied the sample ezstream_mp3.xml and made some changes to it to satisfy what I needed to do.
#your streaming server’s http://ip-or-host:port/stream
#refer to your icecast.xml’s <source-password>
<filename>playlist.m3u</filename>#this still needs to be created
<stream_once>1</stream_once>#when file from <filename> is done being streamed, repeat.
<svrinfodescription>music that i mostly listen to</svrinfodescription>
Next is to create the playlist “playlist.m3u”. One way to do that would be to (my audio files are stored in /usrlocal/music):
find /usr/local/music -name *.mp3 >/usr/local/music/playlist.m3u
The file should now contain the filenames of my audio files along with their absolute paths.
To start streaming and have it run in the background:
ezstream -c /usr/local/music/my_first_stream.xml &
To access this stream, you can use the media players listed here: http://www.icecast.org/3rdparty.php. MSWindows’ own mediaplayer works too btw. The url to the stream would then be: http://starvingpenguin.com:8000/stream
-create start/stop script for icecast