[FFmpeg-devel] [PATCH] fix for transparencies in animated gifs
bjorn at giphy.com
Tue Nov 28 02:07:05 EET 2017
On Mon, Nov 27, 2017 at 5:41 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com>
> 2017-11-27 18:50 GMT+01:00 Bjorn Roche <bjorn at giphy.com>:
> > Sorry for the very delayed response, Carl:
> > On Tue, Nov 21, 2017 at 6:55 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com>
> > wrote:
> >> 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
> >> > (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.
> remuxing == -vcodec copy
> What about ffmpeg -i in.gif -vcodec copy out.gif ?
That doesn't work. Weather I use my patch or not it aborts:
Assertion video_par->format == AV_PIX_FMT_PAL8 failed at
As far as I can tell, the gif decoder (which I haven't touched) outputs
BGRA, but the gif writer requires PAL8.
> 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
> > /Users/bjorn/Desktop/smoketrail-out%d.png
> This produces transparent images here for the output
> file of ticket #6813.
./ffmpeg -i transparency.apng out.gif
Produces the expected results (you don't see previous images "behind" the
Sr. Video Pipeline Engineer
bjorn at giphy.com
More information about the ffmpeg-devel