How to properly record sound when capturing web cam?

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|

How to properly record sound when capturing web cam?

Jean Louis
Hello,

I would like to know how to properly record sound
when capturing video camera.

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

then in that case the sound get lost some number
of seconds before the video ends, and all becomes
silent in the output file.

If anybody knows how to remedy that, let me know.

Also other options to improve web cam recording
for low quality size is needed, so that I may send
video messages easy.

Jean Louis
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Carl Eugen Hoyos-2
2018-05-01 12:54 GMT+02:00, Jean Louis <[hidden email]>:

> 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.

> 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?

aac/mp4 output should work better / is much more
tested than vorbis/ogg.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Jean Louis
On Tue, May 01, 2018 at 01:04:18PM +0200, Carl Eugen Hoyos wrote:

> 2018-05-01 12:54 GMT+02:00, Jean Louis <[hidden email]>:
>
> > 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
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Carl Eugen Hoyos-2
2018-05-01 13:10 GMT+02:00, Jean Louis <[hidden email]>:

> 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.)

[...]

> [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?

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Jean Louis
On Tue, May 01, 2018 at 01:41:44PM +0200, Carl Eugen Hoyos wrote:
> 2018-05-01 13:10 GMT+02:00, Jean Louis <[hidden email]>:
>
> > 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->                                                                                          
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Carl Eugen Hoyos-2
2018-05-01 13:52 GMT+02:00, Jean Louis <[hidden email]>:

> admin-> ffmpeg -y -f v4l2 -video_size 320x240 -i /dev/video0
> -thread_queue_size 800 -f alsa -i default -q:v 4 output.mp4

I don't know if this makes a difference but you can try to
swap inputs:

$ ffmpeg -f alsa -i default -video_size 320x240 -i /dev/video0
-thread_queue_size 800 -qscale 4 out.mp4

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Jean Louis
On Tue, May 01, 2018 at 05:58:46PM +0200, Carl Eugen Hoyos wrote:

> 2018-05-01 13:52 GMT+02:00, Jean Louis <[hidden email]>:
>
> > admin-> ffmpeg -y -f v4l2 -video_size 320x240 -i /dev/video0
> > -thread_queue_size 800 -f alsa -i default -q:v 4 output.mp4
>
> I don't know if this makes a difference but you can try to
> swap inputs:
>
> $ ffmpeg -f alsa -i default -video_size 320x240 -i /dev/video0
> -thread_queue_size 800 -qscale 4 out.mp4

Tried it. Again the same non-functional
result. Even worse, now is sound not in sync with
video.

Jean
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Carl Eugen Hoyos-2
In reply to this post by Jean Louis
2018-05-01 13:52 GMT+02:00, Jean Louis <[hidden email]>:

> 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

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Jean Louis
On Tue, May 01, 2018 at 06:01:44PM +0200, Carl Eugen Hoyos wrote:

> 2018-05-01 13:52 GMT+02:00, Jean Louis <[hidden email]>:
>
> > 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
[~]
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Gyan Doshi
In reply to this post by Carl Eugen Hoyos-2


On 5/1/2018 9:28 PM, Carl Eugen Hoyos wrote:
>
> I don't know if this makes a difference but you can try to
> swap inputs:
>
> $ ffmpeg -f alsa -i default -video_size 320x240 -i /dev/video0
> -thread_queue_size 800 -qscale 4 out.mp4


  thread_queue_size is an input option and applied per file.

     { "thread_queue_size", ... OPT_INPUT, ...
         "set the maximum number of queued packets from the demuxer" },


Gyan

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Carl Eugen Hoyos-2
In reply to this post by Jean Louis
2018-05-01 18:04 GMT+02:00, Jean Louis <[hidden email]>:

> [video4linux2,v4l2 @ 0x2590a40] Detected monotonic timestamps, converting
> Input #0, video4linux2,v4l2, from '/dev/video0':
>   Duration: N/A, start: 1525190574.860860

> Input #1, alsa, from 'default':
>   Duration: N/A, start: 1525190574.924269

This is correct now, as said it could not work before.
(If it did work for some encoders, this indicates a
bug there.)

> [alsa @ 0x2592fc0] Thread message queue blocking;
> consider raising the thread_queue_size option (current value: 100)
> [video4linux2,v4l2 @ 0x2590a40] Thread message queue blocking;
> consider raising the thread_queue_size option (current value: 8)

You should try to fix this.

Are you sure your system is fast enough for vp9 realtime
encoding?

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Jean Louis
On Tue, May 01, 2018 at 06:14:15PM +0200, Carl Eugen Hoyos wrote:

> 2018-05-01 18:04 GMT+02:00, Jean Louis <[hidden email]>:
>
> > [video4linux2,v4l2 @ 0x2590a40] Detected monotonic timestamps, converting
> > Input #0, video4linux2,v4l2, from '/dev/video0':
> >   Duration: N/A, start: 1525190574.860860
>
> > Input #1, alsa, from 'default':
> >   Duration: N/A, start: 1525190574.924269
>
> This is correct now, as said it could not work before.
> (If it did work for some encoders, this indicates a
> bug there.)
>
> > [alsa @ 0x2592fc0] Thread message queue blocking;
> > consider raising the thread_queue_size option (current value: 100)
> > [video4linux2,v4l2 @ 0x2590a40] Thread message queue blocking;
> > consider raising the thread_queue_size option (current value: 8)
>
> You should try to fix this.
>
> Are you sure your system is fast enough for vp9 realtime
> encoding?

This is Thinkpad L430, pretty fast machine. Should
be working.

I have tried this one:

ffmpeg -y -f v4l2 -thread_queue_size 800 -video_size 800x448 -i /dev/video0 -f alsa -thread_queue_size 10000 -ac 1 -ar 14400 -i default  -q:v 5  output.webm; mplayer output.webm; ls -l output.webm

and that one works without warnings of the
thread_queue_size, maybe it would work with less
of it, but with 3000 it was still warning.

Yet, the result that sound is interrupted in WEBM
and MP4 and MKV formats is still same. If the
video is 15 seconds, 3 seconds before the sound is
off, and I could see on screen that only 10+
seconds were recorded.

OGV format is working well.

MPG format is working well but not with less than
15 fps, which is unrelated, so I can record it
with 640x480 without problems it has more fps.

If video is 7 seconds, sound is off about on 5th
second.

Jean
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Erik Dobberkau
> I have tried this one:
>
> ffmpeg -y -f v4l2 -thread_queue_size 800 -video_size 800x448 -i
> /dev/video0 -f alsa -thread_queue_size 10000 -ac 1 -ar 14400 -i default
> -q:v 5  output.webm; mplayer output.webm; ls -l output.webm
>
>
This might not have the least to do with all of this, I just want to poiunt
out that an audio sample rate of  14400 Hz (where I guess 44100 is
intended) might contribute to trouble downstream...
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: How to properly record sound when capturing web cam?

Jean Louis
On Tue, May 01, 2018 at 07:23:09PM +0200, Erik Dobberkau wrote:

> > I have tried this one:
> >
> > ffmpeg -y -f v4l2 -thread_queue_size 800 -video_size 800x448 -i
> > /dev/video0 -f alsa -thread_queue_size 10000 -ac 1 -ar 14400 -i default
> > -q:v 5  output.webm; mplayer output.webm; ls -l output.webm
> >
> >
> This might not have the least to do with all of this, I just want to poiunt
> out that an audio sample rate of  14400 Hz (where I guess 44100 is
> intended) might contribute to trouble downstream...

Well I did try that in first place, without 14400,
that was when I was making OGV to make size of
video smaller. Otherwise with or without sound
rate, the sound goes off in some formats such as
MP4 or MKV.

Jean
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".