Jump to content

# Icecast

1 language

- 日本語

From ArchWiki

Related articles

- Mpd
- Mplayer

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

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://localhost:8000/example.ogg.m3u` (this refers to a mount point called "example").

## Installation

Install icecastAUR.

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.

## Configuration

All configuration is done in `/etc/icecast.xml`.

Warning: Before starting `icecast` make sure to change the default passwords in the `<authentication>` section!

By default icecast listens on port `8000`. It can listen on more than one port - this behavior can be changed by modifying one or more `<listen-socket>` sections.

Note: Although icecast allows to freely configure the FQDN in the `<hostname>` section, for simplicity's sake `localhost` is assumed throughout this article.

Icecast binds to all interfaces (i.e. `0.0.0.0`) by default. To change this behavior, modify a `<bind-address>` section below a respective `<listen-socket>` section.

To set defaults for all mounts that do not specify their type (e.g. `<mount type="normal">`) the `<mount type="default">` section can be modified:

    /etc/icecast.xml

    <mount type="default">
      <public>0</public>
      <intro>/stream.m3u</intro>
      <max-listener-duration>3600</max-listener-duration>
      <authentication type="url">
        <option name="mount_add" value="http://auth.example.org/stream_start.php"/>
      </authentication>
      <http-headers>
        <header name="foo" value="bar" />
      </http-headers>
    </mount>

Note: The `icecast.service` runs as the icecast user. Setting a user and group to change to in the `<changeowner>` section below `<security>` is not required and is not recommended.

## Running

Enable and start `icecast.service`.

To verify that icecast is running go to http://localhost:8000/ or check the status of `icecast.service`.

## Streaming

Several programs are able to stream to icecast based on a `<source-password>` set in the `<authentication>` section of the configuration.

Note: The `icecast.service` has to be started before streaming to it.

### MPD

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.

Make sure to setup MPD and a client to control it.

Configure MPD (as system or user service) to be an icecast source:

    mpd.conf

    audio_output {
        type        "shout"
        encoding    "ogg"
        name        "my cool stream"
        host        "localhost"
        port        "8000"
        mount       "/example.ogg"
        user        "source"
        password    "<source-password>"

    # Set either quality or bit rate
    #   quality     "5.0"
        bitrate     "64"
        format      "44100:16:1"
    # Optional Parameters
    #   description "here is my long description"
    #   genre       "jazz"
    }

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

Start `mpd.service`.

The icecast web interface should now list this new stream and the playlist should be available as http://localhost:8000/example.ogg.m3u

### ezstream

ezstreamAUR is a native source client for icecast. It uses XML files for configurations, like icecast

Several 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/file.xml

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

    <intakes>
       <intake>
    	<type>playlist</type>
    	<filename>playlist.m3u</filename>
       </intake>
    </intakes>

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

Icecast configuration can be displayed with:

    $ xmms2 server config | grep ices

    ices.encodingmaxbr = -1
    ices.encodingminbr = -1
    ices.encodingnombr = 96000
    ices.host = 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 config 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.

### VLC

vlc is a full-featured media player and transcoder with built-in support for Icecast streaming. It can be controlled via GUI or command line, and can act as an Icecast source for media files or real-time audio captured from JACK output ports and other sources. For example, this command connects VLC to the first JACK audio output ports it finds, encodes the audio as Ogg Vorbis, and streams it to an Icecast mount point at `http://localhost:8000/stream.ogg`:

    $ cvlc 'jack://channels=2:ports=.*' ':sout=#transcode{vcodec=none,acodec=vorb,ab=192,channels=2,samplerate=44100,scodec=none}:std{access=shout,mux=ogg,dst=//source:hackme@localhost:8000/stream.ogg}' :no-sout-all :sout-keep

Alternatively, VLC offers a guided GUI to stream to an Icecast server. When opening any media source, choose Stream and then add Icecast as a destination. You will be prompted for the network Address, Port, Mount Point, and Login:pass. Use `source:<password>` as the format for the latter. Select the desired transcoding options on the next screen and you are ready to go.

## Playback

Streams can be listened to via a web browser when visiting http://localhost:8000.

Additionally, there are several clients that can make direct use of a provided playlist file (e.g. http://localhost:8000/example.ogg.m3u)

### MPD

Icecast streams can be played back using MPD.

Use an MPD client such as mpc to add the URL of an icecast playlist file to the playlist of a (local) MPD instance:

    $ mpc add http://localhost:8000/example.ogg.m3u

The added item behaves like any other track in the MPD playlist.

### MPlayer

Install the mplayer package.

Start the program and provide it with the icecast playlist:

    $ mplayer -playlist http://localhost:8000/example.ogg.m3u

### Mpv

Install the mpv package.

Start the program and point it at the icecast playlist:

    $ mpv http://localhost:8000/example.ogg.m3u

### Sonata

- Install the sonata-gitAUR 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/example.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.

### VLC

In addition to acting as an Icecast source, vlc can play back streams from Icecast and other network audio sources. Choose Open Network Stream... and provide the URL when prompted.

## Tips and tricks

### Running Icecast in a chroot environment

The factual accuracy of this article or section is disputed.

Reason: Since icecast 2.4.4-2 the systemd service is started as the separate user icecast and does not require setting up a user/group pair to change to in the `<changeowner>` section of the configuration anymore. This might have consequences to the way chroot setups have been done previously. (Discuss in Talk:Icecast)

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

    <chroot>1</chroot>

Edit the `[Service]` section of `icecast.service`:

    WorkingDirectory=/usr/share/icecast

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

    <logdir>./log</logdir>
    <webroot>./web</webroot>
    <adminroot>./admin</adminroot>
    <pidfile>./icecast.pid</pidfile>

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/

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

## See also

- Official Website - The official Icecast website
- List of clients - The upstream list of clients that work with Icecast
- MPD Wiki: Configuration - Configuration page in the MPD wiki
- ffmpeg2theora live streaming howto[dead link 2025-04-05—HTTP 404] - Howto on live streaming with icecast, oggfwd and ffmpeg2theora
- Ezstream - The ezstream website

Category:

- Media servers

Hidden categories:

- Pages or sections flagged with Template:Style
- Pages or sections flagged with Template:Accuracy
- Pages with dead links