A UPnP (Universal Plug-n-Play) server will announce its presence on your local network and allow media files to be streamed to any device running a UPnP browser/player (such as MediaHouse browser for Android, which I’m using). Out of the box, the MediaTomb UPnP server will stream most types of standard media files without problems, but there is no direct way of interacting with the DVD menu from the UPnP browser. While you can use an external program like VLC to stream the MPEG contents of an ISO, if you want to be able to play different sections of the ISO (for us that means mostly playing different episodes of television series) you will have to use MediaTomb’s scripting ability – which is inactive in the version you will get using apt-get
.
The feature to activate is MediaTomb’s integrated JavaScript engine, which allows you to break down ISO files into different “virtual objects”, each representing a section (or language etc) of the ISO, which you can then play directly in your UPnP browser/player. To enable scripting, you need to compile MediaTomb with support for libjs
. The instructions here are a combination of information found on Richard Appleby’s blog, Ebixio and a bit of trial-and-error:
sudo apt-get update
sudo apt-get build-dep mediatomb
cd ~
apt-get source mediatomb
nano mediatomb-0.12.0~svn2018/debian/rules
# or use your favorite editor. The version you just downloaded may also be different
In the file, search for MEDIATOMB_CONFIG_OPTIONS and change --disable-libjs
to --enable-libjs
. Change --disable-libdvdnav
to --enable-libdvdnav
and add --enable-libdvdread
You will also need a JavaScript interpreter for ARM (here SpiderMonkey which depends on libmozjs0d
and libreadline5
):
sudo apt-get install libreadline5
sudo wget http://launchpadlibrarian.net/19949433/libmozjs0d_1.8.1.16%2Bnobinonly-0ubuntu1_armel.deb
# from Launchpad
dpkg -i libmozjs0d_1.8.1.16+nobinonly-0ubuntu1_armel.deb
sudo wget http://launchpadlibrarian.net/19949435/spidermonkey-bin_1.8.1.16%2Bnobinonly-0ubuntu1_armel.deb
# from Launchpad
sudo dpkg -i spidermonkey-bin_1.8.1.16+nobinonly-0ubuntu1_armel.deb
You will also need the packages libmozjs-dev
and libdvdnav-dev
:
sudo nano /etc/apt/sources.list
Add this line to the bottom
deb http://security.debian.org/debian-security squeeze/updates main
And continue with the packages:
sudo apt-get update
sudo apt-get install libmozjs-dev
sudo apt-get install libdvdnav-dev
# this will also install libdvdread-dev
Now, typing in sudo mediatomb-0.12.0~svn2018/.configure
will go through all the compile options and everything should be fine at this point. The following will compile three .deb files which you can subsequently install (time for coffee at this point while your Cubox chews through the code):
cd mediatomb-0.12.0~svn2018
sudo dpkg-buildpackage -rfakeroot -us -uc
The following will prevent your custom MediaTomb from being overwritten when you update your software:
sudo su
echo mediatomb hold | dpkg --set-selections
echo mediatomb-common hold | dpkg --set-selections
echo mediatomb-daemon hold | dpkg --set-selections
echo libmozjs2d hold | dpkg --set-selections
echo libmozjs-dev hold | dpkg --set-selections
press Ctrl-D to exit super-user mode.
I then had to install some Firefox/IceWeasel components to continue (not sure why, you can try without and see what happens):
sudo apt-get install libjs-prototype iceweasel firefox
sudo apt-get -f install
sudo apt-get install firefox
Finally, install the three .deb packages created by the compile process earlier:
cd ..
sudo dpkg -i mediatomb*.deb
The last steps are to install the packages MediaTomb needs to read and understand the DVD structure:
sudo apt-get install libdvdread4
sudo apt-get install libdvdnav4
– and finally to tell the config file to parse DVD ISO images using the JavaScript engine (there is a sample script file with the MediaTomb distribution which works quite well, but you can also customise the script to suit your needs):
in ~/.mediatomb/config.xml
replace:
<virtual-layout type="builtin"/>
with
<virtual-layout type="js">
<dvd-script>/usr/share/mediatomb/js/import-dvd.js</dvd-script>
</virtual-layout>
Under the tag <mimetype-contenttype> add:
<treat mimetype="application/x-iso9660-image" as="dvd"/>
Start the program with mediatomb --daemon
, use your browser to navigate to http://your.server.ip:49152
and use the web interface to add your media file directories. When this is done (can take a while for ISO files) you can happily stream all your content to your favorite UPnP browser.