[FFmpeg-user] How to properly record sound when capturing web cam?
Jean Louis
ffmpeg at rcdrun.com
Tue May 1 14:10:56 EEST 2018
On Tue, May 01, 2018 at 01:04:18PM +0200, Carl Eugen Hoyos wrote:
> 2018-05-01 12:54 GMT+02:00, Jean Louis <ffmpeg at rcdrun.com>:
>
> > The command that works well is following one:
> >
> > ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0
> > -thread_queue_size 1024 -f alsa -i pulse -bufsize 256k
> > output.ogv
> >
> > however, if I change the format, and use it like:
> >
> > ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0
> > -thread_queue_size 1024 -f alsa -i pulse -bufsize 256k
> > output.mp4
>
> Complete, uncut console output missing.
admin-> ffmpeg -f v4l2 -video_size 320x240 -vsync 1 -i /dev/video0 -thread_queue_size 1024 -f alsa -i pulse 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: 450649.994945, 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 'pulse':
Duration: N/A, start: 1525172942.545140, bitrate: 1536 kb/s
Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
File 'output.mp4' already exists. Overwrite ? [y/N] y
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 @ 0x2646180] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x2646180] profile High 4:2:2, level 1.3, 4:2:2 8-bit
[libx264 @ 0x2646180] 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
[video4linux2,v4l2 @ 0x2601980] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[alsa @ 0x2603e80] Thread message queue blocking; consider raising the thread_queue_size option (current value: 1024)
frame= 102 fps=0.0 q=29.0 size= 0kB time=00:00:01.66 bitrate= 0.2kbits/s dup=61 drop=0 sframe= 117 fps=116 q=29.0 size= 0kB time=00:00:02.15 bitrate= 0.2kbits/s dup=66 drop=0 sframe= 133 fps= 88 q=29.0 size= 0kB time=00:00:02.66 bitrate= 0.1kbits/s dup=71 drop=0 sframe= 147 fps= 73 q=29.0 size= 0kB time=00:00:03.15 bitrate= 0.1kbits/s dup=76 drop=0 sframe= 163 fps= 65 q=29.0 size= 0kB time=00:00:03.66 bitrate= 0.1kbits/s dup=82 drop=0 sframe= 178 fps= 59 q=29.0 size= 0kB time=00:00:04.20 bitrate= 0.1kbits/s dup=87 drop=0 sframe= 193 fps= 55 q=29.0 size= 0kB time=00:00:04.66 bitrate= 0.1kbits/s dup=92 drop=0 sframe= 208 fps= 52 q=29.0 size= 0kB time=00:00:05.16 bitrate= 0.1kbits/s dup=97 drop=0 sframe= 223 fps= 49 q=29.0 size= 0kB time=00:00:05.69 bitrate= 0.1kbits/s dup=102 drop=0 frame= 236 fps= 46 q=-1.0 Lsize= 312kB time=00:00:07.76 bitrate= 329.3kbits/s dup=106 drop=0 speed= 1.5x
video:205kB audio:97kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.420086%
[libx264 @ 0x2646180] frame I:1 Avg QP:24.51 size: 10299
[libx264 @ 0x2646180] frame P:96 Avg QP:23.98 size: 1755
[libx264 @ 0x2646180] frame B:139 Avg QP:26.18 size: 220
[libx264 @ 0x2646180] consecutive B-frames: 16.9% 2.5% 33.1% 47.5%
[libx264 @ 0x2646180] mb I I16..4: 15.0% 55.0% 30.0%
[libx264 @ 0x2646180] mb P I16..4: 0.4% 0.5% 0.1% P16..4: 44.4% 11.3% 9.8% 0.0% 0.0% skip:33.5%
[libx264 @ 0x2646180] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 23.6% 0.5% 0.1% direct: 1.6% skip:74.1% L0:41.8% L1:54.0% BI: 4.2%
[libx264 @ 0x2646180] 8x8 transform intra:50.6% inter:56.5%
[libx264 @ 0x2646180] coded y,uvDC,uvAC intra: 58.5% 88.8% 77.3% inter: 6.5% 28.7% 11.6%
[libx264 @ 0x2646180] i16 v,h,dc,p: 6% 11% 7% 76%
[libx264 @ 0x2646180] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 12% 25% 7% 8% 7% 7% 8% 10%
[libx264 @ 0x2646180] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 11% 14% 8% 10% 10% 8% 11% 8%
[libx264 @ 0x2646180] i8c dc,h,v,p: 58% 10% 14% 17%
[libx264 @ 0x2646180] Weighted P-Frames: Y:2.1% UV:2.1%
[libx264 @ 0x2646180] ref P L0: 58.2% 13.3% 13.0% 15.5% 0.0%
[libx264 @ 0x2646180] ref B L0: 84.6% 8.0% 7.4%
[libx264 @ 0x2646180] ref B L1: 90.3% 9.7%
[libx264 @ 0x2646180] kb/s:212.91
[aac @ 0x2647740] Qavg: 210.333
You have mail in /home/data1/protected/Maildir
[~]
admin-> mplayer output.mp4 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 @ 0x55bd2d8e1c40]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 213.6 kbps (26.1 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 @ 0x55bd2d8fdfa0]Multiple frames in a packet.
AUDIO: 48000 Hz, 2 ch, floatle, 128.1 kbit/4.17% (ratio: 16015->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 @ 0x55bd2d8fdfa0]channel element 0.0 is not allocated
Movie-Aspect is undefined - no prescaling applied.
[swscaler @ 0x55bd2d913180]bicubic scaler, from yuv420p to rgb24 using MMXEXT
[swscaler @ 0x55bd2d913180]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: 6.1 V: 7.3 A-V: -1.131 ct: -0.135 0/ 0 1% 0% 0.3% 0 0
Exiting... (Quit)
> > then in that case the sound get lost some number
> > of seconds before the video ends, and all becomes
> > silent in the output file.
>
> How do you test the output file?
I use mplayer to play the file.
> aac/mp4 output should work better / is much more
> tested than vorbis/ogg
Ogv works perfect.
Mp4 not on my side.
Jean
More information about the ffmpeg-user
mailing list