Turning MythTV into a Networked UPnP Media Server


There are many ways in which you can setup your MythTV (Mythbunbtu) server:
  • Combined Frontend / Backend
  • Separate Frontend(s) and one Backend
However, probably the most useful and flexible configuration is setting the Backend as a media server using UPnP (available since MythTV 0.20), accessable from any UPnP client like for example XBMC (XBOX Media Centre) or your network enabledTV!
By default MythTV assumes you are using a dynamic (DHCP) IP address on your Backend PC, as by default most distributions install Linux in this way. Bacause of this, the MythTV backend is configured with a localhost IP address of 127.0.0.1.
We are therefore going to make two changes to the MythTV PC configuration:
  1. Give it a static IP address
  2. Change the MythTV backend IP address to the static address
Setting a Static IP Address
There are two ways of doing this:
  • graphically using the GUI
  • via the command line.
In the past, the GUI method did not work reliably, but htis seems to be okay in Mythbuntu/ Ubuntu 11.10
WARNING: These instructions only apply if you are using  MythTV in a combined backend/ frontend configuration i.e. both are running on the same PC. Otherwise in Step 2, you may have problems connecting to your MythTV backend SQL server.
You are advised to backup your database before proceeding.
Step 1 – Setting a Static IP Address
 
Method 1: Graphically using the GUI
See the video for step 1 – method 1 of these instructions on my YouTube Channel
  • Open Terminal and enter ifconfig
  • Make a note of the submet mask, for 192.168.1.x range of addresses, this is 255.255.255.0
  • Open Network Manager by right clicking on the network icon in the top right of the desktop and selecting Edit Connections
  • Select the most recently used wired connection (normally wired connection 1), and select Edit
  • Select the tab marked IPv4Settings
  • Change Method from Automatic (DHCP) to Manual
  • Enter your static IP address. if you don’t know what address to set, it is probably best to start at 200 and work backwards. Normally your network router takes the address of 254.

In my example we will set:

IP address of 192.168.1.104
Subnet Mast of 255.255.255.0
Default gateway (my network router addres) 192.168.1.254
DNS servers (my network router address)  192.168.31.254
  • Once done, click Save, then close Network Manager
  • Right click on the network icon in the top right of the desktop and this time unselect Enable Networking, then repeat this time enabling networking. This will force the operating system to refresh its IP address, assigning the static IP address to your computer.
Method 2: Via the command line
 
Comprehensive instructions are available on help.ubuntu.com, below is a summary of the steps necessary
  • Open Terminal (Applicatuions > Accessories > Terminal)
  • Enter ifconfig and make a note of the network interface beig used e.g. eth1, we will need this later.
  • Enter cd /etc/network to navigate to the network directrory
  • Enter sudo nano interfaces (interfaces is the network configuration file) which should look similar to the following
   Using the following settings,
Network interface is eth1
IP address of 192.168.1.104
Subnet Mast of 255.255.255.0
Default gateway (my network router addres) 192.168.1.254
    edit the file so the following lines appear at the bottom of the file.
Note: the line # iface eth1 inet dhcp is commented out as it sets up dhcp, as this is not required it does not need to be entered. The line below iface eth1 inet static is used to enable a static ip address and the parameters for this follow.
  • Save the file.
  • We now need to configure the PC for DNS name resolution, pointing it to a DNS server. In our case this will be our router 192.168.1.254.
   In Terminal enter sudo nano /etc/resolv.conf
   At a bare minimum it should have the following line present:
nameserver <ip address of your DNS server/ router>
   In our example this owould be
nameserver 192.168.1.254
  • Save the file
  • Restart networking by entering sudo /etc/init.d/networking restart
  • Close Terminal
Step 2 – Configuring MythTV Backend
See the video for step 2 of these instructions on my YouTube Channel
  • Launch MythTV Backend Setup (Applications > System > MythTV Backend Setup)
  • Select the General from the main menu
  • Change the two IP address fields so that they show the static IP address you assigned to your PC in Part 1 above. In our example of a static IP addresss of 192.168.1.104, it would look like the following
  • Click Next, all the way until you get to Finish
  • Click Finish
  • Press Esc to Close MythTV Backend Setup and follow the on screen instructions. MythTV Backend is now configured.
To test, either open up XBMC, select Videos and Add a new video source by browsing, The name of your MythTV Backend server should appear, select it and you should now be able to view recordings stored on your MythTV backend. Alternatively use a networked UPnP TV to display the server.

=-=-=-=-=
Powered by Blogilo

Advertisements

6 thoughts on “Turning MythTV into a Networked UPnP Media Server

  1. Hi,
    quick question. I have Mythbuntu 9.10, on 2 machines: one is only a front end, and the other is only a backend.

    Maybe you can solve a mystery for me.

    I got a Samsung DVD blue ray recently, and every once in a while, not determinisitic, it detects my mythtv backend and I can play recorded shows (MPG files). I believe it can do this because it uses UPnp. Not sure. However, if my frontend is on, then the blue ray player doesn’t SEE it. Sometimes, if I shutdown the front end, and reboot the blue ray player, it can now SEE the mythtv AVMedia server and I can play the contents. Sometimes.. no matter what I do.. the blue ray player cannot detect it. I did notice that if I play a DVD for an hour, and I exit to the main menu in the player, I CAN see the mythbackend.

    I wasn’t sure if the blue ray had problems… or the mythbackend..

    So I get an app (BubbleUpnp) for my android phone, and I CAN find my mythtv backend on the network, and I can play MPEG recorded tv shows. Wonderful… there must be something wrong with the blue ray player then.. it doesn’t check the network often enough..
    So I install a Upnp browser/player on our iPad. That works too, but not if my android phone is already connected to my mythbackend..

    It SEEMs that my backend only allows ONE connection when Upnp is being used.

    When I look for Upnp config files on google, I am usually told that UPnP requires no config at all. I was hoping to bump up the number of connections allowed.

    Any ideas?

  2. I don’t have any of my MythTV servers setup as separate frontend/ backend, personally I see little point and it can make troubleshooting harder.

    I do have two Samsung DLNA TVs and I have no problem viewing two recordings separately from a single MythTV server, plus a video stream using MythWeb on a PC.

    If I want to view or manage recordings on a PC which does not have MythTV Frontend installed, in my case the majority I use MythWeb. Access is really easy, just enter the ip address of your MythTV server, in your case the backend server followed by mythweb

    e.g. If your server has an IP address of 192.168.1.100 then enter

    http://192.168.1.100/mythweb/

    in your webbrowser, I use Firefox but it should work in other browsers. I use the ASX video stream when using MythWeb, this opens up the recording in VideolLAN (VLC).

    For more information on MythWeb see http://www.mythtv.org/wiki/MythWeb

    The specification of my server is a AMD Athlon 64 x2 4200 CPU and 2Gb of RAM. Networking is over a 100Mbps LAN and all clients are networked using cable, not wireless as I’ve found it unreliable when streaming video.

    Make sure that each of your devices have unique IP addresses, your server needs a static IP addresses, you clients can have dynamic addresses. However, if one of your clients takes the address used by your MythTV server, i.e. the address was not reserved, then this may cause the problems you are experiencing.

  3. Additional Note:

    Having re-read your question, it looks very likely that you have duplicate IP address issues. I assume your DHCP Server is your DSL Router, you will need to check this out to ensure is correctly allocating IP addresses to clients.

    To prove the point, you could allocate static IP addresses to your Blue ray player and your MythTV Frontend and then test to see if they both play nicely.

  4. Have you got your Mythbuntu server to stream to your Roku box (they have an app/channel for Mythtv)?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s