Watch tv using a hauppauge pvr usb 2 and ubuntu 11.10

From LinuxIntro
Jump to: navigation, search

Contents


To watch TV using my Hauppauge PVR USB 2 tuner and Ubuntu 11.10

Get a video device

Before doing anything about watching TV, it is important that you see a video device in your operating system and can use this.

  • find out which video devices you have. Video devices can come e.g. from your webcam and - when we have it connected - from your TV tuner:
$ ls /dev/video*
ls: cannot access /dev/video*: No such file or directory
in this case we do not have a webcam or any other video device seen by the system.
  • plug your tuner into a USB slot, connect the antenna cable and connect power
  • find out which video device has been added:
$ ls /dev/video*
/dev/video0
in this case, /dev/video0 is our video device
  • kill all processes that block your video device:
$ lsof | grep video
nautilus  1769  bootstick  mem       REG       8,34    46824    3691 /usr/lib/libgstvideo-0.10.so.0.24.0
ok, there is a process nautilus blocking the video device. Kill it
$ killall nautilus
verify it is killed
$ killall nautilus
nautilus: no process found
verify there is no other process
$ lsof | grep video
$
good
  • install a video viewer
sudo apt-get install mplayer
  • now it is time to see if there is any video signal at all from the TV tuner. Expect to see snow or a TV channel with this command:
mplayer /dev/video0

What can go wrong

It happens sometimes that you see nothing but a green screen after starting

mplayer /dev/videox

In this case it helped me to reboot my computer. Or detect which processes are accessing /dev/video and kill them:

lsof | grep video

Switching channels

You can now switch TV channels if you know the frequency of your stations. For example if i want to watch hr in Germany I use

echo "55250000" > /sys/class/pvrusb2/sn-8567330/ctl_frequency/cur_val

What can go wrong for switching channels

sudo echo "104300000" > /sys/class/pvrusb2/sn-8567330/ctl_frequency/cur_val
bash: /sys/class/pvrusb2/sn-8567330/ctl_frequency/cur_val: Permission denied

In this case sudo does not work for all the line. You have to use

sudo su -
echo "104300000" > /sys/class/pvrusb2/sn-8567330/ctl_frequency/cur_val

Get TV software

You do not want to look up frequencies and use the command line just to switch to another channel. So get a TV watching application. I chose xawtv.

mplayer /dev/video0
  • in another console run
scantv -o .xawtv

See also