Opened 9 years ago

Last modified 9 years ago

#4189 new defect

webcam overlay audio desync Windows 7

Reported by: Kakariko__ Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: rogerdpack@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hi im using this command. FFmpeg 32bit windows static version from http://ffmpeg.zeranoe.com


 ffmpeg -loglevel warning -rtbufsize 100000k -f dshow -i video="UScreenCapture" -f dshow -i video="MyWebCam" -filter_complex "[0:v]setpts=PTS-STARTPTS[background];[1:v]setpts=PTS-STARTPTS,scale=-1:134[foreground];[background][foreground]overlay=main_w-overlay_w+1:main_h-overlay_h" -f dshow -i audio="virtual-audio-capturer" -c:v libx264 -crf 21 -preset:v veryfast -pix_fmt yuv420p -tune film -c:a libmp3lame -q:a 2 -ar 44100 -threads 0 "E:\test.mkv"

audio is ~2 seconds too fast. Tested on two laptops, tested with stereo mix also. Thanks for help.

Change History (10)

comment:1 by Kakariko__, 9 years ago

without overlay, all is ok

comment:2 by Carl Eugen Hoyos, 9 years ago

Please provide the command line together with the complete, uncut console output to make this a valid ticket.

comment:3 by Kakariko__, 9 years ago

Problem is with some delay at the start.

Here is no problems

<22:07:38.303> [FFmpeg] Input #0, dshow, from 'video=UScreenCapture':
  Duration: N/A, start: 14057.561000, bitrate: N/A
    Stream #0:0: Video: rawvideo, bgr24, 640x480, 30 tbr, 10000k tbn, 30 tbc
Input #1, dshow, from 'video=FFsource':
  Duration: N/A, start: 14057.586000, bitrate: N/A
    Stream #1:0: Video: rawvideo (NV12 / 0x3231564E), nv12, 640x480, 30 tbr, 10000k tbn, 30 tbc

at 22:07:38 there is info about Input #0 and Input #1. But here info about Input #1 is delayed about 3 seconds and this 3 seconds means video delay.

<22:08:36.778> [FFmpeg] Input #0, dshow, from 'video=UScreenCapture':
  Duration: N/A, start: 14116.020000, bitrate: N/A
    Stream #0:0: Video: rawvideo, bgr24, 640x480, 30 tbr, 10000k tbn, 30 tbc

<22:08:39.178> [FFmpeg] [dshow @ 028de340] real-time buffer[UScreenCapture] too full (64% of size: 100000000)! frame dropped!

<22:08:39.278> [FFmpeg] [dshow @ 028de340] real-time buffer[UScreenCapture] too full (67% of size: 100000000)! frame dropped!

<22:08:39.428> [FFmpeg] [dshow @ 028de340] real-time buffer[UScreenCapture] too full (70% of size: 100000000)! frame dropped!

<22:08:39.578> [FFmpeg] [dshow @ 028de340] real-time buffer[UScreenCapture] too full (72% of size: 100000000)! frame dropped!

<22:08:39.629> [FFmpeg] Input #1, dshow, from 'video=XSplitBroadcaster':
  Duration: N/A, start: 14117.228000, bitrate: N/A
    Stream #1:0: Video: rawvideo, bgr0, 320x240, 9.67 tbr, 10000k tbn, 10000k tbc

is there any way to fix it?

comment:4 by Roger Pack, 9 years ago

try combining your audio with a video input (else they're on a separate graph with different timers)

comment:5 by Kakariko__, 9 years ago

could you help with command for ffmpeg? Tried that earlier but could get working command

comment:6 by Roger Pack, 9 years ago

in general audio=X:video=Y
full command line and console output from failing example please?

comment:7 by Roger Pack, 9 years ago

also try with -loglevel verbose please?

comment:8 by Kakariko__, 9 years ago

 ffmpeg -loglevel verbose -rtbufsize 400M -f dshow -i video="UScreenCapture" -f dshow -i video="XSplitBroadcaster" -filter_complex "[0:v]setpts=PTS-STARTPTS[background];[1:v]setpts=PTS-STARTPTS,scale=-1:150[foreground];[background][foreground]overlay=main_w-overlay_w+1:main_h-overlay_h" -itsoffset 5.008 -f dshow -i audio="virtual-audio-capturer" -c:v libx264 -crf 21 -preset:v veryfast -pix_fmt yuv420p -tune film  -c:a libmp3lame -q:a 2 -ar 44100 -threads 0 "E:\AV_2015-02-09 23;04;56.mkv"
<23:05:04.975> [FFmpeg] ffmpeg version N-68675-g1515bfb Copyright (c) 2000-2014 the FFmpeg developers
  built on Dec 24 2014 22:56:55 with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 16.100 / 56. 16.100
  libavformat    56. 16.101 / 56. 16.101
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  5.101 /  5.  5.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100

<23:05:05.130> [FFmpeg] Input #0, dshow, from 'video=UScreenCapture':
  Duration: N/A, start: 27307.506000, bitrate: N/A
    Stream #0:0: Video: rawvideo, bgr24, 640x480, 24 tbr, 10000k tbn, 24 tbc

<23:05:08.280> [FFmpeg] Input #1, dshow, from 'video=XSplitBroadcaster':
  Duration: N/A, start: 27308.991000, bitrate: N/A
    Stream #1:0: Video: rawvideo, bgr0, 320x240, 19.83 tbr, 10000k tbn, 10000k tbc

<23:05:08.380> [FFmpeg] Guessed Channel Layout for  Input Stream #2.0 : stereo
Input #2, dshow, from 'audio=virtual-audio-capturer':
  Duration: N/A, start: 27310.720000, bitrate: 1536 kb/s
    Stream #2:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
[Parsed_scale_2 @ 09315fe0] w:-1 h:150 flags:'bilinear' interl:0
[graph 0 input from stream 0:0 @ 093162a0] w:640 h:480 pixfmt:bgr24 tb:1/10000000 fr:10000000/416666 sar:0/1 sws_param:flags=2
[graph 0 input from stream 1:0 @ 09317ba0] w:320 h:240 pixfmt:bgr0 tb:1/10000000 fr:119/6 sar:0/1 sws_param:flags=2

<23:05:08.531> [FFmpeg] [auto-inserted scaler 0 @ 0412a540] w:iw h:ih flags:'bilinear' interl:0
[Parsed_overlay_3 @ 09316380] auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_setpts_0' and the filter 'Parsed_overlay_3'
[graph 0 input from stream 0:0 @ 093162a0] TB:0.000000 FRAME_RATE:24.000038 SAMPLE_RATE:nan
[auto-inserted scaler 0 @ 0412a540] w:640 h:480 fmt:bgr24 sar:0/1 -> w:640 h:480 fmt:yuv420p sar:0/1 flags:0x2
[graph 0 input from stream 1:0 @ 09317ba0] TB:0.000000 FRAME_RATE:19.833333 SAMPLE_RATE:nan
[Parsed_scale_2 @ 09315fe0] w:320 h:240 fmt:bgr0 sar:0/1 -> w:200 h:150 fmt:yuva420p sar:0/1 flags:0x2
[Parsed_overlay_3 @ 09316380] main w:640 h:480 fmt:yuv420p overlay w:200 h:150 fmt:yuva420p eof_action:repeat
[Parsed_overlay_3 @ 09316380] [framesync @ 09316468] Selected 1/1000000 time base
[Parsed_overlay_3 @ 09316380] [framesync @ 09316468] Sync level 2
[graph 1 input from stream 2:0 @ 041fbb40] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x3
[audio format for output stream 0:1 @ 041fbc40] auto-inserting filter 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the filter 'audio format for output stream 0:1'

<23:05:08.580> [FFmpeg] [auto-inserted resampler 0 @ 041fbcc0] ch:2 chl:stereo fmt:s16 r:48000Hz -> ch:2 chl:stereo fmt:s16p r:44100Hz

<23:05:08.680> [FFmpeg] [libx264 @ 0a362900] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle

<23:05:08.730> [FFmpeg] [libx264 @ 0a362900] profile High, level 3.0
[libx264 @ 0a362900] 264 - core 144 r2525 40bb568 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:-1:-1 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.15 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 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=1 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=21.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00

<23:05:08.880> [FFmpeg] utput #0, matroska, to 'E:\AV_2015-02-09 23;04;56.mkv':
  Metadata:
    encoder         : Lavf56.16.101
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 640x480, q=-1--1, 24 fps, 1k tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc56.16.100 libx264
    Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p
    Metadata:
      encoder         : Lavc56.16.100 libmp3lame
Stream mapping:
  Stream #0:0 (rawvideo) -> setpts (graph 0)
  Stream #1:0 (rawvideo) -> setpts (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #2:0 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help

<23:05:09.433> [FFmpeg] frame=   24 fps=0.0 q=26.0 size=      39kB time=00:00:05.00 bitrate=  63.5kbits/s    

<23:05:09.885> [FFmpeg] frame=   59 fps= 57 q=26.0 size=      42kB time=00:00:05.00 bitrate=  68.1kbits/s    

<23:05:10.438> [FFmpeg] frame=   88 fps= 57 q=26.0 size=      43kB time=00:00:05.00 bitrate=  70.9kbits/s    

<23:05:10.944> [FFmpeg] frame=   99 fps= 48 q=26.0 size=      46kB time=00:00:05.00 bitrate=  74.5kbits/s    

<23:05:11.444> [FFmpeg] frame=  107 fps= 42 q=26.0 size=      49kB time=00:00:05.00 bitrate=  79.7kbits/s    

<23:05:11.944> [FFmpeg] frame=  116 fps= 38 q=26.0 size=      50kB time=00:00:05.00 bitrate=  81.6kbits/s    

<23:05:12.446> [FFmpeg] frame=  128 fps= 36 q=26.0 size=      54kB time=00:00:05.00 bitrate=  88.0kbits/s    

<23:05:12.946> [FFmpeg] frame=  140 fps= 34 q=26.0 size=      66kB time=00:00:05.50 bitrate=  97.5kbits/s    

<23:05:13.398> [FFmpeg] *** dropping frame 150 from stream 0 at ts 160

<23:05:13.448> [FFmpeg] frame=  152 fps= 33 q=26.0 size=      77kB time=00:00:06.00 bitrate= 105.7kbits/s dup=0 drop=1    

<23:05:13.949> [FFmpeg] frame=  164 fps= 32 q=26.0 size=      88kB time=00:00:06.50 bitrate= 111.5kbits/s dup=0 drop=1    

<23:05:14.456> [FFmpeg] frame=  176 fps= 32 q=26.0 size=     102kB time=00:00:07.00 bitrate= 118.8kbits/s dup=0 drop=1 


comment:9 by Roger Pack, 9 years ago

Cc: rogerdpack@gmail.com added

comment:10 by Roger Pack, 9 years ago

is your main background xsplitbroadcaster or uscreencapture here? what if you combine audio in its "same input" like "-i audio=X:video=Y ?

Note: See TracTickets for help on using tickets.