| Icecast Installation and Management: A Guide to Open Source Audio Streaming | ||
|---|---|---|
| <<< Previous | Next >>> | |
Creating an audio server does not end with installing and configuring icecast. The icecast server by itself is only half the equation as it handles only the audio server portion. An icecast server also requires a streaming utility to which listeners connect. This type of program is commonly known as an encoder or "streamer" as it handles the encoding of the audio and parses the stream to connected listeners. Meanwhile the local audio client on the listener side interprets the data fed to it by the streamer.
This chapter looks at a few of the GUI and CLI streaming utilities available for use with icecast. This focuses on the older icecast1 server, though several of these tools will also work with icecast2. A later chapter tackles those streamers recommended for use with icecast2. There are many streamers available for the older deprecated icecast1 release. Unlike most Linux distributions, advocates of streaming tools are not fanatical zealots or proponents of a particular application. Use is oftentimes a matter of personal preference or accomplishing a particular streaming task. This chapter does not recommend one encoder over another. Instead it attempts to show the positives aspects of each.
The LiveIce utility was developed for icecast to provide real-time streaming over the Internet. It was written by Scott Manley and is based on two of his previous works; Mp3Serv, an MP3 broadcasting system and Mp3Mixer, a small utility that allowed the user to "mix" MP3 streams. For legal reasons the actual MP3 encoder is not included in the LiveIce program. Instead it uses an external encoder that is installed separately and is executed and fed data by LiveIce. Several encoders are supported, including commercial packages such as Fraunhofer's l3enc and mp3enc. Older releases such as Xing Technologies xingmp3enc for Linux, as well as the many adaptations of the ISO sources such as LAME and Screamer, are fully supported by LiveIce. As mentioned earlier in this book, LAME is the recommended encoder in most instances. Scott Manley, the LiveIce developer, has not improved much upon the code as of late, but is helpful to aspiring users.
The following are some LiveIce items that showcase its many positive features. Browse the bulleted entries to determine if LiveIce is right for your streaming needs.
Download the LiveIce source code. This can either be the latest tarred and zipped file provided by Scott Manley via his web page or the most recent CVS release. Not much work has been done on the original LiveIce source code so the latest tarball should be up-to-date. The next few section explain how to install LiveIce and what encoders work with this application.
The current URL for downloading or becoming more acquainted with LiveIce is the following: http://star.arm.ac.uk/~spm/software/liveice.html. There is no version number affixed to this release, so don't look for one.
Save the compressed file to a standard location and build as usual.
# cp liveice.tar.gz /usr/local/src # gunzip -c liveice.tar.gz | tar xvf - # cd liveice/ # ./configure && make |
When compilation is complete, copy the binary and configuration files to the icecast bin/ directory. These two files, liveice and liveice.conf, are the only items needed to run LiveIce. However, these are not the only files available for use. Be aware that there are two separate interfaces for running the utility; the first is a simple terminal interface displaying the audio levels, and the second is a Curses-based user interface. This latter format allows for easier display of information for beginning users.
Due to the fact that LiveIce is relatively unsupported at the present time, the Curses-based display may not work correctly on most current Linux distributions. The recommended method remains the CLI or terminal interface format. This interface currently uses Linux-specific TTY settings to put it in non-blocking canonical input mode. To customize this interface further, edit the settings in the config.h file should the terminal mode not play well with your system. This file is created after running the configure script.
Again, a minimalist GUI is available, which is written in TK. It simply provides all the buttons in a nice window. It is doubtful whether any more work will be made in this respect. The system also requires the OSS sound drivers. These usually come standard with most Red Hat Linux releases and derivatives as well as with the latest SUSE versions.
Nearly all other options are set via the command line. All configuration settings are stored in a configuration file. The default is saved as /etc/liveice.cfg and ./liveice.cfg. The default /etc/liveice.cfg should be used for all default settings, i.e. the encoder, the decoder, default bitrates and sample rates and so on. The only things that may need to be changed on a per-session basis can be altered using command line options.
A separate audio encoder is required for LiveIce to work. Before attempting to compile and run LiveIce, decide which encoder would be best for your needs. Be aware that not every encoder works. Some encoders have problems reading from pipes, which is the primary method used by LiveIce for forwarding audio to the icecast server. The recommended encoder once again is LAME. The general consensus is that users experience few or no errors when using LAME. Most industries and applications has standardized on LAME as the audio encoder of choice.
LiveIce can be set up to read and encode either streaming audio or static playlists based on MP3 files residing on the system's local or networked drives. Customize the liveice.cfg file to accomplish either of these two formats. Though the file itself is well-commented, beginning users may find the terminology initially confusing. The following section explains how to modify and customize the LiveIce files to stream either format.
The configuration files used by LiveIce are simple text files which set the audio variables. Included with the source code is a liveiceconfigure.tk script; a simple TK-based GUI that allows for customization of nearly all options and writes them to a static file. This script executes a GUI application called the LiveIce Configuration Generator, designed specifically to assist new users. It is normally executed from the command line by typing the following in a terminal window:
# wish liveiceconfigure.tk |
![]() | Be aware that this application overwrites the default liveice.cfg configuration file. Back up the distribution file, any other customized or previously edited file before using this tool. |

The LiveIce Configuration Generator tool is included with the LiveIce source code.
Figure 6-1 shows the default settings of the LiveIce Configuration Generator. Be aware that the default settings do not work when initially launched. Some changes must be made in order to get LiveIce to operate correctly. Edit the available settings to suit your environment. This includes modifying the Server (as well as the port number), Name, Genre and URL fields. The Directory, Login Type and Password variables should be changed to accommodate your setup. The PCM Audio Format, Hz, and Soundcard items should also be modified. Be familiar with the settings particular to your sound card. As explained in Chapter 3 under the section titled "Audio Fundamentals," know your soundcard's limitations and your desired duplex and bitrate settings. Choose your encoder of choice. Again, LAME works well in most instances and is the recommended choice. To stream live audio or play static MP3 files, customize the next fields shown within the display.
The LiveIce Configuration Generator provides an option to find and create a list of all available MP3 files residing on the local machine. This playlist can be later edited by hand if some files need to be removed. The last few fields are for any other executables required by the configuration. Save the new configuration file when done. Use the default liveice.cfg filename only if you have already backed up the original distribution file. Move this file to the location of your choice when complete.
Some users prefer editing the liveive.cfg configuration file by hand. Though this may result in more errors and false startups than successful executions, it is an efficient method of better understanding the LiveIce syntax at the core level. Once you have a functional configuration file, copy the liveice.cfg file and liveice binary over to the /usr/local/icecast/bin directory. Placing both the configuration file and the completed binary in the same location facilitates the execution of LiveIce along with the icecast server.
The following is an edited sample of a liveice.cfg file. The password file should remain unencrypted or readable in plain-text format. This particular configuration is designed for streaming audio use, versus a static file playlist. Examine the comments to see what items must be removed or added in order to stream a static playlist. You may need to download a copy of mpg123 since it no longer comes packaged with some Linux distributions. The drop-in replacement program is mpg321. For further information on what each item accomplishes, either examine the default liveice.cfg file included with the source code along with all the attached comments or continue reading below for a more detail explanation.
Example 1. Example liveice.cfg File
# -------- Sample liveice.cfg Config File -------- SERVER 192.168.0.5 # SERVER localhost PORT 8000 NAME Radio Free Linux GENRE Live URL http://icecast.mydomain.com/ PUBLIC 1 X_AUDIOCAST_LOGIN # ICY_LOGIN PASSWORD xxxxxxxx SAMPLE_RATE 44100 MONO # uncomment the next line to encode a playlist # NO_SOUNDCARD # uncomment the next line to encode a live stream SOUNDCARD HALF_DUPLEX USE_LAME3 /usr/local/bin/lame SOUND_DEVICE /dev/dsp MOUNTPOINT live BITRATE 64000 VBR_QUALITY 1 # uncomment the next line to encode a playlist # MIXER # uncomment the next line to encode a stream NO_MIXER # PLAYLIST playlist DECODER_COMMAND mpg123 # MIX_CONTROL_MANUAL # CONTROL_FILE mix_command # TRACK_LOGFILE track.log # VERBOSE 10 |
Similar to the standard icecast configuration file, certain options are included that are not readily understood at first glance. This section better clarifies what each item listed under the liveice.cfg file accomplishes. I have included and annotated many of the comments provided by Scott Manley on his web page in order to better explain each item listed under the configuration file. After each definition is an example entry.
The following items list all the individual variables found in a standard liveice.cfg file. Where possible each variable is explained in as much detail as possible. However, in some cases the variables are either not used, not yet implemented or may be better explained by referring to the commented liveice.cfg file.
The target icecast or Shoutcast server to which the audio stream is sent for broadcasting. Older icecast versions required the port number to be one number higher than the listening port. In most current setups the PORT variable is the same port number as used by icecast. This is set in the configuration file using the following options:
SERVER localhost
PORT 8000
These items define those fields appearing on a directory or YP server:
NAME Radio Free Linux
GENRE Live
URL http://icecast.mydomain.org
This tells the server whether it should inform the directory server of your stream. In the configuration file specify the PUBLIC variable followed by either a 1 (public) or 0 (private). Public means you want others to be aware of your streaming server. Private means to keep it to yourself or to ito limit access only to those who have access to you system:
PUBLIC 1
PUBLIC 0
Icecast supports two header formats; one is compatible with the old Shoutcast format, the other is a more versatile x-audiocast system allowing multiple streams on one server. If you are using the latest version of icecast select x-audiocast, otherwise remain with the icy format:
ICY_LOGIN
X_AUDIOCAST_LOGIN
The login password to the icecast server. The actual password is viewable in plain text within this configuration file. It is a very good idea to use a different password than the default shown here as it prevents other people from broadcasting from your server without permission:
PASSWORD letmein
This next section deals exclusively with the types of audio formats used by LiveIce. Set the bitrate and technical aspects of audio encoding in this section.
This option sets the sampling frequency and number of channels used for the internal sound format. Some encoders are unable to do less than 32kHz and some may change the format to something else if the ideal format for a given bitrate is of a lower quality. MONO or STEREO sets the number of channels. LiveIce currently does not support more than 2 channels.
SAMPLE_RATE 32000
MONO
STEREO
Choose the encoder of choice from the list of supported programs. Remember there are constraints on the types of MP3 data LiveIce can produce which are dependent on the program you intend to use. By specifying the encoder in the liveice.cfg file you can also specify the name of the binary, in the event it is under a different name from what the program expects. Comment out any other encoder names not being used:
USE_AJ_ENCODER encoder
USE_L3ENC l3enc
USE_MP3ENC mp3enc
USE_SCREAMER lamer
USE_XING xingmp3enc
USE_XING_VBR xingmp3enc
USE_LAME3 lame
These options set the quality of the generated MP3 stream. The bitrate level should be low enough to accommodate modem users, but also high enough that it does not jeopardize sound quality. Most dialup users fall under the 33.6 to 56Kbit range. Plan accordingly based on the typical audience range to which you are appealing. Remember also that no one ever gets 56Kbit from a 56k modem.
VBR quality is used in variable bitrate modes, currently only supported by the Xing MP3 encoder. The bitrate is increased when more data is required by the music, and reduced when the aural complexity is simpler. Average bitrates are dependent on the PCM audio format also. Variable bitrate quality takes on a more significant role in icecast2 when supporting Ogg Vorbis audio streams.
BITRATE 32000
VBR_QUALITY 20
This section explains the different formats used by the hardware encoder. Here you specify how the soundcard should interface with the software.
Unless there is some reason you do not want LiveIce to monopolize your soundcard this option should be left enabled. This will only work in Mixer mode where the audio is read from external files and programs.
SOUNDCARD
NO_SOUNDCARD
Some individuals have soundcards and drivers which allow the computer to record and play data at the same time. This can help when monitoring audio output, but when used with LiveIce there can be too much buffering and the 1/4 second lag that most people experience is confusing. Half-duplex is the recommended setting:
HALF_DUPLEX
FULL_DUPLEX
There are 2 supported audio generation modes; the first and simplest uses the input from the soundcard. This is what most commercial radio stations do - take input directly from their mixing desk. The mixer mode adds the option of playing files from your computer, which may be MP3 files and other formats. This mode can prove quite complicated and allows mixing and speed control on each channel. The no mixer option is recommended for most users:
NO_MIXER
MIXER
The previous options optimally defined the success or failure of the LiveIce encoding program. The final few items are for adding static files in the form of playlist, audio players and logging features.
The Tcl script included with LiveIce, also known as the LiveIce Configuration Generator, can search local hard drives for any MP3 files for creating a static playlist. Use the Create button within the GUI interface to generate a playlist of files found on the hard drives or any other networked drives. This list is saved to the current working directory. A line referring to the new playlist is added to the configuration file. Copy this playlist file to the same location as your liveice.cfg file and liveice binary. Edit the playlist later for modified listings.
If you prefer not to use the Tcl script, create a custom playlist by hand using the following example:
# find </example/mp3/directory> -name *.mp3 -print > playlist.pl |
You may later decide to custom edit the entries here or change the play order depending on your own tastes.
Starting the LiveIce streaming program is a fairly simple process. It is designed to run as a Curses application or from the command line interface. If you are managing your system in run level 5 or within an X Window environment, it is as simple as starting a terminal emulator and then calling the LiveIce binary. I recommend starting the process from within a screen session. By that I mean, start up a screen session and then execute the LiveIce binary. What screen does is launch an internal session that can be detached and re-attached elsewhere. In this manner LiveIce can be started anywhere; from a console on the machine itself, or from any other remote networked Linux device from which you can SSH or secure shell back into the icecast server. Once in, re-attach the screened LiveIce session and monitor audio output and performance.
Here is a quick example of the previous description. On the icecast server itself or on the machine using LiveIce, type the following:
# screen |
A new session is launched internal to your own terminal session. Start the LiveIce binary after first changing to the proper directory:
# cd /usr/local/icecast/bin # ./liveice |
Once confirming all is running correctly and that your terminal or console window appears similar to that of Figure 6-2, detach the screened session for later use. To do so, type Control-A and then D. Re-attach to this operating screen at some later time and from some other machine. When re-attaching, be sure and use the -r with the screen command in order to connect to the active screen session. Otherwise, you will be launching a new screen session and the LiveIce stream will be present on a separate, non-visible screen. When detached from a screen session, the audio streamer continues to operate and stream the incoming audio to connecting listeners.

LiveIce running within a screened terminal window.
| <<< Previous | Home | Next >>> |
| Starting the Icecast Server | LiveIce XMMS |