From ArchWiki
Jump to navigation Jump to search

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: See Help:Style. (Discuss in Talk:Icecast#)

Icecast is a program for streaming media such as audio and video across a network. Different types of clients connect to the IceCast server, either to provide a "mount point", control the server, or listen to the audio being cast.

Icecast has support for streaming many audio streams simultaneously - each stream has a "mount point" which a client can access, with a network URI such as http://server:8000/mpd.ogg.m3u (this refers to a mount point called "mpd").

List of source clients that work with Icecast.

Setting up Icecast

  • Install icecast. Alternatively, you can build and install the icecast-khAUR package. Icecast-kh (Karl Heyes) extends on the official release with features that may be (if found to be working out well) merged into next official releases.
  • Edit the configuration file.

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

Since one wishes to stream audio, it's extremely important that you uncomment at least one mount, such as below:

<mount type="default">
    <authentication type="url">
            <option name="mount_add" value=""/>
            <header name="foo" value="bar" />

The daemon from the icecast package is started as the nobody user. The daemon from the icecast-khAUR package is started as the icecast user. To change this behavior, pay attention to the <changeowner> section.

Icecast paths

Local user

Note that if you are running icecast under a local user (i.e. one that does not use /etc/icecast.xml) then you will need to copy the icecast web xml files from /usr/share otherwise you will get errors about XSLT and the web interface will not work.

$ cp -R /usr/share/icecast/web ~/icecast/

Also, make sure that the <changeowner> section in the icecast configuration file is commented out, as changing the owner of a process requires root privileges.

Running icecast

  • Start icecast

You can start icecast as a single user by executing:

# icecast -b -c /etc/icecast.xml

If you want icecast to remain in the foreground of your terminal, remove the -b flag.

To run icecast as a system daemon, start the icecast.service systemd unit.

To run icecast at system boot, enable the icecast.service systemd unit.

  • 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.

Or run

# systemctl status icecast

Running Icecast in a chroot environment

Change following settings in `/etc/icecast.xml`:


Add these line to the section `[Service]` in `/usr/lib/systemd/system/icecast.service`:


Now change this entries in `/etc/icecast.xml`:


Create a log directory under `/usr/share/icecast` and set the permissions:

# cd /usr/share/icecast
# mkdir log
# cd log
# touch access.log playlist.log error.log
# cd ..
# chown -R icecast:icecast log/

Streaming with MPD

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 front-end options.

Note: MPD has its own built-in HTTP Streaming, and using Icecast+mpd may not be needed. See Music Player Daemon : HTTP Streaming for more information.

Step 1: Set Up MPD and Install a Client

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

Step 2: Ensure Icecast is running

Start Icecast in first, or mpd will not have anything to stream :

# systemctl start icecast

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"
    encoding    "ogg"
    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 bit rate
#   quality     "5.0"
    bitrate     "64"

    format      "44100:16:1"

# Optional Parameters
    user        "source"
#   description "here is my long description"
#   genre       "jazz"
} # end of audio_output

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

Step 4: Running MPD with Icecast

Now you can start mpd.service.

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

Step 5: Test / use the stream

Now that you have installed the necessary software you probably want to test/use the stream. Realize that you will need your client to do two things:

  1. Connect to the mpd server so you can control it
  2. Connect to the stream to actually hear the music. Connecting to the mpd server will alter output to the Icecast server but you will not hear it.

Sonata (a graphical mpd client) and mplayer (a command line client) are just two of the available clients. Note that if you use mplayer, you will need another way to control the remote mpd server (for example ssh)


You can play an icecast stream from another mpd instance, on another computer, for example.

Use mpc to add the url to mpd's playlist

$ mpc add http://ip.of.server:8000/mpd.ogg.m3u

You can then play the stream as if it was a song belonging to your local mpd instance.


  • Install the sonataAUR package.
  • Start it up and you should be greeted by Sonata's preferences.
  • Set 'Name' to the name of your server.
  • Set 'Host' to the IP address of your server.
  • Set 'Port' to '6600'.
  • Click the '+' and repeat the previous steps but instead about your local computer (i.e. its name and IP).
  • Right-click->'Connections' and select your server. Then click on the 'Library' tab, if all is well, you should see your entire music selection that is on your server. Find a folder, right-click and click 'Add'. Clicking on the 'Current' tab will show you your current playlist, which should have the contents of whatever folder you just chose from the library. Double-click on a song. You should see the text get bold and the progress bar show up, just like it is playing, but you will not hear anything. Fear not.
  • Right-click->'Connections' and select your local computer. Then click the 'Streams' tab. Right-click and click 'New'. Make 'Stream Name' the name from your servers /etc/mpd.conf file's audio_output { } section and make the URL IP.of.server:8000/mpd.ogg.m3u. Double-click on this stream.
  • Click on the 'Current' tab and you will see the URL of the stream as your only item. Double-click on it and after a delay you should hear whatever song you had chosen on the server.


  • Install the mplayer package.
  • Start it, telling it to play the playlist that icecast places in the icecast root directory (the playlist redirects mplayer to mpd.ogg)
$ mplayer -playlist http://ip.of.server:8000/mpd.ogg.m3u

To control the remote mpd server, if you have an ssh server on the same machine, you can login and use ncmpcpp] to control it.

Or, if your mpd server is listening on an accessible interface/port ($ ss -p -l -t on the mpd machine will show mpd listening on, for example) then you can set the MPD_HOST variable which directs a local client like mpc to the remote server.

$ export MPD_HOST=ip.of.server
$ export MPD_PORT=6600      # optional
$ mpc play

Streaming with oggfwd and ffmpeg2theora

If you want to stream a single track, for example, you can use this method instead of changing your mpd setup.

  • Start icecast using a previously setup config file using
$ icecast -c path/to/config.xml

or start the icecast.service systemd unit instead.

  • Start ffmpeg2theora, sending its output to oggfwd, which forwards to the icecast server for you.
$ ffmpeg2theora --no-skeleton --novideo -o - path/to/audio/file | \
  oggfwd localhost 8000 source_password_here /mountpoint_name_here.ogg

Alternatively, you can use this script:


if [ $# -eq 1 ] 
  echo "Usage: $0 music-file"
  exit 1


set -e
ffmpeg2theora --no-skeleton --novideo -o - "$music" 2> /dev/null | \ 
  oggfwd localhost 8000 "$pass" /"$mountpt".ogg

Streaming with ezstream

ezstreamAUR is a native source client for icecast. It shares similar config as icecast, *.xml file.

Sevaral examples can be found in /usr/share/examples/ezstream/. It supports mp3, Ogg Vorbis, Ogg Theora, for streaming video ffmpeg2theora can be used to reencode into Ogg Theora.

After configuring, stream can be started by

ezstream -c /path/to/flie.xml

Multiple media can streamed by creating a m3u playlist and defining it under <intakes> in config file


Streaming with XMMS2

xmms2 is a minimal music player which can be controled with several clients, setting this up is fairly simple compared to MPD and media can be added to stream on fly unlike ezstream.

List of icecast config can be found by,

xmms2 server config | grep ices

ices.encodingmaxbr = -1
ices.encodingminbr = -1
ices.encodingnombr = 96000 = localhost
ices.mount = /stream.ogg
ices.password = hackme
ices.port = 8000
ices.public = 
ices.streamdescription = 
ices.streamgenre = 
ices.streamname = 
ices.streamurl = 
ices.user = source

These can be changed as follows,

xmms2 server conifg ices.password my_password
xmms2 server config ices.port 5080
xmms2 server config ices.public 1

Change the output as ices so XMMS2 can mount the stream on icecast server.

xmms2 server config output.plugin ices

Upon starting, the stream should be working and files can be added with the command "add".

Alternatively, XMMS2 can be controlled with lxmusic which provides a simple GUI.

Playing the stream

The above mentioned sonata and mplayer methods can be used.