HOWTO Compile MPD With AAC/M4A Support on Ubuntu

Monday, March 24, 2008
Linux’s Music Player Daemon, MPD, is an interface-less jukebox. It’s like iTunes, Winamp, or Rhythm Box, except there is no built in GUI. Think of it as the Apache or MySQL of the music player world.

MPD is great for remotely controlling your Linux powered entertainment system or, as in my office’s case, to allow 15 staff to each act as work-day DJs.

Our office music server runs Ubuntu 7.10, but the default mpd package for Ubuntu doesn’t have M4A (AAC) support for MPD. Here’s what we did to re-compile MPD.

This tutorial will set you up with a new MPD with support for OSS/ALSA that will play the following formats:

  • MP3
  • AAC
  • OGG Vorbis
  • FLAC
  • WAV

First, MPD requires libfaad2-dev and libmp4v2-dev to compile with AAC support. I’m using the debian-multimedia repositories to get these packages and they don’t have versions of libfaad2-dev and libmp4v2-dev suitable for Ubuntu 7.10.

No worries, this is a good excuse to learn how to build packages “gentoo style” using apt to build packages from source.

You’ll need the apropriate repositories enabled. Check your /etc/apt/sources.list file to ensure you have at least universe and multiverse enabled. Then add the debian-multimedia repositories. Append the below lines to your /etc/apt/sources.list.

## Debian Multimedia
deb http://www.debian-multimedia.org stable main
deb-src http://www.debian-multimedia.org stable main
deb http://www.debian-multimedia.org testing main
deb-src http://www.debian-multimedia.org testing main
deb http://www.debian-multimedia.org unstable main
deb-src http://www.debian-multimedia.org unstable main

Update your apt package database with an apt-get update. Next, we need to install the basic dependancies that will allow you to compile the software.

sudo apt-get install build-essential dpkg-dev \
    debhelper libasound2-dev libid3tag0-dev \
    ccache libxvidcore4-dev libid3-3.8.3-dev \
    libgtk2.0-dev libesd0-dev libsdl1.2-dev \
    liba52-dev liblame-dev libxt-dev \
    xlibs-static-dev nasm libx264-dev dpatch \
    autotools-dev libfaad-dev libvorbis-dev \
    libimlib2-dev libfaac-dev texi2html \
    libtheora-dev libgsm1-dev libxvmc-dev \
    libamrnb-dev libamrwb-dev libsamplerate0-dev \
    libflac-dev fakeroot checkinstall

Once that has finished coming down the wire we’re almost ready to start compiling. Let’s get the MPD source code, and some initial dependancies.

sudo mkdir -p /usr/local/src
cd /usr/local/src
sudo wget http://www.musicpd.org/uploads/files/mpd-0.13.1.tar.gz
sudo tar zxvf mpd-0.13.1.tar.gz
sudo chown -R "$USER":admin mpd-0.13.1*
NOTE: The above snippet download’s mpd version 0.13.1. This is up to date as of March 23, 2008.

Time to compile! We’re using apt-get -b source PACKAGE-NAME to download and compile the source packages. This is a good way to do things since it will create DEB packages automatically, plus it’s good Debian form. I recommend learning how to use this feature of apt.

sudo apt-get -b source libavcodeccvs-dev libavutilcvs-dev
sudo dpkg -i *.deb
sudo apt-get -b source libmp4v2-0
sudo dpkg -i *.deb

Lastly we compile and install mpd. Run the following commands.

cd mpd-0.13.1
make clean
./configure
make
sudo checkinstall -D make install
sudo ln -s /usr/local/bin/mpd /usr/bin/mpd

If you haven’t received any errors, then you’re good to go!

The MPD Wiki is a good resource for help with the rest of the set up and configuration.

James-andres-165-bw James Andres

Country: Canada
About

Hello! Welcome to the current online home of James Andres, myself.

I'm a web developer, system administrator, and all-round geek.

This site is a journal of my life as it relates to techology.

Kudos and Link Bait

I work at Donat Group Enterprises building social networks, often with the Drupal CMS, of which I am a contributor. You may remember me from such sites as Project Opus.

Ross Howard-Jones is a brilliant designer who helped prettify this site. David Gratton inspired me to get off my ass and put this site together.

This site was built with the great language Ruby on the so-so platform Rails.