[FFmpeg-devel] [PATCH] fix for transparencies in animated gifs

Bjorn Roche bjorn at giphy.com
Mon Nov 27 19:50:23 EET 2017

Sorry for the very delayed response, Carl:

On Tue, Nov 21, 2017 at 6:55 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com>

> 2017-11-21 18:53 GMT+01:00 Bjorn Roche <bjorn at giphy.com>:
> > Support for transparencies in animated gifs requires modifying both
> > libavcodec/gif.c and libavformat/gif.c because both the graphics
> > control extension (handled by libavformat/gif.c) and the raw frame data
> > (handled by libavcodec/gif.c) must be changed.
> Does remuxing animated gif with transparency work with your patch?

A command like this:

    ffmpeg -i in.gif out.gif

seems to produce the same output as before: transparency replaces with
opacity. However a command like this:

    ffmpeg -i in.gif  -vf palettegen -y /tmp/pal.png && ffmpeg -i in.gif
-i /tmp/pal.png -lavfi paletteuse -y -f gif out.gif

produces an output that looks like the input (including transparency).

I believe this is a problem with the decoder, however, since

    ffmpeg -i /Users/bjorn/Desktop/smoketrail.gif

produces opaque images as well.


Bjorn Roche

Sr. Video Pipeline Engineer

bjorn at giphy.com

More information about the ffmpeg-devel mailing list