MythTV - An Open Source alternative to TiVo

by Ralph
April 9th 2005

  MythTV is a suite of programs that allow you to build the mythical home media convergence box on your own using Open Source software and operating systems.

  Features include pause, fast-forward and rewind live TV as well as record shows to your hard disc, and much more!

  Today I'll walk you through how I installed Knoppmyth R5A12 with a single Hauppauge PVR 500 on my system.



  Download Knoppmyth R5A12 software from one of the mirrors here. Use your favorite cd burning app to create a bootable cd from the .iso

  Go to labs.zap2it.com (for US) and create a user account. Accept the terms. The next screen is your subscription registration. Use ZIYN-DQZO-SBUT in the "Certificate Code" field. Fill out the survey, then proceed to the lineup choices and configure your account for your location and the channels you have. This information will be imported into MythTv when you run mythtv-setup. Don't worry about the "your subscription expires on..." Every so often you'll have to fill out another survey in order to continue using the Zap2it DataDirect service. It's only a few questions and they provide the means to download your program guide. This is required, but their service is free.

  First back up all important data on your HD if you will be dual booting with Knoppmyth incase you make a mistake when partitioning your HD. Unless you know what you are doing, create your partitions of the following sizes: 5-7gb for /, 500mb for /swap, 10gb for /cache (used for live tv buffer - REQUIRED) and the rest of the hard drive for /myth.

  Make sure you computer is set to boot from the CD drive first in the BIOS. Stick the Knoppmyth CD in and reboot.

  While booting up, Knoppmyth will try to probe for all the hardware in your computer and automatically set up the proper modules. Once the probe is finished you'll see 6 options to choose from. Choose Partition which will run cfdisk.

      select "New, Primary" with the size of your / partition
     arrow down to free space
     select "New, Logical" enter 500
     arrow over to type and select swap from the list
     arrow down to free space again
     select "New, Logical" enter 10gb for /cache
     arrow down to free space once more
     select "New, Logical" and use the rest of the space for /myth

  Write the partition numbers and their corresponding mount points down on a piece of paper as you will need this information later. Then write the partition table to the hard drive. After the partition has been written, quit cfdisk. Sometimes logical partitions will not be recognized until you reboot. So type reboot, so the partitions will be seen by the Knoppmyth installer. After the reboot and back at the Knoppmyth installer main menu, you must format your new partitions.

  Based on the recommendations of the creator of Knoppmyth format your partitions as root as follows:

Press ctrl+alt+F2 then type:

     mke2fs -O sparse_super -m0 -i8000000 -L cache -M /cache /dev/hdaX

(Where X denotes the number for the /cache partition that you wrote down on your paper)

     mke2fs -j -O sparse_super -m0 -i8000000 -L myth -M /myth /dev/hdaX

(Where X denotes the number for the /myth partition that you wrote down on your paper)

Press ctrl+alt+F1 to return to Knoppmyth installation

  These formatting options should yield some performance increases on /cache (used for the live tv buffer) A journaling fs is highly recommended for the /myth partition. This is where all your recorded programs will be stored.

Choose 2 to auto install if you're installing on a brand new clean hard drive that is connected to /dev/hda (primary master) Auto install will only work if you choose /dev/hda.

  Choose 4. Manual Install (SATA users must choose manual install) After you create and format the 2 partitions above, choose 1. Configure Installation. Select your / partition. Enter the requested information, but DO NOT create a user "mythtv" as this user is already created with a password of "mythtv". Remember your Administrator/root password. (If you are dual booting and want to use an existing boot loader - i.e. Lilo or Grub - then select to install the boot loader to the partition instead of MBR, or else this will wipe out your existing boot loader configuration.)

  Once back to the main menu, pick 2. Start installation. Verify the information and select yes. Once complete, exit and reboot the system. (If dual booting, now is the time you need to edit /etc/lilo.conf of your existing boot loader and run lilo as root)

  After the system reboots, it will start X and Knoppmyth will open an Xterm and ask for the root password. Enter the root password, configure your system time and date (important especially for those that adhere to Daylight Savings Time) Configure your IP address.

  Select i586 for Pentium class processors, K6, C3, etc. or I686 for PentiumPro class processors, PentiumPro and above, Athlon and Duron. If unsure i586 is the safe bet, this is the default and is compiled with LIRC. If you choose i686 then also select IR remote on the next screen. If you have an nVidia based video adapter which supports XvMC don't select XvMC at this time.

  KnoppMyth will install the appropriate packages and start mythtv-setup, where you have to configure the MythTv backend.



          General
Delete card options (for fresh installs only)
Delete channel settings (for fresh installs only)
Change the ip address to dhcp ip address
Master server ip address should be the same as above
DO NOT change the ports



Directory for recordings should be /myth/tv (your /myth partition)
Live-TV buffer should be /cache/cache (your /cache partition)
The live tv buffer can be no larger than the /cache partition you created. I bumped it up to 5GB with a minimum of 100MB on my 10GB /cache partition.
Tick to save original files after transcoding if you wish to transcode your recordings
TV format NTSC for US
Enter the rest of the settings to match your system/location.
Enter any shutdown/wakeup commands you use (or leave default)
Enter any wake on lan commands you use
Maximum jobs should match how many encoder cards you have (i.e. pvr 500 has 2 tuners onboard so you can do 2 jobs at once)
If you have a fast cpu you can set CPU usage to high if you want the commercial detection/transcoding jobs to use all available cpu cycles.
Click next then finish

          Capture Cards
Create a new capture card for each capture card you have
The pvr 500 uses 2 capture cards, so I need to create 2
Change the card type to match your card (use pvr 250/350 for the pvr 500)
Set the video device to /dev/video0 for the first capture card
Set the default input that the cable is hooked to (coax is tuner 0 for the first tuner)



Create a new capture card for each tuner you have
The second tuner of a pvr 500 should be set to /dev/video1 with tuner 0



          Video Sources
Select New video source
Enter a Video source name (i.e. cable, antenna, etc)
Enter the user ID and password you used when you registered at labs.zap2it.com and select retrieve lineups. If you set up more than one lineup, pick the corresponding line up. (a digital cable box has 1 lineup and cable ready televisions have another where I live)
Leave the channel frequency table to default and click finish

          Input connections
This tells the card which input connection to use and what method you are using to connect to it
Scroll down to the correct input connection for each card and hit enter
Set the video source to the source you set up in Video sources
Click finish
Do this for each card you have



          Channel Editor
Nothing to do at this time.

  Hit the ESCape key to exit mythtv-setup. You'll see in the terminal that it's connecting to zap2it to download all the guide info for the next 2 weeks. This takes a while so go grab a sandwich. Don't be concerned about the "401 Unauthorized" and "200 OK" messages, these are normal. The Frontend will now start. At this point you should install the nvidia drivers if you are using an nvidia based video card.

Hit ctrl+alt+F1
     log in as root
     cd /usr/src
     tar -jxvf kernel-source-2.6.9-chw.tar.bz2
    install-nvidia-6629-debian.sh
This will install the nvidia drivers and restart GDM

  Once Knoppmyth boots to the desktop again, you'll see the same box where you need to enter the root password again. BEFORE you do, open a new terminal by right clicking on the desktop, and then click on Apps->Shells->Bash and login as root by typing:

     su
    password
<--enter the root password at this prompt

  For now we have to mount the two partitions manually. (Substitute X for your partition numbers that you wrote down earlier):

      mkdir /myth/tv
     mount /dev/hdaX /myth/tv
     chown mythtv:mythtv /myth/tv
     chmod a+rwx /myth/tv
     mkdir /cache
     mkdir /cache/cache
     mount /dev/hdaX /cache
     chown -R mythtv:mythtv /cache

  This creates the 2 mount points for the live tv buffer (/cache/cache) and the storage for all your recordings (/myth/tv) and assigns owner:group both to mythtv.

  Now you need to edit /etc/fstab so your partitions are mounted automatically when you boot up the computer. Still as root, type:

     nano /etc/fstab

  Where you see "# Added by KNOPPIX" change to match your partitions you created earlier. Here's mine for an example only.

     # Added by KNOPPIX
     /dev/hda8 /cache ext2 auto,users,exec 0 0
     # Added by KNOPPIX
     /dev/hda9 /myth/tv ext3 auto,users,exec 0 0

  ** Note that hda8 and hda9 will have to be changed for your partitions and also note that I delete the "no" in "noauto" for both lines. This will now auto mount your partitions.

     ctrl+O to write the file to disc and press enter (uppercase letter O)
     ctrl+X to exit nano
     exit
    exit

  Enter the root password in the original bash terminal that was open. Mythbackend will start again. IMPORTANT You have already entered your card and channel settings so hit "No, leave alone" for both questions. Double check all 5 categories to make sure everything is as it should be. Keep hitting the ESCape key to exit back to the desktop when finished.

  Now Mythfrontend will run. Just hit the ESCape to exit back to desktop again. Open a bash terminal again and type:

     wget http://www.ivtv.tv/releases/ivtv-0.3/OLD/ivtv-0.3.2s.tgz

  This will download the ivtv driver tarball. The releases are quick and often, and the old drivers are moved to /OLD when the new drivers are uploaded. I used version 0.3.2s.tgz of the ivtv driver and that worked the best for me. Now type:

      su
     password <--enter root password at this prompt
     mkdir /lib/modules/old
     mv /lib/modules/2.6.9-chw-4/extra/msp3400.ko /lib/modules/old
     mv /lib/modules/2.6.9-chw-4/kernel/drivers/media/video/tuner.ko /lib/modules/old
     mv /lib/modules/misc/tuner.ko /lib/modules/old/tuner.ko.misc
     tar -zxvf ivtv-0.3.2s.tgz
     cd ivtv-0.3.2s/driver
     make
     make install
     cp tuner.ko /lib/modules/2.6.9-chw-4/kernel/drivers/media/video/tuner.ko
     cp tuner.ko /lib/modules/misc/tuner.ko
     cd ../utils
     make
     make install

  Download and extract the Hauppauge firmware:

     wget ftp://ftp.shspvr.com/download/wintv-pvr_250-350/win9x-2k-xp_mpeg_wdm_drv/pvr48wdm_1.8.22037.exe
     ./ivtvfwextract.pl pvr48wdm_1.8.22037.exe

  This replaces ivtv-fw-dec.bin and ivtv-fw-enc.bin in /lib/modules

  Insert the CD that came with the pvr 500 and mount the cd to /cdrom and then cp the firmware to /lib/modules:

     mount /dev/hdX /cdrom
    cp /cdrom/WinTV-PVR-150500MCE_2.0.18.22316_WHQL_signed/HcwMakoA.ROM /lib/modules


 Replace X with the locatation of your cdrom device.

  Edit /etc/mythtv/modules/ivtv with nano:

     nano /etc/mythtv/modules/ivtv

  Make it look like like below. Spelling is extremely important!

      alias char-major-61 lirc_i2c
     alias char-major-81 videodev
     alias char-major-81-0 ivtv
     alias char-major-81-1 ivtv
     options cx25840 no_black_magic=1
     options ivtv ivtv_std=0 tuner=57,57 tda9887=0,0 ivtv_debug=1

     options cx25840 i2c_enable=1
     options saa7127 i2c_enable=-1
     options msp3400 once=1 simple=1

  Write the file to the HD and exit nano. This is for a single PVR 500. If you have other pvr cards in your computer, you'll have to slightly modify some of these options. I only have the one pvr card, so this works for me. Read the docs in ivtv-0.3.2t/doc/README.cx25840

  For the line "options ivtv ivtv_std=0"
0=NTSC
1=PAL
2=SECAM

  Now the last file you need to edit using nano is /etc/init.d/set_ivtv_params

      cd /etc/init.d
     mv set_ivtv_params ./set_ivtv_params.old
     nano set_ivtv_params

  Just enter the lines below. Then write the file and exit.

     #!/bin/bash

     /usr/local/bin/ivtvctl -d /dev/video0 -u 1 -f width=720,height=480 -p 6
     /usr/local/bin/ivtvctl -d /dev/video1 -u 1 -f width=720,height=480 -p 6

  Fix the permissions for this file:

     chmod +x set_ivtv_params

  Type reboot in the terminal to reboot your computer

  Now we need to configure the Mythfrontend. Arrow over to Information Center, select Weather and set up for your location. Once finished, pres "i" to save and the ESCape key to exit.

  Arrow over to Utilities/Setup, hit enter, select Setup, hit enter, select TV Settings, hit enter. Hit next untill you see the Commercial Skip settings. Set the Commercial Skip Method to All and then set Autmatically Skip Commercials to Auto

  ESCape (key) back to Recording Profiles. Select MPEG-2 Encoders and hit enter. Set all of them to 720x480 and then do the same for Transcoders.

  The rest of the settings need to be set up for your preferences. For now hit the ESCape key until you are back at the main menu and Watch some TV!





  The details for installing knoppmyth R5A12 have been copied from Pamphlet of KnoppMyth




This page has been viewed      times.