views:

22

answers:

1

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  A: 

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.

daramarak
+1 Couldn't agree with you more....
Adrian Regan
Yes, the question seems pretty naive. You'd never be able to draw frames at exactly 33.3333... per second, repeating decimal or not. There is some variation every frame.
Qwertie