[FFmpeg-user] How to properly record sound when capturing web cam?

Jean Louis ffmpeg at rcdrun.com
Tue May 1 19:04:05 EEST 2018


On Tue, May 01, 2018 at 06:01:44PM +0200, Carl Eugen Hoyos wrote:
> 2018-05-01 13:52 GMT+02:00, Jean Louis <ffmpeg at rcdrun.com>:
> 
> > Input #0, video4linux2,v4l2, from '/dev/video0':
> >   Duration: N/A, start: 453144.187672
> 
> > Input #1, alsa, from 'default':
> >   Duration: N/A, start: 1525175436.738077
> 
> Sorry, I missed this.
> A/V sync is impossible with these start times.
> Try the v4l2 timestamps options to get similar
> start times:
> $ ffmpeg -timestamps abs -video_size 320x240 -i /dev/video0

This time with timestamp abs, I get sound very
short at begin of video, then interrupts and
nothing more. It is even worse.

But because something did change, maybe it is
related.

Jean

ffmpeg -y -f v4l2 -timestamps abs -video_size 800x448 -i /dev/video0 -thread_queue_size 100 -f alsa -ac 1 -ar 14400 -i default -q:v 5  output.webm; mplayer output.webm; ls -l output.webm
ffmpeg version git-2018-04-27-92a0a6b Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-shared --prefix=/package/media/ffmpeg --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libopus --enable-libpulse --enable-libtheora --enable-gpl
  libavutil      56. 17.100 / 56. 17.100
  libavcodec     58. 19.100 / 58. 19.100
  libavformat    58. 13.100 / 58. 13.100
  libavdevice    58.  4.100 / 58.  4.100
  libavfilter     7. 20.100 /  7. 20.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
[video4linux2,v4l2 @ 0x2590a40] Detected monotonic timestamps, converting
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 1525190574.860860, bitrate: 86016 kb/s
    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 800x448, 86016 kb/s, 15 fps, 15 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : mono
Input #1, alsa, from 'default':
  Duration: N/A, start: 1525190574.924269, bitrate: 230 kb/s
    Stream #1:0: Audio: pcm_s16le, 14400 Hz, mono, s16, 230 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> vp9 (libvpx-vp9))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> opus (libopus))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x25d5540] v1.5.0
[libopus @ 0x25d7380] No bit rate set. Defaulting to 64000 bps.
Output #0, webm, to 'output.webm':
  Metadata:
    encoder         : Lavf58.13.100
    Stream #0:0: Video: vp9 (libvpx-vp9), yuv422p(progressive), 800x448, q=-1--1, 200 kb/s, 15 fps, 1k tbn, 15 tbc
    Metadata:
      encoder         : Lavc58.19.100 libvpx-vp9
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: opus (libopus), 16000 Hz, mono, s16, 64 kb/s
    Metadata:
      encoder         : Lavc58.19.100 libopus
[alsa @ 0x2592fc0] Thread message queue blocking; consider raising the thread_queue_size option (current value: 100)
frame=   25 fps= 10 q=0.0 size=       1kB time=00:00:00.00 bitrate=6904.0kbits/s speed=0.000417x [video4linux2,v4l2 @ 0x2590a40] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
frame=   30 fps=3.0 q=0.0 Lsize=      86kB time=00:00:02.00 bitrate= 351.9kbits/s speed= 0.2x
video:82kB audio:3kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.433394%
MPlayer SVN-r38101-snapshot-5.3.0 (C) 2000-2018 MPlayer Team

Playing output.webm.
libavformat version 58.13.100 (internal)
libavformat file format detected.
[lavf] stream 0: video (vp9), -vid 0
[lavf] stream 1: audio (opus), -aid 0
VIDEO:  [VP90]  800x448  0bpp  15.000 fps    0.0 kbps ( 0.0 kbyte/s)
Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directory
[vdpau] Error when calling vdp_device_create_x11: 1
Opening video filter: [screenshot]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 58.19.100 (internal)
Selected video codec: [ffvp9] vfm: ffmpeg (FFmpeg VP9)
==========================================================================
Clip info:
 ENCODER: Lavf58.13.100
Load subtitles in ./
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 1 ch, floatle, 0.0 kbit/0.00% (ratio: 0->192000)
Selected audio codec: [ffopus] afm: ffmpeg (FFmpeg opus)
==========================================================================
[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
AO: [alsa] 48000Hz 1ch floatle (4 bytes per sample)
Starting playback...
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is 1.79:1 - prescaling to correct movie aspect.
[swscaler @ 0x55902196b180]bicubic scaler, from yuv422p to yuyv422 using MMXEXT
[swscaler @ 0x55902196b180]using unscaled yuv422p -> yuyv422 special converter
VO: [xv] 800x448 => 800x448 Packed YUY2  [fs]
[VO_XV] Shared memory not supported
Reverting to normal Xv.
[VO_XV] Shared memory not supported
Reverting to normal Xv.
Movie-Aspect is 1.79:1 - prescaling to correct movie aspect.
VO: [xv] 800x448 => 800x448 Packed YUY2  [fs]
[VO_XV] Shared memory not supported
Reverting to normal Xv.
[VO_XV] Shared memory not supported
Reverting to normal Xv.
A:   0.0 V:   0.0 A-V:  0.025 ct:  0.000   0/  0 ??% ??% ??,?% 0 0
[VD_FFMPEG] DRI failure.
A:   0.3 V:   2.0 A-V: -1.709 ct: -0.085   0/  0  3%  1%  0.1% 0 0


Exiting... (End of file)
-rw-r--r-- 1 admin admin 88031 May  1 18:03 output.webm
[~]


More information about the ffmpeg-user mailing list