FFmpeg calculation of pts is in fact very complicated (pay attention to `ist->pts` and `ist->next_pts`):
- https://github.com/FFmpeg/FFmpeg/blob/n4.3.1/fftools/ffmpeg.c#L2321-L2452 Calculate pts largely from, but not limited to `decoded_frame->best_effort_timestamp`;
- https://github.com/FFmpeg/FFmpeg/blob/n4.3.1/fftools/ffmpeg.c#L2553-L2635 Advance by `duration_pts` (which is scaled packet duration for the most part) in most branches.
It has all those branches and even heuristics because video codecs are very complex with packets coming out of order and not necessarily carrying pts info. (Compare to audio pts calculation, which is very simple.)
However, gif is nothing like H.264, H.265, AV1 and all that jazz. It's just a simple format with a series of crappily compressed frames... So I believe this is an anything-goes scenario.