Saturday, May 19, 2012

Installing Mythbuntu with WinTV-DCR

A few years back, I bought a tower PC with Windows Vista Media Center (home version) and a tuner card built in.  I've used it almost exclusively as a personal video recorder. For a variety of reasons, Vista has increasingly gotten on my nerves, so I finally bit the bullet and replaced it with MythTV.  The process has taken much longer than I expected, partly due to dopiness on my part, partly due to sketchy instructions here and there (or presumptions that I know things I do not). Herein I chronicle some of the details in case they'll help anyone else. It will be a long post, as it was a long process.

I should note a few more things about my equipment before diving in. I am a Comcast cable customer. I run the incoming cable through a splitter, with one connection to the TV (flat-screen HD) through a set-top cable box and the other to the tuner card in the PC. The PC has an NVidia graphics card (the precise model is, I think, irrelevant) that connects to the TV via an HDMI cable.

The tuner in the PC can only capture analog channels (NTSC), and Comcast is moving more and more channels to digital. So part of the motivation of trying out MythTV was that I needed to install a new tuner in any case. After a little online shopping, I settled on a Hauppauge WinTV-DCR (model 2650), a dual-tuner CableCARD receiver that connects to the PC via USB. The 2650 is not explicitly recognized by MythTV, but according to multiple success stories by other people, you can falsely identify it as an HDHomeRun Prime and it will work fine with MythTV.

As I've mentioned more than once, I run Linux Mint on various PCs and laptops, so I initially thought about installing Mint on my PVR machine and then adding MythTV. A couple of things I read online about complications, coupled with the  discouraging thought of downloading a potentially large number of dependent packages via my slow DSL line, caused me instead to download Mythbuntu 12.04 (at the office, where speeds are much greater) and burn an ISO image to a DVD. Mythbuntu is basically Ubuntu with things deemed inessential to a media server stripped out and MythTV added.

My initial thinking was to run Mythbuntu from the DVD, give it a test drive, then install it alongside Vista long enough to confirm that I liked it and to move my existing recordings over. Fortuitously, I took the precaution of copying almost all the recordings to an external hard drive before beginning the experiment. (The "almost" refers to one two-hour recording, approximately 5.3 GB, which could not be copied to the external drive. The issue was not lack of space; apparently the file was too large for the file system -- which might be FAT; I can't recall -- on the drive.)

Like other Ubuntu-based distributions, including Mint, you can boot from the CD or DVD, try out the system, and optionally install it. The test drive is useful to determine whether Mythbuntu correctly identifies and has drivers for your keyboard, mouse, display, network connections etc. In my case, this all worked fine, including installation of the NVidia proprietary drivers. For what it's worth, my keyboard and mouse are wireless, through a hub connect by USB. There was no problem with either of them.

I expected also to test MythTV itself, but as it turns out that cannot be done booting from the DVD. MythTV is a client-server system, so it comes with two parts, a front-end (client) and a back-end (server). You can test MythTV's front-end with a preexisting back-end, but if (like me) this is your first foray into MythTV, you will not have a back-end installed. No back-end, not test.

There was nothing for it but to install Mythbuntu. Mythbuntu initially gave me a screen with three choices, the first being to install alongside Vista. I chose that and took the default choice for disk partitioning. Shortly thereafter, Mythbuntu informed me that one of the partitions (it was not clear which; possibly the swap partition) was too small at the size it had selected itself and that I should back up and make it bigger. So I backed up and got what looked like the "how do you want me to install it" dialog again. Apparently I paid insufficient attention when I clicked the top choice, because this time the top choice was to wipe the old system and install just Mythbuntu. When I realized what it was doing (almost immediately) I ejected the DVD (the only way I could find to stop it), then reinserted the DVD and tried to restart the installation ... only to be told that the hard drive now had no system on it. To paraphrase Captain Keith Mallory, my "bystanding days" were over and I was "in it now up to [my] neck". A full install was on.

Thereafter, installation of Mythbuntu was quick and painless. There were 89 MB of updates awaiting me, which I deferred while I worked on the TV part. Physical connection of the WinTV was trivial (power cord, USB to the PC, attach the cable, insert the CableCARD).  The installation screen lets you select an IR remote if you have one. I do, left over from Media Center, and selecting the standard Media Center remote worked ... for a while ... more about that below. The WinTV comes with its own remote, but I thought it would be easier to stick to the MCE remote (to which I'm used) rather than figure out how to get the WinTV remote to work.

For the video device, I selected the NVidia driver. There were a couple of drop down boxes to configure "TV-Out". I wasn't sure whether that was necessary, but I figured probably not; the prompt starts "If you would like to configure TV-Out". So I stuck with the default settings, which seems to have worked.

MythTV itself started, and suddenly the mouse was gone.  My first thought was "how the heck do I navigate", but the keyboard arrow and tab keys worked fine. I later discovered this is a design feature, not a bug. When you are in a MythTV window, there is no mouse cursor. MythTV expects you to navigate via the remote. I wish I'd seen that somewhere before I launched into the installation, but no harm done. The remote worked fine to advance, retreat, select and cancel. At least it worked for a while (more to come).

In the video setup menu, I clicked the hi-def test button. It downloaded a 70+MB HD movie clip and played it successfully in the TV ... other than a lack of sound. The setup wizard theoretically allowed me to configure sound. I chose ALSA, but no joy. So I tried various other ALSA settings in the list (specifically those that mentioned NVidia), along with clicking the rescan button, and had no luck.

After a bit of searching, I exited MythTV, opened a terminal, and ran aplay -L, which showed me default:NVidia as a recognized sound device. That's what I'd hoped for, so I ran sound-test -Ddefault:NVidia -c 2 -t sine and heard tones in both of the TV's built-in speakers. (Sidebar: without the -t sine argument, you get "pink noise", which to me sounds like a bad connection.)

I then went back to the sound configuration screen in the front-end, and lo and behold the choice had changed, on its own, to ALSA:dmix:CARD=NVidia, DEV=0, and sound was working in MythTV. Maybe I forgot to try that one, or maybe my tests in the terminal somehow made the device more visible (?).

To configure the video source, I followed these instructions with minimal difficulty. I've had an account with Schedules Direct for a while, so my channel lineup was already configured. The one hiccup was that clicking Fetch channels from listing source repeatedly failed to do anything, until I realized that the CableCARD was not firmly seated in the receiver slot. (Paul slaps himself a few times.)

Pairing the device required a call to Comcast, in which I needed to give them three pieces of data: the card's serial number; a host ID, and a device (data) ID. The serial number was on the receipt I got from Comcast, but where to get the other two things? The back-end settings have a menu for Capture Card, in which I selected HDHomeRun Prime for each of the two tuners, and was given addresses for them and an IP address (on my home network, so a nonroutable address). This turns out not to be what Comcast wants. When you install the WinTV in Windows 7, the information is magically provided to you, but where would I find it in Mythbuntu? After a bit of searching, I indirectly stumbled on the answer. That IP address in the Capture Card screen was for a web server built into the WinTV. I opened that in a browser and it handed me the necessary information, including the serial number, on a silver platter. I called Comcast and in fairly short order had the card authorized (although they warned me it could take 45 minutes for the card to download all the channel information it needed).

Somewhere in the middle of this process I turned off the PC and went out to dinner. When I returned and booted the PC, the IR remote no longer worked! That's happened a second time as well. When I first observed this, I wasted considerable time searching for the source of the problem, playing with various remotes, and looking in the wrong places for where I could reconfigure it. (System > Control Center > Infrared is where I select the remote.) The lsusb command, run in a terminal, failed to show the remote being attached. As it turns out, unplugging the receiver's USB cable and then plugging it back in fixes the problem. I think I ran across some tweaks one can make in system files to eliminate the need to do that, and I will definitely research that tomorrow. I can't picture having to reseat the remote cable every time I wake the computer.

I have not yet tried to record anything, nor to import my Windows recordings, so there will probably be a follow-up post. Meanwhile, there are two pressing issues. One is fixing that bug with the IR remote. The other is to figure out why the first channel in my cable lineup (which happens to be ABC) is showing programming dubbed in Spanish (?!). All the other channels coming through the WinTV tuner are in English, and the one that is dubbed when viewed through the tuner is in English when viewed through the cable box.

9 comments:

  1. So you too have found the fun of MythTV. I've been playing around with MythTV for a few years now. Here are some good references.

    http://linhes.org/
    the wiki and forums are really good along with the LinHES distribution

    http://mythtvcast.com/
    as far as I know the only podcast about MythTV

    ReplyDelete
  2. Larry, thanks for the links. I'm still sorting out various adventures with MythTV (such as bogus audio tracks, crashing the front end multiple times last night, setting it up to wake up when a recording is scheduled ...), so there'll be another post or two as I find some answers. Or maybe there'll be a primal scream post. :-) I find it a hopeful sign that you've been using it for a few years.

    ReplyDelete
    Replies
    1. Unfortunately I don't have a working build right now as we switched to dish and are using their platform. I do intend to getting one setup again though.

      Delete
  3. Thanks Paul for your online blog. I've been using mythtv since ubuntu 8 and recently been unhappy with my analog tv tuner ( Hauppauge 1600 tuner ). Don't get me wrong the Hi-def side of it works wonders with nvidia and Vdpau enabled. But it's not quite perfect setup ( the nvidia is DVI out only so having to use analog audio out. This is very tricky telling xorg.conf to this correctly) so i'm upgrading. After coming across your blog and reading about the WinTV-DCR (model 2650) I've ordered me one and a new nvidia card with HDMI out.

    Thanks a bunch. Hopefully I'll report back with a successful story.

    ReplyDelete
    Replies
    1. Kris, please do check back and let me know how it turned out. Also, if you know any tricks/shortcuts for using the Program Finder in MythTV, I'd like to hear them. The only way I can see so far is to scroll horizontally to the first letter, then scroll vertically to the name of the show. That's not terrible, but I'm surprised that you can just type a few letters and get to the show. I guess I'm spoiled ... or maybe I'm missing something obvious.

      Delete
    2. Hi Paul,

      Good news and bad news. The good news is the new video card Nvidia GeForce GT 430 works great. Vdpau works perfectly and is the only way to view 1080i flawlessly. The hdmi sound works nice too. Slight crackle when mute/unmute but overall very happy. Also my lirc remote is functional again using the zilog patch. The analog side of the hauppauge 1600 is not terrible so probably will return the WinTV-DCR (model 2650) or install it for my dad ( he uses Comcast ).

      Reason being I use Charter cable and they want to charge me $45 to install it. I find this rather annoying as they don't even use Linux and I would be paying the cable company for something they don't even know how to install.

      As for your question about the program finder. I will look into more but I think all you need to do is program unused buttons on the remote to page up/down or whatever keyboard shortcut does the trick. This is better done with a RF to IR remote that can handle multiple buttons assignments. I use http://www.officedepot.com/a/products/909148/URC-URC-RFS200-Universal-Remote-Control

      Thanks

      Delete
    3. Kris,

      Thanks for the tip about the remote. I haven't found any keys (other than tab and arrow) that do much with the Program Finder, but I'll confess I haven't spent much time fiddling with it.

      Charter was going to charge you $45 to install what?? The hookup is trivial: you just pop in a cable card, access the device's built-in web server and pair it. I didn't need a Comcast tech to come to my house; I picked up the CableCard from them and did the rest by phone (no charge). Would Charter charge you for the phone call and the three minutes a tech spends at the other end syncing the device? Yikes!

      Delete
    4. Hi Paul,

      I stopped by Charter's office today and spoke with a nice lady. She did offere to give me a card and let me install it myself, but because I have a business account their policy is that all business accounts require a technician to install any products regardless how trivial.

      The reason I have a business account is I'm to bundle the TV and internet and save probably close to $100 a month. The caveat is a business account isn't allowed to lease a cable box.

      No cable box is no problem for me as I have mythtv. I still have the basic and extended basic cable channels that I pay for and port to mythtv via schedule direct.

      The WinTV-DCR would be a nice little addition to my existing setup ( Hauppauge WinTV-HVR-1600 for NSTC/ATSC signals and a SiliconDust HDHR3-US HDHomeRun Dual TV Tuner for QAM signals ). The WinTV-DCR would give me another source of NSTC and QAM signals, which I'm hoping the NSTC would be clearer than the Hauppauge NSTC one.

      Overall I would save in the long run just paying the cable company $45 for the install because if I switched back to a residential account ( just for the TV side ) I would be paying almost double what I'm paying now $33/m

      So maybe I'll schedule an appointment with them though I dread doing so because it would mean giving up my Saturday just so they could tell me they will show up between 12pm - 6pm. Yippie

      Thanks

      Delete
    5. Don't know if this would work with Charter, but with a few contractors I've given them my cell and told them that if they call me 20 minutes before showing up, I'll hustle home to meet them. Of course, this only works if I'm planning to be close by and doing something I can abort on short notice. I do so love those six hour windows.

      Delete

Due to intermittent spamming, comments are being moderated. If this is your first time commenting on the blog, please read the Ground Rules for Comments. In particular, if you want to ask an operations research-related question not relevant to this post, consider asking it on Operations Research Stack Exchange.