UPnP

From MythTV Official Wiki
Jump to: navigation, search

Universal Plug and Play (UPnP) media sharing is an extremely easy method of sharing media (pictures/video/audio) on your network as it features automatic discovery and does not require any configuration. As with most things which are very convenient, the security of any given implementation is an issue to which careful attention should be paid.

Introduction

Universal Plug and Play is a set of computer network protocols from the UPnP Forum. The goals of UPnP are to allow UPnP devices on a network to detect each other and connect seamlessly, and to simplify the implementation of networks in the home (data sharing, communications, and entertainment) and corporate environments.

The UPnP architecture supports zero-configuration, which implies no need for manual configuration on the user's end. There are typically three types of UPnP AV (Audio/Video) device control protocols (also called profiles); "UPnP AV MediaServer" whose sole purpose is to share content, "UPnP AV MediaRenderer" which renders content and exposes an interface to control the playback, and a "UPnP AV MediaServer ControlPoint" which can detect/find "UPnP AV MediaServers" and browse them to read media from them. A DMP (Digital Media Player) typically only implements a UPnP AV MediaServer ControlPoint, to be able to play files from UPnP AV MediaServers.

For a more detailed explanation see Developers Notes on UPnP.

UPnP in MythTV

MythTV versions starting from 0.20 have a built-in UPnP server (a so called "UPnP AV MediaServer" device). UPnP servers are where you store and share your media (pictures/videos/audio/music) from. So you can share MythTV media files to any UPnP client (a so called "UPnP AV MediaServer ControlPoint" device) on your local-network, as long as the UPnP client is not behind a firewall or you have opened the ports for UPnP in your firewall (1900 UDP and 6543 TCP). The UPnP client can then play those media files if it supports those MythTV codecs/container formats.

UPnP Clients

UPnP AV MediaServer ControlPoints (UPnP clients) are available for most operating systems and many hardware platforms. UPnP clients can be categorized as either software-based or hardware-based. Software-based UPnP clients can be run on PCs (personal computers), mainly on Win32, Linux, BSD, Unix or Mac platform. Hardware based UPnP clients may run on a stand alone (or any specific hardware) DMP (Digital Media Player). For example, a DVD player with a ethernet interface to stream media files over the network.

See UPnP Client Info for information on specific clients.

Troubleshooting

  • Make sure you set the proper external IP in mythtv-setup, otherwise you will be able to see your server via UPnP, but the file location urls will contain the default 127.0.0.1 IP address.
  • Make sure you have a value for MusicLocation and/or VideoStartupDir set for your backend hostname if your frontend and backend are on different machines.
  • Make sure you have a route for 224.0.0.0/4 out your lan nic BEFORE mythbackend starts (ip route add 224.0.0.0/4 eth0). It seems it won't work if you add the route later.
(I got a cryptic response to this. ip route add 224.0.0.0/4 via 192.168.0.1 worked for me in SL7, 0.28-pre)
Modern Linux already has multicast setup correctly; check ip maddr show and ip route get 239.255.255.250 .
  • Make sure your firewall is disabled or UDP port 1900 and TCP port 6543 are open. Opening TCP port 111 (for RPC) sometimes helps DLNA client discovery of MythTV.
  • The Playstation 3 can take a while to find the backend. Searching can help, but the PS3 (f/w 2.17) isn't actually sending the packet everytime you search. You can tcpdump for udp packets to 239.255.255.250 to watch for it. `tcpdump ether host {ps3 mac addr}` also works well.
  • If your UPnP client does not see your videos, and you are using a Storage Group for video, you must configure the frontend settings on your backend machine to point to the storage group path for videos. Go to Utilities/Setup->Setup->Media Settings->Video Settings->General. Change "Directories that hold videos" to point to the same directory as your video Storage Group. This only applies to 0.24 and previous. 0.25 has been rewritten to use neither settings, and instead pull content from the existing content list populated by MythVideo, rather than populate its own list.

Overriding the default devicemaster.xml file

The devicemaster.xml file contains default settings the MythTV UPnP server will use for things like friendlyName, modelName, modelNumber etc. MythTV supplies a default file with these setting that will work for most users but if you want to override some setting, for example if you run more than one mythbackend on a network and you want to be able to distinguish which server a client connects to, then you can do that by following these instructions.

1. Copy the default devicemaster.xml file somewhere.
sudo cp /usr/share/mythtv/devicemaster.xml /home/mythtv/.mythtv/

2. Make sure the user that runs the backend can read from it.
sudo chown mythtv:users /home/mythtv/.mythtv/devicemaster.xml

3. Edit the devicemaster.xml file as required.

4. Add the database setting telling the backend where to find the new devicemaster.xml file (replace HOSTNAME with the correct one).
INSERT INTO settings (value, data, hostname) VALUES ('upnpDescXmlPath', '/home/mythtv/.mythtv/', 'HOSTNAME');

5. Restart the backend for the new settings to take effect.


See Also

External Links