MythTV, Ubuntu Natty, WinTV HVR-950Q analog, Mac Mini

This one took a while to figure out.

I bought a USB TV tuner, even though I have a perfectly good PCI one, because I want to replace my big loud server machine with an old Mac Mini refitted with some more storage and a new OS. Oh, I should tell the story of the Mac Mini first.

So, as mentioned above, I have a nice working server machine with (analog NTSC cable) DVR capability thanks to my WinTV HVR-1600 PCI card and the excellent work of the LinuxTV, MythTV, and IVTV people (and, surely, the credits could roll on forever, but I’ll be brief).

But it’s too noisy. I realized that the Mac Mini was quiet and could probably take on the various duties of my server machine, simple as they are, if only I had DVR. USB TV tuners must be as good as PCI ones these days, right? That’s true to a point: the HVR-950Q can record all the same stuff (NTSC, ATSC, ClearQAM, OTA/cable, etc.), but I didn’t realize until I bought it that it doesn’t do MPEG2 encoding on-board like the HVR-1600 does. Ah well, the little processor in the Mini (mid-2007 model with 1.83GHz Core 2 Duo) should be able to handle that.

So I pushed ahead: utilizing guides from around the internet, I popped the Mini open and gave it 4GB of RAM (collected from an old laptop) and a 500GB HD (which I had as a spare for a little RAID box that is currently unused because of _its_ fan noise, which is a story for another day). Along the way I had to replace the stupid connector for the HD temperature sensor that stupid broke because I inadvertently yanked the stupid wire out (thanks for your sacrifice, girlfriend’s old trash laptop!). Then I installed Ubuntu Natty server 64-bit on it, which was a convoluted process. But worthwhile, because now I have a nice, somewhat capable Linux server that’s quite small and quiet. I don’t care that much about being able to run OSX, though I can still do that if necessary by plugging the old drive into the box through USB, and, yeah, I’ll probably end up buying another OSX box some day for some reason, because I just have the sort of life that requires me to run a lot of OSs.

Anyway, now I have everything in line to do the DVR thang with my quiety hardware. A test run recording something with mencoder worked, and only used 40% of one CPU core, so the little processor can handle the video encoding well enough. But MythTV refused to work with the 950Q, and I’m _not_ going to give up all the goodness of MythTV and MythWeb.

Forum/blog posts by users and even a driver writer/all-around 950Q-debugging-all-star declared victory with this hardware; one even specifically mentioned a Mac Mini. The MythTV logs, even at maximum verbosity, failed to uncover the root cause (spoiler alert: the failure point in this case is not logged, even though similar failures around it are). Poring over more posts and more logs, trying out dozens of settings changes, playing with alternate encoders, reading through code, etc. added up to more hours than I really should have spent with this, especially since I was getting nowhere.

Finally I broke down and pulled out gdb to see if I could debug into the heart of this thing. Luckily, the Ubuntu packagers included a package with debug symbols, so I was able to do pretty decent source-level debugging without having to recompile (spoiler: yet). Turns out that somewhere around kernel version 2.6.38, the old V4L1 header was removed (deprecated, no doubt), which caused problems for the Ubuntu people in packaging MythTV. They worked out a patch to separate out the V4L1 functionality from the V4L2 stuff, but they didn’t get it quite right for my case. A little, crucial, function called SetFormatV4L2 was defined as a dummy returning false (failure), but the driver for the 950Q is a V4L2 thing, so the recorder quietly died every time, quietly (remember how I said this particular failure mode is not logged?).

This being the open-source world, I was able to mimic the ifdef patterns that the MythBuntu people had applied elsewhere, so as to get the SetFormatV4L2 and DoV4L2 functions defined properly while still being able to compile without the V4L1 header. And, woot, it all works now. I posted a bug report to the MythBuntu team, so hopefully that’ll get fixed upstream before the next update to libmythtv hits my box.

In any case, thanks once again to open source and the bazillion people who inadvertently cooperated to ensure that I can time-shift Soul Quest Overdrive. Because, in the end, that’s really what it’s all about, isn’t it?

13 Comments

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.