MythTV Tweaks

After using and tinkering with MythTV for over a year, a small pile of adjustments have stacked up that have been made to both the backend and the frontend that have improved performance. These can’t be listed as must have’s, but they definitely are good to have. Some of these may seem obvious, but not everyone sees things the same way.

1 Store Your Recordings on a Separate Drive (or drives)

The installation of mythtv recommends storing your recordings on a separate partition from the rest of the operating system. This is done to insulate the recordings files from the key operating system files, and, in general, it is a Best Practice. However, for optimal performance, this should be taken a step further: Set up a separate drive or drives to hold your recordings. This will separate all of the disk interaction between the OS and its related files from mythtv and its recordings. The result will be a smoother end user experience.

An internal SATA drive is probably the best and least expensive solution. An external SATA drive is good, too, but more expensive. A PATA drive would work well, but it is best to keep that drive on a different controller than the drive that your OS is on.

2 Reduce The Size Of Your Guide

By default, MythTV will collect 14 days of guide data to get information about future shows. This is actually great for searching for shows, and performing other user-related options, but it can wreak havoc on the system performance. A dead give-away is in th mythbackend.log file:

2007-12-23 09:31:54.099 Scheduled 871 items in 12.4 = 0.20 match + 12.17 place

If the scheduled items creeps up too high (typically greater than 700), then your system is working pretty heavily to schedule a lot of shows based upon the 14 days of guide data. This can cause the database to become rather large and slow down all database queries, which, in turn, slows down the end user experience.

A happy medium is reducing the number of days of guide data from 14 to 9.

3 Optimize the IVTV Paramaters

The default kernel parameters for the IVTV based cards do not take advantage of the buffers on the cards. This means that you will see a lot of logged error messages referring to “application not reading fast enough”. This could result in choppy recorded video which is a Bad Thing(tm).

options ivtv enc_yuv_buffers=8 enc_mpg_buffers=32 enc_vbi_buffers=8 enc_pcm_buffers=8

4 Know Your Hardware

One of the largest problems is that the underlying nature of MythTV is to take full use of the hardware it has at hand. One cannot help but try to squeeze everything (and more) out of their hardware. However, keep in mind that if you have a single processor frontend/backend system, you don’t want to be recording too many shows at any one time or running too many concurrent commercial flagging processes because the single processor just cannot handle it.

The most optimal set up is to have a fully networked frontend/backend system:

  • Have a frontend (client) system for each television in the house. It is probably best to have these as identical systems with minimal hardware requirements since they will only be acting as display systems.
    • NFS mounting of videos, mp3’s, photos, etc.
  • Have a backend (server) system stowed away in a closet. This will be the system that you will end up beefing up. A dual-processor system is recommended since it will be performing all of the work (recording, streaming to the frontend processes, commercial flagging, etc).
    • SATA storage for recordings
    • Separate storage for video, mp3s, photos, etc.
  • 100MB networking from the backend system to each of the frontend systems.

By having the same frontend systems, if you ever have a failure of a frontend, you can always easily shuffle them around while you repair or replace the failed components.

The same goes for remote controls. Although the temptation is to just reuse the multifunction remote you already have for your TV, cable box, Tivo, etc, it just isn’t worth the hassle. Simplicity in the setup will definitely improve everyone’s WAF (Wife Approval Factor). If each frontend has the same remote (although configured specifically for the equipment attached to that frontend), then, as a user (not the admin), you just have to learn the buttons on the one remote, and it applies to all of the frontends.

Grab yourself an inexpensive multi-function remote like the OneForAll ( for each of your frontend systems. I was very hesitant at buying a remote I couldn’t test out since many multi-function remotes disable certain buttons based upon the mode you are in. However, this remote specifically has a PVR mode and you can move button functions from one mode to another.

5 Know What You Are Displaying To

The K.I.S.S. (Keep It Simple, Stupid!) Principle really helps when maintaining your MythTV systems. By having your frontend system as similar as possible, the level of administration needed on those system drops. In other words, if you tinker with one, you know you just have to make that same change on all of the others. Unfortunately, it is harder to control what types of televisions you are displaying to.

Remember: essentially, your expensive TV screen is just a simple computer monitor at this point. You are not using the internal tuner and you are not using all of the various input (DVD player, Antenna, Cable, etc) connections. You are just using the one input on the TV that is coming out from the computer. It is nice and simple.

IF it is possible, try to stick to the same kind of input, even though you will end up with different TV’s throughout your home. For example, if your TVs all have component input as the best quality input, then make sure that all of your frontend systems can output component video.

Try to avoid using any of the ‘PC’ inputs on TV’s. Component, HDMI, Composite, S-Video, and coaxial are all bound by TV broadcast standards. Once you start fiddling with the PC inputs, you have a lot of extra work to perform in order to get it to properly display the broadcast video on the screen. Stick with the standards, and you will be satisfied.

In my case, all of ours have HDMI connections on them. Some video HDMI as evil, but that’s another topic all together. I got away with purchasing some inexpensive DVI to HDMI cables (10ft, ~$10ea. on-line).

By keeping things similar or the same, the X configuration for each of the frontend systems will be the same.

6 Optimize the database

The MySQL database behind MythTV takes an enormous beating as shows are recorded, scanned for commercials, watched, bookmarked, and deleted, just to name a few causes. It does not take a very long time for the database to become more ‘fragmented’ and provide slower responses due to the increasing level of ‘fragmentation’. This has a direct impact on the user experience in a very negative way.

The solution to this is to periodically optimize the database. The problem with optimizing the database is that it is intensive and will only make things worse before it makes it better. So, it is much better to run this off-hours.

The easiest solution is to run a wrapper around mythfilldatabase which optimizes the database. But, because mythfilldatabase is run according to the grabber’s suggested schedule, this might end up running in the middle of the day.

What I found as the happy medium between the two was to craft the wrapper such that the database gets optimized only one day a week:

# mythoptdb – Call this in mythfilldatabase’s place in
# mythtv-setup

if [ `date +%a` = “Sun” ]; then

/usr/bin/mythfilldatabase –remove-new-channels –quiet –max-days 9 $*

The “” script that comes as part of the contrib from MythTV has one shortcoming: it doesn’t always work properly. It worked for me for a long time, then started hanging on the optimization/repair when my database grew rather large. I ended up replacing it with which does the job more efficiently. Still, you must keep in mind that the database will be unavailable during the optimization/repair of all tables. The goal is to keep this (very) short.

7Understand the order of your inputs

Setting up MythTV can be very confusing: there are so many options in the mythtv-setup screens that is can be easy to either miss an important option or be unable to find that elusive option later on. Add in to the equation the fact that there are easily just as many (if not more) options in the frontend setup menus, it becomes almost overwhelming.

One item that took a couple of emails to the mailing list to figure out is the ordering of the tuners. When recording, the backend server process is set up to select the first available tuner, and when you go to watch live tv (which I almost never do now-a-days), it also is set up to select the first available tuner. Additionally, if you are watching live TV and mythtv needs to record something, you get the expected warning that it needs the tuner for that recording.

All of that sounds normal, and it is. However, you can change the settings to have mythtv’s backend select the tuners in reverse order so as to avoid conflict

8 High Definition recordings vs Standard Definition recordings

Standard Definition (SD) recordings, when displayed via MythTV on that nice screen just don’t look as good as that old 4:3 tube television. The problem there is that SD is broadcast as interlaced video, and the computer (the mythtv box) only displays in progressive mode (see this great description of the differences). That, and the quality of SD is so low, many of the artifacts that you didn’t notice previously now show up amplified because of the larger screen size, the better screen quality, and the MPEG2 encoding. However, SD has one advantage: it is small. Typical hour-long shows run about 300-500MB.

High Definition (HD) recordings are an entirely different beast, and they come in many different flavors. Aside from an awesome increase in picture quality, they all have one important factor in common: they are huge. A typical 1 hour recording can run between 3 and 6 gigabytes.


My experience is limited to only Over-The-Air (OTA) HD transmissions from the local affiliate stations, but I definitely recommend the HDHomeRun for an OTA setup. MythTV supports it right out of the box, it is easy to configure, and you can get HD recordings set up within minutes.

Obtaining HD recordings off of your cable/satellite box is an entirely different beast, and, unfortunately, I have not gone down that route just yet.


MythTV is still in a beta phase, and, although there are a lot of people who are using it, it still is not entirely ready for prime-time; the system isn’t made to run entirely on its own and it does need some tlc. I cannot stress this enough: don’t go cheap on your backend system’s motherboard. Make sure that it is a solid board with well supported chips. Some inexpensive, and tempting, motherboards use chipsets that work well as windows systems, but perform with numerous problems under Linux (some Jetway, PCChips, MSI, and some via-based motherboards) which will only give you major headaches.

This is not to say that you couldn’t have a successful system that you don’t need touch for weeks on end, but it is likely that things may creep up that you, and no one else, expected. Besides, you will want to tinker with it over time to fully optimize the system.

A great example is the impact of cpu frequency scaling on a MythTV backend: don’t do it. If you have multiple cards and a couple of drives (OS and video), cpuscaling can wreak havoc on the system: ivtv drivers have been known to stop responding (requiring the backend to be shut down and the drivers unloaded and reloaded) and active/busy SATA interfaces have been known to falsely believe that there are ext3 journal errors which results in the drive being put in to read-only mode.

With all of the above said, you can create an excellent home-wide DVR system using COTS (Common Off The Shelf equipment) that is DRM-free, completely customizable to your liking, and extremely versatile.


1 Pings/Trackbacks for "MythTV Tweaks"

Leave a Reply