Webradio

Let's see how to stream a webradio. When you're on live, we play your voice. Otherwise, music will be played from a playlist.

We use icecast and mpd.

Setting up icecast and mpd

# pkg_add icecast mpd
# cp /usr/local/share/examples/icecast/icecast.xml.dist /var/icecast/icecast.xml

Edit icecast.xml:

<location>Sur Mars</location>
<authentication>
  <source-password>greatpasspphrase</source-password>
  <relay-password>greatpasspphrase</relay-password>
  <admin-user>admin</admin-user>
  <admin-password>adminpw</admin-password>
</authentication>
<hostname>athome.tld</hostname>
<!-- You may have multiple <listener> elements -->
<listen-socket>
  <port>8000</port>
  <bind-address>0.0.0.0</bind-address>
</listen-socket>
<mount>
    <mount-name>/play.ogg</mount-name>
    <no-mount>1</no-mount>
</mount>
<mount>
    <mount-name>/live.ogg</mount-name>
    <fallback-mount>/play.ogg</fallback-mount>
    <fallback-override>1</fallback-override>
</mount>

Run icecast :

# rcctl enable icecast
# rcctl start icecast

Now edit /etc/mpd.conf :

music_directory      "/mnt/music"
# Pour icecast. Pensez à modifier le mot de passe
audio_output {
    type        "shout"
    encoding    "ogg"
    name        "My great radio"
    host        "localhost"
    port        "8000"
    mount       "/play.ogg"
    password    "greatpasspphrase"
    bitrate     "128"
    format      "44100:16:2"
}

Now run mpd :

# rcctl enable mpd
# rcctl start mpd

To deal with mpd and start playing, use mpc :

# pkg_add mpc

see man mpc.

Open port 8000.

Now try to play your radio on "http://athome.tld:8000/live.ogg".

Stream a live

We will stream on "/live.ogg", not on "/play.ogg".

You can stream with the well known VLC. Choose the menu Stream (ctrl-d), add a file of choose a device. When a destination is asked, choose Icecast.