[theora-dev] Time in video file

Gregory Maxwell gmaxwell at gmail.com
Tue Mar 15 12:05:50 PDT 2011

On Tue, Mar 15, 2011 at 1:54 PM, Richard Watts <rrw at kynesim.co.uk> wrote:
>  Pacing is generally done by a more accurate clock delivered around the side
> (e.g. via Ogg's granulepos - which is a completely abstract value that can mean
> anything you like, but in practice tends to be a timestamp in ms).

Richard, I'm sorry to be rude. But what planet are you writing to us from?

The granpos in ogg isn't a "completely abstract value that can mean
anything you like", it's a codec specific value which must map to
times and be monotonically increasing.  The actual mapping is codec
specific, and in theora the granpos maps to a frame counter, not a
timestamp in ms. (Except insofar as you can convert a counter at fixed
frame rate into times).

This is all well defined in the Theora spec.

In order to generate a VFR theora file at a minimum you will need to
stuff the stream with zero byte packets for the skipped frames (of
course, libtheora will do this for you if you just keep feeding
duplicates. If you do this yourself you'll break the granpos
accounting and rate control).  Otherwise frames will be displayed at
the wrong time, especially in any case where multiple frames are
contained on the same ogg page.

More information about the theora-dev mailing list