| Icecast Installation and Management: A Guide to Open Source Audio Streaming | ||
|---|---|---|
| <<< Previous | Next >>> | |
Though ices2 is the recommended streaming utility for the latest icecast release, there are several other streaming utilities available. Each of these utilities offers unique features that might be preferable over the more well-known streamers. Ices2, for example, is designed to stream only Ogg Vorbis files. Other streamers have addressed this deficiency and provide features missing from ices2, including MP3 streaming and the ability to stream in multiple formats using differing bitrates. This chapter examines other available programs that work in tandem with icecast2.
For those users who prefer MP3 over Ogg Vorbis or for whatever reason still use MP3 as the de facto format for streaming purposes, there is hope. While the recommended streamer ices2 normally supports only Ogg Vorbis streaming, there are other streamers around that provide MP3 support.
Aficionados of icecast1 often employed LiveIce for their streaming solution needs. Just as development on icecast1 has waned, so too has there been little, if any, work done on the original LiveIce. As many have discovered, the original LiveIce does not work with icecast2. However, another developer has taken up the banner and has a new release available. He has dubbed it LiveIce-sn. The current download site is here: http://liveice.sourceforge.net/.
If you are like me and enjoyed using LiveIce back in icecast's infancy, use this new release. Liveice-sn works with Icecast version 2 servers, although the developer considers it a work in progress, and not all the documentation is up to date. Live the original, LiveIce-sn is a CLI client that streams live audio from the soundcard to icecast versions 1 and 2 servers in MP3 format. For the time being, this LiveIce version does not do any other format. Again, if live Ogg encoding is required, use ices. Naturally, Ogg has better audio quality and is completely open.
Download the source code for LiveIce-sn from the Sourceforge site and uncompress in a secure directory. Use the standard commands to configure and make the source.
# cp liveice-sn0x.tar.gz /usr/local/src/ # cd /usr/local/src # gunzip -c liveice-sn0x.tar.gz | tar xvf - # cd liveice-sn0x/ # ./configure # make |
Do not attempt to install the binary using the make install command; this option is not yet defined. Copy the binary to the directory of your choice. Make certain the configuration file is stored in the same directory as that of the binary.
![]() | As is the case with the original, this version of LiveIce also requires LAME and the mpg123 or mpg321 decoder. Compile and install these other two programs before continuing the install of LiveIce-sn. Place the binaries in your path. the recommended suggestion is /usr/local/bin. |
Setting up the configuration files is nearly identical to that of the original LiveIce program. The liveiceconfigure.tk script is also included here and can be run from the command line, just as in the former version. Refer to chapter 6 and the configuration of LiveIce for additional information.
![]() | The developer notes that this GUI tool has not yet been tested for compatibility with icecast version 2. Stick with the command line for the time being. |
The main LiveIce-sn web page provides links to sample configuration files. Use them judiciously when setting up the program. If playing a collection of static audio files, generate a playlist from your MP3 collection. This is done much like the generation of Ogg Vorbis files. Define this list using a different name.
# find <mp3_audio_directory> -name *.mp3 -print > \ /usr/local/icecast2/conf/playlist.mp3.txt |
Copy the liveice.cfg.dist file to liveice.cfg. Edit this new program to suit. If using a playlist and executing the binary from the source directory, make certain this playlist file is in the same location.
Included here for your perusal is a highly edited example liveice.cfg file. Again, notice that certain options are required to be uncommented for streaming static MP3 files while other must be uncommented and their counterparts commented out for streaming live input. For further information regarding the variables listed here, consult the more heavily commented distribution configuration file or the previous chapter on the original LiveIce. The following example can be used for streaming static files.
Example 1. Example liveice-sn Configuration File
# example liveice-sn configuration file SERVER 10.52.38.229 PORT 8000 PASSWORD letmein USE_LAME3 /usr/local/bin/lame ENCODER_ARGS -h # uncomment the soundcard option for streaming static files SOUNDCARD # uncomment the no_soundcard file when streaming live audio # NO_SOUNDCARD SOUND_DEVICE /dev/dsp #FULL_DUPLEX HALF_DUPLEX SAMPLE_RATE 22050 BITRATE 32000 # MONO STEREO ENCODING_QUALITY 30 #VBR_QUALITY 1 # used when connecting to an older shoutcast server #ICY_LOGIN # used when connecting to icecast1 servers #X_AUDIOCAST_LOGIN #MOUNTPOINT live # used when connecting to icecast v2 servers HTTP_LOGIN MOUNTPOINT playlist # Stream metadata NAME Rundfunk - An Eclectic Collection of MP3 Audio Files # genre -g GENRE experimental # public flag -x PUBLIC 0 # URL -u URL http://10.52.38.229/ #password -P PASSWORD letmein #description - only valid in x-audiocast systems DESCRIPTION Radio Free Linux # No mixer - simple mode uses line-in on soundcard # uncomment no_mized when streaming live audio #NO_MIXER # uncomment when streaming static files MIXER # esd mode - reads from esdmon #ESDMON_MODE # Shout mode - load the playlist and run in sequence thourgh it #SHOUT_MODE # Mixer mode - complicated mp3 mixer #MIXER # some modes need a playlist PLAYLIST playlist.txt # to decode mp3 a version of mpg123 is required DECODER_COMMAND mpg123 # local file for recording #SAVE_FILE local_filename.mp3 # # request the remote server to record the data #REMOTE_DUMPFILE remote.mp3 # a time limit on operation # #DURATION 3600 UPDATE_DELAY 2 #if you use the mixer you can record and replay events. #MIX_CONTROL_MANUAL #MIX_CONTROL_AUTO #MIX_CONTROL_LOGGED #CONTROL_FILE mix_command # log every track played to a file #TRACK_LOGFILE track.log # specify the format #LOGFILE_FORMAT %t %T %f %F %a %n %b %u # update script can be executed at every track change... #UPDATE_SCRIPT # set the debugging level VERBOSE 0 # EOF |
A couple points of notice; be aware of what items should be commented out and what should remain uncommented for streaming live audio or static files. Also, if using a playlist for streaming static files, note the name of the playlist shown in the liveice.cfg file. This playlist file must be in the same directory as that of your configuration file.
At the present time there is no option available for randomizing play of audio files in the playlist. However, a simple awk script can rearrange the order of each line of audio files in a standard playlist. Here is an example script that shuffles the lines of a playlist into a random order. I borrowed it from Heiner Steven who posted it on a web page, which now no longer exists. Here I have named it shuffle.
Example 2. Playlist Randomization Script
##########################################################################
# File Description
# Shuffles the sequence of lines in a pseudo-random order.
# Each line is printed exactly once.
##########################################################################
PN=`basename "$0"` # Program name
VER='1.3'
# We need a "new" awk having srand() and rand(). Examples: GNU awk "gawk",
# Solaris "nawk", or "mawk".
#NAWK=awk
Usage () {
echo >&2 "$PN - print lines of a file in random order, $VER
usage: $PN [file ...]"
exit 1
}
Msg () {
for MsgLine
do echo "$PN: $MsgLine" >&2
done
}
Fatal () { Msg "$@"; exit 1; }
searchprog () {
_search=$1; shift
for _dir in `echo "$PATH" | sed "s/^:/.:/;s/:\$/:./;s/:/ /g"`
do
[ -x "$_dir/$_search" ] || continue
echo "$_dir/$_search"
return 0
done
return 1
}
while [ $# -gt 0 ]
do
case "$1" in
--) shift; break;;
-h) Usage;;
-*) Usage;;
*) break;; # First file name
esac
shift
done
: ${NAWK:=`searchprog mawk || searchprog gawk || searchprog nawk || echo awk`}
randseed=${RANDOM:-}
"$NAWK" '
BEGIN { srand('"$randseed"') } # initialize random number generator
{ print rand() " " $0 }
' "$@" |
sort -n | # Sort numerically on first column
cut -f2- # Remove sorting column |
To run this script, make the file executable, then reference the old playlist file with all the files listed in order, then pipe the output to a new playlist. Here is an example:
# chmod u+x shuffle # ./shuffle playlist.txt > playlist.new.txt |
If you wish to change the order of the file, simply run the script again and generate a new playlist.
Once you have a working playlist and have successfully started the stream, connect to your icecast server using the audio client of choice. When using Liveice-sn as the default streamer, the mountpoint is defined somewhat differently than that of ices2. Rather than affixing an .ogg suffix to the end of the test file, the default is to state the filename listed under the MOUNTPOINT variable in the liveice.cfg script. When sending a live audio feed to your server, define the mountpoint as live, or place the following URL in your audio client: http://10.52.38.229:8000/live. This is merely a suggested format.
If streaming a playlist you compiled yourself, define the mountpoint as playlist in the liveice.cfg file and connect to your URL of choice. Here is a sample connection made to my work machine: http://10.52.38.229:8000/live. The audio client should be able to determine whether the stream is MP3 or Ogg Vorbis based and decode the audio without problem.
Experienced LiveIce users will notice that the actual streaming display of Liveice-sn to STDIN is somewhat different from that of the original. Rather than simply showing a volume level and the latest song, more data is displayed to the screen. The streamer initially reads through all the files in the playlist and then adds channels for each of the new songs. As a song completes its run, the next song and its id3 data appears. The output is much more verbose than previous versions. Output is also posted to a logtracks.log file by default. This filename and its location can be changed within the liveice.cfg file.
Below is an example screenshot of Liveice-sn running a test SUSE Professional machine.

Liveice-sn streaming audio from a defined playlist.
| <<< Previous | Home | Next >>> |
| Ices2 XML Configuration | Ices0 |