[FFmpeg-user] fading multiple graphic overlays

Christian Johannesen chrisjohannesen at gmail.com
Fri Apr 1 17:44:51 CEST 2016


On Thu, Mar 31, 2016 at 6:29 PM, Christian Johannesen <
chrisjohannesen at gmail.com> wrote:

> I'm able to use ffmpeg to fade the same graphic overlays multiple times
> but I wonder if i'm not using the right approach. When I use 1 overlay the
> process runs at 35fps, but if I try to overlay the same graphic 3 times the
> performance drops to 14fps.
>

I re-did my test by removing the fifo and changing how I set the fade, but
I still get a performance hit for multiple graphics.

One graphic:

 D:\ffmpeg\ffmpeg-20160330-git-be746ae-win64-static\bin
>ffmpeg -i D:\overlaytest\base.mov -loop 1 -i D:\overlaytest\overlay.png
-filter_complex
"[1:0]format=rgba,fade=in:st=2:d=0.5:alpha=1,fade=out:st=4:d=0.5:alpha=1[t0]";"[0:0][t0]overlay=shortest=1[tmp0]"
-map "[tmp0]" D:\overlaytest\graphic_png_overlay_one_V2.mp4
ffmpeg version N-79173-gbe746ae Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.3.0 (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-libmfx
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 32.100 / 57. 32.100
  libavformat    57. 29.101 / 57. 29.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 40.102 /  6. 40.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\overlaytest\base.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2016-01-07 16:42:02
  Duration: 00:02:00.04, start: 0.000000, bitrate: 23926 kb/s
    Stream #0:0(eng): Video: prores (apcs / 0x73637061),
yuv422p10le(bt709), 1920x1080, 21552 kb/s, SAR 1:1 DAR 16:9, 23.98 fps,
23.98 tbr, 24k tbn, 24k tbc (default)
    Metadata:
      creation_time   : 2016-01-07 16:42:02
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 (LT)
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz,
stereo, s32 (24 bit), 2304 kb/s (default)
    Metadata:
      creation_time   : 2016-01-07 16:42:02
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2016-01-07 16:42:02
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
Input #1, png_pipe, from 'D:\overlaytest\overlay.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 1920x1080 [SAR 2835:2835 DAR 16:9],
25 fps, 25 tbr, 25 tbn, 25 tbc
[libx264 @ 000000016e860860] using SAR=1/1
[libx264 @ 000000016e860860] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 000000016e860860] profile High, level 4.0
[libx264 @ 000000016e860860] 264 - core 148 r2665 a01e339 - H.264/MPEG-4
AVC codec - Copyleft 2003-2016 - 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=34
lookahead_threads=5 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=23
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 'D:\overlaytest\graphic_png_overlay_one_V2.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    encoder         : Lavf57.29.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc
(default)
    Metadata:
      encoder         : Lavc57.32.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 (prores) -> overlay:main
  Stream #1:0 (png) -> format
  overlay -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame= 2878 fps= 36 q=-1.0 Lsize=    1952kB time=00:01:59.95 bitrate=
133.3kbits/s speed= 1.5x
video:1918kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 1.799672%
[libx264 @ 000000016e860860] frame I:12    Avg QP:10.75  size: 18902
[libx264 @ 000000016e860860] frame P:725   Avg QP:24.85  size:  1095
[libx264 @ 000000016e860860] frame B:2141  Avg QP:30.31  size:   440
[libx264 @ 000000016e860860] consecutive B-frames:  0.8%  0.0%  0.1% 99.1%
[libx264 @ 000000016e860860] mb I  I16..4: 95.3%  0.1%  4.6%
[libx264 @ 000000016e860860] mb P  I16..4:  0.1%  0.1%  0.2%  P16..4:  0.4%
 0.2%  0.1%  0.0%  0.0%    skip:99.0%
[libx264 @ 000000016e860860] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.4%
 0.2%  0.1%  direct: 0.0%  skip:99.3%  L0:52.3% L1:45.6% BI: 2.2%
[libx264 @ 000000016e860860] 8x8 transform intra:6.2% inter:9.9%
[libx264 @ 000000016e860860] coded y,uvDC,uvAC intra: 7.4% 16.4% 14.4%
inter: 0.1% 0.0% 0.0%
[libx264 @ 000000016e860860] i16 v,h,dc,p: 92%  6%  2%  0%
[libx264 @ 000000016e860860] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16%  8% 74%  1%
 0%  0%  0%  0%  0%
[libx264 @ 000000016e860860] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 28% 29%  4%
 3%  3%  2%  2%  2%
[libx264 @ 000000016e860860] i8c dc,h,v,p: 77% 11% 11%  1%
[libx264 @ 000000016e860860] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000000016e860860] ref P L0: 56.3%  4.3% 23.0% 16.4%
[libx264 @ 000000016e860860] ref B L0: 64.8% 26.5%  8.8%
[libx264 @ 000000016e860860] ref B L1: 80.7% 19.3%
[libx264 @ 000000016e860860] kb/s:130.84

Three graphics:

D:\ffmpeg\ffmpeg-20160330-git-be746ae-win64-static\bin
>ffmpeg -i D:\overlaytest\base.mov -loop 1 -i D:\overlaytest\overlay.png
-filter_complex
"[1:0]format=rgba,fade=in:st=2:d=0.5:alpha=1,fade=out:st=4:d=0.5:alpha=1[t0]";"[1:0]format=rgba,fade=in:st=8.6:d=0.5:alpha=1,fade=out:st=12.6:d=0.5:alpha=1[t1]";"[1:0]format=rgba,fade=in:st=12.2:d=0.5:alpha=1,fade=out:st=14.2:d=0.5:alpha=1[t2]";"[0:0][t0]overlay=shortest=1[tmp0]";"[tmp0][t1]overlay=shortest=1[tmp1]";"[tmp1][t2]overlay=shortest=1[tmp2]"
-map "[tmp2]" D:\overlaytest\graphic_png_overlay_three_V2.mp4
ffmpeg version N-79173-gbe746ae Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.3.0 (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-libmfx
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 32.100 / 57. 32.100
  libavformat    57. 29.101 / 57. 29.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 40.102 /  6. 40.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'D:\overlaytest\base.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2016-01-07 16:42:02
  Duration: 00:02:00.04, start: 0.000000, bitrate: 23926 kb/s
    Stream #0:0(eng): Video: prores (apcs / 0x73637061),
yuv422p10le(bt709), 1920x1080, 21552 kb/s, SAR 1:1 DAR 16:9, 23.98 fps,
23.98 tbr, 24k tbn, 24k tbc (default)
    Metadata:
      creation_time   : 2016-01-07 16:42:02
      handler_name    : Apple Alias Data Handler
      encoder         : Apple ProRes 422 (LT)
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz,
stereo, s32 (24 bit), 2304 kb/s (default)
    Metadata:
      creation_time   : 2016-01-07 16:42:02
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2016-01-07 16:42:02
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
Input #1, png_pipe, from 'D:\overlaytest\overlay.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 1920x1080 [SAR 2835:2835 DAR 16:9],
25 fps, 25 tbr, 25 tbn, 25 tbc
[libx264 @ 000000e04f814fe0] using SAR=1/1
[libx264 @ 000000e04f814fe0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 000000e04f814fe0] profile High, level 4.0
[libx264 @ 000000e04f814fe0] 264 - core 148 r2665 a01e339 - H.264/MPEG-4
AVC codec - Copyleft 2003-2016 - 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=34
lookahead_threads=5 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=23
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 'D:\overlaytest\graphic_png_overlay_three_V2.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    encoder         : Lavf57.29.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc
(default)
    Metadata:
      encoder         : Lavc57.32.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 (prores) -> overlay:main
  Stream #1:0 (png) -> format
  Stream #1:0 (png) -> format
  Stream #1:0 (png) -> format
  overlay -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame= 2878 fps= 14 q=-1.0 Lsize=    1973kB time=00:01:59.95 bitrate=
134.7kbits/s speed=0.597x video:1938kB audio:0kB subtitle:0kB other
streams:0kB global headers:0kB muxing overhead: 1.780594%
[libx264 @ 000000e04f814fe0] frame I:12    Avg QP:10.76  size: 18989
[libx264 @ 000000e04f814fe0] frame P:725   Avg QP:24.81  size:  1118
[libx264 @ 000000e04f814fe0] frame B:2141  Avg QP:30.30  size:   442
[libx264 @ 000000e04f814fe0] consecutive B-frames:  0.8%  0.0%  0.1% 99.1%
[libx264 @ 000000e04f814fe0] mb I  I16..4: 95.3%  0.1%  4.6%
[libx264 @ 000000e04f814fe0] mb P  I16..4:  0.1%  0.1%  0.2%  P16..4:  0.4%
 0.2%  0.1%  0.0%  0.0%    skip:99.0%
[libx264 @ 000000e04f814fe0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.4%
 0.2%  0.1%  direct: 0.0%  skip:99.3%  L0:52.2% L1:45.6% BI: 2.2%
[libx264 @ 000000e04f814fe0] 8x8 transform intra:6.2% inter:10.4%
[libx264 @ 000000e04f814fe0] coded y,uvDC,uvAC intra: 7.5% 16.6% 14.5%
inter: 0.1% 0.0% 0.0%
[libx264 @ 000000e04f814fe0] i16 v,h,dc,p: 91%  7%  2%  0%
[libx264 @ 000000e04f814fe0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16%  8% 74%  1%
 0%  0%  0%  0%  0%
[libx264 @ 000000e04f814fe0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 28% 29%  4%
 3%  3%  2%  2%  2%
[libx264 @ 000000e04f814fe0] i8c dc,h,v,p: 77% 12% 11%  1%
[libx264 @ 000000e04f814fe0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000000e04f814fe0] ref P L0: 56.5%  4.5% 22.8% 16.2%
[libx264 @ 000000e04f814fe0] ref B L0: 64.8% 26.5%  8.7%
[libx264 @ 000000e04f814fe0] ref B L1: 80.7% 19.3%
[libx264 @ 000000e04f814fe0] kb/s:132.24


More information about the ffmpeg-user mailing list