[Libav-user] Detecting if a gif is animated or not
Don Moir
donmoir at comcast.net
Thu Sep 15 21:10:49 EEST 2016
> I was hoping there was some kind of magic number or number of frames
in the header.
Unfortunately there is not.
I go ahead and parse the gif file without decoding it. I do this to get
the duration which I do without ffmpeg. Then I let ffmpeg decode it
since that falls into place better with other decoding. For my use case
on a timeline, it can be useless not to have duration information. I of
course could also count the frames, but I don't need that. If the
returned duration is non zero it is animated. I do use the ffmpeg
avio_skip and avio_r8 ffmpeg functions to do a quick read thru of the file.
On 9/15/2016 8:56 AM, Carl Eugen Hoyos wrote:
> 2016-09-15 14:37 GMT+02:00 Gonzalo Garramuño <ggarra13 at gmail.com>:
>>> Do you think this is possible in general (without decoding the gif)?
>> I was hoping there was some kind of magic number or number of
>> frames in the header. But I guess from your answer, that's not the
>> case. Anyway, I solved the issue in some other way.
> If the gif does not contain a Graphic Control Extension (0x 21 F9) the gif
> only contains one frame afaict.
>
> I believe you have to parse the header to find (or not find) the extension.
> I suspect that one-frame gifs with GCE are at least possible to create.
>
> Carl Eugen
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
More information about the Libav-user
mailing list