[FFmpeg-user] Webcam capture

Rodolfo Medina rodolfo.medina at gmail.com
Wed Jul 22 20:43:26 EEST 2020


Carl Zwanzig <cpz at tuunq.com> writes:

> On 7/22/2020 6:22 AM, Rodolfo Medina wrote:
>> Same problem also with simply:
>>
>>   $ ffmpeg -f alsa -i hw:1,0 -f video4linux2 -i /dev/video0 out.mpg
>>
>> , and audio completely out of sync...
>
> And complete command output is still missing (it's always helpful)....
>
> Since this works--
> mencoder tv:// -tv driver=v4l2:width=640:height=480 [...]
>
> The computer you're using may not have enough resources to process those large
> frames. If the native resolution of the devices is 3200x2400, that's
> 23MB/frame, and encoding often needs to keep a few in memory at once. As you
> tried in mencover, dial down the capture size in ffmpeg and see if that work.



Same problem also with: -s 640x480

$ ffmpeg -f alsa -i hw:1,0 -f video4linux2 -s 640x480 -i /dev/video0 out.mpg > log
ffmpeg version 4.1.4-1+b2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9 (Debian 9.2.1-1)
  configuration: --prefix=/usr --extra-version=1+b2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:1,0':
  Duration: N/A, start: 1595439555.172771, bitrate: 1536 kb/s
    Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Input #1, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 23292.147778, bitrate: 147456 kb/s
    Stream #1:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
File 'out.mpg' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #1:0 -> #0:0 (rawvideo (native) -> mpeg1video (native))
  Stream #0:0 -> #0:1 (pcm_s16le (native) -> mp2 (native))
Press [q] to stop, [?] for help
[alsa @ 0x55b787639980] ALSA buffer xrun.
[mpeg @ 0x55b787656ec0] VBV buffer size not set, using default size of 230KB
If you want the mpeg file to be compliant to some specification
Like DVD, VCD or others, make sure you set the correct buffer size
Output #0, mpeg, to 'out.mpg':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: mpeg1video, yuv420p(progressive), 640x480, q=2-31, 200 kb/s, 30 fps, 90k tbn, 30 tbc
    Metadata:
      encoder         : Lavc58.35.100 mpeg1video
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
    Metadata:
      encoder         : Lavc58.35.100 mp2
[video4linux2,v4l2 @ 0x55b787653d00] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[alsa @ 0x55b787639980] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
frame=  991 fps= 32 q=7.5 size=    2382kB time=00:00:32.96 bitrate=
592.0kbits/s dup=200 drop=0 speed=1.07x     


thank you..,

rodolfo


More information about the ffmpeg-user mailing list