[theora-dev] Time in video file

Richard Watts rrw at kynesim.co.uk
Tue Mar 15 12:10:35 PDT 2011

On 15/03/11 19:05, Gregory Maxwell wrote:
> 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)

 From RFC3533:

  'Ogg does not have a concept of 'time': it only knows about
sequentially increasing, unitless position markers. An application
can only get temporal information through higher layers which
have access to the codec APIs to assign and convert granule positions
or time'.

  So I stand corrected - sorry.

> 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.

This, however, is just broken as a design. However, I doubt that anyone
here will be prepared to listen to reason (or indeed do anything other
than simply rail at me), so I shall shut up and leave you to your
1000fps frame-dupping. Good luck with that.


More information about the theora-dev mailing list