home   articles   archive   forum   masthead  
Published at 10.1.2000
Author: Ronny Ziegler
Translator: Andy Ziegler
Languages: de nl
Printer printer-version
Support Us!
 

Your own broadcast station: Icecast

Icecast Do you want to own a broadcast station? Using Icecast you can send your programs around the world.
Icecast is the Linux counterpart to the program Shoutcast. Both can send music via the internet streaming around the world. It is like owning your own broadcast station with a little advantage: You can be heard everywhere in the world.
The music is usually transmitted in the mp3 format and has a data rate of 32 or 64 kBps.
This low rate is necessary to guarantee a smooth streaming without any disturbances. The mp3 players which support internet streaming can buffer a few seconds of music and would prevent interrupts if the stream stopped.

Streaming into the Intranet

But why just as a big broadcast station?
Another nice use of Icecast is inside an intranet, which itself supports a much more efficient transport of the files.
Maybe you have a server with many mp3 files placed in the cellar and want to stream music into your local network. Just one person has to create a playlist and all users can choose their favorite songs just like using a Jukebox (also see IceDJ).

Installation

The installation of the program is not difficult as long as you do not try unusual settings.
First, get Icecast from the internet. The homepage of Icecast is located at http://icecast.linuxpower.org/. You should download the newest version (as source code) and uncompress it:

  >> tar zxvf icecast-1.x.x.tar.gz -C /tmp
  >> cd /tmp/icecast-1.x.x/
  
The program can be compiled typing:
  >> ./configure
  >> make
  
You install the package as root by executing:
  >> make install
  
This command copies all necessary files into /usr/local/icecast ..
The configuration of icecast is done in the file usr/local/icecast/etc/icecast.conf. The most important settings are:
Parts of the file icecast.conf
   # --first a few setting of the server and owner
   #
   #The location where the server is placed
   location Music from the mars
   #the owner's email address
   rp_email webmaster@home.de
   #The URL of the web page corresponding to the music
   server_url http://www.linuxnetmag.de
   [...]
   #--You can administrate the icecast server via the network,
   #  this option is secured by a password
   #normal clients should not be able to log in
   client_password not_used
   #The remaining passwords have to be changed
   encoder_password mypassword
   admin_password mypassword
   oper_password mypassword
   [...]
   #The port icecast uses
   port 8010
   #The host name of the server
   server_name my.computer.com 
  

All other settings should remain untouched.

Now you can start Icecast the first time (as root on port 8010):

  >> /usr/local/icecast/bin/icecast -P 8010
  
Icecast would send the following to the I/O if everything was set properly:

Output of icecast
  [09/Jan/2000:16:38:37] Icecast Version 1.3.0 Starting..
  [09/Jan/2000:16:38:37] Using stdin as icecast operator console
  [09/Jan/2000:16:38:37] Tailing file to icecast operator console
  [09/Jan/2000:16:38:37] Server started...
  [09/Jan/2000:16:38:37] Listening on port 8010...
  [09/Jan/2000:16:38:37] Using [ronny.ziegler.de] as servername...
  [09/Jan/2000:16:38:37] Max values: 20 clients, 10 clients per 
  source, 10 sources, 5 admins
  -> [09/Jan/2000:16:38:37] [Bandwidth: 0.000000MB/s] [Sources: 0]
   [Clients: 0] [Admins: 1] [Uptime: 0 seconds]
  -> 
  

This output offers a prompt which can be used to configure Icecast during running.
Typing help gives you a list of all available commands.

shout

Until now, Icecast does not play any music because it was never programmed for this.
Shout does this job and is placed at /usr/local/icecast/bin/ . Shout can be started on another computer inside of the network. This work-sharing between streaming server and music database makes sense. While the Icecast server has a lot of work to do steaming the music to all clients another computer can be used as a database or, if you wanted to be a live broadcast station, it would be able to encode the music in real time.
Therefore Shoutcast needs some options that have to be specified depending on your configuration.

  • The server where icecast is running on. If shout was started on the same computer icecast is running on a simple localhost would be enough. In any other case, the name or IP is needed
  • The password which allows you to transfer files to icecast (in the icecast.conf at admin_password)
  • The port that is used by icecast (port number 8010 in our case)
  • The directory where the mp3 files are placed

All together, the command looks like:
  >> /usr/local/icecast/bin/shout localhost -P mypassword -e 8010 /tmp/mp3/*
  
If everything works well, Shout starts transmitting music to Icecast:

Output of shout
  Playing /tmp/mp3/Alice_in_Fashionland.mp3
  [2:38] Size: 2219520 Bitrate: 112000 (28455 bytes/dot)
  [......................................
  

Icecast mentions in the prompt that it accepted the connection:

Output of icecast
  -> [09/Jan/2000:17:37:57] Accepted encoder on mountpoint /monkey from localhost.
   
  2 sources connected
  -> [09/Jan/2000:17:37:57] Assigning listeners from pending source 3
  -> [09/Jan/2000:17:37:57] Kicking source 3 [localhost] [Lost all clients to new 
  source] 
  [encoder], connected for 10 minutes and 19 seconds, 824214 bytes transferred. 2 
  sources connected
  -> [09/Jan/2000:17:37:57] Kicking all 0 clients for source 3
  -> 
  

Where is the music?

Now you can hear the music on port 8010 on all mp3 players that support music streaming will hear it also. Using freeamp, a simple

  >>freeamp http://my.server.de:8010
  
is enough. The program automatically connects to Icecast. To get the best quality, use Xmms. Too bad that you have to create a playlist by your own including the Icecast server:

playlist.pls
  [playlist]
  numberofentries=1
  File1=http://my.server.de:8010
  

If you load this file, you can hear internet radio with Xmms, too.

All M$ Windows users should create a link to their homepage which automatically starts the predefined mp3 player and contacts the Icecast server.

You need the following tags in your HTML page:

HTML-code
  <a href="shoutcast-playlist.pls"><img src="tunein.gif" Border=0><
  /a>
  

and you need a file shoutcast-playlist.pls placed in the same directory. This file should look the same way as the playlist for Xmms.

shoutcast-playlist.pls
  [playlist]
  numberofentries=1
  File1=http://my.server.de:8010
  

Now your internet broadcast station is ready. The abilities of icecast are impressively overwhelming and just the most important options are described in this "short" article. Until now you transmit music that is placed in a special directory. Also icecast can manage live steaming and send data in real time. It supports playlists and many more useful things that would make this article too big.


Links:
Homepage icecast: http://icecast.linuxpower.org/




Talkback Area




Enter Own Comment