Log in

View Full Version : Cannot record sound with video from webcam


cord-factor
25th July 2009, 19:57
Hi, all
I have Acer 7520 laptop and gentoo linux on it. Webcam and internal mic separately works fine (video in mencoder and sound in audacity). But when I try to capture both video from webcam and sound from internal mic there are no sound in result file.
Here is mencoder output:

$ mencoder tv:// -tv width=640:height=576:fps=15:alsa:adevice=hw.0,0 -oac pcm -ovc xvid -xvidencopts fixed_quant=5 -o video.avi
MEncoder 29040-4.3.2 (C) 2000-2009 MPlayer Team
success: format: 9 data: 0x0 - 0x0
TV file format detected.
Selected driver: v4l2
name: Video 4 Linux 2 input
author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
comment: first try, more to come ;-)
v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
Selected device: Acer Crystal Eye webcam
Capabilites: video capture streaming
supported norms:
inputs: 0 = Camera 1;
Current input: 0
Current format: YUYV
v4l2: ioctl set format failed: Invalid argument
v4l2: ioctl set format failed: Invalid argument
v4l2: ioctl set format failed: Invalid argument
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Invalid argument
Error: Cannot set norm!
Selected input hasn't got a tuner!
v4l2: ioctl set mute failed: Invalid argument
[V] filefmt:9 fourcc:0x32595559 size:640x480 fps:15.000 ftime:=0.0667
xvid: using library version 1.2.2 (build xvid-1.2.2)
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
==========================================================================
Opening video decoder: [raw] RAW Uncompressed Video
VDec: vo config request - 640 x 480 (preferred colorspace: Packed YUY2)
VDec: using Packed YUY2 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
videocodec: XviD (640x480 fourcc=44495658 [XVID])
xvid: par=0/0 (vga11), displayed=640x480, sampled=640x480
xvid: Fixed Quant Rate Control -- quantizer=5/1=5.00
Selected video codec: [rawyuy2] vfm: raw (RAW YUY2)
==========================================================================
Forcing audio preload to 0, max pts correction to 0.
v4l2: select timeout

Skipping frame!
Writing header...1f ( 0%) 0.90fps Trem: 0min 0mb A-V:0.000 [0:0]
ODML: vprp aspect is 4:3.
Writing header...
ODML: vprp aspect is 4:3.
Pos: 0.7s 12f ( 0%) 6.39fps Trem: 0min 0mb A-V:0.000 [0:0]
Skipping frame!
Pos: 1.6s 27f ( 0%) 9.38fps Trem: 0min 0mb A-V:0.000 [618:0]
1 duplicate frame(s)!
Pos: 1.8s 29f ( 0%) 9.64fps Trem: 0min 0mb A-V:0.000 [585:0]
1 duplicate frame(s)!
Pos: 2.1s 32f ( 0%) 10.00fps Trem: 0min 0mb A-V:0.000 [552:0]
1 duplicate frame(s)!
Pos: 3.3s 49f ( 0%) 11.29fps Trem: 0min 0mb A-V:0.000 [535:0]
Skipping frame!
^CPos: 5.5s 83f ( 0%) 12.56fps Trem: 0min 0mb A-V:0.000 [553:0]
Flushing video frames.
Writing index...
Writing header...
ODML: vprp aspect is 4:3.

Video stream: 554.059 kbit/s (69257 B/s) size: 383224 bytes 5.533 secs 83 frames
v4l2: ioctl set mute failed: Invalid argument
v4l2: 85 frames successfully processed, 0 frames dropped.


How can I fix this? Thx.

oldcpu
10th August 2009, 16:15
I do not know enough about mencoder to comment on your example

I found what worked for my on my PC was:
mencoder tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0:forceaudio:adevice=/dev/dsp -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o webcam.avi

Also, with ffmpeg, the following also worked for me on my laptop: ffmpeg -f oss -i /dev/dsp -f video4linux2 -s 320x240 -i /dev/video0 out.mpgNote with ffmpeg, on my Dell Studio 15 laptop, the audio was about 400 msec ahead of the video. This was easily fixed in avidemux. The mencoder command did not have the audio/video sync problem.

My Dell Studio 15's webcam is an ID: 05ca:18a1 Ricoh Co., Ltd and it works with the uvc driver.

cord-factor
11th August 2009, 18:14
adevice=/dev/dsp
oh! it works, Thank you :)