> 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 <ggarr...@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@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

_______________________________________________
Libav-user mailing list
Libav-user@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to