Streaming With Icecast

From ArchWiki
Revision as of 08:26, 14 February 2008 by Bastikr (Talk | contribs) (added further description to changeowner and logging of icecast)

Jump to: navigation, search

MPD is a program for playing music via a daemon process instead of using a client. It also incorporates a music database for quick access, playlists, and a variety of frontend options.

Step 1: Set Up MPD and Install a Client

Use the MPD Install Guide to install and configure MPD and a client.

Step 2: Setting up Icecast

  • Install Icecast via Pacman
 # pacman -S icecast
  • Edit the configuration file.

Open up /etc/icecast.xml in your text editor du jour. The main section you want to pay attention to is <authentication>. Inside the <authentication> block are all the passwords that icecast use. I STRONGLY RECOMMEND you change them.
Icecast defaults to listening on port 8000, and you may also change that if you wish.

You will also want to uncomment the changeowner lines to switch to a user and group without root privileges. The default log path, /var/log/icecast, is not created automatically, so you will need to either create that folder and chown to the user in the changeowner lines, change the log path, or disable logging. Be aware that by turning changeowner on, all paths are relative to the home directory of that user. You will have to edit all paths manually. A good choice might be to create a new user "icecast" and set its home directory to /usr/share/icecast. Create there a directory "log" and don't forget to give the ownership to icecast. Afterwards change the paths section to the following:

  • Start icecast

You can start icecast by executing:

 # icecast -b -c /etc/icecast.xml
  • Test it.

Make sure Icecast is running by opening up http://localhost:8000/ in your web browser. You should be greeted by an Icecast2 Status page. This indicates everything is running properly.

Step 3: Configure MPD to be an Icecast Source

Edit /etc/mpd.conf and enable the Icecast audio_output by adding the following:

audio_output {
    type        "shout"
    name        "my cool stream"
    host        "localhost"
    port        "8000"
    mount       "/mpd.ogg"

# This is the source password in icecast.xml
    password    "hackme"

# Set either quality or bitrate
#   quality     "5.0"
    bitrate     "64"

    format      "44100:16:1"

# Optional Paramters
    user        "source"
#   description "here's my long description"
#   genre       "jazz"
} # end of audio_output

# Need this so that mpd still works if icecast is not running
audio_output {
    type "alsa"
    name "fake out"
    driver "null"

Step 4: Running MPD with Icecast

You can run both MPD and Icecast with the rc.d scripts:

# /etc/rc.d/icecast start
# /etc/rc.d/mpd start

Note that icecast must be started first for the stream to work.