6
votes

If I have a video that plays at 30fps, then the duration of each frame is 1/30th of a second or 33.333333... milliseconds.

Assume you were implementing a video player, how would you handle the fact that the duration of each frame is represented by a repeating decimal?

For example, if you truncate the duration of the 1st 29 frames to 33.33 milliseconds, then the duration of the 30th frame would have to be slightly longer, 33.43 milliseconds, in order to maintain a 30fps rate.

Is there a standard way that video playback software handles this?

1
I'd think that rounding is the standard way - after all, it doesn't matter if the frame shows for 33.33 or 33.34 ms, as long as it all adds up to 30 fps. Anyway, with flat panels, hundredths of ms won't make a noticeable difference, and human detection limit is at most somewhere in the single ms. Assuming I were implementing a video player, I'd worry more about buffering and efficient decoding - skips are very noticeable, and common.Piskvor left the building

1 Answers

2
votes

If you use a double i doubt you should have any problems :) No seriously you will never be able to control the timing as accurately that round of errors in your timing will cause any problems. There are much greater problems in implementing a video player than that.