Getting the Hauppauge Win TV HVR USB 950Q Tuner to work with Ubuntu 14.04 Linux and XBMC/Kodi

Since I moved from cable TV to free HDTV over-the-air (OTA) ATSC TV, I have been using the Homeworx HW-150PVR as a PVR (personal video recorder) for HD TV.

It works, but its user interface is very poorly done. Also, the size of the recordings are around 6.6 GB per hour, since it dumps the video and audio as is to the disk, without any transcoding. To get over this, I have a set of custom scripts that reduce the size while preserving acceptable quality, which I will outline in another article. But this requires that I unplug the USB disk and plug it into another machine, then unplug it and re-plug it back to the PVR.

I was looking for an alternative that would allow me to allow a PVR with a network connection, so the movement of files would not require physically plugging in USB disks.

For that, it seems that XBMC/Kodi was the right fit for being a PVR.

Odroid U3 with Ubuntu

My initial thinking was to get the Odroid U3 computer, which is similar to the Raspberry Pi, but with more features. I would need a power supply, and a case.

There is work on getting OpenELEC to work on it, which is an out of the box XBMC distribution.

But in the meantime, since it runs standard Ubuntu 14.04 and therefore I can do with it what I do with any Ubuntu computer. Also, being so small, having it turned on all the time was both tempting, and guiltless.

However, looking for Ubuntu packages of tvheadend client and server for XBMC on ARM was not encouraging. For example, the Team XBMC PPA has packages for xbmc-pvr-tvheadend-hts for i386 and amd64, but not armhf.

So, it seems that going for a regular PC with Intel architecture was inevitable. Before spending the money on a proper PC of the correct form factor and a tuner, I opted to test the USB TV Tuner first.

HP Pavilion Laptop with Intel i5 M450

I did so on an HP Pavilion DM4 13.3" Laptop with a broken hinge, and a disk that died a few months ago. The specifications are Intel i5 CPU M450 @ 2.4 GHz, and 4GB RAM. This CPU has 2 cores, and 4 threads. The disk was replaced with a 2.5" 256GB OCZ Vertex SSD which was lying around.

Hauppauge Win TV HVR USB stick 950Q

Then, I ordered the Hauppauge Win TV HVR USB Stick 950Q from Futureshop for $69.99 after $20 discount. It is supported in the Linux TV project.

Installing Ubuntu Linux 14.04

I opted for the server version of Ubuntu 14.04 as the starting point, using a standard install just with openssh-server enabled. I then installed the xubuntu-desktop meta package. Of course, this is the same as installing Xubuntu 14.04. I was later told by our local XBMC expert that starting with XBMCUbuntu was a better option. Maybe next time ...

Installing XBMC

Before we install XBMC, we need to add the team's PPA repository, and before we can do that, we have to install the commands that make it easy to add the repository.

# Install the add-apt-repository command
sudo apt-get install python-software-properties pkg-config software-properties-common

We then add the XBMC repositry, and retrieve a list of the packages.

# Add the Team XBMC repository
sudo add-apt-repository ppa:team-xbmc/ppa
sudo aptitude update

Finally, we install XBMC itself:

# Install xbmc
sudo aptitude install xbmc

Installing tvheadend

TVHeadEnd is the PVR server for XBMC on Linux. It interfaces with the tuner, and provides the recording functionality, ...etc.

To install it we need two parts, the client (from Team XBMC's PPA) and the server (from TVHeadEnd's project repository).

# Install TVHeadEnd PVR client
aptitude purge xbmc-pvr-tvheadend-hts

We then add the tvheadend repository, and do an update:

# Add the tvheadend repository
sudo curl http://apt.tvheadend.org/repo.gpg.key | sudo apt-key add -
sudo apt-add-repository http://apt.tvheadend.org/stable
sudo aptitude update

Finally, we install the TVHeadEnd server:

# Install the tvheadend server
sudo install tvheadend

Adding Missing Firmware

However, the firmware that comes with Ubuntu 14.04 is missing one firmware file, so when you try to tune channels, you get the following errors.

$ dmesg | grep xc5000

If you find something like:

xc5000: waiting for firmware upload (dvb-fe-xc5000c-4.1.30.7.fw)...
xc5000: Upload failed. (file not found?)

Then the file is missing, and you have to install it manually using the following commands:

First, unplug the TV Tuner from the USB port, then unload the kernel modules using the commands:

$ sudo rmmod bttv
$ sudo rmmod tuner

Then download the missing file, and move it to /lib/firmware, using the commands:

wget http://www.kernellabs.com/firmware/xc5000/dvb-fe-xc5000c-4.1.30.7.fw
sudo mv dvb-fe-xc5000c-4.1.30.7.fw /lib/firmware/

Now, re-insert the tuner into the USB socket, and then your tuner again. I use kaffeine under KDE, but there are multiple tuners out there depending on what you have and what you prefer.

The full output will be similar to the following:

[ 6657.904057] usb 2-1: new high-speed USB device number 3 using ehci-pci
[ 6658.058796] usb 2-1: New USB device found, idVendor=2040, idProduct=7200
[ 6658.058802] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=10
[ 6658.058805] usb 2-1: Product: WinTV HVR-950
[ 6658.058808] usb 2-1: Manufacturer: Hauppauge
[ 6658.058810] usb 2-1: SerialNumber: [removed]
[ 6658.420164] au0828: i2c bus registered
[ 6658.616624] tveeprom 8-0050: Hauppauge model 72001, rev E1H3, serial# [removed]
[ 6658.616632] tveeprom 8-0050: MAC address is 00:0d:fe:84:00:2a
[ 6658.616636] tveeprom 8-0050: tuner model is Xceive XC5000C (idx 173, type 88)
[ 6658.616640] tveeprom 8-0050: TV standards NTSC(M) ATSC/DVB Digital (eeprom 0x88)
[ 6658.616643] tveeprom 8-0050: audio processor is AU8522 (idx 44)
[ 6658.616647] tveeprom 8-0050: decoder processor is AU8522 (idx 42)
[ 6658.616651] tveeprom 8-0050: has no radio, has IR receiver, has no IR transmitter
[ 6658.616654] hauppauge_eeprom: hauppauge eeprom: model=72001
[ 6658.619140] au8522 8-0047: creating new instance
[ 6658.619145] au8522_decoder creating new instance...
[ 6658.630077] tuner 8-0061: Tuner -1 found with type(s) Radio TV.
[ 6658.630099] xc5000 8-0061: creating new instance
[ 6658.634865] xc5000: Successfully identified at address 0x61
[ 6658.634869] xc5000: Firmware has not been loaded previously
[ 6659.713055] au8522 8-0047: attaching existing instance
[ 6659.722375] xc5000 8-0061: attaching existing instance
[ 6659.727367] xc5000: Successfully identified at address 0x61
[ 6659.727372] xc5000: Firmware has not been loaded previously
[ 6659.727376] DVB: registering new adapter (au0828)
[ 6659.727383] usb 2-1: DVB: registering adapter 0 frontend 0 (Auvitek AU8522 QAM/8VSB Frontend)...
[ 6659.728604] Registered device AU0828 [Hauppauge HVR950Q]
[ 6666.036378] xc5000: waiting for firmware upload (dvb-fe-xc5000c-4.1.30.7.fw)...
[ 6666.036435] xc5000: firmware read 16497 bytes.
[ 6666.036437] xc5000: firmware uploading...
[ 6670.152165] xc5000: firmware upload complete...
[ 6672.920061] xc5000: waiting for firmware upload (dvb-fe-xc5000c-4.1.30.7.fw)...
[ 6672.920153] xc5000: firmware read 16497 bytes.
[ 6672.920156] xc5000: firmware uploading...
[ 6676.920085] xc5000: firmware upload complete...
[ 6704.306249] xc5000: waiting for firmware upload (dvb-fe-xc5000c-4.1.30.7.fw)...
[ 6704.306319] xc5000: firmware read 16497 bytes.
[ 6704.306320] xc5000: firmware uploading...
[ 6708.280078] xc5000: firmware upload complete...

Tune the stations

In order to configure TVHeadEnd, you need to carefully follow the instructions on their site. This is a multi-step process that takes some time to complete, because of the time it takes to scan all 68 possible channels, as well as following all the steps.

Problems So Far

I was disappointed to find some serious show stoppers with the above setup.

Problem 1: No sound on HDMI

There is sound coming out from the laptop speakers, but there is none coming out from the TV through the HDMI cable. I am not sure if this is a related to XBMC itself or the underlying Linux configuration.

Problem 2: TVHeadEnd Administration User Interface

My personal experience is that the administration user interface for tvheadend is cubmersome, because it requires a lot of steps that are not obvious, e.g. first configure an adapter, then scan, then map the muxes to channels, then manually rename each channel without knowning which channel it is, otherwise, they don't show up in XBMC. This is better served by a wizard that walks a first time user through the process.

I ended up naming the channels an initial letter, e.g. A, B, C, ...etc. since I did not know which channel is which. Then after XBMC picks them up and I can know which one is which, I go back to TVHeadEnd, and rename each channel for what it really is. However, when do so, XBMC does not pick up the updated channel names!

I had to wipe XBMC configuration (e.g. totally removing ~xbmc/.xbmc directory), in order to sync them. Later, I found out that if I use the "reset PVR" under System -> Settings -> Live TV does the same job without having to reconfigure everything again.

Problem 3: TVHeadEnd Requires Multiple Reboots

TVHeadEnd is also flaky because often you cannot connect to port 9981 (nor can XBMC connect to it on port 9982 for streaming), unless you reboot 3 or 4 times. This means that you cannot start watching TV reliably on a reboot. You have to waste time rebooting several times, which is frustrating.

Problem 4: Poor HDMI Quality

The output from the laptop's HDMI to the TV is not of good quality. There are very visible "motion streaks" when tuned to a TV channel, which does not happen with
either the crappy PVR that I have, or the TV's built in ATSC tuner.

Problem 5: XBMC Stability Issues

XBMC sometimes spontaneously aborts after streaming ATSC TV for a while. I just returned to the XUbuntu desktop. Another time, the XBMC is streaming a weak channel, then XBMC decides not to respond to the keyboard or the remote control vi a HTTP port 8080.

Problem 6: No Program Info, nor EPG

There is no program info sent from TVHeadEnd to XBMC. This means you don't get an idea on what the current program is, nor what time it starts and ends, like I have on my TV and the Homeworx PVR. As a result, the Electronic Program Guide (EPG) that is generated dynamically from the Program Info is absent. On the TV and the Homeworx, when I flip the channel, the name of the program, and its start and end times are shown for a few seconds for most channels. XBMC lacks this feature (or it is hard to find the settings for it, if it exists) which is disappointing.

Alternatives For Future Attempts

As evidenced from the above, a small ARM computer is not an option, because of the lack of tvheadend clients in the XBMC PPAs. The laptop is not a good option either, so a "shuttle" type chassis or Zotac small PC seems to the way to go.

Also possible is using XBMC with an over the LAN tuner with HDHomeRun instead of a USB tuner.

However, the flakiness and cumbersomeness of tvheadend, and XMBC being unstable under streaming video, makes using them less viable than I initially thought.

Contents: 

Tags: