Whiskey Kilo Linux  •  Exploring GNU/Linux and F/OSS
intrepid.jpg

Thursday 23rd February 2012

drupal member logo

drupal logo

ubuntu logo

gnome logo

opensource logo

Run your own online radio station with icecast2 and ezstream (howto)

Icecast logo
Always wanted to be a dj at your own online radio station? Well, spend 15 minutes of your time and start broadcasting. It's really that easy.

I will show you how to build an online streaming server with icecast2 running on ubuntu 10.04. And I will be using ezstream to feed a mp3 playlist to the server.

Installing icecast2 and ezstream

First, install icecast2 and ezstream using the commandline or via synaptic if you're running a gui.

sudo apt-get install icecast2 ezstream

Configure icecast2

The icecast2 config file is located at /etc/icecast2/icecast.xml. The default configuration is very usable, so we'll only change the passwords. Take your favorite text editor and open /etc/icecast2/icecast.xml. Change the default passwords for source, relay and admin. The source password is used by ezstream to feed mp3's to icecast2. The admin password is used for the admin web interface. An example file is attached at the end of this post.

<authentication>
<!-- Sources log in with username 'source' -->
<source-password>hccsecret</source-password>
<!-- Relays log in username 'relay' -->
<relay-password>hccsecret</relay-password>
 
<!-- Admin logs in with the username given below -->
<admin-user>admin</admin-user>
<admin-password>hccsecret</admin-password>
</authentication>

Next, edit the file /etc/default/icecast2. By default icecast2 won't start on reboot,so we need to change ENABLE from false to true.

# Edit /etc/icecast2/icecast.xml and change at least the passwords.
# Change this to true when done to enable the init.d script
ENABLE=true

Now, start icecast2 from the command line or reboot your system.

sudo /etc/init.d/icecast2 restart

Point your browser to port 8000 on where ever your server is located, e.g. http://your-server-or-ip-adres.org:8000, and you should see something like this:

Screendump of icecast

Your online radio station is up, but isn't yet broadcasting anything. That's the task of ezstream. If icecast2 won't start, check the logs in /var/log/icecast2 for clues.

Configure ezstream and create playlist

Ezstream will be feeding the icecast2 streaming media server with mp3's or ogg music files. First, put together a selection of mp3's and make a playlist text file with the full path to a mp3 files on single lines. An easy way to do this from the command line is:

find /home/wim/ -name *mp3 -type f > /home/wim/playlist-armin.txt

This will find all mp3's in the home directory of user wim and dumps the output in the file playlist-armin.txt. The -type f makes sure that find only returns files and not directories.

Next, copy one of the example config files from /usr/share/doc/ezstream/examples to your home directory and open the file in your favorite editor. I chose ezstream_mp3.xml. An example file is attached at the end of this post. Make the following changes.

<ezstream>
<url>http://localhost:8000/armin</url>
<sourcepassword>hccsecret</sourcepassword>
<format>MP3</format>
<filename>/home/wim/playlist-armin.txt</filename>
<stream_once>0</stream_once>
<svrinfoname>HCC streaming radio</svrinfoname>
<svrinfourl>http://koorenneef.nl</svrinfourl>
<svrinfogenre>Dance</svrinfogenre>
<svrinfodescription>A State Of Trance Radio</svrinfodescription>
<svrinfobitrate>320</svrinfobitrate>
<svrinfochannels>2</svrinfochannels>
<svrinfosamplerate>44100</svrinfosamplerate>
<!-- No advertising on a public YP directory -->
<svrinfopublic>0</svrinfopublic>
</ezstream>

  • url is the location of your server (localhost since ezstream is running on the same machine as icecast2) followed by the name of your feed. This can be anything and I chose armin. In a moment, after ezstream is feeding mp3's to the icecast2 server, your listeners can point their clients to http://your-server-or-ip-adres:8000/armin to hear the music.
  • sourcepassword is the password we set in the icecast2 config file.
  • filename is the location of our playlist, relative to the config file or an absolute path.
  • stream_once is set to 0 to keep repeating the playlist. Set to 1 of you only want to play your list once.
  • svrinfopublic is set to 0 to prevent your radio station from being published on the public yellow pages of icecast.

The last thing to do is start ezstream and start broadcasting to the world!

ezstream -c /home/wim/ezstream_mp3.xml

Now, point a music client like totem, rhythmbox or audacious to http://your-server-or-ip-adres.org:8000/armin (or where ever your server is located) and start listening.

You may want to autostart ezstream after a reboot by adding a command to /etc/rc.local.

There is more info available at

Tip 1: If your server is behind a router, don't forget to configure port forwarding or your router will block all requests to port 8000.

Tip 2: If for some reason you want to skip to the next song in your playlist, execute the following command and send the SIGUSR1 signal to the running ezstream process:

kill -10 `pidof ezstream`

Happy broadcasting. And keep it legal, will you?

AttachmentSize
icecast.xml6.44 KB
ezstream_mp3.xml1.49 KB
screendump-icecast.png61.56 KB
Tags:

Comments

Excellent tutorial on setting

Excellent tutorial on setting up icecast and ezstream. I had to change the permissions for the ezstream_mp3.xml file from 777 to 644 in order to get it to work on openmediavault. I also added 1 to ezstream_mp3.xml following 0 in order to randomize the playlist. Everything seems to be working so far. Will see over the coming days how it does.

Thanks for the help
John

Bravo

Thx pal!!
btw, what if I just wanna use Icecast for relay server from another Internet radio streaming to reduce the bandwidth usage from my intranet clients?

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may link to images on this site using a special syntax

More information about formatting options

CAPTCHA
This question is used to make sure you are a human visitor and to prevent spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.