MythTV: Turning Linux Into a Digital Video Recorder: The Front End

115

After reading the first part of this series, you should have a MythTV server up and running. To watch TV or schedule recordings you’ll need to setup one or more MythTV front ends. Since the front end has to decode, deinterlace, and display the video content, it normally has to perform more work than the MythTV back end. Luckily, I have a recent NVidia graphics card which is capable of performing much of the video processing grunt work for me.

With the 0.21-19.fc11 packages from RPM Fusion installed, watching TV should be as easy as telling the front end where the database is stored, the user name and password to use to connect to the database, and then selecting “Watch TV” from the interface. You should be able to use the up and down arrow keys to change channels and hit “r” to record the show you are currently viewing.

As you probably noticed earlier, I wound up using a subversion build of MythTV. Although I do enjoy a good compile as much as the next man, I had a reason to go trawling the bleeding edge of MythTV. The desktop machine I was using had an NVidia graphics card in it and I’m using the binary drivers for it. One of the nice things about the binary drivers is Video Decode and Presentation API for Unix (VDPAU), which lets you use the GPU to perform decoding, deinterlacing and display of video content.

Unfortunately, if you are using the binary drivers and the composite extension of X for pretty desktop effects, you can suffer intermittent bright red screen flashes during video playback. I was getting these flash artifacts with version x86_64-185.18.36 of the NVidia drivers. These flashes go away for me when I either disable the composite extension or use VDPAU to display video content. Getting MythTV to use VDPAU was the preferable solution not only because it let me continue to use composite effects on the desktop but also offload video processing onto the graphics card. The following discussion of VDPAU should be of interest to those with recent NVidia hardware (Series 8 or newer).

VDPAU is still a relatively new technology. One downside of this freshness coupled with the binaries being provided by NVidia is that many package repositories build things without VDPAU support. However, If you grab a recent enough source rpm for mythtv from RPM Fusion and rebuild it on a machine with the VDPAU development files installed you will get a MythTV that supports and depends on the VDPAU libraries.

First, I tried grabbing the development source package for MythTV from RPM Fusion. Which at the time was version 0.2.svn.r21667.fc12. This can be recompiled with rpmbuild –rebuild and all seemed to work well. But when you grab the bleeding edge code you can get burned and there is a bug in that revision that prevents tuning video channels.

From there, I wound up grabbing the latest from subversion, tarring it up and replacing the sources that the RPM Fusion development package was using with those I just pulled from subversion. Hopefully this game of cat and mouse will come to an end with binary packages being offered with VDPAU support.

Once you have a VDPAU enabled mythtv front end installed you need to tell MythTV you want to use it as the default for video playback. Go to Setup/TV Settings/Playback and in the third page set the Current Video Playback Profile. Select “Add New” and then Add New Entry. Make sure that the Decoder, Video Renderer, and OSD Renderer are all set to VDPAU. The next page lets you pick a deinterlacer, which I had set to Advanced 2x Hardware using a GTS 250 card.

One last word on VDPAU, if you are using it you will want to follow the advice and turn off Real-Time Priority and turn on OpenGL VSync.

The core features of a Digital Video Recorder (DVR) are scheduling recordings and playing them back. The former is done through the Manage Recordings/Schedule Recordings menu selection. You can schedule recordings by viewing a program listing of your channels and selecting which programs you wish to record, searching by program title, keywords, or the people in the program, or manually entering a channel, start time, and duration.

Figure 1: MythTV Program Guide The Program Guide screen is shown in Figure 1. Scrolling up and down lets you select which group of channels you are interested in and scrolling to the right advances you in time. Hitting “r” will tell MythTV to record the currently selected program. Pressing return lets you set up recurring recording of the active program. Because you are unlikely to want to always tell MythTV what you like, recurring recording is one of the best features.

You can choose to record only the currently selected showing, the same time slot each day or week, one showing of the title per day or week, or to record the program at any time, either on the current channel or any channel. The recording can also be automatically post processed including commercial removal and transcoding to save on disk space. You can also explicitly set a window of time before and after the program to record in case the broadcast is not on time as well as assign a priority to the recording. The priority feature is wonderful, allowing you to set a recurring capture of a news program which will not be usurped by and adhoc recording.

Figure 2: MythTV Program Finder.Another way to find shows is through the program finder (shown in Figure 2) which lets you drill down using the program name. The program finder is divided into three lists, the leftmost one shows the first letter of the program, the middle list shows every program starting with the first letter selected in the leftmost list and the rightmost list shows the times that the selected program is running. The interface works surprisingly well and lets you find a program of interest regardless of which channel happens to be broadcasting it.

Once you have recorded some programs, they are available through the menu selection Media Library/Watch Recordings. If a recording is in progress it will also appear with a little animated icon telling you that it is currently being captured. The Watch Recordings page shows each recorded program with a thumbnail of the show and as you scroll left to right you can see the description of each program. Pressing “i” lets you edit the information for a recording, including transcoding the video file, saving it from expiration, or editing the Recording Schedule used to record it. This last option is great because you can record a show once and if you like it, easily setup a recurring schedule to grab it in the future.

Figure 3: The MythWeb Interface.The MythTV interface allows you to perform all actions from viewing TV, scheduling recording, and setting hotkeys and other preferences. Using the MythTV interface on a desktop machine can be a little clunky because it is designed to operate on a TV. MythWeb lets you access your MythTV server from a Web browser, which lets you see much more of the schedule on screen at any time as well as being more mouse friendly. The schedule itself looks fairly close to the MythTV interface, with more channels and time slots visible at the same time. Setting up a recording is shown in Figure 3.

On Fedora 11, to get MythWeb going I had to install the mythweb package and make very slight tweaks to a configuration file before restarting apache. Of course, you will also want to secure the MythWeb address from unauthorized access.

# cd /etc/httpd/conf.d/ 
# edit mythweb.conf
...
setenv db_password "YouKnowToChangeMeRight"
...
# chown root.apache mythweb.conf
# chmod 750 mythweb.conf
# service httpd restart

If you want to break out of MythTV and directly access your recorded programs, you will find that the nominated storage directory contains files where the names are non descriptive numbers. To make sense of this you can use the mythtvfs FUSE filesystem which exposes your recorded programs with descriptive file names.

If you want to access your MythTV from clients running other operating systems, there are binaries for OSX and instructions on how to build the frontend for Win32.

MythTV is a very sophisticated DVR solution. With the packages from RPM Fusion you can get it installed on a Fedora 11 machine fairly simply. As of September 2009 the VDPAU issue means you’ll have to rebuild MythTV to get an optimized client installed. This would have been as easy as rpmbuild –rebuild on the source RPM but the channel scan issue left me chasing a newer checkout from subversion.