[FFmpeg-devel] [PATCH]Animated gif transparency

Don Moir donmoir at comcast.net
Thu Dec 27 23:36:31 CET 2012

> On 12/27/12, Don Moir <donmoir at comcast.net> wrote:
>> Attached fixes remaining issue where transparent background is wrong for
>> some gifs.
>> example problem file:
>> http://sms.pangolin.com/temp/transparent_background_wrong.gif
>> Without the patch, it will show a gray background instead of a transparent
>> background for above file.
>> I also need the entire duration on open but its not set, so currently only
>> option is to read packets and accumulate duration. I
>> tried with gifs upto 225 frames and it worked fine but is overkill and would
> Doing it in lavf is overkill too.
>> be nice if the duration was set on open which means
>> reading thru the file accumulating delays. Doing this also gives you the
>> option of generating keyframes outside of first frame only.

Don't know if getting the entire duration can be some kind of option. Would be better if done internally since the only external way 
is to read packets while it could just skip the reading of packets and just read the delays.

Useful for timeline apps and seeking to a point in time. The lack of keyframes is not really an issue for me but would be better 
with additional key frames.

The largest gif file I could find was 3mb with 192 frames. I also tested a smaller file that had 225 frames. In both cases and even 
with reading packets getting the duration was about 6 / 7 ms on my slower machine. So I can live with that but better to have an 
option I think. 

More information about the ffmpeg-devel mailing list