View: HTML | Text | PS | PDF | RTF | Wiki | DocBook | DocBook Inline | changelog | about this header Circle Jeff Boweron  
Configuring a DNLA Player Under Ubuntu

Configuring a DNLA Player Under Ubuntu

This document describes how to steam media to your Ubuntu box.


Table of Contents
1. Introduction
2. XBMC
3. Coherence
3.1. Help! My servers aren't showing up!
A. Playing NetFlix on Ubuntu
B. Discussion
C. About Me

1. Introduction

DLNA, also referred to as UPnP, is a means for you to share your media with other devices on your home network. Once relegated to the ubergeeks, DLNA is becoming increasingly popular. Many standalone devices can act as DLNA servers, and you can look into PS3 Media Server or MediaTomb to stream your media from Ubuntu or Tversity and PlayOn to stream from a Windows server (more on PlayOn in a bit). But how do we get your media from a server in your basement or TV room to your Ubuntu laptop?


2. XBMC

The most common method is to install XBMC, a full-featured, multi-platform media player. But XBMC's interface is a little invasive, it's designed for an HTPC (Home Theater PC) where you view it from a distance. As such it has a very nice interface that can be controlled with simple keystrokes without the need for fine mouse control.

XBMC works best in full-screen mode. It can operate in a windowed mode, but you'll find some things like mouse and keyboard focus can be a bit odd at times. The mouse cursor also changes to a large, high contrast mouse well-designed for viewing across the room.

Figure 1. XBMC Screenshot

XBMC has two main problems. The first is the interface. While fantastic for sitting in front of the PC with a bowl of popcorn, the vast majority of the stuff I watch is playing in a small window in the background and I'd rather have a few simple clicks than to scroll through the pretty interface.

The second is a bit more serious, we're two months into the Maverick release and XBMC still doesn't have a Maverick repository. While I'm sure I can get the Lucid build to work, it's broken out of the box on my TouchSmart.

UPDATE: Shortly after the initial draft XBMC did release an update supporting Maverick. While still not a great choice for my own desktop use it's now a viable option for a HTPC or for people looking for a full-screen, keyboard only experience. From a personal standpoint, I still don't like that they missed two months of support for an OS that I'll only have installed for six months and they don't officially support Lucid. This latter is a bit more serious, for a dedicated HTPC I'd certainly run an LTS version of Ubuntu just like my servers unless there was a strong reason not to. With official support for Hardy running out in April 2011 (three months away at the time of this update) I really need official Lucid support soon.

Still, by all accounts it runs just fine on Lucid and it's free software so it's hard to complain too loudly (especially since I'm sure it's more of a lack of documentation update than a lack of intent). If you want to install it, visit their Installation Page or just run the commands below. Amusingly, this installation procedure does not work on any officially supported Ubuntu release...


sudo add-apt-repository ppa:team-xbmc
sudo apt-get update
sudo apt-get install xbmc

You can get help setting up a DLNA (or UPnP as XBMC calls it) source on their website. It's pretty straightforward and a decent reason to go out and get a remote control for your PC. Another alternative is to look at some of the Android-based remotes.


3. Coherence

Coherence is a Linux library that can handle connecting to DLNA servers. To install it, run sudo apt-get install python-coherence and you should be all set.

The default video player in Ubuntu is Totem (called "Movie Player" in the Applications menu). To integrate DLNA support in Totem we'll need a pair of files that we'll copy to a new directory /usr/lib/totem/plugins/upnp-coherence/. We need the plugin definition and the plugin code. Alternately you can execute the following commands to download them from the source. More details can be found in the Coherence Wiki.


sudo mkdir /usr/lib/totem/plugins/upnp-coherence && sudo wget --output-document /usr/lib/totem/plugins/upnp-coherence/upnp-coherence.totem-plugin   http://coherence.beebits.net/browser/trunk/Coherence/misc/Totem-Plugin/upnp-coherence.totem-plugin?format=raw && sudo wget --output-document /usr/lib/totem/plugins/upnp-coherence/upnp-coherence.py   http://coherence.beebits.net/browser/trunk/Coherence/misc/Totem-Plugin/upnp-coherence.py?format=raw

Now you'll need to open up Totem (or restart it) and click on Edit --> Plugins. Check the "Coherence DLNA/UPnP Client" box and click Close. NOTE: If you're running Oneiric you'll probably want to check out this bug. Coherence is apparently borked in this release.

Figure 2. Enable Coherence Plugin

On the right-hand side there's a dropbox box that probably says "Playlist", click on it and you should be able to select "Coherence DLNA/UPnP Client" which will eventually bring up a list of available servers.

Figure 3. Showing DLNA Servers

You'll note in the screenshot listings for Hulu and Netflix, read on to learn a bit more about PlayOn.


3.1. Help! My servers aren't showing up!

DLNA is a little temperamental when it comes to announcements. On all of my DLNA clients and with all of my servers I've ended up with times where I can't see one server or another. I've found that the easiest way to handle this is to bounce one of my servers. Since I run the servers in a VirtualBox virtual machine, it's fairly trivial for me to open up an rdesktop session into the DLNA guest and disable one of the media servers. If I know someone's streaming from one (for example, if there's a good chance someone's watching Hulu from PlayOn) then I've found that bouncing another often will cause the client to detect all the DLNA servers on the system. In other words, if I bounce Orb my Tversity and PlayOn servers will appear in the list.

If you don't have access to the media server, or you just don't want to risk having issues with other users, you can also try exiting Totem and running the command sudo killall coherence. When you open Totem again it will restart Coherence and broadcast another request for servers.

This is a little annoying but considering how pervasive the problem seems to be I suspect a protocol-level issue.

Another thing to try is to see if other systems can see your DLNA server. The XBox 360 and PS/3 both can play DLNA streams, many Android phones have DLNA players, or you can try running a DLNA client on other systems (XBMC runs on Windows and Mac as well as Linux, I'm sure there are others that also work just fine). If nothing can connect you'll want to check your server, particularly the firewall and whether you can run a player on the server itself.

Restrictive outgoing firewall rules on your client may also be a problem, but probably more common would be an issue where both of your systems are connected via wifi. As a security feature, many new wifi routers will restrict direct wifi-to-wifi communication by default. You may be able to disable this feature, but I'd strongly recommend trying to hardware at least your server to the network. Wifi by itself isn't horribly reliable for large scale streaming, and you'll use twice the bandwidth if you need to stream from your server to the wifi access point and then from the access point to the client.


A. Playing NetFlix on Ubuntu

OK, I'm the first to admit this is a cheat. However, if you've got a lot of Linux boxes it may be a good option for you since it's only cheating once.

First, I encourage all of you with accounts to make it a point to try to watch movies on Netflix Instant Play as often as possible. The more people they have hitting their servers with Linux browsers the more likely they are to realize that they should develop a Linux client. Hopefully with Chrome netbooks coming out they'll listen, especially considering the blow-back from their recent announcement touting open source while failing to have a Linux client.

However, despite this lack of a client I'm currently streaming a movie from NetFlix to my Ubuntu machine as I'm writing this. In essence you need at least one Windows machine on your network, this is where the cheating part comes into play. If you don't have such a machine, you can consider VirtualBox - an easy-to-use and yet still powerful virtualization platform that allows you to run Windows inside of a Linux box. VirtualBox is a document for another day, but it has a nice wizard-based interface and the only change you'll need to make from the defaults (once you select the appropriate OS) is to change the network interface from NAT to Bridged. I also try to give it a little more memory, try for at least 1GB or about half of the physical memory you've got - trial and error will help you find a happy medium here. You may also find that virtualization takes its toll on the CPU horsepower, and a lack of GPU acceleration doesn't help either. I have the PlayOn video quality set to low, but I also only have a basic PC as my server and four full-time VMs.

Obviously licensing is an issue here. Many PCs come with an OEM license for Windows, check the license carefully against the laws in your country, you may be able to install Windows into a virtual machine on the same hardware. For my money it's worth looking into a Microsoft Action Pack Subscription, this gives you access to a bunch of Windows licenses as well as a wealth of other MS software that can be used in a non-production environment. Obviously I don't recommend that you search for things like "Windows XP slipstream torrent" or other illegal ways of getting the software, but I can say that it's often cheaper and easier to just go out and buy a low end PC than it is to deal with these licensing things. Needless to say, please don't construe any of this as legal advice since I'm not a lawyer nor do I play one on TV.

Now you'll need a fantastic little program called PlayOn. It resides on your Windows box and will use DLNA to stream local media, NetFlix content, Hulu content, and content from a slew of other locations. They're on the verge of releasing an Android application as well which will make it all the more powerful. There's a free trial, and keep an eye out for sales that frequently mean 50% off (follow them on Twitter or Facebook to keep tabs on the sales).

To configure PlayOn just click on the icon in the system tray, desktop, or start menu. Under Channels you can enter your account information for some of the various services or disable the channels you don't want. For Hulu it's optional (it gives you access to your queue), however NetFlix is a subscription-based service so you'll need it there.

Figure A-1. PlayOn Setup

Under the Coherence panel in Totem (or under DLNA/UPnP server lists on other players/dedicated hardware) you should now see "PlayOn" appear with links to various services.

This is only one step better than the advice to run a Windows virtual machine and play your movies via a Windows browser. If you've got a single Ubuntu PC I'd probably recommend that route, it's a cleaner solution in most respects and you can probably get better performance. However, you'll need one VM for each machine with that solution, and on a netbook running Windows in a VM is a bit taxing by itself. With the PlayOn solution you'll only need a single Windows box for your entire network, everything else can stream from it - including many standalone devices and DLNA-enabled TVs.


B. Discussion

Questions, comments, problems or complaints? Discuss this document on our forum here.


C. About Me

My name is Jeff Bower, I'm a technology professional with more years of experience in the telecommunications industry than I'd care to admit. I tend to post with the username jdbower on various forums. Writing these documents is a hobby of mine, I hope you find them useful and feel free to browse more at https://www.ebower.com/docs.

If you've got any questions or feedback please feel free to email me at docs@ebower.com or follow me on Google+ or Twitter.