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

  • James
    2011/06/09 - 08:28 | Permalink

    Hi, just wondering if you know if this fix was applied? What version of mythtv you are running and what file I need to apply these patches to if it isn’t fixed?

    I’m running Natty and MythTV 0.24-1

    I didn’t compile though I simply did an apt-get install, compiling looks to be like a major PITA but if I can get analog working it would be nice.

    Currently if I enable my 950q as an analog device my digital doesn’t even work. I have to disable my analog device and then the digital works fine.

    Also would like to know how you are getting along with the mac mini. I’ve got a 2.0Ghz version with 2gig ram, 2007 model as well. Current plan is to only use it as the front end, but potentially using it as a dual tuner back end and front end would result in saving the need for a gigantic server box on the backend.

  • Steven
    2011/06/09 - 12:38 | Permalink

    I don’t think it has been applied yet. The Question (linked above as ‘bug report’, https://answers.launchpad.net/ubuntu/+source/mythtv/+question/158555 ) and the Bug report ( https://bugs.launchpad.net/ubuntu/+source/mythtv/+bug/790099 ) have not had any responses yet, and I don’t think libmyth has changed in the repos since then.

    I haven’t really tried to use digital tuning, so I can’t say for sure whether the analog and digital side will get along even with the changes I made.

    The patch for my changes is in the bug report. It’s not too hard to get a version built with the changes; there are various places around the web that guide you on building patched packages for Ubuntu.

    The Mac Mini is working out well. It handles the analog recording/encoding flawlessly, using about 30% of one core. I also have it doing some other network chores and it’s doing fine with those too, so it’s a good replacement for the biggish box I had running before. I haven’t tried using it as a MythTV front-end; I hear that there are some tricks to getting the video drivers to work properly on the Mini, but I assume there are solutions to those.

    Good luck!

  • James
    2011/06/09 - 12:45 | Permalink

    Thanks for the response. I greped through the latest code and I cannot find the lines you specify anywhere and especially not in NuppelVideoRecorder.cpp I checked the .h as well and I do not see what you removed in there. Perhaps it was patched?

    The fact that you aren’t using a digital tuner though makes it sound like it may not fully solve the problem. I’ll see if I can get anywhere but the analog shuts off in a couple of months so I won’t kill myself.

    Thanks.

  • Steven
    2011/06/09 - 21:26 | Permalink

    I see that I had my diff backwards in the reports. I’ve switched ’em.

    So, for example, line 1141 in NuppelVideoRecorder.cpp was
    #ifdef USING_V4L
    but should be
    #if defined(USING_V4L) || defined(USING_V4L2)
    etc.

    Sorry about that :-).

  • Steven
    2011/06/09 - 23:10 | Permalink

    On a suggestion from a Mythbuntu developer, I tried the PPA version of the package (libmyth-0.24-0, version 2:0.24.1+fixes.20110609.4dec7cf-0ubuntu0mythbuntu3 from the PPA referenced at http://www.ubuntuupdates.org/ppas/69 . Also had to update mythtv-backend from the PPA to match that).

    That one worked for me. Apparently the V4L2/V4L patch that seemed to be the cause of my problem was removed (see revision 442 at https://code.launchpad.net/~mythbuntu/mythtv/mythtv-fixes).

    So, I guess my saga is at an end :-). I’ll just use the PPA until the main repo gets updated.

  • James
    2011/06/10 - 07:19 | Permalink

    Wow thanks I will give this a shot tonight! Hopefully it also solves my problems.

    While I have your attention how did you get the 950q to even work initially? I found lots of suggestions about setting the xc5000.conf in /etc/modprobe.d to be debug=1 and power_off = 1 but Natty doesn’t have any config files under that folder.

    I ended up unplugging the device, typing rmmod xc5000 then re-inserting and typeing modprobe xc5000 power_off=1 debug=1 But I have to do this anytime I reboot etc.

    Is there a better way?

  • James
    2011/06/10 - 08:32 | Permalink

    Now I really feel stupid…

    sudo add-apt-repository ppa:mythbuntu/0.24 — good
    sudo apt-get update — good
    sudo apt-get install 2:0.24.1+fixes.20110609.4dec7cf-0ubuntu0mythbuntu3
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package 2:0.24.1+fixes.20110609.4dec7cf-0ubuntu0mythbuntu3
    E: Couldn’t find any package by regex ‘2:0.24.1+fixes.20110609.4dec7cf-0ubuntu0mythbuntu3’

    Am I missing something obvious here?

    Thanks!

  • James
    2011/06/10 - 08:49 | Permalink

    Nevermind I’m a moron! package mythtv … done!

  • Steven
    2011/06/10 - 09:43 | Permalink

    Oh yeah, I created files for the xc5000 options. I created two files under /etc/modprobe.d, local.conf and xc5000.conf, each with the contents
    options xc5000 no_poweroff=1 debug=1
    I don’t think I need to have both; I must have taken advice from two different people at different times :-).

    I have other files in that directory that I didn’t create, too. Not sure why you don’t, but hopefully just creating them will do the trick for you (after a reboot).

  • James
    2011/06/13 - 10:17 | Permalink

    Hi Steven,

    Yeah looks like the two files solved my problem. Analog doesn’t work with the new PPA unfortunately. I don’t think it is worth my time to get it work when Analog goes dead in my area in about a month and a half. Thanks for your help.

    For anyone googling that finds this. I have a Mac Mini 2.1 with 2gig of ram and 2.0Ghz intel core 2 duo processor. It runs Ubuntu with MythTV, able to playback 1 HDTV show and record 2 simultaneously. CPU utilization is around 40%. I cannot do picture in picture very well, it can show both shows, but pausing causes the other to jump like crazy as it can’t keep up the processing.

    In general this is a great setup for mythtv and was relatively painless to setup.

  • James
    2011/06/15 - 17:50 | Permalink

    Hi Steve,

    Hope you don’t mind, figured I would post another update for googlers.

    I installed 2 950q’s in my mac mini and I can use one on analog and one on digital! Seems something is messed up with MythTV now both inputs on the same card do not work at the same time.

    Now I’m just trying to get the audio to work and I’m golden!

  • 2011/08/21 - 14:30 | Permalink

    Really nice, Thanks for this

  • 2011/10/12 - 13:13 | Permalink

    “Brendan.

    Sorry it took do long to get back to you (1 week). Yes I just got the hvr-950q working again yesterday after trying the new Ubuntu 11.10 beta and going back to 11.04 after too much aggravation. Your request prompted me to start a website (my first attempt ever !) http://www.ubuntubut.com Do me the favor of visiting it where I put my notes of how to install the hvr-950q using MythTV, and a lot more. I have google tracking and I would love to see more visitors.

    I got it working YEAH!

    Feel free to advise me of how to make it better or how it worked well for you. I hope it helps.

    http://www.ubuntubut.com

    Mark Ackerman
    http://www.ubuntubut.com

  • Leave a Reply

    Your email address will not be published. Required fields are marked *