fps property

double get fps

The stream's frame rate: the declared rate when there is one, else the frame count over the duration.

Declared wins because the derived rate inherits every inaccuracy in the duration. A WebM's duration is the container's (it stores no per-stream one), which spans the audio tail: a true-30fps clip whose audio runs 17ms past its video derives as 29.86fps and resamples to the wrong source frames. The rate is a rational for the same reason, so NTSC's 30000/1001 stays 29.97 rather than rounding to 30.

Implementation

double get fps {
  final declared = declaredFps;
  if (declared != null && declared > 0) return declared;
  return durationSeconds > 0 ? nbFrames / durationSeconds : nbFrames.toDouble();
}