[theora] Mapping from granulepos to absolute time
conrad at metadecks.org
Sun Dec 13 16:03:56 PST 2009
2009/12/14 Pushkar Pradhan <pradhan.pushkar at gmail.com>:
> I am trying to figure out how theora timestamps map to absolute time values.
> This information would be needed to seek by 1 sec, 5 secs etc.
> I understand the granulepos is interpreted as Absolute number of key frames
> so far | number of frames since last key frame. E.g. 1000|1, 1000|2, ...
No, it is interpreted as:
frame number of most recent keyframe | number of frames since
so for the frame 1000|1, the frame number is simply 1000+1 = 1001.
> How does this map to absolute time in millisecs since the start, I can think
> of the following formula:
> Total number of frames = Total number of keyframes * Key frame interval +
> prediction frames
> Total number of millisecs = (Total number of frames / Frame rate) * 1000
> Is this correct?
No, the keyframe interval is not necessarily constant.
so, just take the frame number that I described above, and divide by
the frame rate.
More information about the theora