AVerMedia TVCapture 98
Card Features/Overview
Features
- An Analog PCI Card
Making it Work
Card 13 in the bttv cardlist works for a number of AverMedia cards, including the AverTV98 Stereo card with an NTSC tuner sold in the US. These are available only on the aftermarket at this point. The cards are good and cheap, and well-supported in Linux. The only exception, detailed below, is that I've not been able to pull the audio directly off the card and have to use a patch cable.
Installing the card
This card shows up on the PCI bus as two devices, one for video capture and one for audio:
lspci:
0000:03:04.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11) 0000:03:04.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
lspci -vn:
0000:03:04.0 0400: 109e:036e (rev 11) Subsystem: 1461:0004 Flags: bus master, medium devsel, latency 64, IRQ 16 Memory at fb6fe000 (32-bit, prefetchable) [size=4K] Capabilities: [44] Vital Product Data Capabilities: [4c] Power Management version 2
0000:03:04.1 0480: 109e:0878 (rev 11) Subsystem: 1461:0004 Flags: bus master, medium devsel, latency 64, IRQ 16 Memory at fb6ff000 (32-bit, prefetchable) [size=4K] Capabilities: [44] Vital Product Data Capabilities: [4c] Power Management version 2
The card is recognized when the bttv module is loaded on boot; here's a typical dmesg log:
bttv: driver version 0.9.15 loaded bttv: using 8 buffers with 2080k (520 pages) each for capture bttv: Bt8xx card found (0). ACPI: PCI interrupt 0000:03:04.0[A] -> GSI 16 (level, low) -> IRQ 16 bttv0: Bt878 (rev 17) at 0000:03:04.0, irq: 16, latency: 64, mmio: 0xfb6fe000 bttv0: detected: AVerMedia TVCapture 98 [card=13], PCI subsystem ID is 1461:0004 bttv0: using: AVerMedia TVCapture 98 [card=13,autodetected] bttv0: gpio: en=00000000, out=00000000 in=00fff7c3 [init] bttv0: Hauppauge/Voodoo msp34xx: reset line init [11] tuner: chip found at addr 0xc2 i2c-bus bt878 #0 [sw] bttv0: Avermedia eeprom[0x4002]: tuner=2 radio:no remote control:no bttv0: using tuner=2 tuner: type set to 2 (Philips NTSC (FI1236,FM1236 and compatibles)) by bt878 #0 [sw] bttv0: i2c: checking for MSP34xx @ 0x80... not found bttv0: i2c: checking for MSP34xx (alternate address) @ 0x88... not found bttv0: i2c: checking for TDA9875 @ 0xb0... not found bttv0: i2c: checking for TDA7432 @ 0x8a... not found bttv0: registered device video0 bttv0: registered device vbi0
The card works well. The picture quality is good, and there is no gunk around the edges that need cropping.
Both ntsc-cc and zvbi works for Closed captioning.
Getting the sound from the sound card
The common method for getting the sound off the card is to use a patch cable from the tv card to your sound card; this works fine.
For recording off the tv-card, you'll likely have to instruct your mixer to use a particular capture channel. The sound card may well have the relevant capture channels muted or the volume turned off. This may sound counterintuitive, if you already hear the sound through your sound card to your speakers, but you need to activate a different channel to capture.
You may be able to see the capture channels with a mixer such as alsamixergui or kmix or aumix. In alsamixer, for instance, press F4 to display the capture channels. Still, mixers typically present only a subset of the full channels available on sound cards, and may leave out what you need.
Solution: use alsa's amixer command-line mixer control, like this:
amixer controls | grep Capture
That gives you your capture channels, something like this:
numid=20,iface=MIXER,name='Capture Source' numid=21,iface=MIXER,name='Capture Switch' numid=22,iface=MIXER,name='Capture Volume'
The numbers will vary, and you might get a IEC958 you can ignore.
Then see their settings:
amixer -c 0 cget numid=20
For the capture source, that will show available inputs:
numid=20,iface=MIXER,name='Capture Source' ; type=ENUMERATED,access=rw---,values=2,items=8 ; Item #0 'Mic' ; Item #1 'CD' ; Item #2 'Video' ; Item #3 'Aux' ; Item #4 'Line' ; Item #5 'Mix' ; Item #6 'Mix Mono' ; Item #7 'Phone' : values=0,0
So this channel takes two values, for stereo input. Set the values:
amixer -c 0 cset numid=20 5,5
I got sound working by setting capture source to mix, and upping the volume:
amixer -c 0 cset numid=22 15,15
Legal values are shown by the cget command, as above. The capture switch has to be on, but it likely already is.
Many cards don't have separate switches for capture source and volume. The Audigy2 Value, card, for instance, just needs
amixer -c 0 cset numid=19 100%,100% unmute cap
Once you've found settings that work, save them with
alsactl store
Not using a gui may seem like a hassle (and you may well be able to do all this with alsamixergui, kmix, aumix-gtk, etc.), but it's scriptable and you see what you're doing.
Getting the sound directly off the tv card
The second of the two devices on the PCI bus -- the audio capture devices -- means that it is technically possible to get the audio straight off the PCI bus.
Petr Vandrovec reports that on his AverMedia TVCapture98, the digital channel is not connected to anything. Analog capture can be made to work, but the card needs to be initialized by a Win98 driver. On power-on, boot with Win98 with btpcivid.vxd from Feb 25 1999 (105492 bytes), and then warmboot into Linux. In his experience, only this .vxd performs the required intialization - newer .vxds and WDM *.sys drivers do not. Without performing initialization by this .vxd file, only samples with value 0x7FFF are captured. Some voltage reference or other variable is missing from the bttv or btaudio driver.
For the moment, I'll leave the following failed attempt at getting btaudio to work in place -- that is to say, an attempt without the benefit of the Win98 initialization.
First, you need the btaudio module (see Gerd Knorr's instructions), which can be inserted like this:
modprobe btaudio debug=3
You should get something like this in dmesg and /var/log/syslog:
btaudio: driver version 0.7 loaded [digital+analog] ACPI: PCI interrupt 0000:03:04.1[A] -> GSI 16 (level, low) -> IRQ 16 btaudio: Bt878 (rev 17) at 03:04.1, irq: 16, latency: 64, mmio: 0xfb6ff000 btaudio: using card config "default" btaudio: registered device dsp1 [digital] btaudio: registered device dsp2 [analog] btaudio: registered device mixer1
I'm not sure how to test the digital device, /dev/dsp1, but tried this:
mencoder -tv driver=v4l2:device=/dev/video0:fps=30000/1001:chanlist=us-cable:adevice=/dev/dsp1:input=0:amode=1:normid=4 \ -ffourcc DIVX -ovc lavc -oac mp3lame -lameopts cbr:br=128 -endpos 10 -o digital.avi tv://5
But mencoder is unable to pick up any sound. I then insert the btaudio module turning off the digital mode:
modprobe btaudio digital=0 debug=3
I see this in dmesg:
btaudio: driver version 0.7 loaded [analog] ACPI: PCI interrupt 0000:03:04.1[A] -> GSI 16 (level, low) -> IRQ 16 btaudio: Bt878 (rev 17) at 03:04.1, irq: 16, latency: 64, mmio: 0xfb6ff000 btaudio: using card config "default" btaudio: registered device dsp1 [analog] btaudio: registered device mixer1
First I set recording to Line1:
aumix -d /dev/mixer1 -1 R
Then I try to record (these channels have no playback capability under the btaudio driver):
mencoder -tv driver=v4l2:device=/dev/video0:fps=30000/1001:chanlist=us-cable:adevice=/dev/dsp1:input=0:amode=1:normid=4 \ -ffourcc DIVX -ovc lavc -oac mp3lame -lameopts br=128 -srate 8000 -endpos 10 -o analog.avi tv://5
Again mencoder just hangs there, encoding video but not finding any audio. In dmesg, I see this:
btaudio: open analog dsp [35] btaudio: fmt: bits=16 btaudio: stereo=0 channels=1 btaudio: rate: req=44100 dec=10 shift=2 hwrate=179200 swrate=44800 btaudio: bufsize=131072 - bs=8192 bc=16 - ls=2048, lc=64 btaudio: rate: req=44100 dec=10 shift=2 hwrate=179200 swrate=44800 btaudio: bufsize=131072 - bs=8192 bc=16 - ls=2048, lc=64 btaudio: recording started btaudio: recording stopped
I change the recording to Line2:
aumix -d /dev/mixer1 -2 R
Same result -- no audio is detected. If I try to turn up the volume (which is stuck on zero) on /dev/mixer1, it fails; a strace show this:
# strace aumix -d /dev/mixer1 -1 R -v75
open("/dev/mixer1", O_RDWR) = 3 ioctl(3, 0x80044dfe, 0x50737c) = 0 ioctl(3, 0x80044dfd, 0x507380) = 0 ioctl(3, 0x80044dff, 0x507384) = 0 ioctl(3, 0x80044dfb, 0x507388) = 0 ioctl(3, 0xc0044dff, 0x507384) = 0 ioctl(3, MTRRIOC_ADD_ENTRY, 0x7fbffff8e4) = -1 EINVAL (Invalid argument) write(2, "aumix: MIXER_WRITE", 19aumix: MIXER_WRITE) = 19
A hardware rate of 179200 is detected, suggesting that we're on the right track. Or at least in the right neighborhood.
Model Variants
I have an AverMedia TV98 with Remote marketed in the US which has a model number of M168-K, this is apaprently slightly different from other M168 series boards. With the default tuner setting, it could only tune in the 'upper' band of US-Cable frequencies (channel 55+ approx.)
I explicitly set in /etc/modprobe.d/bttv.conf:
options bttv card=13 tuner=6
And I was able to tune in the whole band. Still working on checking audio.