[FFmpeg-trac] #9750(avfilter:new): overlay filter alpha premultiplied performs brighter on transparent images
FFmpeg
trac at avcodec.org
Sun May 1 17:17:57 EEST 2022
#9750: overlay filter alpha premultiplied performs brighter on transparent images
------------------------------------+------------------------------------
Reporter: windowsair | Owner: (none)
Type: defect | Status: new
Priority: normal | Component: avfilter
Version: git-master | Resolution:
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
------------------------------------+------------------------------------
Comment (by windowsair):
Let's first focus on the RGBA file "a.hex" as rawvideo input. (I have
uploaded that before)
1. get the expected output:
{{{
ffmpeg.exe -i a1.mp4 -f rawvideo -s 1920x540 -pix_fmt rgba -i a.hex
-filter_complex
"[0:v][1:v]overlay=x=0:y=0:alpha=premultiplied:format=rgb[v]" -map "[v]"
-c:v:0 libx264 -f mp4 output.mp4
}}}
2. get the wrong output (black becomes bright)
{{{
ffmpeg.exe -i a1.mp4 -f rawvideo -s 1920x540 -pix_fmt rgba -i a.hex
-filter_complex
"[0:v][1:v]overlay=x=0:y=0:alpha=premultiplied:format=yuv420[v]" -map
"[v]" -c:v:0 libx264 -f mp4 output.mp4
}}}
Maybe, as you said, there is a loss of accuracy in the different pixel
format conversions.
But when I first set the output format of overlay to rgb and then convert
it back to yuv420p, I get the correct output as expected. I use the
following command:
{{{
ffmpeg.exe -i a1.mp4 -i imagename.png -filter_complex
"[0:v][1:v]overlay=x=0:y=0:format=rgb:alpha=premultiplied[v0];[v0]format=yuv420p[v]"
-map "[v]" -c:v:0 libx264 -f mp4 output.mp4
}}}
Sorry, I don't know anything about FFmpeg. Hope this helps!
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9750#comment:9>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list