Run a DLNA Server that Works with a Samsung TV :: Updated

Having just bought a Samsung ‘Smart’ TV, I was very keen to take advantage of its built in DLNA media renderer. I already have mediatomb running on my headless file/mail/web/whatever server, so I thought I’d be all ready to go. Sadly, Samsung seems to have not implemented the DLNA standard in a sane way, and despite following a number of guides on I found on the internets suggesting sending custom http headers to the TV, I could not get mediatomb to play nicely with the TV.

Don’t start me on why Samsung can’t make DLNA work properly. Rather than supporting the standard, they have written and support their own Windows only DLNA server. Not very helpful for their customers who run Linux, OSX or have a NAS appliance. Anyway, I digress. Having originally written this article based on PS3 Media Server, I’ve since also discovered other cross platform servers that work well with Samsung TVs – tvmobili and serviio – so I’ve updated this article to cover that as well.

PS3 Media Server

So having given up on mediatomb, I turned to ps3 media server. PS3 media server, as the name suggests, is a DLNA server focussed on the PS3 as a DLNA renderer. However, it has been adapted to operate with a number of different renderers, including Samsung TV’s. PS3 Media Server is written in java and is GUI based. This is fine for windows users, who would generally run a server with a GUI. However, for me, and my headless server, it poses a few problems. The main one being getting the thing to run as a daemon. There are a number of options for doing this, but the standard ones didn’t seem to work that well on my setup, so I had to get creative. Anyway, into it:

First thing is to make sure you have a working JAVA runtime. Your distribution should provide the necessary packages. Then download the latest ps3 media server from here. Uncompress it with:

tar -zxpf pms-generic-linux-unix-1.50.1.tgz

If you are running it headless, then you’ll need to set up a basic configuration. So create a file at ~/.config/PMS/PMS.conf containing:

thumbnails = true
thumbnail_seek_pos = 300
mencoder_ass = true
folders = /path/to/folder/1, /path/to/folder/2
hide_videosettings = true
hide_enginenames = true
audiochannels = 2

If you’re not running headless, just start PMS by cd’ing to the directory you created with the tar command above and type:

./PMS.sh

If you’re running headless, then there are a number of ways to run ps3 media server, so that it doesn’t stop running when you logout. The way a lot of websites suggest is to use the nohup command, like this:

nohup ./PMS.sh &

nohup prevents the hangup signal (the signal given when you logout of the shell from which you ran the command) from being passed to the ./PMS.sh programme and keeps it running when you log out of your ssh session. However, on my setup, this didn’t work – ie. when I logged out of the ssh session, ssh hung, and when I killed the terminal I was using to run ssh, PMS stopped running. An additional suggestion was to redirect all output, which should help with this behavior. So run:

nohup ./PMS.sh > foo.out 2> foo.err < /dev/null

This didn’t work for me either. So I tried running the command using screen. This should allow me to detach from the screen session, and then logging out of ssh should not affect PMS.sh. However, again this didn’t work. Logging out of ssh hung and killing the terminal killed PMS.sh. So, I tried running it using the at daemon, and hey presto, it worked! So to do this, run this command:

echo ./PMS.sh | at now

tvmobili

tvmobili is a cross platform uPNP/DLNA server which works well with Samsung TV’s, as well as a number of other devices. Unlike PS3 Media Server, it isn’t free. It has an interesting payment model – the first month of use is free. You can then stream 10GB of video per month free. Anything over that, and you need to pay to use it. It seems you can either pay a small monthly fee to use it for that month, or a one off fee to have unlimited streaming “forever”. At this stage, I’ve only been using it for a few days, so I haven’t had to pay to use it yet. Configuration is done through a web interface, so tvmobili can be used on a desktop or a headless server easily.

Installation is relatively straightforward. The developer provides both .rpm and .deb packages for easy installation on most mainstream distributions. The packages also install an init script to easily start the server as a daemon. There is a bit of a trick when using this server with OpenSuse. The init script supplied starts the daemon using the daemon command. However, this command is not available on OpenSuse, instead they use the startproc command. So open /etc/init.d/tvmobilisvcd in an editor, and replace this line:

daemon --pidfile $PIDFILE $DAEMON /packageroot:$PACKAGEROOT /LogDir:$LOGDIR /PidFile:$PIDFILE

with:

startproc -p $PIDFILE $DAEMON /packageroot:$PACKAGEROOT /LogDir:$LOGDIR /PidFile:$PIDFILE

also, comment or delete this line:

. /etc/rc.d/init.d/functions

then start the server with:

/etc/init.d/tvmobilisvcd start

Configuration is pretty straightforward. Just point your browser to port 30888 on the machine you installed tvmobili on. You can then pretty much follow your nose from there. Specify the folders containing your content, and pretty much leave everything else alone – worked for me.

serviio

Servio is another free cross-platform uPNP/DLNA server. There is a pay “pro” version, however, this version doesn’t have any features that are particularly useful to me, so I’m using the free version. However, this server has a wide range of supported renderers, including Samsung TV’s.

Installation is pretty simple. Serviio is a java application. All that is required is Java 6 and the ffmpeg libraries – both of which are installed by default by the major distributions. Simply uncompress the downloaded tarball, change to the bin/ directory found in the extracted directory and run the shell script ./serviio.sh. If you are running headless, then open up a screen session, and run it from there. Unlike PS3 Media Server, there are no issues with the server exiting when you exit the terminal session you’re logged into.

To configure, run the ./serviio-console.sh script from the same directory. There are quite a few configuration options, but the defaults are quite sane. The main option you want to look at is specifying the folder(s) containing your media files.

One of the strengths of this server is the fact that it uses ffmpeg as the transcoding engine. The quality and the speed is noticeable when compared with PS3 Media Server (which uses Mencoder) and tvmobili (which uses vlc). The other strength is the use of metadata to organise and present your files in your renderer. Serviio accesses metadata about all your files from the internets and uses it to create a whole bunch of virtual folders which allow you to easily find whatever you want – for example files organised by actor, director, genre, tv series etc. What’s more it works. I have a number of different tv shows spread around various directories. Serviio gathers them all up, and puts them all in the correct show and season folders.

Serviio is the best uPNP/DLNA server I’ve come across. The virtual folders are the clincher. There’s even an android app for configuring it (see screenshot above).

Enjoy.