Ubuntu media server – reprise.
OK, so some of you will remember this article where I was babbling on at great length about setting up a media center using mp3, jinzora, and so on. Well, I hit a small snag a bit down the line and thought I’d share the adventure with you lot. Basically, the problem is this: mpd on Ubuntu doesn’t support the AAC audio format (the format iTunes uses by default to encode, and the format the iTunes music store uses for its DRM free downloads)Ã‚Â out of the box. There’s a very good reason for this – mpd is a universe component – it’s open source and community maintained. The AAC file format, though, is multiverse because it can’t legally be distributed in some countries.
The only way around this is toÃ‚Â build mpd from source, and that involves getting a pile of prerequisite packages installed. So here’s what we do.
First of all, we want to get rid of the packaged version. One caveat here, the uninstall process likes to nuke directories in /var/lib/mpd, so move /var/lib/mpd/music somewhere safe (unless it’s a symlink to somewhere else, of course). Likewise, you’ll want to make sure you have a copy of /var/lib/mpd/playlists.
Once it’s all safe, do:
apt-get remove mpd
And it’s gone.
Next, we want to download a copy of the mpd sources.
That will get you the current release. Next bit is down to personal choice – I tend to have a /usr/src directory that I stick sources in so I can keep them hanging around in case I want to rebuild or (more usually) do a make uninstall when the package with the options I want finally becomes available.
So – let’s get the sources untarred. Assuming you’ve saved the download in your home directory;
tar zxfv ~/mpd-0.13.0.tar.gz
There we go – we have the sources unpacked and it’s time to install some pre-requisites. Firstly, a C compiler will be handy. Fortunately, Ubuntu has a useful meta-package to install everything you need to compile and link.
sudo apt-get install build-essential
This will download and install a whole pile of software. Once that’s there, we need to install a substantial list of prerequisites. Although your system is already capable of playing media formats, you don’t yet have the dev packages installed and these are required for mpd to be linked against. So here we go;
sudo apt-get installÃ‚Â libmikmod-dev libid3tag0-dev libmpcdec-dev libmpcdec3 libfaad2-dev libmp4v2-dev libvorbis-dev libflac-dev liboggflac-dev libaudiofile-dev liblame-dev libmad0-dev libsamplerate-dev libao-dev libalsa-dev libasound2-dev libao2 libao-dev
Phew! That’ll chunter away for a wee while installing. When it does, we just need to do a;
sudoÃ‚Â make install
At this point, have a look in /var/lib/mpd and, if necessary, create a playlists directory or move your saved playlists directory back, similarly for your music directory / symlink.
sudo /etc/init.d/mpd start
And that should be you! Your media player now supports AAC files. Of course, the trouble here is that you won’t get nice handy automatic updates for mpd any more. Hopefully, someone will produce a new package which is build in this way. You could always make one yourself and run a repository for it.