Opened 7 years ago
Closed 7 years ago
#6911 closed defect (fixed)
Drawbox & drawgrid replace source pixels if input or box color has alpha
Reported by: | Gyan | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avfilter |
Version: | git-master | Keywords: | drawbox |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
If the video input has an alpha component or the user specifies transparency in the box/grid-color, the drawbox and drawgrid filters replace the source pixels when painting the box or grid. This is almost always undesired. The alpha component of the user color is meant for blending the box/grid on top of the input. The input alpha should be left intact. Essentially, the filters draw a "hole" if alpha is involved. See attached result-drawbox-src-with-no-alpha-existing.jpg
Inputs and outputs for
ffmpeg -i view.jpg -i window.png -lavfi "[1]drawbox=200:0:400:56:c=black@0.5:t=fill[win];[0][win]overlay" result-drawbox-src-with-alpha-existing.jpg
are attached, along with expected result.
Attachments (7)
Change History (9)
by , 7 years ago
Attachment: | result-drawbox-src-with-alpha-existing.jpg added |
---|
by , 7 years ago
Attachment: | result-drawbox-src-with-alpha-expected.jpg added |
---|
by , 7 years ago
Attachment: | result-drawbox-src-with-no-alpha-existing.jpg added |
---|
by , 7 years ago
by , 7 years ago
Attachment: | window.png added |
---|
comment:1 by , 7 years ago
by , 7 years ago
Attachment: | result-drawbox-src-with-alpha-patched-replace-no-21.jpg added |
---|
by , 7 years ago
Attachment: | result-drawbox-src-with-alpha-patched-replace-yes-21.jpg added |
---|
comment:2 by , 7 years ago
Keywords: | drawbox added |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Fixed by your patch in 1c76134fe37ac20695627e3f5ce1f2bbf1245fcc. Thanks.
Patch at https://patchwork.ffmpeg.org/patch/6701/ introduces a new boolean option 'replace'. If set to
1
,yes
ortrue
, current behaviour is retained. With the default of0
,no
orfalse
, the behaviour is as shown in the 'expected' image.