Of course, you could just go and install a packaged version of the last official release (0.11) with apt-get, but:
- 0.11 was released in March'08, which means that you'll be missing the newest features
- that's not fun :)
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 APTBoth 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.
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:
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 :)
Thanks for this, linking to it from my blog.
ReplyDeleteA little pointer to anyone compiling the ffmpegthumbnailer that gets the error
configure: error: +Could not find ffmpeg. Please update PKG_CONFIG_PATH to point at location of ffmpeg pkgconfig files directory.
Run this...
cat config.log | grep "No package"
and that will tell you what packages you need to download. Make sure they are the dev ones!
i.e. mine said
No package 'libavformat' found
No package 'libswscale' found
so i ran
sudo apt-get install libavformat-dev libswscale-dev
Cheers,
Dean
My Coding Blog
Hi Dean, you're right: I assumed ffmpeg was already installed. I'll update the entry accordingly. Cheers!
ReplyDeleteHi JS,
ReplyDeleteI've really enjoyed your blog and using your howtos. I'm having a problem compiling mediatomb though.
I started with your other tutorial compiling ffmpeg + x264 + MP3 + Xvid + AMR on Ubuntu (everything
appears to have gone smooth) and have since moved on to this mediatomb howto. When I 'make'
mediatomb I receive the following.
/usr/local/lib/libavformat.so: undefined reference to `av_fifo_realloc2'
/usr/local/lib/libavcodec.so.52: undefined reference to `av_memcpy_backptr'
/usr/local/lib/libavcodec.so.52: undefined reference to `av_lfg_init'
I read on another one of your howtos how someone else was having similar issues. It was recommended
to remove the a and so files for the offending. Where do I delete from if these files exist? My /usr/lib
or the source directory for what I'm compiling?
Thanks for some great reading!
Ig
I get the same.
ReplyDeleteDid apt-get remove libavcodec-dev, then deleted libavcodec.a and libavcodec.so from /usr/local/lib, then installed libavcodec-dev again. Still got the same error when doing 'make'
@iglooc00l:
ReplyDeleteyes, it's the same problem as the other person. You need to remove any previous copy of these libraries (.a & .so). They have probably been installed using APT, so you may first try to remove them with 'apt-get remove libavcodec-dev', etc.
If that doesn't work, just look for the offending files in /usr/lib and delete them (or move them to a backup directory if you're worried). Then just run 'ldconfig' to refresh the library cache and you should be fine.
@Magnus:
ReplyDeleteyou need to check for older libs in /usr/lib. The ones in /usr/local/lib are the one you built :)
Okay, new snag. "./configure" ffmpegthumbnailer
ReplyDeleteconfigure: error: +Could not find ffmpeg. Please update PGK_CONFIG_PATH to point at location of ffmpeg pkgconfig files directory.
What gives...When I "./configure" mediatomb, it says it finds ffmpeg. Why doesnte ffmpegthumbnailer suddenly?
This is hard for someone who hasn't used linux in 10 years :D
@Magnus: looks like you have the same problem as Dean (1st comment on this entry). Please try his suggestion, it should help.
ReplyDeleteHi JS,
ReplyDeletewhat do I need to add to the config.xml to make mediatomb play DVD ISO files?
The original config.xml contains only these two lines (less-than signs removed because of html code...):
treat mimetype="application/x-iso9660" as="dvd"/>
treat mimetype="application/x-iso9660-image" as="dvd">
Well, that's obviously not enough to make mediatomb recognize iso files so I added
map from="iso" to="application/x-iso-9660-image"/>
to the mappings section, but that did'nt help... My PS3 shows iso files on mediatomb as "incompatible data".
As there's an extra import script (import-dvd.js) I assume a new category should show up if mediatomb recognizes an iso file?
Maybe you could post the lines I need to add/edit in the config.xml?
Greets Stefan
Oh, of course it's
ReplyDeletemap from="iso" to="application/x-iso9660-image"/>
'sudo apt-get remove libavcodec-dev' and removing the .a and .so files in /usr/lib did the trick.
ReplyDeleteCouldn't have done it without this blog. And I learned a LOT in the process, thanks a bunch JS.
Now I just need to figure out how to set up transcoding =)
Guess I spoke too soon.
ReplyDelete'MediaTomb UPnP Server version 0.12.0 - http://mediatomb.cc/
Output removed
2009-01-02 20:07:35 INFO: Loading configuration from: /home/nannus/.mediatomb/config.xml
2009-01-02 20:07:35 INFO: Checking configuration...
2009-01-02 20:07:35 ERROR: /usr/share/mediatomb/web : 20 x No such file or directory'
Fixed. Just needed to delete config.xml
ReplyDeleteSorry for chattering all over your blog =)
Uhm, my typo was only in the comment, not in the config.xml...
ReplyDeleteSo my problem still persists: How do I need to configure mediatomb to play DVD ISO files? :-/
By the way, JS, thanks for your great tutorials on how to set up mediatomb for online content, last.fm, ffmpegthumbnailer and stuff... I got it all up and running - perfect :)
@Stefan: AFAIK, this is not fully functional yet. The mediatomb guys will try to complete for the 0.12 release.
ReplyDeleteAlright, thanks a lot :)
ReplyDeleteDo you know when 0.12 will be released? The last news entry on mediatomb.cc regarding the release date (2008-09-27) says "[...] we can release it this year"...
Small typo, the path to libdvdread should be:
ReplyDeletewget ftp://ftp6.mplayerhq.hu/MPlayer/releases/dvdnav/libdvdread-4.1.3.tar.bz2
i.e., ../dvdnav/.. instead of ../dvdread/..
Thank you
@royw: grrr, just fixed it. Thanks :)
ReplyDeleteThanks for all your work on this... I found it after getting everything except ffmpegthumbnailer working and installed. When I try to install it I receive the same error over and over again no matter which version I try to install:
ReplyDeletelibffmpegthumbnailer/.libs/libffmpegthumbnailer.so: undefined reference to `BZ2_bzDecompress'
libffmpegthumbnailer/.libs/libffmpegthumbnailer.so: undefined reference to `BZ2_bzDecompressEnd'
libffmpegthumbnailer/.libs/libffmpegthumbnailer.so: undefined reference to `BZ2_bzDecompressInit'
collect2: ld returned 1 exit status
make[2]: *** [ffmpegthumbnailer] Error 1
Have any clues on how to fix it?
@Anonymous: that's weird. I can't find these symbols in my build:
ReplyDeleteubuntu% pwd
/home/julien/tmp/ffmpegthumbnailer-1.3.0/src/libffmpegthumbnailer/.libs
ubuntu% nm *.o *.so |grep BZ2
ubuntu%
Can you run the same command and post the output?
sorry it took a bit to get back to you. I appreciate the fast response. After the initial tries it started spewing errors about gcc 4.2 and a bug. Rebooted the system and tried to compile ffmpegthumbnailer again and it succeeded! I now have all working that should be working. Not sure if thumbnails are supposed to show on the PS3 or not but I do have flac transcoding.
ReplyDeleteDid I get you right when you said the ISO stuff is still not functional yet for the PS3?
Thx again!
Thanks for this how-to all is working well except I can't seem to get mediatomb start at boot, any ideas?
ReplyDeleteso first off thanks for such a great tutorial!! I am having one tiny problem with getting mediatomb to start properly. Everything compiled without errors but when I start mediatomb I get the following error:
ReplyDeletemediatomb: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_gcd
I have tried reinstalling libavcodec without any luck. Any ideas? Thanks in advance!
@Bert: one way to do it is "System" > "Preferences" > "Sessions" and add mediatomb to the list.
ReplyDelete@Wheaties: this symbol is in libavutil. My guess is that you have an older version of the library in /usr/lib. You should either uninstall it, or define LD_LIBRARY_PATH in you .cshrc (or equivalent):
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
@Anonymous: yes, AFAIK, ISO support is not there yet. I haven't seen any recent SVN update on this but I'll keep my eyes peeled :)
ReplyDelete@js I'm running mediatomb on a server, so adding it to sessions isn't an option. I did find some startup-scripts but somehow they don't do the job. So if someone has it working, please post it.
ReplyDeletegreetings Bert
I thought I read in one of the TUT's, thanks by the way working great, that vlc was used in the past to stream the youtub content, or the apple trailers? if that's the case would it be possible to do the same with the iso files until mediatomb is ready? Iso saves so much space and for us poor folk means less $$
ReplyDeleteI'm getting this error when running mediatomb.
ReplyDelete$ mediatomb
mediatomb: error while loading shared libraries: libavcodec.so.51: cannot open shared object file: No such file or directory
I compiled ffmpeg from source following an earlier post on this blog:
/usr/lib/libavcodec.a
/usr/lib/libavcodec.so
/usr/lib/libavcodec.so.52
/usr/lib/libavcodec.so.52.14.0
Any ideas?
Also ran into this error on ffmpegthumbnailer make: http://code.google.com/p/ffmpegthumbnailer/issues/detail?id=24&q=moviedecoder
Managed to get around it by following the solution of someone on the ubuntu forums, using prevu to install 1.3.0 from jaunty:
http://ubuntuforums.org/showthread.php?t=1064609
Fixed by recompiling/installing everything with --prefix=/usr/local instead of --prefix=/usr.
ReplyDeleteHad to go back and reinstall a lot of other stuff for /usr/local as well, but I should probably have done that a long time ago.
Great tutorial!
ReplyDeleteAlmost everything is working ok.
Somebody asked for a /etc/init.d startup service script. Here is mine for Ubuntu 8.10 (based in te script from package mediatomb-daemon, slightly modified). It works fine for me. Configuration un /etc/mediatomb/config.xml.
Create autostart/autostop links with "sudo update-rc.d mediatomb defaults"
Good luck
# Read configuration variable file if it is present
[ -r $DEFAULT ] && . $DEFAULT
# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
# Start the daemon if NO_START is disabled in DEFAULT
if [ "$NO_START" = "yes" ]; then
test "$1" = "start" && \
{
log_warning_msg "$NAME: Not starting $DESC."
log_warning_msg "$NAME: Disabled in $DEFAULT."
}
exit 0
fi
# Run as root if USER not specified
if [ ! $USER ]; then
USER=root
fi
# Check for an invalid user or one without a home directory
eval USERHOME=~$USER
if [ "${USERHOME#/}" = "${USERHOME}" ]; then
log_failure_msg "$NAME: The user '$USER' specified in $DEFAULT is invalid."
exit 1
fi
# Check if group is not specified and assign a proper group
if [ -z $GROUP ]; then
GROUP="$USER"
fi
if [ "$INTERFACE" != "" ] ; then
INTERFACE_ARG="-e $INTERFACE"
else
INTERFACE_ARG=""
fi
DAEMON_ARGS="-c /etc/mediatomb/config.xml -d -u $USER -g $GROUP -P $PIDFILE -l $LOGFILE $INTERFACE_ARG $OPTIONS"
#
# Function that starts the daemon/service.
#
do_start() {
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
touch $PIDFILE
chown $USER:$GROUP $PIDFILE
touch $LOGFILE
chown $USER:$GROUP $LOGFILE
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
--test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
}
#
# Function that stops the daemon/service.
#
do_stop() {
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service.
#
do_reload() {
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
if [ -n "$INTERFACE" ]; then
# try to add the multicast route
if [ "$VERBOSE" != no ]; then
{
log_action_begin_msg \
"$NAME: Trying to add the multicast route"
$ROUTE_ADD $INTERFACE \
&& log_action_end_msg 0
} || {
true && \
log_warning_msg "Failed to add multicast route. skipping."
}
else
$ROUTE_ADD $INTERFACE >/dev/null 2>&1 || true
fi
fi
log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_warning_msg "$DESC" "'$NAME'" "was already started" ;;
2) log_end_msg 1 ;;
esac
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0)
log_end_msg 0
if [ -n "$INTERFACE" ]; then
# try to add the multicast route
if [ "$VERBOSE" != no ]; then
{
log_action_begin_msg \
"$NAME: Trying to delete the multicast route"
$ROUTE_DEL $INTERFACE \
&& log_action_end_msg 0
} || {
true && \
log_warning_msg \
"Failed to delete multicast route. skipping."
}
else
$ROUTE_DEL $INTERFACE >/dev/null 2>&1 || true
fi
fi
;;
1) log_warning_msg "$DESC" "'$NAME'" "was already stopped" ;;
2) log_end_msg 1 ;;
esac
;;
reload|force-reload)
log_daemon_msg "Reloading $DESC" "$NAME"
do_reload
log_end_msg $?
;;
restart)
#
# If the "reload" option is implemented, move the "force-reload"
# option to the "reload" entry above. If not, "force-reload" is
# just the same as "restart".
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
sleep 1
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
Hi, thanks for an excellent guide. I myself is using Fedora so I had a lite bit of work to do before i got it all right. However when I read DVD:s (ISO) something goes wrong :
ReplyDeletelibdvdnav: Using dvdnav version 4.1.3
libdvdread: Using libdvdcss version 1.2.10 for DVD access
libdvdnav: DVD Title: Jumper Sample - FDSCR
libdvdnav: DVD Serial Number: 386C306300005321
libdvdnav: DVD Title (Alternative):
libdvdnav: Unable to find map file '/home/Caine/.dvdnav/Jumper Sample - FDSCR.map'
libdvdnav: DVD disk reports itself with Region mask 0x00400000. Regions: 1 2 3 4 5 6 8
Anyone else seen this? <:P
Might add that i get this when i run the file from the ps3
ReplyDeleteERROR: DVD Image requested but title parameter is missing!
the include path for mp4 support seems wrong. Its looking for mp4.h but no package provides that header file on Debian. Shouldn't this be mp4v2.h?
ReplyDeleteWhen i transcode a .mkv file
ReplyDeletei get corrupt format.
(on the top of my head, at work)
in the terminal i can see a %in %out message beeing displayed twice.
ffmpegthumbnailer however seems to be able to create a screenshot of the file .. This didn't go as smotth as i hoped < : )
@Hed:
ReplyDeleteAFAIK, ISO support isn't there yet (see http://juliensimon.blogspot.com/2009/01/status-update-on-mediatomb-012.html for more).
Transcoding MKV is tricky (I don't do it myself). You should try converting the file from the command line using ffmpeg: if it doesn't work, then it's an ffmpeg issue, not a mediatomb issue.
@julien
ReplyDeleteAhh my bad. I just thougt it was as i saw that you had it in your config. < = )
about the matroska issue:
ffmpeg seems to be working correctly.
When i run it with the ffmpeg script is outputs allot of :
[mpeg4 @ 0x9dc0c50]Invalid and inefficient vfw-avi packed B frames detected
but other then that it keeps on going. I must confess that i don't really know what that in tails. Video en/decoding is very new to me. :P
This is a great tutorial, and I've used it to install Mediatomb with 9.04 Jaunty. But I'm wondering how to install it so Mediatomb runs as a daemon, instead of forcing me to start it manually. There is nothing inside /etc/default/mediatomb and no program in the init.d folder. I'm also worried that if I install the daemon from the repository, it will overwrite this compiled version. Any suggestions?
ReplyDeleteit is worth mentioning that jpeg support is only enabled when jpeglib is installed before configureing ffmpegthumbnailer
ReplyDeleteapt-get install libjpeg62-dev
Hi guys,
ReplyDeleteI am new to ubuntu. I am trying to follow this utility. I installed ffmpegthumbnailer using apt, followed the rest of the tutorial using Jaunty, when I go to compile it says ffmpegthumbnailer ins not there. I installed it anyway and now I get the error "ERROR: /usr/share/mediatomb/web : 20 x No such file or directory"
i can install mediatomb from apt, but I can't get my mp3 files to play so Itried this. Any suggestions
Error on last post, I meant to say I am using Karmic, not Jaunty
ReplyDelete