Debian Icecast Streaming Radio Server

Posted on: 2017-04-30

I participated in a project at work recently that had me looking into streaming radio technologies. I've listened to them since the age of dialup but haven't ever really messed with running one. This blog will change that.

do a fresh minimal debian install. then install some software

apt-get -y update && apt-get -y upgrade
apt-get -y install mpd icecast2 ncmpcpp mpc  
#configure icecast during the install routine

Icecast is the streaming server that vlc or other similar media players will connect to, to listen to the music.

mpd is a music player that can be remotely controlled and can send the audio it is playing to icecast servers as well as to speakers.

An mpd client controls what mpd is playing. You can think of it as a playlist/queue manager. We will be using a mpd client on the server in this tutorial.

So... DJ > mpc client > mpd > icecast server > vlc or similar > listener.

This provides a lot of power and flexibility. Your DJ could be choosing the next song your guests in franshised restaurants across the US hear from a mpc client on is phone while waiting for a flight in an airport in Mexico.

Configure icecast

vim /etc/default/icecast2
ENABLE=true

vim /etc/icecast2/icecast.xml
#replace any passwords the config script missed
%s/hackme/test1234/g

systemctl enable icecast2
systemctl restart icecast2

Configure mpd

vim /etc/mpd.conf
#set password and bind_to_address if you want to control remotely
#setup audio like so. updating password in shout section.
audio_output {
    type            "null"
    name            "My Null Output"
    mixer_type      "none"                  # optional
}
audio_output {
    type            "shout"
    encoding        "ogg"                   # optional
    name            "My Shout Stream"
    host            "localhost"
    port            "8000"
    mount           "/mpd.ogg"
    password        "test1234"
    quality         "5.0"
    #bitrate         "128"
    format          "44100:16:1"
    protocol        "icecast2"              # optional
    #user            "source"                # optional
    #description     "My Stream Description" # optional
    #url             "http://example.com"    # optional
    #genre           "jazz"                  # optional
    #public          "no"                    # optional
    #timeout         "2"                     # optional
    #mixer_type      "software"              # optional
}

systemctl enable mpd
systemctl restart mpd

Add and play some music

scp my.mp3 root@VMIP:/var/lib/mpd/music/
ncmpcpp
3
u
arrow keys
enter on song
#1 or tab/shift+tab to learn more about the player

Check out the admin UI

http://VMIP:8000  
admin/password you chose
click around
mountpoint list is a list of streams you can tune into

Tune in

Open the M3U URL of the icecast mount in VLC or similar on your laptop.

Thats it. It is worth mentioning that you can stream to your icecast server from other places, so if you have lots of music on a specific machine, there is no reason to copy it to the icecast server. You can also play with things like Darkice and Mixxx to do live broadcasting.

References

https://wiki.archlinux.org/index.php/Streaming_With_Icecast