Howto:Gentoo

From IVTV

Jump to: navigation, search

For the impatient:

ksh> emerge ivtv; modprobe ivtv

Contents

Rationale

Below you will find a precise description howto install a recent version of ivtv (>=ivtv-0.8.0) on a Gentoo system running a pretty recent kernel (>=gentoo-sources-2.6.18) on Intel, AMD or PowerPC architecture. The supported hardware includes general available generic digital video capture devices like the Hauppauge PVR-150 (one tuner) and PVR-500 (two tuners). The description applies to PAL users (no need to change any configuration file).

If ivtv has been installed properly, you are able to make bareback recordings of TV programs and FM radio using the command line of your system (described below). A very neat and user friendly X Window application for recording and viewing recorded TV programs (including lots of other nice things) is offered by the freely available MythTV package. Once you have installed ivtv, and your X Window is up and running, you should be able to emerge mythtv (not covered here).

At the end of this page, the install process of drivers for the TV-Out facility of some cards (e.g. Hauppauge PVR-350) in combination with suitable display adapters will be discussed (see Installing XDriver).

Some variations of cards are specifically designed for and intended to be sold for usage with dedicated (i.e. certified) Microsoft hardware and software. Such cards are equiped with onboard infrared receiver and remote control. These cards, which are denoted with the MCE qualifier, are generally known to work correctly with generic motherboards and ivtv package, but the infrared control is not functional. General infrared control handling (as used by the MythTV package) is available through the lirc package (not covered in this description).

Some cards are equipped with FM radio tuners. If so, you are able to tune into you favorite radio program as well after you have completed the install of your video-card. This also requires that your computer sound system is working properly (preferably alsa). Although installing of the alsa drivers is not covered here, a little section below is dedicated to Tuning your radio.

Introduction

Early versions of ivtv (<=ivtv-0.4.7) provided kernel modules which are not compatible with official V4L(1) modules. Recently ivtv has succesfully merged with the mainstream video kernel modules. Background on this can be found here: [1].

Due to this evolution, the early versions (<=ivtv-0.4.7) are only compatible with kernel versions <=2.6.15, and ivtv-0.6.4 and ivtv-0.7.1 are only compatible with kernel versions 2.6.16 and 2.6.17 respectively. The migration of ivtv towards standard kernel modules has been finalized with ivtv-0.8.0, which is compatible with kernels 2.6.18 and higher. In kernel 2.6.22 ivtv merged with mainline and only ivtv-fb and the userland tools reamain. To see notes on installing with kernels 2.6.22 or greater, see the "Newer Kernels" section below.

The ivtv ebuild scripts are aware of this kernel specific dependency, so you will only be able to emerge ivtv-0.8.0 if you are using the proper kernel (i.e. =2.6.18.x). See the 'News' section on the main page of this wiki for details of which specific ivtv version is intended for a particular kernel. (The ivtv guys abide by maintaining a lot of versions for older and newer kernels alike.)

As stated in the general Howto, ivtv needs some specific kernel modules. Unfortunately, the mentioned list is far from accurate and depends heavily on the specific version of ivtv and the kernel you would like to use.

You are advised to use >=ivtv-0.10.x with kernel 2.6.18. If you have not done so, you are strongly encouraged to upgrade your kernel before emerging ivtv. There will be no active support given on anything but version 0.10 and 1.0.

Newer Kernels (>=2.6.22)

Beginning wit kernel 2.6.22, ivtv has been merged into the mainline kernel. This obviously causes some changes in the installation process. The ivtv ebuild from the portage tree now only contains the userspace applications for the ivtv driver. When using a 2.6.22 or greater kernel, you must use an ivtv version 1.0 or greater.

In the kernel, the following options must be selected (some of these are required for the Gentoo ivtv ebuild to complete)

  • Loadable module support -> Automatic kernel module loading (CONFIG_KMOD)
  • Device Drivers -> Multimedia Devices -> Video For Linux (CONFIG_VIDEO_DEV)
  • Device Drivers -> I2C support (CONFIG_I2C)
  • Device Drivers -> Multimedia Devices -> Enable Video For Linux API 1 (DEPRECATED) (CONFIG_VIDEO_V4L1)
  • Device Drivers -> Multimedia Devices -> Video capture adapters -> Conexant cx23416/cx23415 MPEG encoder/decoder support (CONFIG_VIDEO_IVTV) <- This is the option that builds the ivtv driver

It is recommended to compile all as modules, if possible. The ivtv driver will not be able to load the firmware (yet) if it is built in

After the kernel is correctly configured and installed (running "make && make install && make modules_install from the kernel directory is one way to do this), you can then proceed to emerge ivtv. This will also install the necessary firmware for the card, if it was not already installed (the package is called pvr-firmware). The 1.x versions of ivtv are marked stable, so the default version portage will install should be fine.

Once the emerge has completed, the ivtv driver and the userspace utilities have been built and installed. At this point, you can refer to the end of the generic Howto to see how to load the ivtv module and test the card.

Preparations

As of november 11th, 2006, Portage lists ivtv-0.8.0 as stable for both the amd64 and x86 architectures.

Note that both ivtv-0.8.0 and ivtv-0.8.1 have a bug so that it does not install the corresponding ivtv-fb framebuffer module, see 156163 (November 29th, 2006). You need ths ivtv-fb to get X displayed on the tv-out of the PVR-350, so make sure you follow the guidelines in the comments to solve this issue until the bug is solved in the portage tree. NOTE: Bug is fixed in 0.8.1-r1, use fbcon use flag to install ivtv-fb

If you are running an ppc arch, lets unmask it:

ksh> mkdir -p /etc/portage
ksh> echo "media-tv/ivtv" >> /etc/portage/package.keywords

It is likely that future versions of ivtv (>ivtv-0.8.0) will not immediately be declared stable for your architecture. If you would like to use a newer masked version, you should unmask media-tv/ivtv for your particular architecture (~amd64,~x86) as well.

The ivtv-0.8.0 ebuild script will check if you have provided your =2.6.18.x kernel with the proper kernel modules. The following kernel options are sensed (and required):

CONFIG_EXPERIMENTAL, CONFIG_KMOD, CONFIG_VIDEO_DEV, CONFIG_I2C, CONFIG_VIDEO_V4L1_COMPAT,     
CONFIG_VIDEO_V4L2, CONFIG_FW_LOADER, CONFIG_VIDEO_WM8775, CONFIG_VIDEO_MSP3400,  
CONFIG_VIDEO_CX25840, CONFIG_VIDEO_TUNER, CONFIG_VIDEO_SAA711X, CONFIG_VIDEO_CX2341X,  
CONFIG_VIDEO_SAA7127, CONFIG_VIDEO_TVEEPROM. 

If any of these requirements are not met, the >=ivtv-0.8.0 ebuild script will abort. You can enable the kernel modules by recompiling your =2.6.18.x kernel and adding the necessary modules.

ksh> cd /usr/src/linux
ksh> cp arch/x86_64/boot/bzImage /boot/bzImageKeep
ksh> make menuconfig

In the Linux Kernel Configuration application it is straightforward to configure your kernel with the necessary options. Goto 'Device Drivers' ---> 'Multimedia devices' ---> 'Video Capture Adapters' ---> 'Encoders and Decoders'. In the presented form you will be able by guessing to select most of the required kernel modules from the list above. Please be informed that the CONFIG_VIDEO_TUNER option and the CONFIG_VIDEO_TVEEPROM option must be selected one level higher by <M>odularizing the 'Conexant 2388x (bt878 successor) support' option or bttv module which sets both. See bug 153745. Also remember to enable I2C! NOTE: If you are having issues finding any of the modules use the '/' key to search in the kernel config menu and it will give you both the modules location as well as it's dependencies.

After you have saved the alterations you should rebuild and make the necessary kernel modules available:

ksh> make
ksh> make modules_install
# Make sure your boot device is mounted on /boot !)
ksh> cp arch/x86_64/boot/bzImage /boot   (or use make install which gives it a proper name also)
# replace x86_64 in respect to your architecture (i386, ppc)

Don't forget to reconfigure your boot loader, e.g. if you are using LILO (please be sure to add bzImageKeep as fallback entry first !):

ksh> lilo

Now you should be able to reboot from you newly prepared kernel image:

ksh> reboot

If you have not recently synchronised your local Portage snapshot make sure it is up to date:

ksh> emerge --sync

Installing ivtv in ONE easy return

Assuming you have a recent kernel you can easily build and load the ivtv kernel modules with:

ksh> emerge ivtv; modprobe ivtv

Testing the card

If your card is inserted and the TV connector is connected to a coax wall outlet, you should be able to tune your card. In the following example stjûrder 'Omrop Fryslân' will be selected for cable subscribers to the UPC network in the Provinsje Fryslân, The Netherlands):

ksh> ivtv-tune -f 264
/dev/video0: 264.000 MHz (Signal Detected)

Now you can record this program in mpeg-2 format to file:

ksh> cat /dev/video0 > ~/fry.mpg

After you have killed this capturing process (Ctrl+C), you are able to view the recorded program (assuming you already have emerged the basic video player mplayer) with:

ksh> mplayer ~/fry.mpg

Alternatively you can view the program directly (although not simultaneously while recording):

ksh> mplayer /dev/video0

If you are using a twin card (e.g. PVR-500), you can also tune and play with the second tuner, which is identified by '/dev/video1'.

Autoloading of the ivtv modules

To allow autoloading of the ivtv modules at each reboot you should add "ivtv" to /etc/modules.autoload.d/kernel-2.6 (this mimics the modprobe ivtv command above).

ksh> echo ivtv >> /etc/modules.autoload.d/kernel-2.6

Tuning your radio

If your card is equipped with a FM radio tuner, and the sound system is working properly, you should now also be able to listen to your favorite radio station. Though your card may be equipped with both a video and a radio tuner, you can only utilize one at a time! So you can't listen to your favorite radio station and record your favorite tv station at the same time unless you have dual-tuner card (e.g. a Hauppauge PVR-500).

In the following example the tuner will be tuned to the authors favorite rock-and-roll program (STUBRU), available to subscribers to the UPC network in the Provinsje Fryslân, The Netherlands) with:

ksh> ivtv-radio -f 98.4 
set to freq 98.40
Running: aplay -f dat < /dev/video24
Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo

This will yield output from the radio tuner in high quality (DAT) to your sound card. Apparently, the (first) FM tuner device is identified by /dev/video24.

If you got fed-up (Ctrl+C) with this station, and decided to make a recording of another favorite station of yours (in this case BBC3 radio, available to subscribers to the UPC network in the Provinsje Fryslân, The Netherlands), proceed as follows:

ksh> ivtv-radio -j 102.6 &   ;-- the & will start this as a background process
[3] 11914
ksh>  arecord -D hw:0,0 -d 3600 -f dat ~/bbc3.dat; kill -9 11914
Recording WAVE '/home2/rec/bb3.dat' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo

This will record the station for the duration of one hour (3600 seconds), and subsequently remove the ivtv-radio process from your process list. (You may need to tweak the -D hw:0,0 setting for your own system configuration.) Your favorite music player (no not xmms because is recently was revoked from Portage, but audacious) should be able to play this recorded session. You can even listen to it while it is being recorded.

Unfortunately, the major contributing author of this page experiences some 10-12dB attenuation of the FM radio output compared with the TV sound output (as estimated by the necessary up or down swing off the volume control on the pre-amplifier to accomodate the difference while switching between TV and radio). The quality of his FM sound suffers greatly from this. Sound and noise are amplified the same amount (10-12dB) to reach normal listening conditions. In comparison: the quality of the TV sound is amazingly good (never heard it better on a real TV set). The quality of the FM sound is very noisy. I believe I will not use it very often (I assume most of the ivtv users won't, there is not much information on the internet about recording a FM radio station :-).

Please note: if a FM radio tuner is available the card provides a dedicated FM coax connector. The author has experienced that if you supply a combined TV and FM signal (direct cable signal, implicitly no splitter applied by using a wall socket) the FM radio signal is perfectly available through the regular TV connector. If your signal is split in separate TV and FM signals, you must supply the FM signal. If there is no FM signal then the TV sound from the previously tuned program will be heard and the working of ivtv-radio is void! What I mean here is: when you select a FM channel (when the FM signal is not present) you would at least expect that the TV sound ceases, and that is not the case.

Conclusion

I assume this guide was helpfull to you. It should be a sufficient description of how to use your PVR card with >=ivtv-0.8.0. If you have any remarks please send an e-mail to ivtv-gentoo_AT_intervisit_DOT_com.

If you have become interested in ivtv in general, please visit the ivtv website frequently and subscribe to the ivtv-users@ivtvdriver.org on the Mailinglists page. You should also consider visiting http://gentoo-wiki.com/HARDWARE_PVR_500_Setup where installing ivtv and mythtv are covered. Next on this page you will find a guide installing XDriver, which does not apply to 'regular' PVR-150 and PVR-500 cards but only to the PVR-350. If you experience problems with ivtv and gentoo please check the gentoo bugzilla for open bugs.

Installing XDriver

The ivtvdev driver is now in portage. It is in testing for ~x86 and ~amd64. It also compiles now for Xorg 7.1.x.

# echo x11-drivers/xf86-video-ivtv ~* >> /etc/portage/package.keywords
# emerge xf86-video-ivtv
development