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.
- Extract files into a directory,
- cd to that directory,
- mkdir /var/www/shout and cp *.html /var/www/shout (/var/www is a default document root for Debian's Apache)
- 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"
- 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.
- 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.
- 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)
- 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.
I hope you will not find messages such as Internal Server Error. Click one of the number to maake a request.
- Will the shout.cue information come up, when you type http://your server/cgi-bin/cue.cgi ?
cue.cgi includes <META HTTP-EQUIV="Refresh" CONTENT="3"> tag, it refresh itself very often.
- 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)
- Once you can request your favorite mp3 file to play, you will not want include many files at the startup time. So create
a small playlist that include just a few files you want to play as a DJ's recomendation.
You cannot start shout with a empty playlist. If you do this, shout will complain and terminate itself. - As the author of shout_tools wrote in README, the file you requested will be played repeatedly endless. He wrote "not musch i can do about this", I'd like to do something.
- If you need further information on icecast ans shout, Please read README,MP3-HOWTO..