MediaTomb

FAQ

General

My UPnP player can not see MediaTomb, what is wrong?

Network related problems can be difficult to track, here are some most frequently encountered cases:

  • make sure that both player and server are on the same subnet, otherwise getting UPnP to work requires additional work. You may easily use some kind of tunnel such as OpenVPN to route multicast traffic between subnets, allowing UPnP to work on both subnets. Refer to this simple example to create a tunnel between two subnets; if you leave away the secret keyword your tunnel would not be encrypted which is not needed on most LANs.
  • check if you can ping the player from the server, if this is not possible then you have some general network issue
  • if you have several network interfaces, check that MediaTomb is running on the correct one (you can set the default interface in config.xml)
  • make sure that your firewall is not blocking the server, port 1900 has to be open as well as the port on which the server is running (i.e. web UI port), both TCP and UDP
  • The UPnP protocol players use to find media servers relies on the IGMP protocol, which uses multicast. Be sure your firewall is allowing IGMP join requests from any IP address, and general IGMP traffic destined for broadcast addresses. For example, using iptables on linux and assuming eth1 is the interface MediaTomb is listening on:
      # Special case to allow 0.0.0.0 source for UPnP to use IGMP to
      # register clients with media servers and routers.
      iptables -A INPUT -i eth1 -s 0.0.0.0/32 -d 224.0.0.1/32 -p igmp -j ACCEPT
     
      # Any firewall code to limit eth1 input traffic to the appropriate IP subnets
      # must come AFTER the above special case.
     
      # UPnP uses IGMP multicast to find media servers.  Accept IGMP broadcast packets
      iptables -A INPUT -i eth1 -d 239.0.0.0/8 -p igmp -j ACCEPT
     
  • Similarly, if the interface MediaTomb is listening on is a bridge, ensure IGMP snooping is enabled. On linux, this means setting CONFIG_BRIDGE_IGMP_SNOOPING=y in your kernel config file, and rebuilding your kernel if it wasn't previously set.

I can't browse directory xxx in the Web UI in the Filesystem view, why? How can I add it?

This is a permissions problem - the user/group under which MediaTomb is running has no access to that particular directory. Here is some information on Unix/Linux file permissions.

Inotify is broken or flaky

If mediatomb is serving a directory mounted with a remote filesystem, like NFS or samba, then inotify events will only be generated for file changes made on the actual machine running mediatomb. Mediatomb will not receive inotify events for changes made by other NFS clients – a limitation of most remote filesystems and not a shortcoming of mediatomb. You can switch to using timed scans or run a program on the file server that sends remote inotify events to the mediatomb daemon.

Why is the port of the web UI changing when I restart the server? Why is the UI suddenly asking for a password?

If the port was not specified on command line or in the configuration, MediaTomb will choose the first available port, starting from 49152. When you shutdown the server the port may still be claimed by the system for a short amount of time, thus if you restart MediaTomb we will request port 49152, get back the information that it is not yet available, so the UPnP SDK will automatically try the next port until it finds a free one.

You can however specify a fixed port for the server, in this case we will apply a special reuse option to the socket and we will always listen on the specified port. This can be done by setting <port>number</port> the config.xml

When you are still trying to connect to the old port, it may happen that you will get the login page, requesting a password. In reality, this page comes from the browser cache, so all attempted logins will fail. Make sure to connect to the port where the server is actually running, easiest way to do that on a local machine is to use the bookmark feature.

MediaTomb crashes when importing data, I see something about libavformat or libavutil in the log...

Your ffmpeg library is probably buggy, update it to the latest version. Alternatively, recompile MediaTomb without ffmpeg support.

Note, that running ffmpeg -i filename on a file that causes the issue will reproduce the problem in the terminal. If you can reproduce the crash on the command line using ffmpeg, please consider reporting it to the ffmpeg developers.

How do I make MediaTomb start automatically ?

Debian
  • Edit the file /etc/default/mediatomb
  • Change NO_START=“yes” to NO_START=“no”
  • run this command:
sudo invoke-rc.d mediatomb start

Mediatomb should now be running, and will be started automatically at boot.

  • MediaTomb is now using /etc/mediatomb/config.xml , not the one in ~/.mediatomb.
  • MediaTomb runs as the user:group mediatomb:mediatomb now, so make sure the permissions on you files/dirs are set right.
Ubuntu

This SHOULD have worked on ubuntu too, but it doesn't. Since mediatomb gets started before Network Manager is done setting up all the network connections, mediatomb will fail to find a working networking device and exit.

Easiest way to fix it is to just launch mediatomb when you login.

  • Launch the Sessions Preferences program ( System→Preferences→Sessions )
  • Click “Add”
  • Name: Mediatomb , Command: mediatomb -d
  • Click “Add”

Now mediatomb will start when you log in. Your config file will be in your home dir, ~/.mediatomb/config.xml

This should work on any other distro using gnome too. There are similar methods of starting programs on login in kde/xfce/whatever too.

Another way, which worked for me on ubuntu 9.04 is to change the run level of mediatomb by running these commands:

  • sudo update-rc.d -f mediatomb remove
  • sudo update-rc.d mediatomb defaults 99

I'm no linux guru, but I think that makes mediatomb start after the network is configured and mediatomb can bind to an interface. Hope that helps :)

For a “headless” server where you can't log in, try this workaround: edit file /etc/network/interfaces adding these 2 lines:

auto eth0

iface eth0 inet dhcp

Please note the following if using this method:

  • As soon as you save changes to /etc/network/interfaces, your ethernet port will become disabled. So make sure you are logged in via the physical console (not ssh or telnet) when editing!
  • After your edit is complete, you must run /etc/init.d/networking restart to re-enable your ethernet.
  • Network Manager will report that your network is manually configured. This shouldn't be a problem for most people.
  • This workaround is for dhcp. If you are sophisticated enough to be using a static IP address, you should know what to do :-)
  • You may still need to add a sleep command to /etc/init.d/mediatomb, as described below for OS X, to get reliable startup without error -117.
OS X

Probably the same issue as ubuntu: creating a StartupItem for OS X makes mediatomb start before the network interface is ready for it and then fails with “ERROR: main: upnp error -117”. A workaround for this issue is to add a line “sleep 60” to the StartService routine so the service gets up after a minute when the network interface is probably ready for it.

I am running MediaTomb on a NAS, why do I see several running instances ?

On some platforms threads will appear as processes, so when you do:

ps

you will see several processes, which may let you think that mediatomb has been started several times, which however is not the case.

I have my data sorted on my disk the way I want it, how can I show only the PC-Directory and disable generation of other containers?

If you do not want to generate the virtual containers you can turn the layout feature off, then only the PC-Directory container will be shown. Doing so will also significantly speed up the import of media.

Edit your config.xml and set this:

<virtual-layout type=“disabled”>

Player Quirks

PS3 won't play .avi files anymore after updating to 2.70

The PS3 doesn't like the video/x-msvideo mimetype for .avi files anymore after that update.

Add this to the section with the other <map…./> lines in your config:

<map from=“avi” to=“video/divx”/>

save the config, restart mediatomb, and reimport all your avi files.

You can check the mimetype of the files in the webui by navigating to the file in the database tab,and clicking the edit button (the piece of paper).

My player wants a non-standard mimetype for my content, how do I change it?

Add a custom extension to mimetype mapping in config.xml.

For example, if you want that all .avi files get the video/x-divx mimetype, use the following mapping:

<map from=“avi” to=“video/divx”/>

The mapping is only triggered when the data is being imported, the setting will not affect content that is already in the database. If you want to update previously imported files you will have to reimport them: remove from the database and add them again.

My player supports some .avi movies, but not all (eg PS3)

A good example is the PS3: It supports many variations of the divx codec, but not the DIV3 version. (maybe others too).

The PS3 will say “the data is damaged” when trying to play such a movie.

I assume here the movie is in avi container.

The solution is transcode this specific codec version based on the fourcc string. In the mimetype-profile-mappings section, put:

<transcode mimetype=“video/divx” using=“video-common”/>

You can take the video-common transcoding profile/script from various places, I won't repeat that here. Then, you must add this to your video-common transcoding profile:

<avi-fourcc-list mode=“process”> <fourcc>DIV3</fourcc> </avi-fourcc-list>

This makes sure you will not transcode any avi, except DIV3 (you can add more if you player doesn't support more)

You can still use this profile for non-avi movies also, the avi-fourcc-list block only accepts avi movies.

My Player is unable to play some MP3 files

If this is the case:

  • Your MP3 directory is set to the Inotify scan mode.
  • Your MP3 has an album art image in its ID3 tag.

Then you have hit the taglib problem where taglib opens the mp3 in read-write mode instead of read only.

There are two possible fixes:

  • Use the Timed scan mode on your MP3 directory instead of Inotify.
  • chmod your MP3 file to read only.

This problem has been reported to taglib but it's unlikely we will see a fix any time soon.

Pause video while transcoding on PS3

With PS3 firmware 2.50+ pressing the PS button causes a pause of video playback.

DLNA TVs

Adding this to the config file helps in getting content to be played on some TVs.

<protocolInfo extend="yes"/><!-- For PS3 support change to "yes" -->
 
<custom-http-headers>
  <!-- Samsung needs it -->
  <add header="transferMode.dlna.org: Streaming"/>
  <add header="contentFeatures.dlna.org: DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000"/>
</custom-http-headers>

Scripting

I modified the import.js script, but I see no changes when importing data, what's wrong?

You probably forgot to change the virtual layout type from builtin to js in config.xml:

<virtual-layout type=“js”>

Also, make sure the line:

<import-script>/etc/mediatomb/import.js</import-script>

Points to the correct location where your import.js resides.

Debugging

How do I check what XML is offered to the UPnP devices?

Get the Cidero control point from http://www.cidero.com (free download), run the MediaController application. Open the debug window: Options→Debug Window…

In the main window click on the MediaTomb icon, you will be presented with the content (i.e. with the content layout which you can also see on your UPnP device). Each time you click on a container in the tree you will see a “MediaTomb: Browse Status: OK” entry in the debug window. Click on this line in the Debug Window and you will see the XML of the browse response below.

Jin asked me for a wireshark capture, what do I do?

First of all, make sure that you make the capture on the machine where your MediaTomb server is running. Download and install wireshark on that machine, start wireshark. Make sure to select the correct network interface for the capture - it must be the interface on which MediaTomb is running. Start the capture, start MediaTomb, then start your UPnP player. Reproduce the problem which you are debugging, then stop the capture and save it in pcap format.

 
faq/faq.txt · Last modified: 2011/03/16 22:07 by robk