Up
Down
Return

icecast, shout and shout_tools : mp3 streaming

It's a nice idea to have a mp3 streaming machine in your house. You can save and manage mp3 files easily and play them from any machine connected to your home LAN.

Debian GNU/Linux contains two packages, icecast-server and icecast-client for mp3 streaming.

Abstract image is like this:

mp3 player such as XMMS, WinAMP, RealPlayer etc. on your machine.
          |
          |
icecast(Streaming Mpeg Layer III server)
On the request from the player, receives mp3 stream from shout and sends them to the player.
          |
          |  shout sends mp3 stream to icecast..
          |
Shout?iStreaming Mpeg Layer III feeder?jmp3 encoder/decoder
       |                   |
       |                   |
mp3 files       shout.playlist(mp3 file list)
~~~~~~~~~~~~        ~~~~~~~~~~~~~
       shout reads them

After installation, icecast is started as a daemon by /etc/init.d/icecast.
/etc/default/icecast is a setting file for icecast.

I saw many error messages when I started icecast and shout. These were write access privilege conflicts.
I stopped starting icecast when booted. I wrote a simple shell script to start icecast and shout manually. Also I changed work-directory for icecast and shout from /tmp/shout to /somewhere. After these, they run smoothly without trouble.

$ [29/Jun/2001:21:27:14] Icecast Version 1.0.0 Starting...<===== icecast
Icecast comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of Icecast under the terms of the
GNU General Public License.
For more information about these matters, see the file named COPYING.

[29/Jun/2001:21:27:14] server started...
[29/Jun/2001:21:27:14] listening for encoders on port 8001...
[29/Jun/2001:21:27:14] listening for clients on port 8000...
[29/Jun/2001:21:27:14] listening for remote admin on port 8002...
[29/Jun/2001:21:27:14] waiting for encoder or redirection...
[29/Jun/2001:21:28:26] encoder [127.0.0.1:25356] connecting...<===== shout started
[29/Jun/2001:21:28:26] password accepted...
[29/Jun/2001:21:28:34] directory_add() completed...server id = 26705 and touch f
requency = 5
[29/Jun/2001:21:28:39] directory_touch() completed...
[29/Jun/2001:21:28:39] lost encoder... kicking clients...<===== shout stopped
[29/Jun/2001:21:28:44] directory_remove() completed...
[29/Jun/2001:21:28:44] waiting for encoder or redirection...
[29/Jun/2001:21:30:19] encoder [127.0.0.1:35852] connecting...<===== shout restarted
[29/Jun/2001:21:30:19] password accepted...
[29/Jun/2001:21:30:20] directory_add() completed...server id = 26706 and touch f
requency = 5
[29/Jun/2001:21:30:20] directory_touch() completed...

At first, I saw many 'Cannot do directory_add() directory_touch() messages.

To create shout.playlist, type
find   directory name that contains mp3 files (full path)  -name  *.mp3 > shout.playlist

When you wand add file names on existing shout.playlist, type
find   directory name that contains mp3 files (full path)  -name  *.mp3 >> shout.playlist

Check if created shout.playlist contains files you want to include.
$cat shout.playlist
/usr/local/mp3/K466/01Music_0301.MP3
/usr/local/mp3/K466/02Music_0302.MP3
/usr/local/mp3/K466/03Music_0303.MP3

Once you start shout with -l option, it will playback again and again following shout.playlist. You'll want to change what shout plays. I found shout_tools to do this. You'll find several other tools such as MuSE, shout_tools seems to me the easiest way to do it.

  1. Extract files into a directory,
  2. cd to that directory,
  3. mkdir /var/www/shout and cp *.html /var/www/shout (/var/www is a default document root for Debian's Apache)
  4. Open cue.c with a editor and modify a red marked directory. (Debian's default is /tmp/shout/shout.cue) Once compiled, there will be cue.cgi file and it will display shout.cue information on your browser. /var/www/shout/template.html is the template file to show these information.

    /* modify the following two lines to fit your system */

    #define SHOUT_CUE_FILE "/tmp/shout/shout.cue"
    #define HTML_TEMPLATE_FILE "/var/www/shout/template.html"

  5. Next, open playlist.c with your editor,

    /* modify the next line to point to your default playlist file */

    #define PLAYLIST_FILE "/home/nstrom/list"

    Change /home/nstrom/list with your directory where your shout.playlist is.

  6. Open request.cgi with your editor,

    # modify the next three lines to fit your system configuration

    $PLAYLIST = "/home/nstrom/list";
    $SHOUTPLAYLIST = "/usr/local/shout/shout.playlist";
    $CUEFILE = "/usr/local/shout/shout.cue";

    $PLAYLIST should indicate the directory where your shout.playlist is.
    $SHOUTPLAYLIST should be a working directory for shout. Debian's default is /tmp/shout/shout.playlist. $CUEFILE should be the same with SHOUT_CUE_FILE of cue.c. Most cases, it will be the same directory with $SHOUTPLAYLIST.

    # modify the next line to point to your "success" url

    Modify $SUCCESS_URL = "http://reptilian.res.cmu.edu/request/success.html";

    to /var/www/shout/success.html.

  7. make all will create cue.cgi and playlist.cgi. request.cgi is a perl script. So you don't have to compile it. Copy these three to /usr/lib/cgi-bin(Debian's default cgi-bin directory)

  8. After verified (icecast &) shout is running,, type in http://:your server/cgi-bin/playlist.cgi as the address in your browser and confirm they are running.
    playlist.cgi
    I hope you will not find messages such as Internal Server Error. Click one of the number to maake a request.

  9. Will the shout.cue information come up, when you type http://your server/cgi-bin/cue.cgi ?
    cue.cgi
    cue.cgi includes <META HTTP-EQUIV="Refresh" CONTENT="3"> tag, it refresh itself very often.

  10. Run mp3 player program on another machine (it's OK on the same machenine on which shout is running), type in as a url ttp://your server:8000/ (You can change port number by modifying /etc/default/icecast)