Setting up an Icecast Radiostation in a local network

Recently, I had to do the following setup for a party: There were 3 computers and everyone one of them shall play the music synchronously.
Moreover, the playlist had to be changed dynamically. Sounds easier as it is. :-\

First attempts

The first software I tried was VLC player 2.0.1. I tried RTP and HTTP protocols for streaming but support for dynamic playlists was always the main issue.
If I changed the playlist or even skipped a track, the streaming on client side suddenly stopped and I had to restart it on every client. Sounds inconvenient, and yep, it is indeed.
I also tested VLC’s web interface – which was buggy as hell.

Then I tried Icecast2 together with DarkIce. IceCast2 worked out of the box, but DarkIce accepted only Audio Inputs for the streaming server’s input.
I noticed it when I heard my voice with 10 seconds delay on my laptop while streaming from my desktop ;)


Streaming with Icecast, Jack and IDJC

So what was the final solution? A streaming server with Icecast, Jack and the Internet DJ Console (IDJC). The setup is given here:

Streaming Setup

I chose to install everything in a virtual machine (VM) with Lubuntu 12.04 (x86). Doing it in a VM is not necessary but it has several advantages, most importantly the ability of being portable and runnable on Windows PC and Macs as well. Moreover, your host system will not get touched.
As you can see in the setup diagram above, inside the VM, there are the three mentioned components installed: IDJC takes some audio files of a shared folder, plays and encodes them. Jack passes the encoded stream to Icecast.
Icecast provides a final stream an localhost on port 8000. The port forwarded to the host machine. With the host’s IP (which is examplary, you can access the stream on your local network (unless a firewall is blocking port 8000).

Setting up a VM

For virtualization, I used VirtualBox 4.1.12. I installed Lubuntu in the VM.
After the installation was finished, I opened a terminal window and installed the following software:

$ sudo apt-get install make g++ icecast2 idjc

During installation, Jack will ask for enabling realtime ability on your kernel.
Click ‘yes’ to enable it. Also, Icecast will ask you for entering usernames and password later used for streaming. For demo purpose, I will keep using the standard ones, which are unsafe but acceptable when operating in local networks only.

Make and g++ are required in Lubuntu for building the VirtualBox Guest Additions.
Have have to install them or you won’t have shared folders nor graphic acceleration.
You can install it with:

 $ cd /media/VBOXADDITIONS_4.1.12_77245
 $ sudo ./

To have the permission to access your shared folders, type in the following command:

$ sudo usermod -G vboxsf -a $USER

Shutdown the VM. Add a shared folder which contains some music. I called mine ‘music’ and activated ‘Auto-mount’ and ‘Make permanent’.
Restart the VM, and there should be a folder /media/music_sf now in your guest system.
You can access your music now from within the guest OS.

To have access to the Icecast2 server from outside, you have to setup port forwarding.
In VirtualBox, click on ‘Machine’, ‘Settings…’, ‘Network’ and ‘Port Forwarding’ and enter the following settings:

Port Forwarding

Setting up Jack and IDJC

Icecast2 should run out of the box. However, if you like, you can edit the settings in a configuration file /etc/icecast2/icecast.xml

The standard settings for Jack were not appropriate, the buffer length was too short.
I had to increase the number of frames in a buffer.
I wrote a tiny bash script which starts a Jack Server with a window size of 2048 and runs IDJC afterwards:

 killall -9 jackdbus
 jackd -n xyzzy -d alsa -r 44100 -p 2048 &
 idjc run -p default -j xyzzy

I saved the script as “” in the home folder.
Don’t forget give the script permissions for execution with

$ chmod +x ~/

Execute the script with

$ ~/

In IDJC, click on the button on the lower left. On the appeared popup menu, click on ‘Output’:

Output Button

On the ‘Connection’ tab, add a new connection to an Icecast2 server with the following settings:

Server Settings

Go the ‘Format’ tab. I recommend to use OGG Vorbis with 192kbit. In the tab ‘Streaming Info’, you can add metadata of your choice. Click on the ‘Connect’ button. The bullet on tab ’1′ should be green now. Close the ‘IDJC Output’ Window and go back the IDJC’s main window.

Now, add some music to your playlist. As audiofeed, deactivate ‘DJ’ and start playing some music. On your host system, open a media player of your choice and start a network stream from
If you can hear something, the server is correctly configured.

You can now access the stream within your local network on every client (if there are no blocking firewalls ;) )  from the host system (which is here exemplary IP
For keeping the clients synced, I recommend to use VLC media player for receiving the stream because it has a built-in track synchronization feature.
That’s all, folks!

Posted in Multimedia, Uncategorized | 3 Comments