Wednesday, February 8, 2012

Mediatomb, stream your PC media to TV (Ubuntu)

MediaTomb is an open source UPnP Media server with a cool web user interface, which allows you to stream your digital media through your home network and listen to, or watch it on a variety of UPnP compatible devices. That means no cable directly connected to your PC! It even makes it possible (with some tweaking) to stream YouTube videos to your TV.

You can get it with this CLI command in Ubuntu:
sudo apt-get install mediatomb

Now start your Mediatomb and quit it right after it starts, either with CTRL+C or kill pid, does not matter.
You can start it with this command:

(*Note, I had to do this for the config file to be created in the hidden directory, .mediatomb that is)

Open the config file (be sure you are in right directory!):
sudo gedit ~/.mediatomb/config.xml

<ui enabled="no" show-tooltips="yes">
<ui enabled="yes" show-tooltips="yes"

if you wish to enable web user interface (this is a major security risk though, anyone on your network can access your root files and manipulate them, so be sure to disable this when done with the config, especially if you plan to run this for a few hours+!).
You can select within it, which folder is being scanned for media. It is quite user friendly and straightforward.

If you have a TV with a ethernet port, be sure to plug it into the same network, and source-find Mediatomb. When opened, you will be able to select videos, music or photos available from your PC, and play them!
Do not forget to select which folder is "sharing" content to your TV, which is done in the Web user interface.

***I had some issues with the Samsung TV, everything i tried to play gave me "unsupported format" error. Here is a fix that seemed to work even for other TV brands.

Open the config file:
sudo gedit ~/.mediatomb/config.xml

Remove the comments (<!-- -->) from <custom-http-headers> part and add/modify things so it looks like this (note that 017000 000.. is all in a same line):
<add header=" Streaming"/>
<add header=" DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=017000 00000000000000000000000000"/>

Now, find <mappings> and add the following:
<map from="avi" to="video/mpeg"/>
<map from="mkv" to="video/mpeg"/>

You need to restart Mediatomb for the changes to take effect.

***To disable Mediatomb autorun, do this (backup first):
sudo mv /etc/init.d/mediatomb /etc/init.d/mediatomb.backup
sudo update-rc.d mediatomb remove

If you instead wish to use the autorun feature, be sure to edit the config file located in /etc/mediatomb (yes, there are actually two config.xml).



  1. That's a really useful tool, thanks!

  2. I've always wanted to fiddle around more with Ubuntu, thanks!
    I'll be following you from now on!

  3. That's a great thing! I really do think I'm going to run Ubuntu on my laptop when I get my new desktop! This is encouraging!

  4. I fear my meager laptop can't handle this

  5. This is awesome I was searching for 1such thig in the last week.Now I am gonna try this today.This blog contains very useful posts.ecommerce development e commerce web development ecommerce website development

  6. That's pretty neat I use my ps3 for this sometimes!