ThoughtNature

Inconsequential and deceptively simple.

Tuesday, June 02, 2009

MPD Icecast MP3 streaming

I recently set up MPD with a web front-end and OGG Icecast streaming, and found it was really taxing the 800 MHz CPU of the server.

The idea was to be able to control the music in the communal area from any PC, and also to have the same music streamed to listeners elsewhere.

It worked, in principle, but the CPU load on the server was too great and the audio (both direct output from the server as well as streamed) was cutting out frequently.

After trying all manner of tweaks and hacks, disabling ALSA and trying OSS, modifying /etc/asound.conf, turning off the software mixer and all kinds of arcane encoding directives, even trying XMMS2 and looking into Liquidsoap (which looks incredible, if a little tricky to set up), I eventually compiled MPD from source in order to utilise the new Icecast MP3 streaming option.

To wit:
  1. Download and unpack MPD server sources
  2. Install libmp3lame-dev, libmad0-dev, libasound2-dev, libogg-dev, libshout3-dev, libmp3lame0
  3. Change to the base directory of the unpacked sources
  4. ./configure --enable-shout-mp3 '--enable-lame
  5. make
Now copy the executable to where you want it to reside.

For Ubuntu users, if you already have the Ubuntu version of MPD installed, after compiling simply copy the resulting mpd executable file from the src/ subdirectory of the unpacked sources to /usr/local/bin/ and edit /etc/init.d/mpd, changing the DAEMON= line to specify the full path to the mpd executable.

e.g.
DAEMON=/usr/local/bin/mpd

Now start or restart mpd.

This has made a huge difference - CPU load has dropped immensely and the audio very seldom cuts out anymore.

Labels:

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home