Monday, February 06, 2012

Journey Into Myth TV - Part 1

Part 1 - Acquisition and Server Setup

Something I had been meaning to do for years was finally doable after the digital conversion in Canada last September. That is, to set up Myth TV, an Open Source fully network capable PVR software.

I don't recall when I first heard about Myth TV, probably shortly after I first heard about Tivo, the first commercial PVR device (which never really made inroads into Canada.. their own fault really)

In any case, it was my eventual plan to set up a server just for MythTV to record programs. Over time, I had collected the relevant hardware. In October of 2011, I decided to finally jump right in and set it up. I had purchased a years subscription to Schedules Direct ($25 a year currently, which is about $2 a month, really) and went about piecing together the material that I had stored in my parents basement.

First of all, I had my old Desktop PC, which I hadn't used in years. Which had inside it an Asus M2A-VM HDMI motherboard with ATI graphics built in. As you can see, I had purchased this motherboard with MythTV in mind. It has Gigabit Ethernet, it has 4 sata 3GB ports, a couple PCI and PCIe slots, and for the time (2008) was probably one of the best options for a MythTV box. It took me a few years, but I finally used it for that purpose. And it works pretty good at that. It had 3 Gigs of Ram installed at 667mhz DDR2, which is more than sufficient.

Now, for MythTV, you need to have one or more TV cards to record programs. The more, the better. If you're using MythTV, you want to get the best supported cards you can find. In my case, I already had a USB2 Hauppauge WinTV HVR-850 which I originally obtained at a Boxing Day sale at Futureshop a couple years ago for a really good price (dual analog/digital ATSC stick). It was labeled an HVR-850, but in reality it was the 950Q, which is even better and still sells for more than $100 new. the main difference is the 950Q offers QAM support. That is to say, you can watch and record digital clear unencrypted TV if your cable company supports it. As we live in the communist country of Canada, none of our Cable Companies support QAM. Which is pathetic, but not something I'm going to delve into for this article. I also had an HDTV Dvico Fusion 5 Lite, which is also a dual analog/digital ATSC tuner. These are the tuners I started off with.

For the purposes of setting up my server, I used the Mythbuntu distribution of Linux, which pretty much has MythTV configured by default. I had a few issues with it originally not booting up into MythTV as it should have, but I figured it out somehow. I don't know what I did. It was a graphics driver problem of some sort... and also a problem with fsck doing annoying checks of the hard drives on startup. I started with 1.5TB of storage (One 500Gb and One 1TB drive). I eventually purchased a 3 TB drive on sale for $120 just before the floods happened in Thailand and hard drive prices went up. When you're planning to recordin High Def content, 1.5 TB is just barely enough. 4.5, that's more like it. In any case, you burn Mythbuntu to a disc or USB stick, install it to the hard drive, and you're ready to go.

I soon realized that most of the shows I like are on at the same time. I needed more TV Tuners. I decided to purchase the HD Homerun, which is a dual tuner external box that plugs into your home router. It is well supported by MythTV, and saves you from wasting a USB and PCI port. I purchased it from B&H Photo, who are an EXCELLENT store based in the USA that is very considerate of shipping options for Canadians.. even offering Purolator shipping as opposed to the evil that is UPS or the overkill that is FedEx. I plugged it in to my router, plugged it into the AC, hooked up the antenna, added it as an option to the mythtv server, and voila.

I'm not going to go too far into the technical aspects of setting up Myth TV and adding tuners and configuring options on the device. There are any number of wikis online that tell you how to do that. I'm just going to describe my thoughts on how the process went, and bring up any issues I may have had along the way.

So now I had 3 High Def OTA tuners, and I was using the Dvico Fusion 5 Lite for Analogue. The Dvico Fusion 5 Lite sucks for analogue, though. Most shows recorded with it were unwatchable on my networked boxes. I tried to see if I could find any ivtv based tuners off of ebay or kijiji for cheap.. I did, and now have 3 tuners connected to my analogue cable TV output. A caveat though, I got them cheap because Analogue is being shut down by most Cable Companies in the USA. I have other options down the road, however, and shaw cable still has basic cable in Analogue, but sooner or later that'll be gone. Still, for now, It's a nice supplement. I find myself watching more of what's on OTA anyways. Theres really very little value added with Cable TV that can't be switched for Netflix or other online streaming services for far better value.

Now, I mentioned adding a 3TB hard drive. Here I ran into my first problem. Adding the hard drive to MythTV was no problem. I ended up copying the data from one drive to the new drive, and here I ran into my first major issue. MythTV refused to delete anything I had copied over from the old drive to the new. It had nothing to do with permissions really, but the way MythTV handles it's database. This was doubly annoying as most of those programs were useless garbage to me that I only recorded for testing. If I was unable to remove them, I was going to have a ton of wasted space, and even worse, useless entries. Eventually I found out a cumbersome way of deleting them. The way mythTV stores files, it has the date recorded in the file name. I decided simply to delete anything recorded before November 2011. Now, this deletes the videos themselves, but doesn't remove them from the database. I had to go into MythTV Frontend and MANUALLY delete them. It was a bit of a pain, but I managed to do it. It really would have been nice to be able to do it from MythWeb.

What is MythWeb, you ask? MythTV comes with a web based frontend that even supports playing recordings from a Flash style youtube window. It lets you view TV Listings, lists backend information, shows recorded programs, it's pretty swanky. I quite like it.

So everything is recording fine now. Part 2 will discuss the various front end options available that I've tried and how well they worked. Hopefully I'll write that out by the end of the week.


bwalzer said...

I went through a MythTV phase. The problems I encountered mostly involved the MYSQL database. In particular, after a power failure the database would get into a flaky state that would cause all sorts of weirdness pretty much forever. I eventually got tired of being a full time MYSQL admin and had to give up on MythTV.

An obvious fix would be to use a more robust database. Unfortunately the MythTV developers seem to really like MYSQL.

Anyway ... I would recommend a small UPS for a MythTV installation. It just needs to be big enough to let the system do a normal shutdown when the power stops.

reedsolomon.matr1x at said...

Interesting that you bring up a UPS. There was a two hour power outage in my area of the city I believe on Friday a few days ago. I do have a UPS connected to both my Myth Server and router, however 2 hours was too much for it. It did seem to shut down and recover cleanly. I frequently do a hard reset with no concern for the repercussions and so far so good. As soon as I got home, however, I configured my bios power management options to automatically start up again after power failures. Luckily I didn't really miss any shows.

As I wrote in the article, I did indeed have some issues with MythTV's database. I think keeping a backup of the database to compare potentially broken entries to would be a reasonable solution. Also, It'd be nice if Mythweb was expanded so that simple direct maintenance of the database could be done from there. Such as a "delete all entries older than xxx" or "delete this entry".

I doubt its a question of liking MYSQL, but it is the most popular free open source option.