[FFmpeg-devel] Animated GIF support

Don Moir donmoir at comcast.net
Wed Dec 19 23:59:17 CET 2012

----- 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:


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.

More information about the ffmpeg-devel mailing list