Jonathon Sim's Website

Browse

Mythtv - PVR-150 - Ubuntu - New Zealand HOWTO

Setting up a mythtv-based PVR is not for the faint of heart, but once you are done it is a pretty cool device, gaining you much street-cred/fame/fortune etc. After getting used to mythtv the "legacy" TV experience seems soo 20th century (what, I cant fastforward through the ads?)

I'm afraid this howto wont be too much help, I am mainly trying to document tricky bits that I dont think I will remember :-(

Links

http://pvr.geek.nz/w/index.php/Main_Page
http://zaf.geek.nz/projects/mythtv/mythtv-howto-contents.php

Hardware

My PVR is
  • an old Compaq Deskpro EN, Celeron 733 (this machine is reasonably quiet, and certainly cheap) (I got this for free)
  • A Hauppage PVR-150 - retail (not the OEM version). The OEM version will save you about $30 but doesnt have a remote - this cost about $170
  • A pci GeForce MX 420 (for TV out) - about $70
  • A 250Gb seagate harddrive (the main thing you want for myth is size and "quietness" - seagate drives are quieter than some others)

Note

You can of course find tv cards cheaper than the PVR 150, but I dont recomend it. The PVR-150 does hardware MPEG encoding, which means even an old throw-away machine like this one can record skip-free high quality TV (using just a few % of CPU). Otherwise you need a fast modern machine, and you need to jump through a few more hurdles.

Install ubuntu

Just do the default install. Its probably a good idea to do manual partitioning and create an LVM to put your recordings on. XFS works well as a filesystem Mythtv does a lot of deleting of large files, something ext3/reiserfs do poorly with - XFS and JFS do well, and I am used to XFS on my servers.

Install some prerequesites

sudo apt-get install build-essential gcc-3.4 linux-headers-686 scantv mplayer-686 mysql-server

Install ivtv

Download the latest driver from:http://ivtvdriver.org
There is a howto in the docs for installing on ubuntu. Ignore all the stuff that tells you to compile your own kernel - the linux-headers package is sufficient. Just untar the ivtv source and do
make
sudo make install
make install will tell you what you need to do to install the driver, follow those instructions, then follow the instructions in the docs for installing the firmware

Once installed I find I need to run:
sudo ivctl -d /dev/video0 -p 6 -f width=720,height=576 -u 1 (put this in an init script somewhere)

Testing it

You can test your tv card works like so.
mplayer /dev/video0 Should output some static at this stage since we havent tuned it

Now tune a channel
sudo scantv -c /dev/video0 -C /dev/vbi0 #(set tv norm to PAL, frequency table to newzealand - this will then find some channels)
sudo ivtv-tune -f pal-newzealand --input /dev/video0 -c [channel] #Use a channel number from above
mplayer /dev/video0
You should see some live tv!

Setup Mythtv

sudo apt-get install mysql-server mythtv Set a password for mythtv so you can login: sudo passwd mythtv
edit /etc/group and add mythtv to the admin group so you can sudo: admin:x:106:garry,mythtv Login as mythtv Then follow this guide to setting up myth for NZ(this guy has a pvr-500 - basically two 150s on one card, so he sets up two tuners)
http://zaf.geek.nz/projects/mythtv/mythtv-howto-contents.php

Deal with the fact that ubuntu's mythtv packages are evil

I found big problems getting myth-backend to connect to the database, (look in /var/log/mythtv if you have trouble getting the backend to start). Seemed to be something wrong with the standard init script, so I edited the init script and commented out all the start-stop-daemon stuff and replaced it with
su - $USER -c "$DAEMON $ARG

Autologin

Setup your .xsession, and setup the system to autologin (and bypass all the gnome business):http://www.cs.rit.edu/~css8044/?q=autologin#

The remote

Apparently this works fine with ubuntu's lircd without any major probs http://www.parker1.co.uk/mythtv_ubuntu2.php

I actually compiled my own version of lirc with a patch to support the ir-out of the pvr-150 - and had to tweak some of the button names in lircrc (YMMV - run "irw" to see what lirc calls each button ), but now the remote works very nicely.

Other stuff

You probably want to setup mythvideo/mythmusic/mythnews etc, samba so you can copy movies to/from the thing, ssh for remote admin, a dynamic-dns client and mythweb so you can schedule recordings from on the road. I installed a web-based bittorrent client (torrentflux) (you could also setup torrentocracy to integrate bittorrent right into mythtv)

TV Out

Nvidia TV out works well with the binary nvidia drivers (there are howtos all over the place), with some catches:
  • Nvidia cards can only hardware accelerate 1 screen, so dont use twinview
  • Color was poor on the telly to start with - apt-get install nvidia-settings and tweak the color-saturation and digital-vibrance settings to your taste (and while there playing with "overscan" and "flicker filter" is a good idea too), then put nvidia-settings -l into your .xsession to load the settings on startup

Video Playback (mythvideo)

The machine I used for this PVR is rather old, so I needed to tweak some things to get video playback working well without too much skipping or loss of audio sync, specifically setting the video playback command to mplayer -fs -ao oss -vo xv -framedrop %s(using native ALSA with the driver for the 82801BA/BAM audio controller in this beast didn't work so well, but oss emulation works better - and -framedrop lets it drop frames to maintain audio sync when 733 Mhz just isnt fast enough)