Tuesday, August 24, 2010

Mediatomb UPnP server on your EON ZFS NAS

MediaTomb is an open source (GPL) UPnP MediaServer with a nice web user interface. It allows you to stream your digital media across your home network and listen to/watch it on a variety of UPnP compatible devices. Mediatomb is now available for your EON ZFS NAS in the download section (mtombaa, mtombab) and can be added using the following steps. The binary kit MUST be installed for mediatomb to work.

So let's get started by downloading and re-assembling the mediatomb package.
NOTE: The following steps should be performed as user id "root" unless otherwise specified.
cd /tmp
wget -O mtombaa http://sites.google.com/site/eonstorage/downloads/mtombaa?attredirects=0&d=1
wget -O mtombab http://sites.google.com/site/eonstorage/downloads/mtombab?attredirects=0&d=1
cat mtomba[a-z] > mtomb.tgz
Next, let's create the necessary directories and unpack the mediatomb package.
cd /abyss
mkdir mediatomb
cd mediatomb
gzip -dc /tmp/mtomb.tgz | tar -xf -
Let's add the following entries to /mnt/eon0/.exec, so mediatomb will start automatically when the EON ZFS NAS is booted.
# mediatomb section
(cd /opt ; ln -s ../${POOL}/mediatomb .)
[ -x /opt/mediatomb/bin/start_mtomb.sh ] && /opt/mediatomb/bin/start_mtomb.sh
Let's create the mediatomb logging, database and configuration directories. Also get the start up script (start_mtomb.sh)
mkdir etc log
cd bin
wget -O start_mtomb.sh http://sites.google.com/site/eonstorage/downloads/start_mtomb.sh?attredirects=0&d=1
chmod 755 start_mtomb.sh
(cd /opt ; ln -s ../abyss/mediatomb .)
And finally, to start mediatomb.
/opt/mediatomb/bin/start_mtomb.sh
If all went well, you can point a browser to EON NAS http://ip:49152/ and you should see a image similar to the image below. Let the movie streaming begin.
Mediatomb UPnP server on EON ZFS NAS

23 comments:

Max said...

Fantastic.
Thank you!

Patrick said...

Awesome. I appreciate it. How hard it is it to add various codecs/subtitle support/etc?

Andre Lue said...

Hi Patrick,

Which codecs are you missing? Does transcoding via ffmpeg not work for those video files?

To add subtitles, I would have to compile mencoder/mplayer and it would require editing config.xml with the following example

Patrick said...

I havent tried but I was curious if it would be able to transcode x264 to the PS3. It seemed that ffmpeg is not part of mediatomb by itself, I didn't realize you included it. I did try the configuration bit, but it said it was missing mencoder. It would be nice, if it doesnt take too long to compile. I'd be grateful.

Thanks, it has been much nicer transcoding from the same machine that my files are on, instead of routing the files from the nas to my pc to the ps3.

Andre Lue said...

Hi Patrick,

I tried to include a good number of options. Take a look at the build notes if you wish to see the compile details of each program in mediatomb.

I will try to give mencoder another shot but I ran into libavcodec linking and gcc>=4.2 issues with mencoder last time, hence it was omitted.

Erwin said...

Hi Andre,

It's been a while since I've worked on my EON box. It's running wonderfully and serving well for quite a while now, thanks for that!!

I've tried to follow your mediatomb install, but run into a couple of problems.
First I have to tell I perhaps should have installed /updated the binary kit before. I did not do so.
(Have been doing some stuff with it in the past, but to be honest, I was never really sure it was properly installed and functioning.)

As always I try to follow your examples as user admin, and will only su when I can't step any further forward. Don't know about others, but it might be a good idea to post your general mode of work here (login as user bla, su bla, change dir abyss according your own preferences etc. just to iron out these minor hickups)

The install seems to have run fine, but I can't seem to reach mediatomb (http://eon_IP:49152)
Trying to start mediatomb, I received errors indicating eon could not create log.
So next I fumbled with chmod & chown to get it going, and issuing
ps -ef | grep mediatomb delivers:
------------------------
eon:29:/universe/mediatomb>ps -ef |grep mediatomb
admin 972 915 0 02:50:03 pts/1 0:00 grep mediatomb
------------------------

I installed / updated the binary kit afterwards, this all seems to work out fine, typing "aria2c -v" gave the expected result, and I can now use nano, thanks for that ;)
I then ran through the mediatomb install process once more, but with the same result.

I'm fairly shure there's no network or port issues, as my EON box sits on my internal network, and is well reachable.

Thanks for your suggestions,

Erwin

Andre Lue said...

Hi Erwin,

Thanks for the feedback. The installs (binary kit, mediatomb) are to be done as user "root".

Mediatomb could be done as a less privileged user "admin" but would require more testing to get log directory ACLs right, etc.

I will update the mediatomb and binary kit posts to show which user should run the setup commands.

Erwin said...

Andre,

Thanks for replying.
Does this account for my finding of a mediatomb process, but not being able to load mediatomb in a browser?

Thx,

Erwin

Andre Lue said...

Hi Erwin,

If you see a process running, you should be able to connect.

Do you have 2 nics? The process might be bound to the wrong nic.

Try the following. On EON or via a terminal as admin do:
telnet EON_IP 49152

If it connects you will see a message of the form "escape character is".

Sebastian said...

Andre, your work is very much appreciated!

I installed eon-0.600-130-64-cifs-min.iso but bash calls wget an invalid command. How do I use wget with eon?

Andre Lue said...

Hi Sebastian,

Thanks for sharing your feedback. It sounds like the binary kit is not installed.

The binary kit contains wget and other libraries that mediatomb rely on and must be installed for mediatomb to work.

Lexje said...

Hi Andre,

Finally got around to my 2nd EON install. Took some paper notes, and will try to tidy these up. May prove useful for others; will let you know when done so you can have a look before posting.

Got Mediatomb up & running. I'm definitely no media-server guru, but I seem to have another one running in the house (LinuxMCE).
Not a PS3 guru either, but got one from ebay, mainly for BD, SACD and media player capabilities.
I was pleasantly surprised to see the PS3 pick up on mediatomb immediately.
Ran into some problems, did some research and did some mods to mediatomb's config.xml (it turns out they are presently listed, but commented out in the present config.xml)

Question:
I run into problems however.
After running a database scan for something like over an hour, mediatomb seems to choke.
I'm under the impression it has to do with UTF / ISO-8859-1 settings. I know what this is about, but I don't know in depth what's going on.

Errors:
- lots & lots of [[ERROR: iconv: No such file or directory]]
- otherwise most errors seem to have codeset errors, e.g. french accents, dutch accents etc. [[ Les années Philips]]
- it ends with [[ERROR: iconv: Too many open files]]

found a post here.
Tried to add these lines, but mediatomb would not start after reboot.

* Do you have any suggestion on how to solve these?
* How can I stop / restart mediatomb? I know how to start with the start_mtomb.sh script, but what if we need to stop / restart?

Thanks a ton for your wonderful work!

Erwin

Andre Lue said...

Thanks Erwin,

To stop mediatomb(as user ID root or PID owner):
pkill mediatomb

to start/restart:
/opt/mediatomb/bin/start_mtomb.sh

I think you can do to re-read config.xml changes (not sure):
kill -HUP `pgrep mediatomb`

Can you kindly start a thread and post your /opt/mediatomb/log/mediatomb.log file and some more detailed excerpts of the errors?

Thanks

Lexje said...

Andre,

Update:
In the meantime I've researched the mediatomb documentation. It appears I had put the previously mentioned lines in the wrong place. (Too used to linux style config files & uncommenting I'm afraid...)
So I've got rid of the majority of errors for now.

The good thing:
At least a full scan can take place now without choking mediatomb.

I'll need to follow up on this, and will post if issues arise.

Posting the mediatomb.log wouldn't be too good an idea: It's like 20 GB!
I did a cat on the log, and it kept on running forever! Took a long shower, went to do some errands, and when I returned I still had to kill the scrolling!!

Thanks a lot,

Erwin

Lexje said...

Streaming DVD iso

Hi Andre,

Digging a bit deeper into this mediastreaming stuff I would be interested in installing / compiling mencoder as well.
I'd very much like to be able to stream DVD iso images.
According to this link, this should be possible.

Have you gone any further with mencoder yet?

Thanks a lot!

Erwin

Andre Lue said...

Hi Lexje,

The mencoder fix requires some work. The current version I was testing segfaults complaining that the symbol table for the libav* in ffmpeg are improperly aligned.

Further digging shows the entire notes.mediatomb would have to be rebuilt with gcc 4.2.6+ to fix this. That would require a new binary kit as well with the newer libgcc. This will require some time.

Guido said...

Great Andre, thanks for MT.

Now what's missing for me is currently mkv (matroska) file support.

Any chance of having that also added sometimes ?

Guido

Andre Lue said...

Hi Guido,

Matroska (mkv) support should already work using ffmpeg.

Try the following mkv streaming instructions and that should get it working. The path in the script should be /usr/local/bin/ffmpeg.

When you get your config finally tweaked you can share it for others etc. Others are also welcome to share their configs. Hope that helps.

ìgbàlonígbàńlò said...

for noobs you might need to run the following command and tweak it to get the actual interface you use. I had a bonded lacp aggr interface.

ifconfig -a | sed '/lo0:/,/inet/d' | grep ".*1: flags" | awk '{print $1}' | sed 's/://g
' | head -1

Patrick said...

Andre,

I was trying to setup my system to stream mkv fileson the fly to my PS3. I notice you say we should have ffmpeg in /usr/local/bin, but I do not see it. Is it an easy install? Have you worked through the steps to add ffmpeg to the mediatomb install?

Thanks,
Patrick

Andre Lue said...

Hi Patrick,

Sorry, ffmpeg is located in /opt/mediatomb/bin if everything is linked properly. See /zpool/mediatomb/bin if there is no /opt/mediatomb.

Roenbaeck said...

Any chance you could look into compiling miniDLNA as well? I have been running both miniDLNA and media tomb over the last couple of years, and I much prefer miniDLNA. However, it uses inotify when compiled on Linux to detect directory changes. I'm not sure if there is something similar in Solaris.

Andre Lue said...

Roenbaeck,

Last check, which has been a while, miniDLNA failed to compile on Opensolaris. As far as I know inotify is not available on Opensolaris/Openindiana. I will try to give it another look.