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

Paul B Mahol onemda at gmail.com
Tue Dec 11 20:36:33 EET 2018


Hi,

On 11/27/17, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> 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 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.
>
> remuxing == -vcodec copy
>
> What about ffmpeg -i in.gif -vcodec copy out.gif ?
>
>> 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.

Can anybody get this patch to output correct output for this command:
ffmpeg -v debug -f lavfi -i testsrc2=d=10:alpha=0,format=rgba -lavfi
"[0:v]palettegen[p],[0:v][p]paletteuse" 1.gif ?


More information about the ffmpeg-devel mailing list