public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* PCTV USB2 PAL / adds loud hum to correct audio
@ 2011-02-12 20:22 AW
  2011-02-12 21:33 ` Devin Heitmueller
  0 siblings, 1 reply; 6+ messages in thread
From: AW @ 2011-02-12 20:22 UTC (permalink / raw)
  To: linux-media

Hi!

When I try to use my new USB TV tuner on Fedora 14 (log messages: in the end) 
with this:
mplayer -tv 
driver=v4l2:input=0:width=768:height=576:device=/dev/video2:norm=5:chanlist=europe-west:freq=224.25 tv://

I hear nothing, but I c good pictures...


When I use this command simultaneously:
arecord -D front:CARD=PAL,DEV=0 -f S16_LE -c 2 -r 8000 /aux/tmp/bla.wav
I get correct audio with strong noise:
http://www.wgboome.de./bla.wav
(it is from input=1 for copyright reasons... so there is silence plus noise)

according to "amixer -c1" (card 0 is the audio device on the mainboard and is 
handled by pulseaudio) the PCTV 

audio device has mono audio:
Simple mixer control 'Line',0
  Capabilities: cvolume cvolume-joined cswitch cswitch-joined penum
  Capture channels: Mono
  Limits: Capture 0 - 16
  Mono: Capture 8 [50%] [0.00dB] [on]

but arecord wants "-c2"...

when i add hw:1 as 2nd source to pulseaudio, i get the same result...

Why is that?

Thx.

Bye
Arne

attachment:
usb 1-1: new high speed USB device using ehci_hcd and address 12
usb 1-1: New USB device found, idVendor=2304, idProduct=0208
usb 1-1: New USB device strings: Mfr=2, Product=1, SerialNumber=0
usb 1-1: Product: PCTV USB2 PAL
usb 1-1: Manufacturer: Pinnacle Systems GmbH 
em28xx: New device Pinnacle Systems GmbH PCTV USB2 PAL @ 480 Mbps (2304:0208, 
interface 0, class 0) 
em28xx #0: chip ID is em2820 (or em2710)
em28xx #0: i2c eeprom 00: 1a eb 67 95 04 23 08 02 10 00 1e 03 98 1e 6a 2e 
em28xx #0: i2c eeprom 10: 00 00 06 57 6e 00 00 00 8e 00 00 00 07 00 00 00 
em28xx #0: i2c eeprom 20: 16 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 
em28xx #0: i2c eeprom 30: 00 00 20 40 20 80 02 20 10 01 00 00 00 00 00 00 
em28xx #0: i2c eeprom 40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
em28xx #0: i2c eeprom 50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
em28xx #0: i2c eeprom 60: 00 00 00 00 00 00 00 00 00 00 2e 03 50 00 69 00 
em28xx #0: i2c eeprom 70: 6e 00 6e 00 61 00 63 00 6c 00 65 00 20 00 53 00 
em28xx #0: i2c eeprom 80: 79 00 73 00 74 00 65 00 6d 00 73 00 20 00 47 00 
em28xx #0: i2c eeprom 90: 6d 00 62 00 48 00 00 00 1e 03 50 00 43 00 54 00 
em28xx #0: i2c eeprom a0: 56 00 20 00 55 00 53 00 42 00 32 00 20 00 50 00 
em28xx #0: i2c eeprom b0: 41 00 4c 00 00 00 06 03 31 00 00 00 00 00 00 00 
em28xx #0: i2c eeprom c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
em28xx #0: i2c eeprom d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
em28xx #0: i2c eeprom e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
em28xx #0: i2c eeprom f0: 00 00 00 00 00 00 00 00 0e 5d 62 35 03 ca 7b f3 
em28xx #0: EEPROM ID= 0x9567eb1a, EEPROM hash = 0x7623b74b
em28xx #0: EEPROM info:
em28xx #0: AC97 audio (5 sample rates)
em28xx #0: 500mA max power
em28xx #0: Table at 0x06, strings=0x1e98, 0x2e6a, 0x0000
em28xx #0: Identified as Pinnacle PCTV USB 2 (card=3)
saa7115 7-0025: saa7113 found (1f7113d0e100000) @ 0x4a (em28xx #0)
tda8290_probe: tda8290 couldn't read register 0x1f
tda8295_probe: tda8290 couldn't read register 0x2f
tuner 7-0043: chip found @ 0x86 (em28xx #0)
tda9887 7-0043: creating new instance
tda9887 7-0043: tda988[5/6/7] found
tuner 7-0063: chip found @ 0xc6 (em28xx #0)
tuner-simple 7-0063: creating new instance
tuner-simple 7-0063: type set to 37 (LG PAL (newer TAPC series))
em28xx #0: Config register raw data: 0x10
em28xx #0: AC97 vendor ID = 0xffffffff
em28xx #0: AC97 features = 0x6a90
em28xx #0: Empia 202 AC97 audio processor detected
em28xx #0: v4l2 driver version 0.1.2
em28xx #0: V4L2 video device registered as video2




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PCTV USB2 PAL / adds loud hum to correct audio
  2011-02-12 20:22 AW
@ 2011-02-12 21:33 ` Devin Heitmueller
  2011-02-12 21:44   ` AW
  0 siblings, 1 reply; 6+ messages in thread
From: Devin Heitmueller @ 2011-02-12 21:33 UTC (permalink / raw)
  To: AW; +Cc: linux-media

On Sat, Feb 12, 2011 at 3:22 PM, AW <arne_woerner@yahoo.com> wrote:
> Hi!
>
> When I try to use my new USB TV tuner on Fedora 14 (log messages: in the end)
> with this:
> mplayer -tv
> driver=v4l2:input=0:width=768:height=576:device=/dev/video2:norm=5:chanlist=europe-west:freq=224.25 tv://
>
> I hear nothing, but I c good pictures...
>
>
> When I use this command simultaneously:
> arecord -D front:CARD=PAL,DEV=0 -f S16_LE -c 2 -r 8000 /aux/tmp/bla.wav
> I get correct audio with strong noise:
> http://www.wgboome.de./bla.wav
> (it is from input=1 for copyright reasons... so there is silence plus noise)

The "-r" argument should almost certainly be 48000, not 8000.

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PCTV USB2 PAL / adds loud hum to correct audio
  2011-02-12 21:33 ` Devin Heitmueller
@ 2011-02-12 21:44   ` AW
  2011-02-12 23:34     ` Andy Walls
  0 siblings, 1 reply; 6+ messages in thread
From: AW @ 2011-02-12 21:44 UTC (permalink / raw)
  To: linux-media; +Cc: dheitmueller

Devin Heitmueller <dheitmueller@kernellabs.com> wrote:
> > When I use this command  simultaneously:
> > arecord -D front:CARD=PAL,DEV=0 -f S16_LE -c 2 -r 8000  /aux/tmp/bla.wav
> > I get correct audio with strong noise:
> > http://www.wgboome.de./bla.wav
> > (it is from input=1 for copyright  reasons... so there is silence plus 
noise)
> 
> The "-r" argument should  almost certainly be 48000, not 8000.
> 
Maybe...
That device is rather old...
And i didnt tell pactl anything about sample rate...

With the filter from the appendix the noise is gone...
But it feels like a dirty hack, because it would cut out (overly?) loud noise, 
2...

My wild guess is, that the usbaudio driver injects some bad samples 
(0x8000..0x9000) every appr. 256 bytes...

-Arne

appendix:
#include <stdint.h>
#include <unistd.h>

int main() {
uint16_t buf[1000000];
const int r = read(0,buf,sizeof(buf));
for (int i=0; i*sizeof(*buf)<r; i++) {
if (buf[i]/256>=0x80 && buf[i]/256<0x90) continue;
if (write(1,buf+i,2) != 2) break;
}
return 0;
}



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PCTV USB2 PAL / adds loud hum to correct audio
  2011-02-12 21:44   ` AW
@ 2011-02-12 23:34     ` Andy Walls
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Walls @ 2011-02-12 23:34 UTC (permalink / raw)
  To: AW; +Cc: linux-media, dheitmueller

On Sat, 2011-02-12 at 13:44 -0800, AW wrote:
> Devin Heitmueller <dheitmueller@kernellabs.com> wrote:
> > > When I use this command  simultaneously:
> > > arecord -D front:CARD=PAL,DEV=0 -f S16_LE -c 2 -r 8000  /aux/tmp/bla.wav
> > > I get correct audio with strong noise:
> > > http://www.wgboome.de./bla.wav
> > > (it is from input=1 for copyright  reasons... so there is silence plus 
> noise)
> > 
> > The "-r" argument should  almost certainly be 48000, not 8000.
> > 
> Maybe...
> That device is rather old...
> And i didnt tell pactl anything about sample rate...

I find audio at 8 ksps very unusual for a TV capture device.


> With the filter from the appendix the noise is gone...
> But it feels like a dirty hack, because it would cut out (overly?) loud noise, 
> 2...
> 
> My wild guess is, that the usbaudio driver injects some bad samples 
> (0x8000..0x9000) every appr. 256 bytes...

I looked at the data.  It is mostly hovering around 0, but you have
bursts of very negative values periodically:

(These values are shown as little endian, so swap the bytes to consider the value)

0000630: faff fdff f9ff fbff 1080 1080 1080 1080  ................
0000640: 1080 1080 faff fbff 1080 1080 8888 8888  ................
0000650: 1080 1080 fbff fcff fbff fcff fdff fdff  ................
...
0002fe0: 0000 0000 0100 0100 ffff 0000 1080 1080  ................
0002ff0: 1080 1080 1080 1080 1080 1080 1080 1080  ................
0003000: 8888 8888 0100 0000 ffff ffff 0000 0000  ................

0x8010 is -32752 and 0x8888 is -30584.

The data set contains no large positive values (nothing in the range
0x1000-0x7fff).

The valuex 0x10 and 0x80 do remind me of the YUV values for black: Y =
0x10, U = 0x80, V = 0x80.  Maybe some video data is getting thrown in
with the audio?

Regards,
Andy

> -Arne
> 
> appendix:
> #include <stdint.h>
> #include <unistd.h>
> 
> int main() {
> uint16_t buf[1000000];
> const int r = read(0,buf,sizeof(buf));
> for (int i=0; i*sizeof(*buf)<r; i++) {
> if (buf[i]/256>=0x80 && buf[i]/256<0x90) continue;
> if (write(1,buf+i,2) != 2) break;
> }
> return 0;
> }
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PCTV USB2 PAL / adds loud hum to correct audio
@ 2011-02-13  8:41 AW
  0 siblings, 0 replies; 6+ messages in thread
From: AW @ 2011-02-13  8:41 UTC (permalink / raw)
  To: linux-media

Andy Walls wrote:
> I find audio at 8 ksps very unusual for a TV capture device.
>
I tried it with pulseaudio at 44100 samples/sec
and with some commercial tuned in...
(no big copyright problem hopefully) :-)

i used this command:
parec --device=alsa_input.hw_1 > blah.raw
resulting raw data: http://www.wgboome.de./blah.raw

> The data set contains no large positive values
> (nothing in the range 0x1000-0x7fff).
>
Now the noise is in the positive range, 2...
I made a new filter program (see appendix),
that produces acceptable but still distorted sound.
filter output: http://www.wgboome.de./blah.ogg

> The valuex 0x10 and 0x80 do remind me of the YUV values for black: Y =
> 0x10, U = 0x80, V = 0x80.  Maybe some video data is getting thrown in
> with the audio?
>
sounds good...
because: the unwanted data changed its range now...

-arne

appendix:
...
    (buf[i]/256>=0x80 && buf[i]/256<0xC0) ||
    (buf[i]/256>=0x40 && buf[i]/256<0x80)) {
...



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PCTV USB2 PAL / adds loud hum to correct audio
@ 2011-02-17  9:24 AW
  0 siblings, 0 replies; 6+ messages in thread
From: AW @ 2011-02-17  9:24 UTC (permalink / raw)
  To: linux-media

I send the device back as "dead on arrival"...

so i cant test any patches...

thx.

-Arne



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-02-17  9:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-13  8:41 PCTV USB2 PAL / adds loud hum to correct audio AW
  -- strict thread matches above, loose matches on Subject: below --
2011-02-17  9:24 AW
2011-02-12 20:22 AW
2011-02-12 21:33 ` Devin Heitmueller
2011-02-12 21:44   ` AW
2011-02-12 23:34     ` Andy Walls

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox