Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#8563 closed defect (invalid)

overlay filter with simple PNG adds black fringe

Reported by: quasor Owned by:
Priority: normal Component: avfilter
Version: unspecified Keywords: overlay
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

ffmpeg -v verbose -y -i b.png -i a.png -filter_complex "[0:v]format=rgba[a];
    [1:v]format=rgba[b];
    [a][b]overlay,format=rgba"  out.png
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple clang version 11.0.0 (clang-1100.0.33.17)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.2_2 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, png_pipe, from 'b.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, 1 reference frame, rgba(pc), 100x100, 25 tbr, 25 tbn, 25 tbc
Input #1, png_pipe, from 'a.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, 1 reference frame, rgba(pc), 100x100, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 (png) -> format
  Stream #1:0 (png) -> format
  format -> Stream #0:0 (png)
Press [q] to stop, [?] for help
[graph 0 input from stream 0:0 @ 0x7fa014c2f400] w:100 h:100 pixfmt:rgba tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
[graph 0 input from stream 1:0 @ 0x7fa014c2f680] w:100 h:100 pixfmt:rgba tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
[auto_scaler_0 @ 0x7fa014c30a80] w:iw h:ih flags:'bilinear' interl:0
[Parsed_overlay_2 @ 0x7fa014c2e900] auto-inserting filter 'auto_scaler_0' between the filter 'Parsed_format_0' and the filter 'Parsed_overlay_2'
[auto_scaler_1 @ 0x7fa014c31180] w:iw h:ih flags:'bilinear' interl:0
[Parsed_overlay_2 @ 0x7fa014c2e900] auto-inserting filter 'auto_scaler_1' between the filter 'Parsed_format_1' and the filter 'Parsed_overlay_2'
[auto_scaler_2 @ 0x7fa014c31640] w:iw h:ih flags:'bilinear' interl:0
[Parsed_format_3 @ 0x7fa014c2f040] auto-inserting filter 'auto_scaler_2' between the filter 'Parsed_overlay_2' and the filter 'Parsed_format_3'
[auto_scaler_0 @ 0x7fa014c30a80] w:100 h:100 fmt:rgba sar:0/1 -> w:100 h:100 fmt:yuva420p sar:0/1 flags:0x2
[auto_scaler_1 @ 0x7fa014c31180] w:100 h:100 fmt:rgba sar:0/1 -> w:100 h:100 fmt:yuva420p sar:0/1 flags:0x2
[Parsed_overlay_2 @ 0x7fa014c2e900] main w:100 h:100 fmt:yuva420p overlay w:100 h:100 fmt:yuva420p
[Parsed_overlay_2 @ 0x7fa014c2e900] [framesync @ 0x7fa014c2ea28] Selected 1/25 time base
[Parsed_overlay_2 @ 0x7fa014c2e900] [framesync @ 0x7fa014c2ea28] Sync level 2
[auto_scaler_2 @ 0x7fa014c31640] w:100 h:100 fmt:yuva420p sar:0/1 -> w:100 h:100 fmt:rgba sar:0/1 flags:0x2
Output #0, image2, to 'out.png':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: png, 1 reference frame, rgba, 100x100, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc58.54.100 png
[Parsed_overlay_2 @ 0x7fa014c2e900] [framesync @ 0x7fa014c2ea28] Sync level 1
[Parsed_overlay_2 @ 0x7fa014c2e900] [framesync @ 0x7fa014c2ea28] Sync level 0
No more output streams to write to, finishing.
[AVIOContext @ 0x7fa014d12980] Statistics: 0 seeks, 1 writeouts
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=7.36x
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (b.png):
  Input stream #0:0 (video): 1 packets read (1151 bytes); 1 frames decoded;
  Total: 1 packets (1151 bytes) demuxed
Input file #1 (a.png):
  Input stream #1:0 (video): 1 packets read (2244 bytes); 1 frames decoded;
  Total: 1 packets (2244 bytes) demuxed
Output file #0 (out.png):
  Output stream #0:0 (video): 1 frames encoded; 1 packets muxed (3022 bytes);
  Total: 1 packets (3022 bytes) muxed
[AVIOContext @ 0x7fa014c26380] Statistics: 1151 bytes read, 0 seeks
[AVIOContext @ 0x7fa014c26f00] Statistics: 2244 bytes read, 0 seeks

See attached expected and observed results

Attachments (5)

normal-desired.png (3.0 KB ) - added by quasor 4 years ago.
expected
b.png (1.1 KB ) - added by quasor 4 years ago.
a.png (2.2 KB ) - added by quasor 4 years ago.
out.png (3.0 KB ) - added by quasor 4 years ago.
Screen Shot 2020-03-09 at 11.44.30 PM.png (182.7 KB ) - added by quasor 4 years ago.
Comparison

Download all attachments as: .zip

Change History (9)

by quasor, 4 years ago

Attachment: normal-desired.png added

expected

by quasor, 4 years ago

Attachment: b.png added

by quasor, 4 years ago

Attachment: a.png added

by quasor, 4 years ago

Attachment: out.png added

by quasor, 4 years ago

Comparison

comment:2 by Gyan, 4 years ago

Of note here is that libavfilter inserted auto scalers to convert rgba formatted inputs to yuva420p despite the former being acceptable formats in overlay.

comment:3 by Gyan, 4 years ago

Resolution: invalid
Status: newclosed

Just remembered, this not a bug. Overlay does not set its output format based on negotiation but via an option which defaults to yuv420p instead of auto.

comment:4 by Carl Eugen Hoyos, 4 years ago

Component: undeterminedavfilter
Keywords: ffmpeg removed
Version: 4.2unspecified
Note: See TracTickets for help on using tickets.