HOWTO: compiling mediatomb + ffmpegthumbnailer + all libraries for Ubuntu... and PS3 :)

Published: 2008-12-22
Today I'd like to talk about mediatomb, a media server with a nice web user interface allowing you to stream your digital media through your home network on a variety of 'Universal Plug and Play' (UPnP) compatible devices... such as the PS3 :)

Of course, you could just go and install a packaged version of the last official release (0.11) with apt-get, but:
  1. 0.11 was released in March'08, which means that you'll be missing the newest features
  2. that's not fun :)
So, let's get to work and take care of all dependencies needed to build mediatomb from source. This procedure was successfully performed on Ubuntu 8.04 and 8.10.

1) Installing ffmpegthumbnailer

ffmpegthumbnailer is a small tool which uses ffmpeg to generate video thumbnails. These thumbnails will be displayed by mediatomb while you're browsing your video collection.

[Updated on 2008/01/02] This supposes that you have built ffmpeg. If not, you may be missing a number of libraries: please check the comments below for solutions.

First, we need to install libpng:

ubuntu% sudo apt-get install libpng12-dev

Now, let's fetch the ffmpegthumbnailer source and build it:

ubuntu% wget http://ffmpegthumbnailer.googlecode.com/files/ffmpegthumbnailer-1.3.0.tar.gz
ubuntu% tar xvfz ffmpegthumbnailer-1.3.0.tar.gz
ubuntu% cd ffmpegthumbnailer-1.3.0
ubuntu% ./configure --prefix=/usr/local
ubuntu% make
ubuntu% sudo make install

OK, let's move on.

2a) Installing libdvdnav and libdvdread from source

These two libraries are used to browse DVD file structures: mediatomb needs them to read and stream DVD ISO images.

Since we're going to build the very latest mediatomb version, let's make sure we have up to date libs as well.

You do need to build and install libdvdread before libdvdnav, or the latter won't link.

ubuntu% wget ftp://ftp6.mplayerhq.hu/MPlayer/releases/dvdnav/libdvdread-4.1.3.tar.bz2
ubuntu% bzip2 -d libdvdread-4.1.3.tar.bz2
ubuntu% tar xvf libdvdread-4.1.3.tar
ubuntu% ./configure2 --prefix=/usr/local --enable-shared
ubuntu% make
ubuntu% sudo make install

ubuntu% wget ftp://ftp6.mplayerhq.hu/MPlayer/releases/dvdnav/libdvdnav-4.1.3.tar.bz2
ubuntu% bzip2 -d libdvdnav-4.1.3.tar.bz2
ubuntu% tar xvf libdvdnav-4.1.3.tar
ubuntu% ./configure2 --prefix=/usr/local --enable-shared
ubuntu% make
ubuntu% sudo make install

2b) Installing libdvdnav and libdvdread from APT

Both are available as APT packages (libdvdread-dev and libdvdnav-dev), but they're not up to date on Ubuntu 8.04. Anyway, if you don't want to build them, here's how to install them quickly:

ubuntu% sudo apt-get install libdvdread-dev libdvdnav-dev

3) Installing everything else

Sqlite3 is one of the two databases that mediatomb can use (the other is mySQL).

ubuntu% sudo apt-get install libsqlite3-dev

Libtag is needed to read tags in MP3 files, FLAC files and so on:

ubuntu% sudo apt-get install libtag1-dev

Libexpat is needed parse XML files:

ubuntu% sudo apt-get install libexpat1-dev

Libexif is needed to read tags stored in some digital pictures.

ubuntu% sudo apt-get install libexif-dev

Libmp4v2 is needed to parse mp4 files.

ubuntu% sudo apt-get install libmp4v2-dev

Libmagic helps to find the MIME type of a file based on the 'magic number' usually stored in the file header.

ubuntu% sudo apt-get install libmagic-dev

Libcurl is used to fetch web content using HTTP requests. This is how mediatomb can fetch YouTube content and stream it.

ubuntu% sudo apt-get install libcurl4-openssl-dev

Last, libmozjs is the JavaScript engine used by mediatomb.

ubuntu% sudo apt-get install libmozjs-dev

4) Building mediatomb

Let's fetch the latest sources from the Subversion repository:

ubuntu% svn co https://svn.mediatomb.cc/svnroot/mediatomb/trunk/mediatomb mediatomb

Now, let's generate the configure script and run it (you need autoconf and automake for this):

ubuntu% cd mediatomb
ubuntu% autoreconf -i
ubuntu% ./configure --prefix=/usr/local
lots of output removed
CONFIGURATION SUMMARY ----
sqlite3 : yes
mysql : missing
libjs : yes
libmagic : yes
inotify : yes
libexif : yes
id3lib : disabled
taglib : yes
libmp4v2 : yes
libdvdnav : yes
ffmpeg : yes
ffmpegthumbnailer : yes
external transcoding : yes
curl : yes
YouTube : yes
Weborama : disabled
Apple Trailers : yes
SopCast : disabled
libextractor : disabled
db-autocreate : yes

As you can see, we have pretty much enabled everything (again, sqlite3 is preferred over mySQL, and taglib over id3lib). Support for SopCast and Weborama isn't completely ready yet, so it's probably safer to leave them out.

All right, let's build mediatomb:

ubuntu% make
ubuntu% sudo make install
ubuntu% sudo ldconfig

And now...

ubuntu% mediatomb
MediaTomb UPnP Server version 0.12.0 - http://mediatomb.cc/
===============================================================================
Copyright 2005-2008 Gena Batsyan, Sergey Bostandzhyan, Leonhard Wimmer.
MediaTomb is free software, covered by the GNU General Public License version 2


All right. Let's power up the PS3 and see if it can see the mediatomb server.

Technical illustration

Yes it does. Now using the mediatomb GUI, in just a few clicks, I added some pictures and music to my library. They are almost immediately visible on the PS3:

Technical illustrationTechnical illustration

Not bad at all! That's it for the mediatomb installation. There's still plenty of configuration to do, but this will be the subject of another entry :)