Difference between revisions of "MediaTomb - Free UPnP MediaServer"

From NAS-Central Buffalo - The Linkstation Wiki
Jump to: navigation, search
m
 
(17 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Template:Articles|LS1|OpenLink|FreeLink|Mediaserver}}
+
{{Template:Articles|LS1|OpenLink|FreeLink|Mediaserver|ipkg}}
 
<table align=right><tr><td>
 
<table align=right><tr><td>
 
http://mediatomb.cc/images/mediatomb.png
 
http://mediatomb.cc/images/mediatomb.png
Line 23: Line 23:
 
=== OpenLink (PowerPC)===
 
=== OpenLink (PowerPC)===
  
*Install the [[Precompiled C development environment, running on the LS]] (to get [[w:Perl|Perl]])
 
 
*Install [[Ipkg on the Linkstation (for end-users)]] and enable the NSLU2 Feed: [[Ipkg Package List: PowerPC]]
 
*Install [[Ipkg on the Linkstation (for end-users)]] and enable the NSLU2 Feed: [[Ipkg Package List: PowerPC]]
 
*Install mediatomb with ipkg, which will also install the following dependancies: file, zlib, ossp-js, libexif, sqlite, readline, ncurses, id3lib, libstdc++  
 
*Install mediatomb with ipkg, which will also install the following dependancies: file, zlib, ossp-js, libexif, sqlite, readline, ncurses, id3lib, libstdc++  
Line 35: Line 34:
 
*Configure shares on web interface
 
*Configure shares on web interface
  
go to http://linkstation:4912 to set up shares  
+
go to http://linkstation:49152 to set up shares  
  
{{Postit|FreeLink| Ipkg could be used, although it is not the preferred method (and then for powerPC only) These instructions would dependancies would need to be manually resolved and then the application would need to be compiled from source (or alien could be used on an RPM) }}
+
=== OpenLink (MIPSEL)===
 +
 
 +
once the linkstation is opened up and you have telnet access, go to:
 +
 
 +
http://mediatomb.cc/pages/download
 +
 
 +
and find the appropriate file for your linkstation under the static binaries area. For the linkstation 2 it is mediatomb-static-0.11.0-r2-linux-uclibc-mips2el.tar.gz.
 +
at the command prompt on your linkstation go somewhere to store the file:<BR><BR>
 +
 
 +
cd /mnt/hda/ <BR>
 +
mkdir tmp <BR>
 +
cd tmp <BR>
 +
wget http://downloads.sourceforge.net/mediato...2el.tar.gz (or appropriate location) <BR>
 +
tar -xvzf mediatomb-static-0.11.0-r2-linux-uclibc-mips2el.tar.gz <BR>
 +
then simply type: <BR>
 +
cd mediatomb <BR>
 +
./mediatomb.sh <BR>
 +
to start it up. <BR>
 +
 
 +
 
 +
 
 +
===FreeLink===
 +
 
 +
 
 +
Although it's not a great idea to use [[Ipkg]] and [[w:apt-get|apt]] on the same box Ipkg seems to keep most of it's files separate in <tt>/opt/bin</tt>.  The above feed/method could only be used for a PowerPC linkstation. 
 +
 
 +
 
 +
There are instructions for installing mediatomb on [[w:Ubuntu|Ubuntu]] linux but they are somewhat specific to ubuntu.
 +
* http://ubuntuforums.org/showthread.php?t=397026
 +
 
 +
 
 +
 
 +
====ARM====
 +
 
 +
*this is my fast way to install:
 +
apt-get install libnspr4-0d libmozjs0d
 +
wget http://downloads.sourceforge.net/mediatomb/mediatomb_0.10.0-1etch1_arm.deb
 +
dpkg -i mediatomb_0.10.0-1etch1_arm.deb
 +
 
 +
*alternative install method - adding the debian repository from [http://mediatomb.cc/pages/download#debian_ubuntu MediaTomb Downloads]:
 +
 
 +
#add<br>''deb http://apt.mediatomb.cc/ etch main''<br>to your ''/etc/apt/sources.list''
 +
#install the gpg key for this repository and then install mediatomb:
 +
wget http://apt.mediatomb.cc/key.asc -O- -q | apt-key add -
 +
apt-get update
 +
apt-get install mediatomb
 +
 
 +
*after that run mediatomb
 +
mediatomb
 +
 
 +
it starts server, in bottom of output you can see the internet address for remote control
 +
after first loading stop mediatomb by ctrl+c
 +
 
 +
it auto-creates config files on /root/.mediatomb/
 +
 
 +
 
 +
*Add Playstation 3 DIVX streaming support:
 +
nano /root/.mediatomb/config.xml
 +
 
 +
*under <server> add
 +
<protocolInfo extend="yes"/>
 +
 
 +
*after <extension-mimetype ignore-unknown="no"> add
 +
<map from="avi" to="video/divx"/>
 +
 
 +
restart mediatomb
 +
 
 +
on web admin add your shared folder (remove and repopulate database)
  
  
 
=== Compiling from source ===
 
=== Compiling from source ===
* to be done
+
* to be done, a number of dependancies would have to be resolved... Spidermonkey seems like to most difficult one
 
see http://mediatomb.cc/pages/documentation#id2458225
 
see http://mediatomb.cc/pages/documentation#id2458225
 
  
 
==Usage Options==
 
==Usage Options==
Line 61: Line 126:
 
     --help or -h      this help message
 
     --help or -h      this help message
  
 +
== Starting MediaTomb on Boot ==
 +
Getting MediaTomb to run in daemon mode can be a bit fiddly as it's not always clear where the configuration is being read from (this will often result in your media library and all settings being blown away!).
 +
 +
=== Auto Start for ipkg Installs ===
 +
The current ipkg package provides an init script with some additional configuration. To enable automatic startup of the MediaTomb daemon edit /opt/etc/default/mediatomb and change the value of MT_ENABLE to true.  After that start the daemon by issuing the following command:
 +
/opt/etc/init.d/S90mediatomb start
 +
 +
In this configuration MediaTomb will listen on port 50500, this behavior can be changed by editing ''/opt/etc/mediatomb.conf'' and restarting the server which can by done by:
 +
/opt/etc/init.d/S90mediatomb restart
 +
 +
The config.xml and the database of the daemon configuration will be created in /opt/etc/mediatomb after the first launch.  If you encounter strange behavior or are not sure what is going on, have a look at the log output which will be located in ''/opt/var/log/mediatomb''
 +
 +
=== Auto Start when compiled from source ===
 +
The easiest way to get MediaTomb to start on boot is to create an init.d script; here's one I rolled earlier - all the configuration goes at the top. 
 +
 +
<pre>
 +
#! /bin/sh
 +
# Mediatomb init.d script.
 +
#
 +
 +
NAME=mediatomb
 +
DESC="MediaTomb DLNA Server"
 +
 +
###### START CONFIGURATION ######
 +
 +
# The Location of your MediaTomb binary.
 +
DAEMON=/usr/local/bin/mediatomb
 +
 +
# The MediaTomb Home Directory that you want to use
 +
HOME=/home/jonny
 +
 +
# The User that MediaTomb will run as.
 +
USER=jonny
 +
 +
# The Group that MediaTomb will run under
 +
GROUP=users
 +
 +
# The Process ID file which will be created.
 +
PID=/var/run/${NAME}.pid
 +
 +
# Where the MediaTomb log file will be written
 +
LOG=/var/log/${NAME}.log
 +
 +
###### END CONFIGURATION ######
 +
 +
ARGS="--user ${USER} --group ${GROUP} --pidfile ${PID} --logfile=${LOG} \
 +
        --home ${HOME} --daemon"
 +
 +
if ! [ -x ${DAEMON} ]; then
 +
        exit 0
 +
fi
 +
 +
start()
 +
{
 +
        start-stop-daemon --start --quiet --pidfile ${PID} --exec ${DAEMON} \
 +
                -- ${ARGS}
 +
}
 +
 +
stop()
 +
{
 +
    start-stop-daemon --stop --quiet --oknodo --pidfile ${PID}
 +
}
 +
 +
case "$1" in
 +
    start)
 +
        echo -n "Starting ${DESC}: "
 +
        start
 +
        echo "${NAME}."
 +
        ;;
 +
    stop)
 +
        echo -n "Stopping ${DESC}: "
 +
        stop
 +
        echo "${NAME}."
 +
        ;;
 +
    restart)
 +
        stop
 +
        sleep 1
 +
        start
 +
        ;;
 +
    *)
 +
        echo "Usage: /etc/init.d/${NAME} {start|stop|restart}"
 +
        exit 1
 +
        ;;
 +
esac
 +
exit 0
 +
</pre>
 +
 +
Create this file in ''/etc/init.d/mediatomb'' and then make it executable via:
 +
chmod +X /etc/init.d/mediatomb
 +
 +
Next you need to create a symlink in the appropriate rc.d folder which will cause this script to be executed as the system starts up:
 +
ln -s /etc/init.d/mediatomb /etc/rc.d/rcS.d/S99mediatomb
 +
 +
The next time you start your system, MediaTomb should automagically wind up, if it doesn't the first place to look is the log file which should have been created over at:
 +
/var/log/mediatomb.log
 +
 +
 +
== Common Problems ==
 +
=== MediaTomb fails to start with a -203 uPNP Error ===
 +
If you are seeing the following in your log output:
 +
2009-04-14 21:54:37 ERROR: main: upnp error -203
 +
2009-04-14 21:54:37 ERROR: Could not bind to socket.
 +
2009-04-14 21:54:37 INFO: Please check if another instance of MediaTomb or
 +
2009-04-14 21:54:37 INFO: another application is running on the same port.
  
{{Stubs}}
+
Then it's very likley that you have another uPNP server running on your machine; the most likely candidate is the PCCast daemon which is found on the OpenLink; you can stop it from starting up by modifying:
 +
/etc/init.d/pcastd

Latest revision as of 15:46, 21 November 2010

mediatomb.png

Contents

Overview

MediaTomb is an open source (GPL) UPnP MediaServer with a nice web user interface, it allows you to stream your digital media through your home network and listen to/watch it on a variety of UPnP compatible devices.

MediaTomb implements the UPnP MediaServer V 1.0 specification that can be found on http://www.upnp.org/.

Currently Supported Features

  • browse and playback your media via UPnP
  • metadata extraction from mp3, ogg, flac, jpeg, etc. files.
  • Exif thumbnail support
  • user defined server layout based on extracted metadata (scriptable virtual containers)
  • automatic directory rescans
  • sophisticated web UI with a tree view of the database and the file system, allowing to add/remove/edit/browse your media
  • support for external URLs (create links to internet content and serve them via UPnP to your renderer)
  • support for ContentDirectoryService container updates
  • Active Items (experimental feature), allows execution of server side scripts upon HTTP GET requests to certain items
  • highly flexible configuration, allowing you to control the behavior of various features of the server

Installation

OpenLink (PowerPC)

ipkg install mediatomb 
  • Run MediaTomb (as a daemon)
mediatomb -d   
  • Configure shares on web interface

go to http://linkstation:49152 to set up shares

OpenLink (MIPSEL)

once the linkstation is opened up and you have telnet access, go to:

http://mediatomb.cc/pages/download

and find the appropriate file for your linkstation under the static binaries area. For the linkstation 2 it is mediatomb-static-0.11.0-r2-linux-uclibc-mips2el.tar.gz. at the command prompt on your linkstation go somewhere to store the file:

cd /mnt/hda/
mkdir tmp
cd tmp
wget http://downloads.sourceforge.net/mediato...2el.tar.gz (or appropriate location)
tar -xvzf mediatomb-static-0.11.0-r2-linux-uclibc-mips2el.tar.gz
then simply type:
cd mediatomb
./mediatomb.sh
to start it up.


FreeLink

Although it's not a great idea to use Ipkg and apt on the same box Ipkg seems to keep most of it's files separate in /opt/bin. The above feed/method could only be used for a PowerPC linkstation.


There are instructions for installing mediatomb on Ubuntu linux but they are somewhat specific to ubuntu.


ARM

  • this is my fast way to install:
apt-get install libnspr4-0d libmozjs0d
wget http://downloads.sourceforge.net/mediatomb/mediatomb_0.10.0-1etch1_arm.deb
dpkg -i mediatomb_0.10.0-1etch1_arm.deb
  1. add
    deb http://apt.mediatomb.cc/ etch main
    to your /etc/apt/sources.list
  2. install the gpg key for this repository and then install mediatomb:
wget http://apt.mediatomb.cc/key.asc -O- -q | apt-key add -
apt-get update
apt-get install mediatomb
  • after that run mediatomb
mediatomb

it starts server, in bottom of output you can see the internet address for remote control after first loading stop mediatomb by ctrl+c

it auto-creates config files on /root/.mediatomb/


  • Add Playstation 3 DIVX streaming support:
nano /root/.mediatomb/config.xml
  • under <server> add
<protocolInfo extend="yes"/>
  • after <extension-mimetype ignore-unknown="no"> add
<map from="avi" to="video/divx"/>

restart mediatomb

on web admin add your shared folder (remove and repopulate database)


Compiling from source

  • to be done, a number of dependancies would have to be resolved... Spidermonkey seems like to most difficult one

see http://mediatomb.cc/pages/documentation#id2458225

Usage Options

Usage: mediatomb [options]
Supported options:
   --ip or -i         ip address
   --port or -p       server port (the SDK only permits values => 49152)
   --config or -c     configuration file to use
   --daemon or -d     run server in background
   --pidfile or -P    file to hold the process id
    --user or -u       run server under specified username
   --group or -g      run server under specified group
   --add or -a        add the given file/directory
   --logfile or -l    log to specified file
   --help or -h       this help message

Starting MediaTomb on Boot

Getting MediaTomb to run in daemon mode can be a bit fiddly as it's not always clear where the configuration is being read from (this will often result in your media library and all settings being blown away!).

Auto Start for ipkg Installs

The current ipkg package provides an init script with some additional configuration. To enable automatic startup of the MediaTomb daemon edit /opt/etc/default/mediatomb and change the value of MT_ENABLE to true. After that start the daemon by issuing the following command:

/opt/etc/init.d/S90mediatomb start

In this configuration MediaTomb will listen on port 50500, this behavior can be changed by editing /opt/etc/mediatomb.conf and restarting the server which can by done by:

/opt/etc/init.d/S90mediatomb restart

The config.xml and the database of the daemon configuration will be created in /opt/etc/mediatomb after the first launch. If you encounter strange behavior or are not sure what is going on, have a look at the log output which will be located in /opt/var/log/mediatomb

Auto Start when compiled from source

The easiest way to get MediaTomb to start on boot is to create an init.d script; here's one I rolled earlier - all the configuration goes at the top.

#! /bin/sh
# Mediatomb init.d script.
#

NAME=mediatomb
DESC="MediaTomb DLNA Server"

###### START CONFIGURATION ######

# The Location of your MediaTomb binary.
DAEMON=/usr/local/bin/mediatomb

# The MediaTomb Home Directory that you want to use
HOME=/home/jonny

# The User that MediaTomb will run as.
USER=jonny

# The Group that MediaTomb will run under
GROUP=users

# The Process ID file which will be created.
PID=/var/run/${NAME}.pid

# Where the MediaTomb log file will be written
LOG=/var/log/${NAME}.log

###### END CONFIGURATION ######

ARGS="--user ${USER} --group ${GROUP} --pidfile ${PID} --logfile=${LOG} \
        --home ${HOME} --daemon"

if ! [ -x ${DAEMON} ]; then
        exit 0
fi

start()
{
        start-stop-daemon --start --quiet --pidfile ${PID} --exec ${DAEMON} \
                -- ${ARGS}
}

stop()
{
    start-stop-daemon --stop --quiet --oknodo --pidfile ${PID}
}

case "$1" in
    start)
        echo -n "Starting ${DESC}: "
        start
        echo "${NAME}."
        ;;
    stop)
        echo -n "Stopping ${DESC}: "
        stop
        echo "${NAME}."
        ;;
    restart)
        stop
        sleep 1
        start
        ;;
    *)
        echo "Usage: /etc/init.d/${NAME} {start|stop|restart}"
        exit 1
        ;;
esac
exit 0

Create this file in /etc/init.d/mediatomb and then make it executable via:

chmod +X /etc/init.d/mediatomb

Next you need to create a symlink in the appropriate rc.d folder which will cause this script to be executed as the system starts up:

ln -s /etc/init.d/mediatomb /etc/rc.d/rcS.d/S99mediatomb

The next time you start your system, MediaTomb should automagically wind up, if it doesn't the first place to look is the log file which should have been created over at:

/var/log/mediatomb.log


Common Problems

MediaTomb fails to start with a -203 uPNP Error

If you are seeing the following in your log output:

2009-04-14 21:54:37 ERROR: main: upnp error -203
2009-04-14 21:54:37 ERROR: Could not bind to socket.
2009-04-14 21:54:37 INFO: Please check if another instance of MediaTomb or
2009-04-14 21:54:37 INFO: another application is running on the same port.

Then it's very likley that you have another uPNP server running on your machine; the most likely candidate is the PCCast daemon which is found on the OpenLink; you can stop it from starting up by modifying:

/etc/init.d/pcastd