Setting up MythTV 0.21 on Ubuntu 8.10 with a WinTV-GO card, a Verizon FIOS Motorola QIP7100-1 STB, and happiness

Posted by james on Jan. 7, 2009

MythTV DVR Setup:

I've been wanting to setup a MythTV box for a long time. I hate the idea of wasting hundreds of dollars renting a DVR from the cable company. I also want something I can stream easily to my laptop or desktop, since I rarely watch TV on my actual TV. I knew MythTV was used by a lot of people, so I figured it'd be stable and pretty solid by now. While it is stable, it's incredibly complicated to setup and took me a long time to figure out. One problem is that it's not well documented. There's a lot of holes in the documentation, and so I had to stumble upon a lot of little fixes on my own. I've written down everything here step by step, for my own benefit (in case I have to do this again), but also for other's benefit since they may run into the same problems I did.

My DVR is based off an old AMD Sempron 3100+ with 1GB ram and an 80gb harddrive. It has an NVidia 6600 AGP video card and a Hauppauge WinTV-GO TV tuner card. The motherboard is an ECS NForce-3A with built-in AC97 sound and an NForce3 chipset.

For my setup, I have Verizon FIOS digital TV with HD. I have a Motorola QIP7100-1 HD STB tuning in channels, and I have RCA cables feeding the video from the STB into the composite-in on the tv tuner card. I have the audio going from the RCA outputs on the STB to the minijack line-in on my motherboard. I'm not using the tv tuner card's tuner at all, since CableCard capable hardware isn't available unless you buy a premade system. The signal is all SD, and not great at that, but it's about on par with Slingbox quality so it's fine for streaming to the other rooms of my house.

First, I already had an install of Ubuntu 8.10 working. Without any tweaks (that I know of), most of the hardware was recognized and working. By default it boots into X windows with GDM and shows you a login screen. Here's the steps I took to install/configure mythtv and all the related parts.


  • Install ubuntu 8.10 (as mentioned above)

  • Install mythtv package (v0.21-fixes)


    • Click on System > Administration > Synaptic Package Manager

    • Enter password

    • search for "mythtv"

    • double click on mythtv to mark it for installation (version 0.21.0+fixes at this time)

    • click Apply and install the packages


  • Install the NVidia video drivers


    • Without this step, video playback is extremely choppy and you get XVideo errors in the mythfrontend log. Enabling the nvidia driver also gives you fun alpha blending effects in x windows.

    • Click on System > Administration > Hardware Drivers

    • There will be multiple versions of the "NVIDIA accelerated graphics driver". Click on the recommended/latest one (v177 for me) and click Activate.

    • You may have to reboot here.


  • Setup mythtv ("mythtv-setup"):


    • Run "mythtv-setup"

    • A dialog will popup to ask if it can stop mythbackend. For me, it pops up behind all other windows (??). Make sure you click ok, otherwise it'll look like the command is frozen.


      • Choose "Capture Cards", "New Capture Card"

      • Video device is /dev/video0

      • VBI is /dev/vbi0

      • Audio device is /dev/dsp

      • Default input is Compsite1

      • Select "Video Source", "New Video Source"

      • Give it any name (Video Source 1)

      • Listings Grabber = "No grabber"

      • Select "Input Connections"

      • Choose "[ V4L: /dev/video0 ] (Composite1) -> (none)"

      • Video Source = [the name of the video source]

      • Starting Channel = 3 (this may not be needed?)

      • In "Channel Editor"

      • If I didn't setup a dummy channel, mythfrontend would choke when trying to set the channel and fail. Setting up a dummy channel allowed the composite in to work with mythtv. You wont need this later when you get the real channel data.

      • Select "New Channel"

      • Name = anything

      • Channel Number = anything

      • Video Source = [video source name]


    • Press escape a few times to exit setup

    • Select yes to fill the database

    • wait...


  • Setup listings with mc2xml


    • You don't think about it since tv guide data is freely available on the web, but it's actually a bit hard to get. The problem is that while you can browse to many tv listing sources (full of ads), not many people want to give it away for free in XML or machine readable formats. This is because it costs them money, and they can only afford to give it away when they're making money off the ads. Zap2it used to publish free listings, but apparantly has stopped a while ago. You can still get the data from Microsoft, since they publish the data for their Media Center Edition PC's. This site (http://www.mythtvtalk.com/forum/viewtopic.php?t=8164&start=0) was invaluable in setting up listings, and the below instructions are based directly off that page.

    • Go to http://mc2xml.110mb.com/

    • Download the linux version binary

    • Save it to your home folder, then open a Terminal and copy it to your bin directory ("sudo mv ~/mc2xml /usr/bin")

    • In terminal, create a directory for the listings data ("sudo mkdir /usr/share/mythtv/mc2xml")

    • Run "mc2xml -c us -g [your_zip_code_here]"

    • Choose your tv provider, mine was "Verizon Fios [city] (Digital)". The one without (Digital) only had ~50 channels. The real one had about 2000.

    • As in the page linked to above, I recommend choosing the channels you want and putting it in a file "mc2xml.ch", like:


      • 1

      • 2-10

      • 50

      • 51

      • 52

      • 100-400


    • The less channels you put in the better, since importing into mythtv will take forever. I think you may have better luck running the import in parts with smaller XML files, since my XML file ended up being 100MB big with about 500 channels, 30000 programs, and it took about 4 hours to import mostly choking on memory. Maybe if you run a few updates with smaller files it wont overload the memory and thrash the paging file. Just a guess.

    • run "nice -n 19 mythfilldatabase --update --file 1 xmltv.xl" You can also use --refresh-all instead of --update, I'm not sure when you'd want to use either in this case.

    • You should now have listings in mythfrontend. Yay!


  • Change mixer settings


    • This took me the longest time to figure out. I couldn't get any sound recorders to work in Ubuntu/gnome, and in mythtv I just got a high pitched hissing/whine sound (not static). However, in one of the volume mixers I could unmute the line-in for playback and hear TV audio from the STB, so I knew my sound card drivers were working, just the mixers were setup. I say mixers, because on Ubuntu you have a few different sound systems (Why???). There are drivers that allow they kernel to use the sound card. Then there is the sound server, that allows multiple other programs to use the sound card at once, instead of each program taking over the sound card completely.

    • So Ubuntu 8.10 uses ALSA drivers for the sound card, which give you OSS style /dev/dsp and /dev/audio devices. Now you need a sound server. The ALSA package also includes a sound server to use with their drivers, but Ubuntu has chosen to use PulseAudio as a sound server instead. So instead of ALSA Driver > ALSA Sound Server > Program, you're now using ALSA Driver > PulseAudio Sound Server > ALSA Sound Server Emulation > Program. Normally this is transparent, but the problem now becoms mixers. The sound card's inputs and outputs (pcm, main, line-in, mic, etc) are separate from the mixer devices that control the volume, muting, input source, etc. ALSA has amixer and alsamixer, gnome has gnome-audio-control, and PulseAudio has pavucontrol. I had no luck on alsamixer, gnome-audio-control, or pavucontrol. I had to use amixer. I found a page (http://tldp.org/HOWTO/BTTV/recording.html) that gave me a starting point of how to use it.

    • Find out card number


      • > cat /proc/asound/cards

      • I had 0 for NVidia CK8S (my motherboard sound card) and 1 for Bt878 (the tv tuner's sound). Many WinTV-GO tuners do not have digital sound capture, they simple have a jack on the back that outputs sound that you must connect to your sound card's line-in. I bypassed this completely and just ran audio from the STB straight into the line-in, so I'm only interested in card #0 here.


    • List controls for the card


      • > amixer -c 0 controls


    • Select the correct input source


      • > amixer -c 0 cget name='Capture Source'

      • Find the input marked 'Line', which is the line-in. This was #4 for me:

      • > amixer -c 0 cset name='Capture Source' 4


    • Create a script to do this on bootup:


      • > sudo vi /etc/init.d/set_capture_source.sh

      • Copy & paste this:


        • > amixer -c 0 cset name='Capture Source' 4


      • > sudo chmod a+x set_capture_source.sh

      • > update-rc.d set_capture_source.sh defaults


    • Fix scratchy audio


      • Now that the audio mixer was finally set to allow sound in mythtv, the audio was noticeably scratchy and distorted. The problem was a sampling rate mismatch

      • > mythfrontend

      • Go to Utilities/Setup > Setup > TV Settings > Recording Profiles > Software Encoders (v4l based)


        • For each encoder (default, live tv, high quality, low quality), click on the profile name to edit it

        • Next, Next, Next, then change "Sampling Rate" to 48000 (the default for the sound card)

        • Repeat for each profile so they're all 48000 hz




  • Setup firewire channel changing script:


    • The WinTV-GO has a built-in IR receiver and transmitter (ie. an "IR blaster"), however I've lost the cables a while ago and can't find any instructions on how to use the built-in IR transmitter. I'd probably have to use LIRC, but since I couldn't figure that out I used firewire instead. I was lucky enough to have an extra firewire card for my DVR, but firewire is a more reliable way of changing channels anyway.

    • Install firewire support:


      • Run synaptic package manager, search for 1394.

      • Choose libavc1394, libavc1394-dev, libraw1394, and libiec1394. The -dev packages are needed to compile 6200ch.c below.

      • To use firewire, run > sudo modprobe raw1394

      • To enable firewire for every reboot:


        • > sudo gedit /etc/modules

        • add the lines "dv1394" and "raw1394" to the end


      • You should now have /dev/raw1394 available


    • Compile and modify the channel changer script:


      • > cd /usr/share/doc/mythtv-backend/contrib/channel_changers/

      • > gunzip 6200ch.c.gz (creates the 6200ch.c file)

      • > cc -std=gnu99 -o 6200ch 6200ch.c -lavc1394 -lrom1394 -lraw1394

      • Test changing a channel to get the vendor/device ID's:


        • > ./6200ch -v 1

        • I got "node 1: vendor_id = 0x00002180 model_id = 0x00008100"


      • > sudo gedit 6200ch.c


        • I had to edit 6200ch.c to add the QIP7100-1 vendor & device ID's. If this is beyond you, ask me for my file.

        • I also added 4 digit slow channel changing, since FIOS has >1000 channels now. With 3 digit changing, it sends 3 digits and then the STB waits a few seconds for the last digit before changing the channel. So instead of sending "020" it sends "0020".

        • Update: here's a link to my modified code


      • Recompile to pick up the changes:


        • > cc -std=gnu99 -o 6200ch 6200ch.c -lavc1394 -lrom1394 -lraw1394


      • Copy the file to the bin directory:


        • > sudo cp 6200ch /usr/bin



    • To manually change to channel 100:


      • > 6200ch 100 (or with my script, "6200ch -4 100" for 4 digit changing)


    • Add the channel changing script to mythtv


      • > mythtv-setup

      • Go to Input Connections

      • Select "[ V4L: /dev/video0 ] (Composite1) -> Video Source 1"

      • For "External channel change command:" enter "6200ch" (or "6200ch -4")

      • Next, Finish, press escape to exit. Run mythfilldatabase if you want to, not sure if it's needed.

      • run mythfrontend and check that channel changing works.



  • Setup mythweb:


    • svn co