#8664 closed defect (fixed)

Drawbox filter does not display over transparent backgrounds

Reported by: ScriptTiger Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: drawbox
Cc: thescripttiger@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

This bug is reproducible on all versions later than 3.4.2.

I have the following complex filtergraph stored in a file (filtergraph.txt):

color=

00000000:
1280x720:
sar=1,

trim=

end_frame=1,

format=

rgba,

drawbox=

0:
175:
640:
375:
545454:
15,

drawbox=

640:
175:
640:
375:
545454:
15,

drawbox=

0:
585:
345:
60:
545454:
fill,

drawbox=

935:
585:
345:
60:
545454:
fill,

drawtext=

fontsize=70:
fontcolor=blue:
text='Test':
x=490-(text_w/2):
y=60-(text_h/2),

drawtext=

fontsize=70:
fontcolor=red:
text='Overlay':
x=715-(text_w/2):
y=60-(text_h/2),

drawtext=

fontsize=30:
fontcolor=white:
text='Subtitle':
x=640-(text_w/2):
y=120-(text_h/2),

drawtext=

fontsize=31.5:
fontcolor=green:
text='Host':
x=1100-(text_w/2):
y=620-(text_h/2)

[overlay]

I then issue the following command:

ffmpeg -filter_complex filtergraph.txt -map "[overlay]" overlay.png

In ffmpeg versions 3.4.2 and earlier the png comes out as expected, with some drawboxes and text over a transparent background. However, in versions later than 3.4.2 there are absolutely no drawboxes present in the resultant png but the drawtext comes out fine.

The build information for the latest version that DOES NOT have this problem is as follows:

ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers

built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libmfx --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100

Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

All other versions after that all experience the same issue.

Change History (8)

comment:1 by ScriptTiger, 18 months ago

I don't know if this has to be said, but obviously the drawbox "fill" is actually "max" in 3.4.2 and earlier. So the filtergraph is slightly different depending on what version you run it on, but only different by way of that single difference.

EDIT:

I also just realized I made a typo in the command when I typed it in the above ticket. It should be "-filter_complex_script", not "-filter_complex". Everything else holds true.

Last edited 18 months ago by ScriptTiger (previous) (diff)

comment:2 by ScriptTiger, 18 months ago

Component: undeterminedffmpeg

comment:3 by ScriptTiger, 18 months ago

Cc: thescripttiger@gmail.com added

comment:4 by ScriptTiger, 18 months ago

Keywords: ffmpeg drawbox alpha transparent background added

comment:5 by Carl Eugen Hoyos, 18 months ago

Component: ffmpegundetermined
Keywords: drawtext added; ffmpeg drawbox alpha transparent background removed
Priority: criticalnormal
Version: 4.0.4unspecified

comment:6 by Carl Eugen Hoyos, 18 months ago

Keywords: drawbox added; drawtext removed

comment:7 by Elon Musk, 18 months ago

Did you tried replace option?

comment:8 by ScriptTiger, 18 months ago

Resolution: fixed
Status: newclosed

Thank you, @richardpl, that did it. The "replace" option is new since 3.4.2 and I must have missed it. Shouldn't the default for "replace" be "1" for both backwards compatibility reasons and the fact that most people that use the drawbox filter will probably want to actually see the drawbox?

Anyway, sorry for the newb question. Closed!

Note: See TracTickets for help on using tickets.