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.
wget http://musicpd.org/uploads/files/mpd-0.13.0.tar.gz
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
cd mpd-0.13.0
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;
./configure –prefix=/usr
make
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.
January 4, 2008 at 1:29 pm
Interesting post, I’m just a little confused at why you don’t take a more versatile route and transcode all audio into a pre-defined type. For example .ogg (better compression than mp3). You could make this all autmatic if you wrote a script and told linux to execute it every hour/day/week/month… I would have thought this would have saved the trouble of re-compiling mpd.
fyi – 1 quick google later and I found this script -> http://tarken.lyrical.net/files/aac2mp3 (maybe it’s not too ogg, but easily changeable).
January 4, 2008 at 1:37 pm
A very simple reason. MP3 and AAC are already lossy compression techniques and can sound a little flat and lifeless when piped through a decent hi-fi (as I’m doing here). To then transcode to another lossy format would – well, try it and see. If lifeless music and splashy top frequencies are your thing, it might be ok 😀