[FFmpeg-devel] Animated GIF support

Don Moir donmoir at comcast.net
Thu Dec 20 01:46:27 CET 2012

----- Original Message ----- 
From: "Paul B Mahol" <onemda at gmail.com>
To: "FFmpeg development discussions and patches" <ffmpeg-devel at ffmpeg.org>
Sent: Wednesday, December 19, 2012 7:41 PM
Subject: Re: [FFmpeg-devel] Animated GIF support

> On 12/19/12, Don Moir <donmoir at comcast.net> wrote:
>> ----- Original Message -----
>> From: "Vitaliy Sugrobov" <vsugrob at hotmail.com>
>> To: <ffmpeg-devel at ffmpeg.org>
>> Sent: Sunday, August 12, 2012 9:15 PM
>> Subject: [FFmpeg-devel] Animated GIF support
>>> Hi. I would like to participate in development of animated gif decoding
>>> support.
>>> Actually i've already implemented this feature by adding gif demuxer and
>>> slightly changing
>>> existing gif decoder, but it is not complete yet. There is a problem with
>>> variable delay between
>>> frames in gif: i cannot make it work. I tried to set time base via
>>> avpriv_set_pts_info (1 for numerator, 25 for denominator) in my demuxer's
>>> gif_read_header(),
>>> at the same time in gif_read_packet() i set proper pts, dts and duration
>>> for each succesive packet.
>>> But it doesn't work: conversion from gif to any kind of video gives me
>>> output with
>>> 25 frames per second rate and constant delay between frames. Please point
>>> me in the right direction.
>> I don't use ffmpeg for gif's but did a comparison of latest gif patches and
>> found some problems with ffmpeg animtated gif support.
>> Several had no transparency which should have been transparent and hears a
>> couple samples of that:
>> http://sms.pangolin.com/temp/chompy.gif  - shows gray background
>> http://sms.pangolin.com/temp/cool.gif  - shows black background
>> This one gets transparency right but seems to have the wrong delay. The
>> delay value I get is 15 which is 150ms. With ffmpeg its way
>> to fast.
>> http://sms.pangolin.com/temp/crazy.gif  - 2 frames and animates too fast
>> This one caused me to crash in avcodec_decode_video2:
>> http://sms.pangolin.com/temp/heart.gif
>> I have many more gifs that may cause problems and if you decide to fix the
>> above I will test it some more. All of the above
>> displayed normally outside of ffmpeg.
> Please open bug report for such problems. At least I can not keep
> track of all mailing list threads.

Since I do not use ffmpeg for most image types and probably never well, consider this a public service that I at least spent some 
time testing it more completely. I don't wish to spend any more time on it, but if fixes are made I will test it. If someone wants 
to file bug reports then have at it. I think to often patches are made without complete testing. 

More information about the ffmpeg-devel mailing list