Backtrack:  
 
by lunarg on July 24th 2007, at 23:38

In light of my media guide (which is still under heavy development), I did a bit of experimenting with MythTV.
The result of my experiment is pretty nifty: I now have the ability to watch TV on my laptop (without a TV tuner), as long as I have a connection to my media PC (where the tuner is). Want to know more? Read on then...

As you know (or perhaps not yet), MythTV consists of two parts: a backend server (which does all the work: managing records, accessing hardware and so on), and a frontend client (basically controls the backend server, look up recordings, watch actual TV, etc.).
These two parts communicates with each other using the IP stack. While (according to the Gentoo ebuild maintainer), it is not officially supported, it would be perfectly possible for the backend and frontend to be on two different machines.
I simply had to try this one out, and it turned to work pretty well. Note that this stuff will also be added to the media guide, but for the impatient ones, I line out the quick-n-dirty details here.

Installation and setup

Because of my Gentoo installation, I had to change very little on the server-side (my media PC): MythTV is already configured to listen on the network. MySQL wasn't just yet, so had to reconfigure a few things. And finally, because since I'll be using the same database for all clients, I had to make a few modifications so they would work properly.

Preparations

First of, if your media pc doesn't have a fixed IP (or a fixed IP through a DHCP server), you have to give it one, or make sure that both the media pc itself, as well as the other systems which will be running the frontend, can get to the backend through a DNS name or such.

Adjusting MySQL

The frontend requires three connections to be made:

  • Connection to the backend server
  • Connection to the master server
  • Connection to the MySQL database

For the first two, only a bit of configuration changes are required; for the MySQL, I had to change /etc/mysql/my.cnf to listen on the external network interface as well. (By default, it only listens on localhost): look for the following line and comment it, like so:

#bind-address = 127.0.0.1

In my case, I also had to change user rights for the mythtv user. Only a connection from localhost with that user had access. Fire up the mysql prompt (with your trusty and hopefully known root account with rights to grant and revoke permissions):

# mysql -u root -p
Enter password: ****
mysql> GRANT SELECT, UPDATE, INSERT, DELETE ON mythconverg.* TO 'mythtv'@'%' IDENTIFIED BY 'mythtv';

Note that if your password, database name, or user is different from what I said here, you have to change it to suit your needs.

That should be it for MySQL. If you can connect from another pc to the MySQL database, everything for that part is in order.

Adjusting MythTV configuration

We have to adjust some configuration settings of MythTV. Otherwise connections to the backend would fail. Since frontends get its configuration (accept the MySQL settings of course) from the MySQL database, we have to adjust it there. And since we'll be using a shared database, we have to adjust the settings so that any frontend (be it the one we were always using on the same machine, or a frontend on another machine). This sounds more difficult than it is, though.

There are two ways you can adjust these settings, either by running mythtv-setup on the backend machine (assuming you have X installed), or adjust the settings directly in the MySQL database.

Using mythtv-setup is easy: start it up, choose 1 General and adjust the IP addresses of the backend server and master server to the IP address or DNS name, so that all frontends that are required to connect to the server, can actually connect.

Alternatively, log in to the MySQL database, and change the settings like so:

# mysql mythconverg -h your-server -u mythtv -p
Enter password: ****
mysql> UPDATE settings SET data = 'your-server' WHERE value = 'BackendServerIP' LIMIT 1;
mysql> UPDATE settings SET data = 'your-server' WHERE value = 'MasterServerIP' LIMIT 1;
Install frontend (on Gentoo)

MythTV requires QT3 with MySQL support to be installed. If you haven't done so already, install or reinstall it like so:

USE="mysql" emerge =qt-3*

After that, install MythTV with following flags:

USE="frontendonly" emerge -v mythtv

Notice the frontendonly flag, which effectively tells the build to install only the frontend.
Other flags I had set are:

Quote
USE="alsa dts dvb dvd frontendonly ieee1394 joystick mmx opengl perl vorbis xvmc

That's it for the installation. If everything is in order, you should be able to start MythTV and have it connect to the backend server (provided it's accessible across the network).

Usage

Very simple: start mythfrontend. If all is set up well, the frontend will be able to connect to the backend. From that point on, you can use the frontend like you would when running it on the machine where the backend is running on: watching live TV, manageing recordings, etc.

Note that when going wireless you need a bandwidth of minimal 600 KB/s (for PAL+) and up to over 1 MB/s for any other footage.