[FFmpeg-user] fading multiple graphic overlays

Christian Johannesen chrisjohannesen at gmail.com
Fri Apr 1 00:29:54 CEST 2016


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.

Thanks,
Chris

1 graphic overlay:

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]fade=t=in:0:12,fade=t=out:108:12[fadepng]";"[0:0]fifo[fifo0]";"[fadepng]fifo[fifo1]";"[fifo0][fifo1]overlay=shortest=1[overlay0]"
-map "[overlay0]" D:\overlaytest\graphic_png_overlay1.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 @ 0000002e638a52a0] using SAR=1/1
[libx264 @ 0000002e638a52a0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 0000002e638a52a0] profile High, level 4.0
[libx264 @ 0000002e638a52a0] 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_overlay1.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) -> fifo
  Stream #1:0 (png) -> fade
  overlay -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame= 2878 fps= 35 q=-1.0 Lsize=    1952kB time=00:01:59.95 bitrate=
133.3kbits/s speed=1.47x
video:1918kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 1.799862%
[libx264 @ 0000002e638a52a0] frame I:12    Avg QP:10.69  size: 18868
[libx264 @ 0000002e638a52a0] frame P:725   Avg QP:24.81  size:  1092
[libx264 @ 0000002e638a52a0] frame B:2141  Avg QP:30.29  size:   441
[libx264 @ 0000002e638a52a0] consecutive B-frames:  0.8%  0.0%  0.1% 99.1%
[libx264 @ 0000002e638a52a0] mb I  I16..4: 95.3%  0.1%  4.6%
[libx264 @ 0000002e638a52a0] 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 @ 0000002e638a52a0] 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.5% BI: 2.2%
[libx264 @ 0000002e638a52a0] 8x8 transform intra:6.2% inter:10.2%
[libx264 @ 0000002e638a52a0] coded y,uvDC,uvAC intra: 7.4% 16.5% 14.4%
inter: 0.1% 0.0% 0.0%
[libx264 @ 0000002e638a52a0] i16 v,h,dc,p: 92%  6%  2%  0%
[libx264 @ 0000002e638a52a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16%  8% 74%  1%
 0%  0%  0%  0%  0%
[libx264 @ 0000002e638a52a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 28% 29%  4%
 3%  3%  2%  2%  2%
[libx264 @ 0000002e638a52a0] i8c dc,h,v,p: 77% 11% 11%  1%
[libx264 @ 0000002e638a52a0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000002e638a52a0] ref P L0: 56.2%  4.3% 23.1% 16.5%
[libx264 @ 0000002e638a52a0] ref B L0: 64.7% 26.5%  8.8%
[libx264 @ 0000002e638a52a0] ref B L1: 80.8% 19.2%
[libx264 @ 0000002e638a52a0] kb/s:130.83

Fade graphic overlay 3 times:

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]fade=t=in:48:12,fade=t=out:144:12[fadepng0]";"[0:0]fifo[fifo0]";"[fadepng0]fifo[fifo1]";"[fifo0][fifo1]overlay=shortest=1[overlay0]";"[1:0]fade=t=in:480:12,fade=t=out:576:12[fadepng1]";"[overlay0]fifo[fifo0_0]";"[fadepng1]fifo[fifo1_1]";"[fifo0_0][fifo1_1]overlay=shortest=1[overlay1]";"[1:0]fade=t=in:1056:12,fade=t=out:1104:12[fadepng2]";"[overlay1]fifo[fifo0_0_0]";"[fadepng2]fifo[fifo1_1_1]";"[fifo0_0_0][fifo1_1_1]overlay=shortest=1[overlay2]"
-map "[overlay2]" D:\overlaytest\graphic_png_overlay3.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 @ 000000a62f9996c0] using SAR=1/1
[libx264 @ 000000a62f9996c0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 000000a62f9996c0] profile High, level 4.0
[libx264 @ 000000a62f9996c0] 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_overlay3.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) -> fifo
  Stream #1:0 (png) -> fade
  Stream #1:0 (png) -> fade
  Stream #1:0 (png) -> fade
  overlay -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame= 2878 fps= 14 q=-1.0 Lsize=    1989kB time=00:01:59.95 bitrate=
135.8kbits/s speed=0.588x
video:1954kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 1.766372%
[libx264 @ 000000a62f9996c0] frame I:12    Avg QP:10.76  size: 18968
[libx264 @ 000000a62f9996c0] frame P:725   Avg QP:24.87  size:  1130
[libx264 @ 000000a62f9996c0] frame B:2141  Avg QP:30.25  size:   445
[libx264 @ 000000a62f9996c0] consecutive B-frames:  0.8%  0.0%  0.1% 99.1%
[libx264 @ 000000a62f9996c0] mb I  I16..4: 95.3%  0.1%  4.6%
[libx264 @ 000000a62f9996c0] mb P  I16..4:  0.1%  0.1%  0.2%  P16..4:  0.4%
 0.2%  0.1%  0.0%  0.0%    skip:98.9%
[libx264 @ 000000a62f9996c0] 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.1% L1:45.7% BI: 2.2%
[libx264 @ 000000a62f9996c0] 8x8 transform intra:6.3% inter:11.3%
[libx264 @ 000000a62f9996c0] coded y,uvDC,uvAC intra: 7.6% 16.9% 14.6%
inter: 0.1% 0.1% 0.0%
[libx264 @ 000000a62f9996c0] i16 v,h,dc,p: 90%  8%  2%  0%
[libx264 @ 000000a62f9996c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16%  9% 74%  1%
 0%  0%  0%  0%  0%
[libx264 @ 000000a62f9996c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 28% 29%  4%
 3%  3%  2%  2%  2%
[libx264 @ 000000a62f9996c0] i8c dc,h,v,p: 76% 12% 11%  1%
[libx264 @ 000000a62f9996c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000000a62f9996c0] ref P L0: 56.1%  4.5% 22.8% 16.5%
[libx264 @ 000000a62f9996c0] ref B L0: 65.1% 26.2%  8.7%
[libx264 @ 000000a62f9996c0] ref B L1: 80.7% 19.3%
[libx264 @ 000000a62f9996c0] kb/s:133.31


More information about the ffmpeg-user mailing list