[FFmpeg-trac] #9626(undetermined:new): alphamerge and transparency in main
FFmpeg
trac at avcodec.org
Fri Feb 4 10:11:15 EET 2022
#9626: alphamerge and transparency in main
-------------------------------------+-------------------------------------
Reporter: Jozef | Type: defect
Chutka |
Status: new | Priority: normal
Component: | Version: git-
undetermined | master
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
Using ffmpeg version 2022-01-24-git-0a83ecbf48-full_build-www.gyan.dev
When alphamerge `alpha` has white pixels where `in` has transparent, those
are expected to result transparent on `out`, however ffmpeg renders it
with some(?) color.
How to reproduce:
{{{
% ffmpeg -f lavfi -i color=color=#ff0000:size=100x100:rate=25:duration=4
-i main.png -i mask.png -filter_complex [1][2]alphamerge[v];[0][v]overlay
-frames:v 1 output/bug.jpg -y
}}}
To fix this one can "mask" the `alpha` by the shape of `in` before
alphamerge is applied. Now the new `alpha` has no white pixels outside of
`in` shape.
{{{
% ffmpeg -f lavfi -i color=color=#ff0000:size=100x100:rate=25:duration=4
-i main.png -i mask.png -filter_complex
color=color=#000000 at 0:size=100x100:rate=25,split[b1][b2];[b1][1]overlay[v];[v]split[v][s];[2][s]alphamerge[m];[b2][m]overlay[m];[v][m]alphamerge[v];[0][v]overlay
-frames:v 1 output/fix.jpg -y
}}}
In this case filter graph ends up with 8 total filters instead of 2.
I think ffmpeg should respect transparent pixels in `in` hence marking it
as defect.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9626>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list