[FFmpeg-user] How to properly record sound when capturing web cam?
Jean Louis
ffmpeg at rcdrun.com
Tue May 1 14:52:46 EEST 2018
On Tue, May 01, 2018 at 01:41:44PM +0200, Carl Eugen Hoyos wrote:
> 2018-05-01 13:10 GMT+02:00, Jean Louis <ffmpeg at rcdrun.com>:
>
> > admin-> ffmpeg -f v4l2 -video_size 320x240 -vsync 1 -i /dev/video0
> > -thread_queue_size 1024 -f alsa -i pulse output.mp4
>
> Where I live, I am probably required to tell you that running
> ffmpeg as root is not a good idea.
> (This is to the best of my knowledge unrelated
> to your issue.)
I am not root. Thanks.
> > [video4linux2,v4l2 @ 0x2601980] Thread message queue blocking;
> > consider raising the thread_queue_size option (current value: 8)
>
> I didn't know but this seems to indicate you have to specify the
> thread_queue option for every input stream.
>
> > [alsa @ 0x2603e80] Thread message queue blocking; consider
> > raising the thread_queue_size option (current value: 1024)
>
> Did you try a higher value?
I did try, and I do not see the same error, and
all is again the same.
I found out that if I record to MPG or OGV
formats, it is good.
If I try to record to WEBM or MP4, sound is not
recorded fully.
Jean
admin-> ffmpeg -y -f v4l2 -video_size 320x240 -i /dev/video0 -thread_queue_size 800 -f alsa -i default -q:v 4 output.mp4; mplayer output.mp4; ls -l output.mp4
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
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 453144.187672, bitrate: 36864 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240, 36864 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'default':
Duration: N/A, start: 1525175436.738077, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x18f8280] -qscale is ignored, -crf is recommended.
[libx264 @ 0x18f8280] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x18f8280] profile High 4:2:2, level 1.3, 4:2:2 8-bit
[libx264 @ 0x18f8280] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf58.13.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv422p(progressive), 320x240, q=-1--1, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc58.19.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.19.100 aac
frame= 62 fps= 30 q=29.0 size= 0kB time=00:00:00.30 bitrate= 1.3kbits/s speed=0.148x frame= 77 fps= 30 q=29.0 size= 0kB time=00:00:00.80 bitrate= 0.5kbits/s speed=0.316x frame= 92 fps= 30 q=29.0 size= 0kB time=00:00:01.32 bitrate= 0.3kbits/s speed=0.436x frame= 107 fps= 30 q=29.0 size= 0kB time=00:00:01.80 bitrate= 0.2kbits/s speed=0.509x frame= 122 fps= 30 q=29.0 size= 0kB time=00:00:02.32 bitrate= 0.2kbits/s speed=0.576x frame= 137 fps= 30 q=29.0 size= 0kB time=00:00:02.83 bitrate= 0.1kbits/s speed=0.625x frame= 167 fps= 30 q=29.0 size= 0kB time=00:00:03.83 bitrate= 0.1kbits/s speed=0.693x frame= 178 fps= 30 q=-1.0 Lsize= 159kB time=00:00:05.83 bitrate= 223.9kbits/s speed=0.97x
video:85kB audio:67kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 5.168871%
[libx264 @ 0x18f8280] frame I:1 Avg QP:23.63 size: 9169
[libx264 @ 0x18f8280] frame P:45 Avg QP:23.78 size: 1382
[libx264 @ 0x18f8280] frame B:132 Avg QP:26.23 size: 114
[libx264 @ 0x18f8280] consecutive B-frames: 1.1% 0.0% 0.0% 98.9%
[libx264 @ 0x18f8280] mb I I16..4: 17.0% 53.7% 29.3%
[libx264 @ 0x18f8280] mb P I16..4: 0.6% 0.2% 0.0% P16..4: 52.1% 9.9% 9.3% 0.0% 0.0% skip:27.9%
[libx264 @ 0x18f8280] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 21.3% 0.2% 0.0% direct: 0.2% skip:78.1% L0:43.9% L1:55.4% BI: 0.8%
[libx264 @ 0x18f8280] 8x8 transform intra:46.0% inter:59.9%
[libx264 @ 0x18f8280] coded y,uvDC,uvAC intra: 42.1% 84.3% 51.9% inter: 3.4% 21.6% 4.0%
[libx264 @ 0x18f8280] i16 v,h,dc,p: 34% 13% 17% 37%
[libx264 @ 0x18f8280] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 14% 32% 7% 7% 4% 7% 4% 9%
[libx264 @ 0x18f8280] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 20% 9% 9% 8% 8% 10% 6% 9%
[libx264 @ 0x18f8280] i8c dc,h,v,p: 51% 14% 24% 11%
[libx264 @ 0x18f8280] Weighted P-Frames: Y:4.4% UV:4.4%
[libx264 @ 0x18f8280] ref P L0: 52.4% 7.4% 28.4% 11.8%
[libx264 @ 0x18f8280] ref B L0: 80.8% 14.4% 4.9%
[libx264 @ 0x18f8280] ref B L1: 91.6% 8.4%
[libx264 @ 0x18f8280] kb/s:116.44
[aac @ 0x18f9840] Qavg: 210.239
MPlayer SVN-r38101-snapshot-5.3.0 (C) 2000-2018 MPlayer Team
Playing output.mp4.
libavformat version 58.13.100 (internal)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55be790bbc40]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO: [H264] 320x240 24bpp 30.000 fps 117.3 kbps (14.3 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: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Clip info:
major_brand: isom
minor_version: 512
compatible_brands: isomiso2avc1mp41
encoder: Lavf58.13.100
Load subtitles in ./
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
[aac @ 0x55be790d7fa0]Multiple frames in a packet.
AUDIO: 48000 Hz, 2 ch, floatle, 127.9 kbit/4.16% (ratio: 15986->384000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
[AO OSS] audio_setup: Can't open audio device /dev/dsp: No such file or directory
AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
[aac @ 0x55be790d7fa0]channel element 0.0 is not allocated
Movie-Aspect is undefined - no prescaling applied.
[swscaler @ 0x55be790ed180]bicubic scaler, from yuv420p to rgb24 using MMXEXT
[swscaler @ 0x55be790ed180]using unscaled yuv420p -> rgb24 special converter
VO: [xv] 320x240 => 320x240 Planar YV12 [fs]
[VO_XV] Shared memory not supported
Reverting to normal Xv.
[VO_XV] Shared memory not supported
Reverting to normal Xv.
A: 4.2 V: 5.9 A-V: -1.677 ct: -0.092 0/ 0 1% 0% 0.2% 0 0
Exiting... (End of file)
-rw-r--r-- 1 admin admin 163261 May 1 13:50 output.mp4
[~]
admin->
More information about the ffmpeg-user
mailing list