[FFmpeg-trac] #8588(avfilter:new): Palettegen adds one color on transparent input

FFmpeg trac at avcodec.org
Sun Mar 29 23:04:29 EEST 2020


#8588: Palettegen adds one color on transparent input
-------------------------------------+-------------------------------------
             Reporter:  RedError     |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avfilter     |                  Version:  git-
             Keywords:  palettegen   |  master
  color transparency gif png alpha   |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 [https://github.com/FFmpeg/FFmpeg/blob/master/libavfilter/vf_palettegen.c
 palettegen] from a transparent gif, png, adds the invisible transparency
 color to the palette as a visible color, with no relation to the one
 selected with the transparency_color option.

 On transparent PNG, it will use the rgb value of the transparent areas.
 On transparent GIF, it will always add white.

 None of the available [https://ffmpeg.org/ffmpeg-filters.html#palettegen-1
 options] seem to change that.

 How to reproduce:
 {{{
 ffmpeg -i "transparent.gif" -vf palettegen "palette.png" -y
 }}}

 Of course, using that palette with paletteuse will use the added color in
 the result, as paletteuse has no way of knowing that it was actually a
 transparent color.
 {{{
 ffmpeg -i "target.png" -i "palette.png" -lavfi paletteuse=dither=0
 "target_merged.gif"
 }}}

 This will randomly add one color where there shouldn't be one.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/8588>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list