Problema de escalabilidade e taxa de quadros no vídeo de sobreposição ffmpeg

1

Eu posso usar o seguinte comando para adicionar a superposição de webcam na gravação da área de trabalho.

ffmpeg -y -rtbufsize 100M -f gdigrab -framerate 20 -offset_x 0 -offset_y 0 -video_size 1250x750 -draw_mouse 1 -i desktop -f dshow -i video="HP Truevision HD":audio="Microphone (High Definition Audio Device)" -filter_complex "[0]pad=height=ih+10:color=black[b];[b][1:v]overlay=(main_w-overlay_w):main_h-overlay_h[v]" -map "[v]" -c:v libx264 -r 20 -preset ultrafast -tune zerolatency -crf 30 -pix_fmt yuv420p -map 1:a -c:a libmp3lame  "D:\today.mp4"

Também é possível definir a posição de sobreposição no vídeo, mas sobrepor a web cam ("HP Truevision HD") com taxa de quadros (variação de taxa de quadros baixa) e ao aplicar a escala da seguinte forma:

-filter_complex "[1:v]scale=50:50 [ovrl] [1:v][ovrl]overlay=(main_w-overlay_w):main_h-overlay_h[v]"
A sobreposição

não é dimensionada.

Log:

[gdigrab @ 0000000586183280] Capturing whole desktop as 1250x750x32 at (0,0)
Input #0, gdigrab, from 'desktop':
  Duration: N/A, start: 1462985603.006939, bitrate: 600008 kb/s
    Stream #0:0: Video: bmp, bgra, 1250x750, 600008 kb/s, 20 tbr, 1000k tbn, 20
tbc
Guessed Channel Layout for  Input Stream #1.1 : stereo
Input #1, dshow, from 'video=HP Truevision HD:audio=Microphone (High Definition
Audio Device)':
  Duration: N/A, start: 520629.164000, bitrate: N/A
    Stream #1:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 30 tbr,
10000k tbn, 30 tbc
    Stream #1:1: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
[libx264 @ 000000058920eae0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 000000058920eae0] profile Constrained Baseline, level 3.2
[libx264 @ 000000058920eae0] 264 - core 148 r2665 a01e339 - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 r
ef=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0
 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 ch
roma_qp_offset=0 threads=4 lookahead_threads=4 sliced_threads=1 slices=4 nr=0 de
cimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 ke
yint=250 keyint_min=20 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=30.0 qcomp
=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to 'D:\today.mp4':
  Metadata:
    encoder         : Lavf57.29.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1250x7
60, q=-1--1, 20 fps, 10240 tbn, 20 tbc (default)
    Metadata:
      encoder         : Lavc57.30.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: mp3 (libmp3lame) (i[0][0][0] / 0x0069), 44100 Hz, stereo
, s16p
    Metadata:
      encoder         : Lavc57.30.100 libmp3lame
Stream mapping:
  Stream #0:0 (bmp) -> pad (graph 0)
  Stream #1:0 (rawvideo) -> overlay:overlay (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #1:1 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
frame=   20 fps=0.0 q=29.0 size=     218kB time=00:00:01.00 bitrate=1785.5kbits/
[gdigrab @ 0000000586183280] Thread message queue blocking; consider raising the
 thread_queue_size option (current value: 8)
frame=   21 fps= 20 q=28.0 size=     272kB time=00:00:01.39 bitrate=1599.8kbits/
frame=   40 fps= 26 q=28.0 size=     354kB time=00:00:02.00 bitrate=1449.2kbits/
frame=   42 fps= 20 q=27.0 size=     398kB time=00:00:02.38 bitrate=1369.6kbits/
frame=   60 fps= 23 q=26.0 size=     451kB time=00:00:03.00 bitrate=1231.7kbits/
frame=   64 fps= 21 q=22.0 size=     474kB time=00:00:03.38 bitrate=1147.3kbits/
Past duration 0.629295 too large
Past duration 0.685829 too large
Past duration 0.680367 too large
Past duration 0.688179 too large
frame=   80 fps= 22 q=25.0 size=     498kB time=00:00:04.00 bitrate=1019.5kbits/
frame=   84 fps= 20 q=29.0 size=     536kB time=00:00:04.39 bitrate= 998.5kbits/
frame=  100 fps= 22 q=26.0 size=     574kB time=00:00:05.00 bitrate= 941.2kbits/
frame=  106 fps= 21 q=21.0 size=     627kB time=00:00:05.39 bitrate= 951.6kbits/
frame=  120 fps= 21 q=25.0 size=     648kB time=00:00:06.00 bitrate= 885.4kbits/
frame=  126 fps= 21 q=21.0 size=     692kB time=00:00:06.38 bitrate= 888.5kbits/
frame=  140 fps= 21 q=25.0 size=     713kB time=00:00:07.00 bitrate= 833.9kbits/
frame=  147 fps= 21 q=20.0 size=     761kB time=00:00:07.40 bitrate= 841.7kbits/
frame=  160 fps= 21 q=25.0 size=     778kB time=00:00:08.00 bitrate= 796.6kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
frame=  169 fps= 21 q=20.0 size=     826kB time=00:00:08.45 bitrate= 801.0kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  180 fps= 21 q=28.0 size=     841kB time=00:00:09.00 bitrate= 765.9kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 2 times
frame=  186 fps= 20 q=25.0 size=     949kB time=00:00:09.38 bitrate= 828.9kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  200 fps= 21 q=27.0 size=    1000kB time=00:00:10.00 bitrate= 819.6kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  209 fps= 20 q=23.0 size=    1136kB time=00:00:10.45 bitrate= 890.6kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
Past duration 0.752586 too large
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
frame=  220 fps= 21 q=26.0 size=    1182kB time=00:00:11.00 bitrate= 880.0kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 2 times
frame=  230 fps= 21 q=21.0 size=    1255kB time=00:00:11.50 bitrate= 894.3kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  240 fps= 20 q=25.0 size=    1320kB time=00:00:12.00 bitrate= 901.0kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  249 fps= 20 q=20.0 size=    1381kB time=00:00:12.45 bitrate= 908.7kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  260 fps= 20 q=25.0 size=    1581kB time=00:00:13.00 bitrate= 996.4kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  269 fps= 20 q=23.0 size=    1647kB time=00:00:13.45 bitrate=1003.2kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  280 fps= 20 q=25.0 size=    1677kB time=00:00:14.00 bitrate= 981.0kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  289 fps= 20 q=22.0 size=    1731kB time=00:00:14.45 bitrate= 981.2kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  300 fps= 20 q=23.0 size=    1752kB time=00:00:15.00 bitrate= 956.6kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  309 fps= 20 q=24.0 size=    1809kB time=00:00:15.45 bitrate= 959.2kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  320 fps= 20 q=23.0 size=    1838kB time=00:00:16.00 bitrate= 940.8kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  329 fps= 20 q=30.0 size=    1889kB time=00:00:16.45 bitrate= 940.6kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  340 fps= 20 q=21.0 size=    1992kB time=00:00:17.00 bitrate= 959.8kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  349 fps= 20 q=23.0 size=    2038kB time=00:00:17.45 bitrate= 956.8kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  360 fps= 20 q=21.0 size=    2075kB time=00:00:18.00 bitrate= 944.2kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  369 fps= 20 q=30.0 size=    2117kB time=00:00:18.45 bitrate= 939.9kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  380 fps= 20 q=23.0 size=    2166kB time=00:00:19.00 bitrate= 933.9kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  389 fps= 20 q=30.0 size=    2218kB time=00:00:19.45 bitrate= 934.0kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  400 fps= 20 q=23.0 size=    2267kB time=00:00:20.00 bitrate= 928.4kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  409 fps= 20 q=21.0 size=    2307kB time=00:00:20.45 bitrate= 924.0kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  420 fps= 20 q=23.0 size=    2323kB time=00:00:21.00 bitrate= 906.3kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  429 fps= 20 q=30.0 size=    2376kB time=00:00:21.45 bitrate= 907.6kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  440 fps= 20 q=23.0 size=    2426kB time=00:00:22.00 bitrate= 903.2kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  449 fps= 20 q=30.0 size=    2479kB time=00:00:22.45 bitrate= 904.6kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  460 fps= 20 q=23.0 size=    2580kB time=00:00:23.00 bitrate= 918.8kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  471 fps= 20 q=22.0 size=    2620kB time=00:00:23.55 bitrate= 911.5kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  480 fps= 20 q=21.0 size=    2653kB time=00:00:24.00 bitrate= 905.6kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  489 fps= 20 q=30.0 size=    2698kB time=00:00:24.45 bitrate= 903.9kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  500 fps= 20 q=23.0 size=    2748kB time=00:00:25.00 bitrate= 900.4kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  509 fps= 20 q=23.0 size=    2973kB time=00:00:25.45 bitrate= 957.1kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  520 fps= 20 q=23.0 size=    2992kB time=00:00:26.00 bitrate= 942.8kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  529 fps= 20 q=23.0 size=    3033kB time=00:00:26.45 bitrate= 939.5kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  540 fps= 20 q=23.0 size=    3048kB time=00:00:27.00 bitrate= 924.7kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  549 fps= 20 q=22.0 size=    3088kB time=00:00:27.45 bitrate= 921.6kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  560 fps= 20 q=23.0 size=    3102kB time=00:00:28.00 bitrate= 907.5kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  569 fps= 20 q=22.0 size=    3142kB time=00:00:28.45 bitrate= 904.8kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 3 times
frame=  580 fps= 20 q=23.0 size=    3156kB time=00:00:29.00 bitrate= 891.4kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
    Last message repeated 4 times
frame=  589 fps= 20 q=22.0 size=    3197kB time=00:00:29.45 bitrate= 889.3kbits/
[Parsed_overlay_1 @ 000000058920c740] [framesync @ 00000005862082a8] Buffer queu
e overflow, dropping.
frame=  591 fps= 20 q=25.0 Lsize=    3230kB time=00:00:29.99 bitrate= 882.2kbits
/s dup=300 drop=0 speed=1.01x
video:2745kB audio:469kB subtitle:0kB other streams:0kB global headers:0kB muxin
g overhead: 0.514673%
[libx264 @ 000000058920eae0] frame I:3     Avg QP:22.00  size:171564
[libx264 @ 000000058920eae0] frame P:588   Avg QP:22.15  size:  3903
[libx264 @ 000000058920eae0] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 000000058920eae0] mb P  I16..4:  1.1%  0.0%  0.0%  P16..4: 10.2%  0.0
%  0.0%  0.0%  0.0%    skip:88.7%
[libx264 @ 000000058920eae0] coded y,uvDC,uvAC intra: 30.8% 54.4% 31.7% inter: 3
.0% 5.7% 1.4%
[libx264 @ 000000058920eae0] i16 v,h,dc,p: 38% 32% 17% 12%
[libx264 @ 000000058920eae0] i8c dc,h,v,p: 51% 28% 16%  5%
[libx264 @ 000000058920eae0] kb/s:760.69
Exiting normally, received signal 2.
    
por Anupam Singh 11.05.2016 / 18:49

0 respostas