On Mon, Feb 23, 2009 at 03:10:07AM -0800, J.C. Roberts wrote: > My build of -current is a few days old. I'm having problems recording > with aucat on a particular device. > > The system has an integrated "Intel 82891DB AC97" audio chipset and has > three physical jacks: one output (headphone/hp) and two inputs > (mic/line-in). All the OpenBSD audio toys work perfectly with the > integrated device. > > The system also has a "Logitech QuickCam Pro 9000" USB web cam and in > addition to the camera, it also contains a fairly limited audio device, > basically a cheap, mono microphone with a fixed frequency (16,000Hz). > The dmesg and output of `audioctl -f /dev/audio1` are at the end. > > uvideo(4) /dev/video0 > uaudio(4) /dev/audio1 > > With OpenBSD 4.4-Stable, I can record with the cheap microphone using > either ffmpeg or aucat but aucat on 4.4-stable requires user ('-u') > settings for the device to record properly. > > recording > $ ffmpeg -f oss -ar 16000 -i /dev/audio1 out-ffmpeg-4.4.wav > $ aucat -u -c 0:0 -r 16000 -f /dev/audio1 -o out-aucat-4.4.wav > $ aucat -u -e u8 -c 0:0 -r 16000 -f /dev/audio1 -o test44.raw > playing > $ mplayer out-ffmpeg-4.4.wav > $ mplayer out-aucat-4.4.wav > $ aucat -u -e u8 -c 0:0 -r 16000 -i test44.raw > > Doing the same tests above on OpenBSD 4.5-current shows both ffmpeg and > aucat no longer work for recording audio through the webcam mic. I'm > sure there is a rate/frequency problem (i.e. playing too fast), but > also there seems to be a lot of distortion.
does anything record correctly from it? the mic on my uvideo is pretty much useless. actually, I have several uaudio devices which do not work correctly. something to work on for 4.6. > Q: Could the ffmpeg record/playback issue be due to the use of 'oss' as > the format? that is quite possible. ffmpeg doesn't actually check the parameters it receives from the OSS ioctls. > And if so, is there a "better" choice for recording > formats with ffmpeg given the improvements in OpenBSD audio? not yet > Yes, I know the easy answer is to just use the perfectly working > microphone in the integrated sound card on the main board (audio0), but > getting this funky, cheap microphone on the webcam working properly > with the new aucat seems useful... mainly because it worked fine with > 4.4-stable, and the quirks of the device makes for a good test of aucat. > > Without the "-u" switch on aucat(1), it will try to auto configure > itself, but on the cheap webcam microphone, aucat is ignoring the > number of channels (1) and ignoring the fixed rate (16,000Hz). what makes you say that? > The most strange part of aucat on this microphone is the "-c" switch > channel control somehow effects speed. The default number of channels is > two (stereo) according to the man page for aucat, but the device itself > only has one channel. well, there are twice as many samples in stereo as in mono for the same sample rate ... > Using the -c switch along with rate plays close to normal speed but with > lots of distortion. > $ aucat -d /dev/audio1 -u -e s16le -c 0:0 -r 16000 -o out-wcam.raw > $ aucat -u -e s16le -c 0:0 -r 16000 -i out-wcam.raw > > But not using the -c switch plays far too fast (with distortion) > $ aucat -d /dev/audio1 -u -e s16le -r 16000 -o out-wcam.raw > $ aucat -u -e s16le -r 16000 -i out-wcam.raw > > Q: I don't understand why/how the number of channels affects the rate? > > If I turn on debugging and let aucat auto-configure itself (without > forcing the issue with the '-u' switch), you can see it's actually > trying to resample from 16000 to 441000Hz, but the resulting file plays > too fast and with lots of distortion. > > $ aucat -f /dev/audio1 -o out-wcam-plain.raw > out-wcam-plain.raw: assuming headerless file > safile_new: using 5872(2936) fpb > file_new: sndio:hdl > dev_init: hw recording s16le,0:0,16000Hz > dev_init: using 8808 fpb > safile_start: play/rec started > file_new: wav:out-wcam-plain.raw > cmap_new: out-wcam-plain.raw: s16le,0:0,16000Hz -> s16le,0:1,44100Hz > resamp_new: 2936/8092 > ^Cdev_done: dev_mix = 0x0, dev_sub = 0x89665500 > safile_stop: play/rec stopped > aproc_del: rpipe(hdl): terminating... > file_del: sndio:hdl <>: delayed > sub_hup: sub: eof > aproc_del: sub(sub): terminating... > aproc_del: resamp(out-wcam-plain.raw): terminating... > aproc_del: cmap(out-wcam-plain.raw): terminating... > aproc_del: wpipe(out-wcam-plain.raw): terminating... > file_del: wav:out-wcam-plain.raw <WOK>: immediate > aproc_del: wpipe(out-wcam-plain.raw): freed > aproc_del: cmap(out-wcam-plain.raw): freed > aproc_del: resamp(out-wcam-plain.raw): freed > aproc_del: sub(sub): freed > aproc_del: rpipe(hdl): has refs > file_del: sndio:hdl <>: immediate > aproc_del: rpipe(hdl): terminating... > aproc_del: rpipe(hdl): freed > > > I'm not sure what else I can test or try. If there is any further > information that might be useful, just let me know. do this: $ audioctl -f /dev/sound1 record.{rate=16000,channels=1,encoding=slinear_le,recision=16} $ cat > file < /dev/sound1 <speak into the mic> ^C $ aucat -h raw -c 0:0 -r 16000 -e s16le -i file does it sound right? > > Kind Regards, > JCR > > > ********************************************************** > $ audioctl -f /dev/audio1 > name=USB audio > version= > config=uaudio > encodings=ulinear:8*,mulaw:8*,alaw:8*,slinear:8*,slinear_le:16,ulinear_le:16*,slinear_be:16*,ulinear_be:16* > properties=full_duplex,independent > full_duplex=0 > fullduplex=0 > blocksize=2288 > hiwat=28 > lowat=21 > output_muted=0 > monitor_gain=0 > mode=record > play.rate=8000 > play.channels=1 > play.precision=8 > play.encoding=mulaw > play.gain=127 > play.balance=32 > play.port=0x0 > play.avail_ports=0x0 > play.seek=0 > play.samples=0 > play.eof=0 > play.pause=0 > play.error=0 > play.waiting=0 > play.open=0 > play.active=0 > play.buffer_size=65536 > play.block_size=2288 > play.errors=0 > record.rate=16000 > record.channels=1 > record.precision=8 > record.encoding=mulaw > record.gain=127 > record.balance=32 > record.port=0x0 > record.avail_ports=0x0 > record.seek=0 > record.samples=0 > record.eof=0 > record.pause=0 > record.error=0 > record.waiting=0 > record.open=1 > record.active=1 > record.buffer_size=32768 > record.block_size=1144 > record.errors=0 > > ********************************************************** > $ dmesg > OpenBSD 4.5-beta (GENERIC) #0: Thu Feb 19 19:32:43 PST 2009 > j...@vid.foo.bar:/usr/src/sys/arch/i386/compile/GENERIC > cpu0: Intel(R) Pentium(R) 4 CPU 2.40GHz ("GenuineIntel" 686-class) 2.40 > GHz cpu0: > FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,SBF,CNXT-ID,xTPR > real mem = 2137550848 (2038MB) avail mem = 2058645504 (1963MB) > mainbus0 at root > bios0 at mainbus0: AT/286+ BIOS, date 04/17/03, BIOS32 rev. 0 @ > 0xfd844, SMBIOS rev. 2.31 @ 0xf0240 (51 entries) bios0: vendor IBM > version "24KT41AUS" date 04/17/2003 bios0: IBM 8310XXS > acpi0 at bios0: rev 0 > acpi0: tables DSDT FACP TCPA APIC BOOT > acpi0: wakeup devices USB1(S3) USB2(S3) USB3(S3) USBE(S3) SLOT(S5) KBC_ > (S3) COMA(S5) COMB(S5) acpitimer0 at acpi0: 3579545 Hz, 24 bits > acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat > cpu0 at mainbus0: apid 0 (boot processor) > cpu0: apic clock running at 132MHz > ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 20, 24 pins > acpiprt0 at acpi0: bus 0 (PCI0) > acpiprt1 at acpi0: bus 2 (SLOT) > acpiprt2 at acpi0: bus -1 (AGP_) > acpicpu0 at acpi0 > acpitz0 at acpi0: critical temperature 105 degC > acpibtn0 at acpi0: PWRB > bios0: ROM list: 0xc0000/0xb400 0xe0000/0x10000! > pci0 at mainbus0 bus 0: configuration mode 1 (bios) > pchb0 at pci0 dev 0 function 0 "Intel 82845G Host" rev 0x01 > vga1 at pci0 dev 2 function 0 "Intel 82845G Video" rev 0x01 > wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation) > wsdisplay0: screen 1-5 added (80x25, vt100 emulation) > intagp0 at vga1 > agp0 at intagp0: aperture at 0x88000000, size 0x8000000 > inteldrm0 at vga1: apic 1 int 16 (irq 11) > drm0 at inteldrm0 > uhci0 at pci0 dev 29 function 0 "Intel 82801DB USB" rev 0x01: apic 1 > int 16 (irq 11) uhci1 at pci0 dev 29 function 1 "Intel 82801DB USB" rev > 0x01: apic 1 int 19 (irq 10) uhci2 at pci0 dev 29 function 2 "Intel > 82801DB USB" rev 0x01: apic 1 int 18 (irq 5) ehci0 at pci0 dev 29 > function 7 "Intel 82801DB USB" rev 0x01: apic 1 int 23 (irq 9) usb0 at > ehci0: USB revision 2.0 uhub0 at usb0 "Intel EHCI root hub" rev > 2.00/1.00 addr 1 ppb0 at pci0 dev 30 function 0 "Intel 82801BA > Hub-to-PCI" rev 0x81 pci1 at ppb0 bus 2 > fxp0 at pci1 dev 8 function 0 "Intel PRO/100 VE" rev 0x81, i82562: apic > 1 int 20 (irq 11), address 00:09:6b:f3:41:ad inphy0 at fxp0 phy 1: > i82562EM 10/100 PHY, rev. 0 cbb0 at pci1 dev 10 function 0 "Ricoh 5C475 > CardBus" rev 0x81: apic 1 int 22 (irq 9) cardslot0 at cbb0 slot 0 flags > 0 cardbus0 at cardslot0: bus 3 device 0 cacheline 0x0, lattimer 0x20 > pcmcia0 at cardslot0 > ichpcib0 at pci0 dev 31 function 0 "Intel 82801DB LPC" rev 0x01 > pciide0 at pci0 dev 31 function 1 "Intel 82801DB IDE" rev 0x01: DMA, > channel 0 configured to compatibility, channel 1 configured to > compatibility wd0 at pciide0 channel 0 drive 0: < 6Y250L6> wd0: > 16-sector PIO, LBA48, 239372MB, 490234752 sectors wd0(pciide0:0:0): > using PIO mode 4, Ultra-DMA mode 5 atapiscsi0 at pciide0 channel 1 > drive 0 scsibus0 at atapiscsi0: 2 targets > cd0 at scsibus0 targ 0 lun 0: <LITE-ON, LTR-48246S, SUS5> ATAPI 5/cdrom > removable wd1 at pciide0 channel 1 drive 1: <IC35L040AVER07-0> > wd1: 16-sector PIO, LBA, 39266MB, 80418240 sectors > cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2 > wd1(pciide0:1:1): using PIO mode 4, Ultra-DMA mode 5 > ichiic0 at pci0 dev 31 function 3 "Intel 82801DB SMBus" rev 0x01: apic > 1 int 17 (irq 9) iic0 at ichiic0 > admtemp0 at iic0 addr 0x4c: adm1032 > spdmem0 at iic0 addr 0x50: 1GB DDR SDRAM non-parity PC2700CL2.5 > spdmem1 at iic0 addr 0x51: 1GB DDR SDRAM non-parity PC2700CL2.5 > auich0 at pci0 dev 31 function 5 "Intel 82801DB AC97" rev 0x01: apic 1 > int 17 (irq 9), ICH4 AC97 ac97: codec id 0x41445374 (Analog Devices > AD1981B) ac97: codec features headphone, 20 bit DAC, No 3D Stereo > audio0 at auich0 > usb1 at uhci0: USB revision 1.0 > uhub1 at usb1 "Intel UHCI root hub" rev 1.00/1.00 addr 1 > usb2 at uhci1: USB revision 1.0 > uhub2 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1 > usb3 at uhci2: USB revision 1.0 > uhub3 at usb3 "Intel UHCI root hub" rev 1.00/1.00 addr 1 > isa0 at ichpcib0 > isadma0 at isa0 > com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo > com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo > pckbc0 at isa0 port 0x60/5 > pckbd0 at pckbc0 (kbd slot) > pckbc0: using irq 1 for kbd slot > wskbd0 at pckbd0: console keyboard, using wsdisplay0 > pms0 at pckbc0 (aux slot) > pckbc0: using irq 12 for aux slot > wsmouse0 at pms0 mux 0 > pcppi0 at isa0 port 0x61 > midi0 at pcppi0: <PC speaker> > spkr0 at pcppi0 > lpt0 at isa0 port 0x378/4 irq 7 > npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16 > fdc0 at isa0 port 0x3f0/6 irq 6 drq 2 > fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec > mtrr: Pentium Pro MTRR support > uvideo0 at uhub0 port 6 configuration 1 interface 0 "Logitech QuickCam > Pro 9000" rev 2.00/0.08 addr 2 video0 at uvideo0 > uaudio0 at uhub0 port 6 configuration 1 interface 2 "Logitech QuickCam > Pro 9000" rev 2.00/0.08 addr 2 uaudio0: audio rev 1.00, 2 mixer controls > audio1 at uaudio0 > softraid0 at root > root on wd0a swap on wd0b dump on wd0b > auich0: measured ac97 link rate at 47765 Hz, will use 48000 Hz > video0 detached > uvideo0 detached > audio1 detached > uaudio0 detached > uvideo0 at uhub0 port 5 configuration 1 interface 0 "Logitech QuickCam > Pro 9000" rev 2.00/0.08 addr 2 video0 at uvideo0 > uaudio0 at uhub0 port 5 configuration 1 interface 2 "Logitech QuickCam > Pro 9000" rev 2.00/0.08 addr 2 uaudio0: audio rev 1.00, 2 mixer controls > audio1 at uaudio0 > > > > -- > J.C. Roberts > -- jake...@sdf.lonestar.org SDF Public Access UNIX System - http://sdf.lonestar.org