DarkIce

DarkIce is yet another command-line utility streamer manages icecast audio streams. Unlike ices2, ices0 and LiveIce-sn, it is not limited to a single streaming format. It can stream in multiple Ogg Vorbis and MP3 formats using a single icecast stream and can be used with icecast1, icecast2 and Shoutcast servers. With each server up to eight separate streams can be implemented with varying bitrates and formats. This is especially useful for large-scale enterprise operations requiring many streams for different listening audiences.

Warning

It is important to note that DarkIce is not designed to play streams using a static playlist. Audio must be fed into the input jack of your soundcard. From there DarkIce re-encodes the audio out in the format specified.

More information about Darkice as well as the source code and binary releases can be found on its home page at http://darkice.sourceforge.net/. The latest version of DarkIce as of this writing is 0.14. Though it is still considered beta by some, it is stable enough for use in most production environments.

Configure and install DarkIce in much the same manner as the other streaming utilities listed in this chapter. Uncompress the source in a standard location, and run the standard commands: ./configure, make and make install.

Important

Be aware that DarkIce normally checks the /usr directory for the lame library. This is due to the fact that many Linux distributions include lame as an RPM. To build DarkIce with lame support use the --with-lame-prefix=/usr/local/lib together with the configure script. This is contingent upon building lame from source.

Edit the included darkice.cfg configuration file for your needs.

Example darkice.cfg Configuration

The following is an example darkice.cfg that can be used for multiple streams. The comments after each variable usually provide sufficient information for customizing the file. More information can be found using the command man darkice.cfg.

Example 4. Example darkice.cfg Configuration File

# sample DarkIce configuration file, edit for your needs before using
# see the darkice.cfg man page for details

# this section describes general aspects of the live streaming session
[general]
duration        = 0         # duration of encoding, in seconds. 
                            # 0 means forever
bufferSecs      = 5         # size of internal slip buffer, in seconds

# this section describes the audio input that will be streamed
[input]
device          = /dev/dsp  # OSS DSP soundcard device for the audio input
sampleRate      = 44100     # sample rate in Hz. try 11025, 22050 or 44100
bitsPerSample   = 16        # bits per sample. try 16
channel         = 2         # channels. 1 = mono, 2 = stereo

# this section describes a streaming connection to an IceCast2 server
# there may be up to 8 of these sections, named [icecast2-0] . [icecast2-7]
# these can be mixed with [icecast-x] and [shoutcast-x] sections
[icecast2-0]
bitrateMode     = cbr       # average bit rate
format          = mp3       # format of the stream: mp3
bitrate         = 128       # bitrate of the stream sent to the server
server          = test.mydomain.com
                            # host name of the server
port            = 8000      # port of the IceCast2 server, usually 8000
password        = letmein   # source password to the IceCast2 server
mountPoint      = test      # mount point of this stream on the IceCast2 server
name            = mp3 music test
                            # name of the stream
description     = mp3 music test
                            # description of the stream
url             = http://test.mydomain.com
                            # URL related to the stream
genre           = test      # genre of the stream
public          = no        # advertise this stream?

[icecast2-1]
bitrateMode     = abr       # average bit rate
format          = vorbis    # format of the stream: ogg vorbis
quality         = 0.8       # encoding quality
bitrate         = 96        # bitrate of the stream sent to the server
server          = test.mydomain.com
                            # host name of the server
port            = 8000      # port of the IceCast2 server, usually 8000
password        = letusin   # source password to the IceCast2 server
mountPoint      = test.ogg  # mount point of this stream on the IceCast2 server
name            = ogg vorbis music test
                            # name of the stream
description     = ogg vorbis music test
                            # description of the stream
url             = http://test.mydomain.com
                            # URL related to the stream
genre           = music     # genre of the stream
public          = no        # advertise this stream?

In this example, the first section states that the encoding continues forever and that there is an initial 5 second buffer. The next section specifies the device to which DarkIce should look for audio input or in this case, /dev/dsp. Next, set the sample rate. Because streaming music is the format in this example set the sample rate for 44100. The default is 22050. Next, choose the bits per sample. 16 is a good figure to use initially. You may opt to set this to a value of 8 later or when streaming low quality audio. The same applies to the last option; 1 is for mono sound and 2 equates to stereo sound.

The next two sections are designed for custom streams connecting to an icecast2 server. Included with the default distribution file are other sections explaining the connection process to icecast1 and Shoutcast servers.

Choose the default bit rate. If selecting "vbr" for variable bit rate pick a value that defines the desired quality. Select whether to stream in MP3 or Ogg Vorbis format and set the bitrate and the server name. Next, choose the default port. 8000 is the normal default port, 8001 and others can be used just as effectively. This must be the same port number used by the icecast or Shoutcast server and the password must also match that of the icecast server.

Selecting the proper mountpoint can also be a tricky process. If streaming MP3 specify the default name or, as defined in the example configuration, test. When streaming in Ogg Vorbis format add an .ogg suffix to the end of the mountpoint name. This helps the client player decide which codec to use. The name, description and URL variables provide more information regarding the type of stream. The genre variable defines the type of stream. The public variable advertises the stream on public forums so that others can locate this streaming server.

Starting the DarkIce Streamer

Again, before starting any streamer make certain the icecast or shoutcast server is up and running. Similar to the LiveIce and ices streamers, the DarkIce streamer calls the binary and the configuration file. Here is how an example startup command might appear:

# darkice -c /usr/local/icecast2/conf/darkice.cfg &

Check the log files for any messages in case the server fails to start. Set a higher verbosity using the -h option during startup of the DarkIce streamer. Verbosity can be set anywhere between 0 (silent) and 10 (extremely descriptive messages). For example, the following command sets the verbosity of messages to something reasonable while referring to the configuration file found in the /etc directory:

# darkice -v 5 -c /etc/darkice.cfg

Modify the options and file locations as needed.

Warning

Be aware that in older DarkIce releases if you start the streamer in its own terminal window you cannot close the same window. Even if you affix an ampersand (&) to the end of the script you are not guaranteed the process will continue once the terminal window closes.