[FFmpeg-devel] [PATCH] Fix for paletteuse to support transparency

Carl Eugen Hoyos ceffmpeg at gmail.com
Sat Oct 7 16:53:14 EEST 2017

2017-10-06 23:23 GMT+02:00 Carl Eugen Hoyos <ceffmpeg at gmail.com>:
> 2017-10-06 22:59 GMT+02:00 Bjorn Roche <bjorn at giphy.com>:
>>  libavfilter/vf_paletteuse.c | 175
> Works fine for me

I had tested with the sample from ticket #503 yesterday.

Using the following sample:
I get less nice results:
$ ffmpeg -i 300x180-Scr-f8-056alpha.flv -vframes 1 -vf palettegen pal.png
$ ffmpeg -i 300x180-Scr-f8-056alpha.flv -i pal.png -lavfi paletteuse
-vframes 1 out.png
Transparency in the output file is not correct, I wonder if the line
"if (c1[0] == 0 && c2[0] == 0" should be more something like
"if (c1[0] < 128 && c2[0] < 128)" (or with a threshold variable).

The results get worse with more frames and apng output:
Large blocks "disappear" from the output file, this looks
quite nice without your patch (but without transparency).

Thank you, Carl Eugen

More information about the ffmpeg-devel mailing list