Do 60 FPS GIF's actually exist? Or is the maximum 50 FPS?

I've been recently playing around with FFmpeg and I was trying to convert .avi to .gif since other methods I've tried to so far didn't work so well.

What I noticed is that, when I use this command:

ffmpeg -I filename.gif

I can see some of the file information, including the FPS.

And I saw that the highest FPS that is possible so that the video you convert into a gif does not become slower, is 50 FPS.

Now is that correct though? Is the highest FPS amount you can have in a GIF, so that it doesn't become slower 50 FPS?

So do 60 FPS GIF's not exist?


Solution 1:

The GIF98a specification says in the section about the Graphics Control Extension

vii) Delay Time - If not 0, this field specifies the number of hundredths (1/100) of a second to wait before continuing with the processing of the Data Stream. The clock starts ticking immediately after the graphic is rendered. This field may be used in conjunction with the User Input Flag field.

Which means the smallest value is 1 for a image rate of 100 FPS (this will be difficult to render on most monitors...), and the next smallest value is 2 for an image rate of 50 FPS, and the next value is 3 for an image rate of 33.3 FPS. So exactly 60 FPS is not possible.

Note that this extension was meant for a handful of frames with a delay on the order of seconds (maximum delay is about 600 seconds), so 1/100 seconds resolution was ample. It certainly wasn't meant for video, and that's why the field encodes delay, and not frame rate.

Making video GIFs is really an abuse of the specification (even though it's now so common that most people probably don't realize that, just as most people don't realize GIFs and JPEGs use different kinds of compression, and are meant to be used on different kind of images).

Solution 2:

Using ffmpeg, this is the basic format to emulate a rolling average of 60 fps

ffmpeg -i video.mp4 -vf "settb=1/100,setpts='if(eq(N,0),0,if(not(mod(N,3)),PREV_OUTPTS+1,PREV_OUTPTS+2))'" -vsync vfr -r 100  out.gif

To read these files with ffmpeg , while preserving those timings, use

ffmpeg -min_delay 1 -i out.gif ...

which will show

Stream #0:0: Video: gif, bgra, 1280x720 [SAR 64:64 DAR 16:9], 60 fps, 100 tbr, 100 tbn, 100 tbc

It's a different matter whether any given player fulfills these timings.