openimageio

How to interpret the 'rational' value for FramesPerSecond metadata in some movie formats?


The plugin for GIFs or Movies defines a FramesPerSecond attribute of type

int[2] (rational)

What does that mean? One possible interpretation I came up with is that the second item in the array holds the fractional part. Is that so? If yes, why not just use a float instead?


Solution

  • "Rational" means it's a fraction. The float value would be (approximately) float(value[0])/float(value[1]).

    The reason I said "approximately", and the reason it's not a float to begin with, is because floating point numbers cannot exactly represent many useful fractions.