MythTV and Gentoo GNU/Linux

Disclaimer: Note this is a guide only! I cannot guarantee that my guide will work on your particular system. This is just a reference guide created from my personal experience installing MythTV on top of Gentoo GNU/Linux. If your computer blows up, starts smoking, offers you pot, or stabs you in the chest, I am not responsible for any damages that may arise while following this guide.

Make sure the page URL is: http://home.comcast.net/~alf_park/mythtv.html

Revision History:
   June 12, 2004: Fixed an omission, thanks Carl Anderson.
   June 10, 2004: Fixed some errors. Thanks Erik Hovland and Aaron Bohannon.
   June 7, 2004: Minor updates.
   May 30, 2004: Minor updates.
   May 27, 2004: Added 0.15 upgrade procedure (Appendix 3). Other updates.
   May 21, 2004: Some minor additions and helpful tips thanks to Corin Moss.
   May 5, 2004: Minor revisions. Added some SQL code to section 16.
   April 27, 2004: Added MythWeb section.
   April 3, 2004: Minor revisions and clarifications.
   March 31, 2004: Minor revisions under kernel compilation.
   March 22, 2004: Few minor revisions. Added playback commands.
   March 20, 2004: Initial version.

Overview

MythTV is an open-source (GPL) project that attempts to turn a computer running GNU/Linux into a fully featured TiVo-like box. In addition to recording shows and having time-shifting (Live TV) capabilities, the Myth addons allow for enhanced functionality, bringing a MythTV-enabled box to much more than a TiVo could ever do: a PVR with full HTPC functionality such as DVD playback, MPEG-4 (DivX/XviD) and other video format playback, music jukebox, image viewer, emulation box, web browsing, news, and weather.

Objectives

The impetus to writing this guide is to help fellow Linux users (especially those running Gentoo GNU/Linux) to craft a box capable of running MythTV under a 2.6 series kernel. This guide is specifically tailored to those with a Hauppauge WinTV PVR-250/350 capture card that comes with onboard MPEG-2 encoding (and decoding with the 350). Also this guide will focus on setting up tuner cards for NTSC/M or the standard available in the United States. I will assume that the user has basic knowledge of how to set up Gentoo on his/her own machine.

System Specs

This guide will obviously be tailored to my hardware setup. However, with proper kernel configuration, this guide may help people with differing hardware configurations. My PVR box contains:

A few sidenotes: CPU is a Mobile Athlon XP. I got this so I could overclock at will using the multiplier since the CPU is unlocked. The motherboard has the Nforce Soundstorm APU with S/PDIF TOSLINK (optical) digital out, however, nVidia does not provide drivers for the APU, instead the AC97 codec is used. This is why we will use the ALSA drivers instead. I opted not to use the PVR-350's TV-out functionality since the drivers are unstable, framerate is poor (especially on MPEG-4 playback), and since it is a simple framebuffer, emulation does not work. Perhaps in the future, I'll switch from the nVidia card to the Hauppauge.

Setup Guide and HOWTO

1. Download Gentoo GNU/Linux

I downloaded the 2004.0 release of Gentoo in the two CD flavor (GRP packages for Athlon XP on the second CD) to avoid the long compile times. One or two CDs, this install guide will still help.

2. Bring up the Base System

I used the standard Stage 3 Athlon XP tarball avoiding the long bootstrapping process from Stage 1 and 2. Follow the Gentoo Install Guide closely. Important! Specify your USE flags now to minimize recompilation. My USE flags for my system are below:

USE="x86 mmx 3dnow sse alsa avi crypt cscope dvd flac gif imlib jpeg lirc mad mpeg mysql oggvorbis opengl png quicktime sdl tiff truetype X xmms xv zlib nvidia -arts transcode xinerama -nls net joystick matroska -ldap apache2 xvid v4l2 theora"

Note: If you wish to use the GRP binary CD, do not perform an emerge sync yet!

3. Compile a 2.6 Series Kernel

Emerge gentoo-dev-sources. For the purposes of this guide, I will assume that the kernel is 2.6.5-r1. The gentoo-dev-sources already contains the lirc/lirc-i2c patches which is a blessing in disguise. Note: I can only guarantee that the options seen below are with 2.6.5-r1 kernel. If you want to emerge the same kernel I'm using, do:

emerge =gentoo-dev-sources-2.6.5-r1

Now, configure your kernel, and in addition to the required Gentoo options (like devfs support, see the Gentoo install guide), here are some additional kernel configuration options:

Obviously, if your hardware differs from mine, you should compile in the proper kernel options. I am opting not to post my kernel config file since hardware configurations greatly vary. Other notes: Do not select ACPI power management. If you need power management, go with APM. From my experience, ACPI makes the ivtv driver crash/freeze the system. If you don't plan on using gamepads/joysticks for emulation, just remove support for them above. AGP support does not need to be compiled in since the binary nvidia driver provides it's own GART interface. Note that if you do not own a Hauppauge PVR-250/350, but own a stereo-capable BT-compatible capture card (usually some form of an MSP or TDA chip), then you probably need to compile in the Bt87x Audio Capture under ALSA. The I2C Hardware Sensors Chip Support is not required. I compiled it in so I could take advantage of lm_sensors and monitor temperature and fan speed. Frame buffer support is only needed if you actually need a frame buffer for your primary VGA/DVI card or you want to use the Hauppauge PVR-350 framebuffer TV-out. Obviously, if you have a different sound card (non-intel8x0) then select the proper device. Configure additional options to your liking and hardware such as USB, Firewire, Network devices, etc.

Finish following the Gentoo Install guide and install the necessary system utilities (syslogger, cron daemon, boot loader, etc). Reboot.

4. Install Additional Packages

If you are using the GRP pre-compiled binary CD, insert the disc, mount it, then:

export PKGDIR="/mnt/cdrom"
emerge --usepkgonly <PACKAGE NAME>

A few binary packages you should take advantage of: xfree, gdm, mysql, vorbis-tools, a52dec, lame, sudo, vim, divx4linux, freetype, pciutils, xvid, flac, fontconfig, win32codecs. There are other pre-built binaries which you can install, please peruse the disc and install related multimedia files (such as mplayer, etc.).

5. nVidia and TV-Out

Note: If you want to use the WinTV PVR-350's framebuffer, you should consult section 7 and then appendix 2 instead of this section.

As of this revision of the document, nvidia drivers (5336) fail to overscan. The last overscan capable driver release was 4363. This is what we'll use since a non-overscanned TV-out looks like garbage. Go to this webpage and download the 4363 drivers modified to run under the 2.6 Linux kernel.

As root, run the install program (you may have to chmod it to set the executable bit). Say no to allowing the install program to find a newer version of the driver since this defeats the whole purpose of installing this old driver. Once it has installed, we need to create an /etc/X11/XF86Config-4 file capable of TV-Out. Currently, I'm running at 640x480 resolution since I'm not using the ivtv driver (which is capable of running at a native NTSC resolution of 720x480). The relevant sections from my XF86Config-4 file are:

Section "Monitor"
   Identifier "Sony TV"
   HorizSync 30-50
   VertRefresh 60
EndSection
 
Section "Device"
   Identifier "nvidia"
   Driver "nvidia"
   Option "NvAGP" "1"
   Option "NoLogo" "true"
   Option "HWCursor" "true"
   Option "RenderAccel" "true"
   BusID "PCI:2:0:0"
EndSection
 
Section "Screen"
   Identifier "Screen TV nvidia"
   Device "nvidia"
   Monitor "Sony TV"
   DefaultDepth 24
   Option "TVStandard" "NTSC-M"
   Option "ConnectedMonitor" "TV"
   Option "TVOutFormat" "COMPOSITE"
   Option "TVOverScan" "0.8"
 
   SubSection "Display"
     Depth 24
     Modes "640x480" "400x300" "320x240"
     ViewPort 0 0
   EndSubsection
EndSection

Note that the TVOverScan value is dependent upon your video card and TV. If you have your TV connected via an S-Video cable, change TVOutFormat to SVIDEO. Obviously, there are section missing in the XF86Config-4 file such as the mouse, fonts, etc. Fill in the appropriate sections according to your hardware configuration and test X. Now after the X runs successfully, lets inject stubs into portage so it thinks that the drivers are installed:

emerge inject media-video/nvidia-kernel-1.0.4363-r3
emerge inject media-video/nvidia-glx-1.0.4363-r3

Now any nvidia USE dependencies should be met.

6. ALSA and SPDIF Setup

Now, we'll attempt to get ALSA working. Our kernel has built the ALSA sound drivers, but we need to build the userland utilities to get ALSA working properly. First we need to sync our portage tree to get the latest sources. The following instructions are specifically tailored for the snd-intel8x0 ALSA module and S/PDIF output.

emerge sync
ACCEPT_KEYWORDS="~x86" emerge alsa-lib alsa-oss alsa-utils alsa-tools alsamixergui

You should try to grab the same ALSA lib/oss/utils/tools version which are present in the kernel you are using. Now modify /etc/modules.d/alsa:

alias snd-card-0 snd-intel8x0
alias snd-slot-0 snd-card-0
options snd-pcm-oss dsp_map=2 adsp_map=2

Now run update-modules. For any user who wishes to use the soundcard, you must have the proper .asoundrc file in their home directory. We will be creating a user called "mythtv" soon, so you will need to copy this file into mythtv's home directory. For now, let's just create it in the root directory. Here is my .asoundrc file:

pcm.nforce-hw {
   type hw
   card 0
}
 
pcm.!default {
   type plug
   slave.pcm "nforce"
}
 
pcm.nforce {
   type dmix
   ipc_key 1234
   slave {
     pcm "hw:0,2"
     period_time 0
     period_size 1024
     buffer_size 32768
     rate 48000
   }
}
 
ctl.nforce-hw {
   type hw
   card 0
}

The pcm hw:0,2 line specifies the proper S/PDIF address to re-route PCM data to; you may have to modify this to match your specific setup. Add ALSA to the boot-up sequence, start it, and load either alsamixer or the alsamixergui program to configure your soundlevels:

rc-update add alsa default
/etc/init.d/alsa start
alsamixergui

Set the appropriate sound levels, remember to unmute the IEC (SPDIF) playback channels for sound output. Test playback using aplay, madplay or xmms.

7. ivtv Setup

Now we need to setup the driver that will enable our Hauppauge PVR 250/350 hardware MPEG-2 chip. First we need to download the 0.1.9 release of the driver. Next, grab the unofficial ivtv patch file for your kernel version. After patching the source, follow these steps to build the ivtv driver:

cd ivtv/utils
wget http://hauppauge.lightpath.net/software/pvr250/pvr250_17_21288.exe
./ivtvfwextract.pl pvr250_17_21288.exe
cd ../driver
make; make install
cd ../utils
make
cp ivtvfbctl ivtvplay mpegindex test_ioctl /usr/local/bin

Now we need to create the modules.d file. Create and edit a file called /etc/modules.d/ivtv:

alias char-major-81 videodev
alias char-major-81-0 ivtv
alias char-major-61 lirc_i2c
options ivtv ivtv-debug=0 mpg_buffers=90
options tuner type=2
options msp3400 once=1 simple=1 debug=0
add below ivtv msp3400 saa7115 tuner
add above ivtv lirc_dev lirc_i2c

Add ivtv to the modules autoload. Edit the file /etc/modules.autoload.d/kernel-2.6, add the line:

ivtv

Finally, run update-modules. If you need to start ivtv now, run modprobe ivtv.

8. lirc Setup

First we need to emerge lirc and copy over config files:

ACCEPT_KEYWORDS="~x86" emerge lirc
rc-update add lircd default
cp ivtv/utils/lircd-g.conf /etc/lircd.conf

The last line above copies over the lircd.conf file for the Hauppauge Grey style remote that comes with the PVR 250/350 cards. The MythTV lircrc file will come later when we install MythTV.

9. Miscellaneous Setup before MythTV

Emerge mplayer and qt. You cannot use the binary package of QT since it does not have xinerama support if you wish to use MythBrowser and MythDVD. Otherwise, the binary package will work fine. Here are some miscellaneous steps to take before emerging MythTV:

ACCEPT_KEYWORDS="~x86" emerge mplayer
emerge qt corefonts ntp
ln -s /dev/cdroms/cdrom0 /dev/dvd
useradd -G users,audio,video,games,wheel mythtv
passwd mythtv
mkdir /home/mythtv
cp /root/.asoundrc ~mythtv/.asoundrc
chown mythtv:users -R /home/mythtv

The useradd line creates the mythtv user. We will use this user to control the mythfrontend and database fills. Also, it is important that you setup the ntp-client so the time on your machine is not too far off from what your cable box or provider is set to. The configuration file is located at /etc/conf.d/ntp-client. Don't forget to perform rc-update ntp-client default. It also may be advantageous to startup the Name Server Caching Daemon (nscd) in /etc/init.d/. You may even want to add this as a default level run service.

10. MythTV Installation

Now it's time to emerge the MythTV system and addons. If you have a Pentium 4 class machine, MythMusic may fail to compile. It has been suggested that MARCH=pentium4 could be the culprit.

ACCEPT_KEYWORDS="~x86" emerge mythtv mythtv-themes mythbrowser mythdvd mythgame mythgallery mythmusic mythnews mythvideo mythweather mythweb

Now let's configure the MySQL database. In the mysqladmin line, replace new-password with a password of your own:

/etc/init.d/mysql start
mysql_install_db
mysqladmin -u root password new-password
rc-update add mysql default

Now create the file .my.cnf in the /root directory which contains the following text (replacing new-password with the password you created above):

[client]
password = new-password

Now perform the following commands:

chmod 600 /root/.my.cnf
mysql < /usr/share/mythtv/database/mc.sql
crontab -u mythtv -e

The last line above will create a crontab entry for MythTV. You cannot add this into the system-wide crontab entry or you will get an XMLTV error. I want to run the TV listing update at 6AM every morning. Thus, while in the crontab editor, add these lines:

SHELL=/bin/sh
QTDIR=/usr/qt/3
 
0 6 * * * /usr/bin/mythfilldatabase --no-delete --quiet

Now we need to grab a few files from the MythTV source tarball. First download the source. Now follow these steps:

tar jxvf mythtv-0.15.tar.bz2
cd mythtv-0.15/contrib/dct-channel
make
cp channel /usr/local/bin
cd ~mythtv
mkdir .mythtv
cd .mythtv
cp mythtv-0.15/configfiles/hauppauge-lircrc-nativelirc lircrc
cd ..
ln -s .mythtv/lircrc .lircrc

The above steps copied over the channel changing binary (used to control the Motorola DCT-2244 cable box over RS-232) and copied over the MythTV specific lircrc file for the grey Hauppuage remote into the mythtv user's directory.

11. Create Video Storage with LVM

Instead of using a conventional filesystem straight on physical partitions, it's better to create logical partitions which can be expanded at later dates if you wish to add additional physical disks. I will be using SGI's XFS filesystem because of its excellent performance, journaling support, and code maturity. You may want to use IBM's JFS, however, it remains untested (I couldn't even get it to compile properly). ext3 can be used, but large file deletion performance is suspect. Another option is ReiserFS.

Hopefully you compiled in LVM support into the kernel. First, create physical partitions on each of the disks you wish to be part of the logical volume (use fdisk or cfdisk). In the example below, I will be using two partitions to create the logical volume group /dev/hda3 and /dev/hdb1. First, we need to emerge the LVM and XFS userland tools, then we can begin creating our logical volume:

emerge lvm2 xfsprogs
vgscan
pvcreate /dev/hda3
pvcreate /dev/hdb1
vgcreate mythvideo -s 64 /dev/hda3 /dev/hdb1
vgdisplay mythvideo

Note that you need to run pvcreate on each of the partitions you wish to include in the logical volume group. Of course, you need to also add them to the vgcreate command as well. After running vgdisplay it will output a line Total PE. You need to use this value in the next command:

lvcreate -l <Total PE here> mythvideo -n video
mkfs.xfs /dev/mythvideo/video
mkdir /mnt/video
chown mythtv:users /mnt/video

Now create an /etc/fstab entry for the logical group:

/dev/mythvideo/video /mnt/video xfs defaults 0 0

Continue with the setup:

mount /mnt/video
mkdir /mnt/video/recordings
mkdir /mnt/video/livetv
chown mythtv:users /mnt/video/recordings /mnt/video/livetv

If you are using ext3/ext2, make sure you run the command tune2fs -m 0 -i 0 -c 0 on the volume (or at least with the -m 0 switches. By default, mke2fs reserves 5% blocks for the superuser account which can be significant in a multi-Gigabyte volume.

12. Test TV Tuner and Remote Control

Let's test our handiwork thus far. First, the TV tuner card:

modprobe ivtv
test_ioctl -u 0x3000
test_ioctl -p 4
test_ioctl -f width=720,height=480
test_ioctl -v input=3,output=1
cat /dev/video0 > test.mpg

After a while, break the process by pressing CTRL-C. Test the mpeg file by loading it with mplayer. You should get BOTH video and sound if your card has been configured properly. If not, try specifying different values for the -p parameter. Now let's test the remote control:

/etc/init.d/lircd start
irw

Now start mashing the buttons on the remote pointed toward the Hauppauge IR receiver. You should see control codes printing out on the console. If so, congratulations, lirc is running properly and your remote is configured. Press CTRL-C to break out of irw.

13. MythTV Setup

Now it's time to setup MythTV. Don't worry, we're almost there :) Run the following as the mythtv user. This will ask various setup parts of MythTV according to your setup, consult the MythTV Master Backend Setup for more information. If you have a cable box where it requires the "TV" to be set to a certain channel (in my case it's channel 3), then set the "Preset tuner to channel" to the appropriate channel in the Input Connections setup. Also remember to specify the correct locations of your Recordings and LiveTV directories you created above under LVM.

/usr/bin/mythsetup
(Answer yes to both questions)
mythfilldatabase

mythfilldatabase will take a while to complete. It will grab at least 7 (or more) days of program guide data for ALL channels even if you don't subscribe to them. Please be patient at this step. After this has completed, we can now run the mythbackend and start the frontend:

rc-update add mythbackend default
/etc/init.d/mythbackend start
mythfrontend

14. Post-Configuration Setup

Now it's time to setup the MythTV frontend. You should experiment with the settings to see which best fit your system, but there are a few I will mention here due to their importance. If using the 4363 nvidia drivers, you must disable Hardware XvMC MPEG decoding support under TV Settings/Playback. If you are using recent nvidia drivers (or the WinTV PVR-350 TV-Out) then you can leave it enabled. However, note that XvMC can conflict with some settings such as deinterlace.

Transcoding settings are a bit confusing if you don't know the "direction" in which it's referring to. Just remember that it's transcoding FROM the specified profile TO your settings in the profile. For instance, the Transcoding profile MPEG2 means if the original source file is MPEG2, then it will transcode that file using the profile. Do not select "Automatically transcode after recording" for transcoding profiles, unless you like transcoding loops. :) Make sure you really want to transcode before transcoding. If you have a Hauppauge PVR card, you can simply rename .nuv (NuppleVideo) files into .mpg files. To extract shows from the database and their .nuv format, use the nuvexport tool. This tool exists in portage:

ACCEPT_KEYWORDS="~x86" emerge nuvexport

You shouldn't set your recording profile dimensions to be greater than the resolution of your TV out. First, you'll be wasting valuable space, and second it won't look any better.

Here is my DVD playback command for the curious (I cannot use the -ac hwac3, option since I get a Big Endian format not supported error):

mplayer dvd:// -dvd-device %d -ao alsa1x:spdif -srate 48000 -fs -zoom -vo xv

Note that mplayer does not properly support menus at this time. Use xine or ogle if you need DVD navigation/menu capability. Support for DVD menus is forthcoming in mplayer. And the video playback command:

mplayer -ao alsa1x:spdif -srate 48000 -fs -zoom -vo xv %s

Deinterlace, jitter reduction, aggressive audio buffering all seem to be working like a champ for me.

15. Autologin and DPMS setup

We will use gdm to manage our autologin so when the machine boots, MythTV will automatically start. gdm should already be installed from the GRP. If not, emerge it. Next edit the /etc/rc.conf file and set DISPLAYMANAGER="gdm". Next create an /etc/X11/Sessions/mythtv file that contains the following:

/usr/X11R6/bin/xset s noblank
/usr/X11R6/bin/xset s off
/usr/X11R6/bin/xset dpms off
(sleep 2; /usr/bin/mythfrontend &)
exec <YOUR FAVORITE WM>

The first three lines disable DPMS so your TV won't blank. I use fluxbox for the window manager; insert your favorite window manager in the last line. Now configure mythtv as your default login:

rc-update add xdm default
/etc/init.d/xdm start

The last line will start up X and gdm. Configure mythtv to be the autologin account using the Configure option (usually an icon or menu option somewhere off to the side or bottom). Login once using mythtv session (the one you just created) as the default session. Mythfrontend should now load automatically on boot.

16. Removing Unwanted Channels

See this section of the MythTV documentation on how to remove unwanted channels. If you are using the DataDirect service, simply unchecking channels in your online profile removes them from your lineup. If you are still using XMLTV, make sure you also put not in front of your channels in the xmltv file. Removing unwanted channels will speed up the xmltv update (mythfilldatabase) and you won't have to search through tons of channels that you don't get anyways for movie listings, etc.

The following is only for XMLTV users. To perform a mass deletion of a range of channels quickly from both the channel listing and program listing, first find the proper channel ID and then perform the MySQL delete command below. For example, I want to delete channels between 381 and 393. The channel IDs for those channels are 2381 and 2393 respectively on my system, thus issuing this SQL statement will delete channel and program entries:

delete FROM channel,program USING channel,program WHERE channel.chanid=program.chanid AND (program.chanid>=2381 AND program.chanid<=2393);

17. MythGame Setup

To play all of our classic games, we can use the MythGame frontend. Unfortunately, MythGame isn't very usable in it's current state (in my experience from 0.14, this may have changed with 0.15) as Gentoo's xmame isn't supported and the SuperNES emulation is tailored specifically for the (imho) inferior snes9x. Note: You don't have to be in mythfrontend for the backend to record! With that being said, you can still exit the mythfrontend and play your roms (that you physically own, of course) using a terminal. Emerge the following:

emerge fceultra zsnes xmame gens

You may encounter compilation errors dealing with GL header files. If so, you need to issue opengl-update xfree before emerging the emulators.

18. MythWeb Setup

Make sure that you have specified apache2 in your USE flags. When you emerge mythweb, apache2 and mod_php should be compiled correctly. Now edit the file /etc/conf.d/apache2 and add the line:

APACHE2_OPTS="-D PHP4"

Edit the apache2 configuration file, /etc/apache2/conf/apache2.conf and specify the DocumentRoot and ServerName (if necessary):

ServerName hostname
DocumentRoot /var/www/localhost/htdocs/mythweb

To speed things up, we should enable php zlib compression. To do so, edit the file /etc/php/apache2-php4/php.ini and modify the zlib compression line to:

zlib.output_compression = On

Now add apache2 to the default services and start it. Apache2 takes a while to start for the first time to generate Digest information.

rc-update add apache2 default
/etc/init.d/apache2 start

You should now be able to access your myth box through a browser pointing at its IP address, e.g. http://192.168.1.100/. To restrict access to MythWeb, you can add authentication via htaccess. To do so, edit the file .htaccess under mythweb and uncomment the first 4 lines. Then in /var/www/ run:

htpasswd2 -c htpasswd mythtv

Type in a password for the mythtv user. Of course you can use any combination of user/passwords as you like or even add more than one account.

Appendix 1. Universal Remote Configuration (One-For-All URC-6131)

I purchased a One-for-all universal remote, model URC-6131 because I didn't like the Hauppauge Grey remote that the PVR-350 comes with. Setting the VCR code to 0081 allowed the remote to speak the proper protocol with the Hauppauge IR receiver. Next, I used irrecord to capture as many keys as I could. Finally I used the Keymover function to unify all controls of my system from the receiver/TV/cable box onto the PVR buttons. It works nicely. If you want the lircd.conf and corresponding lircrc files, email me and I will send them to you. With enough requests, I may make them downloadable here.

Appendix 2. ivtv Framebuffer TV-out Setup

First you need to patch ivtv and install an additional X driver. Download the prepdma patch into the ivtv directory.

wget http://membres.lycos.fr/badzzzz/ivtv-fb-fix-prepdma.diff
cat ivtv-fb-fixpredma.diff | patch -p1
wget http://membres.lycos.fr/badzzzz/ivtvdev_drv.o.gz
gunzip ivtvdev_drv.o.gz
mv ivtvdev_drv.o /usr/X11R6/lib/modules/drivers/

If you want to use the ivtv framebuffer for it's picture sharpness, hardware MPEG decoding, and full NTSC resolution (and working overscan), then you need to modify your ivtv modules file and XF86Config-4. First, the /etc/modules.d/ivtv file needs to be modified to:

alias char-major-81 videodev
alias char-major-81-0 ivtv
alias char-major-61 lirc_i2c
options ivtv ivtv-debug=0 mpg_buffers=90
options saa7127 enable_output=1 output_select=0 options tuner type=2
options msp3400 once=1 simple=1 debug=0
add below ivtv msp3400 saa7115 tuner saa7127
add above ivtv lirc_dev lirc_i2c ivtv-fb

If you want to use S-Video instead of composite out for the PVR card, then change output_select=0 to output_select=1. Run update-modules. Now we need to modify /etc/X11/XF86Config-4. But first, we need to find the BusID of our PVR card. Run lspci -v. You should see something like this:

01:09.0 Multimedia video controller: Internext Compression Inc iTVC15 MPEG-2 Encoder (rev 01)
          Subsystem: Hauppauge computer works Inc. WinTV PVR-350
          Flags: bus master, medium devsel, latency 32, IRQ 12
          Memory at d8000000 (32-bit, prefetchable) [size=64M]
          Capabilities: [44] Power Management version 2

Take note of the first set of numbers. In my example it is "01:09.0". You need to convert this into hexadecimal. Since there is no number greater than 9, we don't have to do any conversion. Now let's modify the /etc/X11/XF86Config-4 file:

Section "Monitor"
   Identifier "Sony TV"
   HorizSync 30-50
   VertRefresh 60
 
   Mode "720x480"
     DotClock 34.564
     HTimings 720 752 840 928
     VTimings 480 484 488 504
     Flags "-HSync" "-VSync"
   EndMode
EndSection
 
Section "Device"
   Identifier "ivtv"
   Driver "ivtvdev"
   Option "fbdev" "/dev/fb1"
   BusID "01:0x09:0"
EndSection
 
Section "Screen"
   Identifier "Screen TV ivtv"
   Device "ivtv"
   Monitor "Sony TV"
   DefaultDepth 24
   DefaultFbBpp 32
 
   SubSection "Display"
     Depth 24
     FbBpp 32
     Modes "720x480"
     ViewPort 0 0
   EndSubSection
EndSection

Make sure your framebuffer device is correctly referenced. Mine is /dev/fb1 since I have a framebuffer running on the Geforce4 card as well.

Note that I've had numerous hangs/crashes/freezes with the ivtv driver using TV-out while just watching TV and watching/recording at the same time.

Appendix 3: Upgrading MythTV to 0.15 and Migrating to DataDirect

Update: Official mythtv 0.15.1 ebuilds have entered into portage. The previous copy/digest procedure is no longer necessary and has been removed. However, you still have to upgrade the mysql database properly and perform a mythsetup.

With the new release of 0.15, North American users can dump the XMLTV update scheme and go for the more elegant DataDirect service provided by Zap2it. Follow these steps to get your MythTV functioning under 0.15 and DataDirect. First we need to back up our database just in case something goes wrong:

mysqldump mythconverg -c > backup.sql

Now head on over to labs.zap2it.com and create a free account. Use the code ZIYN-DQZO-SBUT courtesy from mythtv.org. Next we need to create a copy of our channel table. While in mysql, issue this SQL command:

CREATE TABLE channel_copy SELECT * FROM channel;

Now comes the tedious process of upgrading. When performing the mythsetup program, make sure you say yes to clear program and channel settings. Also, for your data provider, make sure you select DataDirect. Follow these steps exactly (make sure that you will emerge wget version >= 1.9.1. If not, perform an emerge sync first):

emerge sync
ACCEPT_KEYWORDS="~x86" emerge wget mythtv mplayer
/usr/bin/mythsetup (clear all program/channel settings: say yes)
/usr/bin/mythfilldatabase
/etc/init.d/mythbackend restart

Now copy over the channel icons. Assuming you have MySQL v4+, issue these two SQL commands:

UPDATE channel,channel_copy SET channel.icon = channel_copy.icon WHERE channel.callsign = channel_copy.callsign;
drop table channel_copy;

Now we need to compile all of the plugins. For example, for mythvideo:

ACCEPT_KEYWORDS="~x86" emerge mythvideo

Repeat this process for mythdvd, mythmusic, mythbrowser, mythweather, mythnews, mythgallery, mythgame, and mythweb. You may also need to run opengl-update xfree first before emerging mythmusic and mythgallery, unless you have emerged "proper" nvidia drivers (gcc can't seem to find the GL header files even though they exist at the right locations!)

One final thing to note, if you upgraded mplayer to the latest, alsa9 audio output has been replaced with alsa1x. Change your player settings from -ao alsa9:spdif to -ao alsa1x:spdif.

Appendix 4: Links

Contact Information

© 2004, Alfred Park (alfpark AT myway DOT com).
You may not copy this page and re-publish it without explicit consent from the author. This is so the most recent version can always be found here.
Created using vim, and best viewed in any browser supporting standards compliant XHTML and CSS.

Valid XHTML 1.1! Valid CSS!  counter