Re: [FFmpeg-user] fading multiple graphic overlays

2016-04-01 Thread Christian Johannesen
On Thu, Mar 31, 2016 at 6:29 PM, Christian Johannesen <
chrisjohanne...@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
  libavformat57. 29.101 / 57. 29.101
  libavdevice57.  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
  libpostproc54.  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.00, 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 @ 00016e860860] using SAR=1/1
[libx264 @ 00016e860860] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 00016e860860] profile High, level 4.0
[libx264 @ 00016e860860] 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 

[FFmpeg-user] fading multiple graphic overlays

2016-03-31 Thread Christian Johannesen
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
  libavformat57. 29.101 / 57. 29.101
  libavdevice57.  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
  libpostproc54.  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.00, 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 @ 002e638a52a0] using SAR=1/1
[libx264 @ 002e638a52a0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 002e638a52a0] profile High, level 4.0
[libx264 @ 002e638a52a0] 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 @ 002e638a52a0] frame I:12Avg QP:10.69  size: 18868
[libx264 @ 002e638a52a0] frame P:725   Avg QP:24.81