MythTV

Miscellaneous Notes

Setting Up a Mythbuntu VM

Install Mythbuntu

Get a [WWW] Mythbuntu ISO image and follow the standard installation procedure. Don't click the "Launch MythTV Setup" button at the end of the installation. You'll configure the backend later.

Once you've disconnected the ISO image and booted into the installed OS, exit out of Mythfrontend, and then update the system. First, comment out the CD-ROM line in /etc/apt/sources.list (which the installer leaves there for some reason), then run:

$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo apt-get autoremove

You may also want to install the Avahi dameon so that you can access the VM as guest-machine-name.local (assuming you configured the VM to used bridged networking):

$ sudo apt-get install avahi-daemon libnss-mdns

If the upgrade installed a new kernel, the system will tell you that you need to reboot, which you should do now.

Install VMware Tools

First, run

$ sudo apt-get install gcc linux-headers-$(uname -r)

Then, build and install VMware tools as usual. It's probably best to reboot when you're finished.

Set up recordings directory

On the host machine, create the directory:

$ sudo mkdir /mythtv-recordings
$ sudo chown $(whoami):$(whoami) /mythtv-recordings
$ sudo chmod 775 /mythtv-recordings

Then, add /mythtv-recordings as a shared folder in VMware. Make sure the name of the shared folder is also "mythtv-recordings" (so that it's mounted as /mnt/hgfs/mythtv-recordings in the guest).

On the guest machine, first run

$ sudo umount /mnt/hgfs

Next, in /etc/fstab, add the options uid=mythtv,gid=mythtv to the /mnt/hgfs entry so that it looks more or less like the following:

.host:/ /mnt/hgfs vmhgfs defaults,ttl=5,uid=mythtv,gid=mythtv 0 0

(To see all the mount options for hgfs, run mount.vmhgfs --help.)

After that, remount /mnt/hgfs and verify that mythtv-recordings now has mythtv as its owner and group:

$ sudo mount /mnt/hgfs
$ ls -l /mnt/hgfs
total 1
drwxrwxr-x 1 mythtv mythtv 102 2008-01-11 13:11 mythtv-recordings

Finally, set up some necessary symlinks:

$ sudo rmdir /var/lib/mythtv/recordings
$ sudo ln -s /mnt/hgfs/mythtv-recordings /var/lib/mythtv/recordings
$ sudo ln -s /var/lib/mythtv/recordings /var/www/recordings

Install WinTV-PVR-USB2 driver and firmware

The [WWW] Hauppauge WinTV-PVR-USB2 tuner uses the [WWW] pvrusb2 driver. The driver and firmware packaged with Mythbuntu don't seem to work, so you have to install them yourself. The instructions that follow are derived from the [WWW] full pvrusb2 setup guide.

To build and install the driver:

$ wget http://www.isely.net/downloads/pvrusb2-mci-20071202.tar.bz2
$ tar xjf pvrusb2-mci-20071202.tar.bz2
$ cd pvrusb2-mci-20071202
$ KDIR=/lib/modules/$(uname -r)/build make --directory driver
$ sudo cp driver/pvrusb2.ko /lib/modules/$(uname -r)/kernel/drivers/media/video/pvrusb2
$ sudo depmod -a

To extract and install the firmware:

$ wget http://hauppauge.lightpath.net/software/install_cd/hauppauge_cd_3.4d1.zip
$ sudo apt-get install unzip
$ mkdir hauppauge_cd_3.4d1
$ unzip -d hauppauge_cd_3.4d1 hauppauge_cd_3.4d1.zip
$ ./pvrusb2-mci-20071202/utils/fwextract.pl hauppauge_cd_3.4d1
$ sudo cp v4l-pvrusb2-24xxx-01.fw v4l-cx2341x-enc.fw v4l-cx25840.fw /lib/firmware/$(uname -r)

Once this is done, attach the tuner card. Use lsusb to verify that the device is connected:

$ lsusb
...
Bus 002 Device 003: ID 2040:2400 Hauppauge 
...

If the driver loaded correctly, there should be a /dev/video0. If there isn't one (which is usually the case on the first try), remove and reload the kernel module:

$ sudo rmmod pvrusb2
$ sudo modprobe pvrusb2

You may have to do this more than once, but in the end you should have a /dev/video0.

Install FusionHDTV5 USB firmware

The [WWW] DViCO FusionHDTV5 USB Gold is supported by the default Mythbuntu kernel. However, due to an [WWW] Ubuntu packaging bug, the required firmware is not included, so you have to download and install it yourself:

$ wget http://linuxtv.org/download/firmware/dvb-usb-bluebird-01.fw
$ sudo cp dvb-usb-bluebird-01.fw /lib/firmware/$(uname -r)

Once this is done, attach the device, and you should see /dev/dvb/adapter0/:

$ lsusb
...
Bus 002 Device 006: ID 0fe9:d501 DVICO
...
$ ls /dev/dvb/adapter0/
demux0  dvr0  frontend0  net0

Install Medibuntu packages

From the [WWW] Medibuntu docs:

$ sudo wget http://www.medibuntu.org/sources.list.d/gutsy.list -O /etc/apt/sources.list.d/medibuntu.list
$ wget -q http://packages.medibuntu.org/medibuntu-key.gpg -O- | sudo apt-key add - && sudo apt-get update
$ sudo apt-get upgrade

The upgrade should install a new version of [WWW] FFmpeg and its dependencies.

Set up MythTV

Backend

Run the backend setup program (Applications > System > MythTV Backend Setup) and add the following configuration info:

When you're finished, exit the setup program and click "OK" to run mythfilldatabase. For some reason, this doesn't get the channel names, so also run

$ sudo -u mythtv mythfilldatabase --do-channel-updates --sourceid 1

Frontend

Start mythfrontend (Applications > Multimedia > MythTV Frontend) and change the following settings (under "Utilities / Setup > Setup"):

Install JustPlay code

$ sudo apt-get install subversion
$ svn co svn://o2s.csail.mit.edu/trunk/o2s-libs/video/mythtv
$ cd mythtv
$ mkdir ~/bin
$ cp reload_driver ~/bin
$ cp reload_driver.desktop ~/Desktop
$ sudo cp cleanup_recordings cut_ads_and_transcode transcode_recording /usr/local/bin
$ cd /var/www/mythweb/modules/tv/tmpl/default
$ sudo mv recorded.php recorded.php.orig
$ sudo cp recorded.php.orig recorded.php
$ cd -
$ sudo patch /var/www/mythweb/modules/tv/tmpl/default/recorded.php recorded.php.patch

Then, run crontab -e as the mythtv user:

$ EDITOR=vi sudo -u mythtv crontab -e

and add the following entry:

0 * * * * /usr/local/bin/cleanup_recordings 2>&1 > /dev/null

last edited 2008-01-18 22:51:08 by ChrisStawarz