[theora-dev] a new proposal
Timothy B. Terriberry
tterribe at vt.edu
Wed Feb 25 23:50:23 PST 2004
> What if, instead of this hypothetical vorbis stream at 44.1kHz, I am
> recording from a PC sound card, so I have one which floats between, say
> 44000 and 44200. Or I'm recording video, and every once in a while,
> something happens and I drop a frame. Such is life. Since the rate isn't
> constant for the entire stream, granulepos doesn't let you calculate an
> exact time offset. It'll be off by a small percentage.
Vorbis is only capable of storing fixed-sample-rate audio. If your audio
sample rate changes, then you need to resample it at a fixed rate to use
Vorbis. This is a limitation of Vorbis (and any other audio codec I can
think of), not of Ogg. This is like saying, "If I lie to the Ogg layer
about the timing information in a stream, why doesn't it keep synch
Dropped frames do not pose a synch problem, even with fixed frame rates,
because the duration of one is exactly one frame. If you mean to imply
that your capture card hands you frames at a variable rate, then to use
Theora you will also need to resample this to a fixed rate. Again, this
is a limitation of the codec, not the container.
Another possible solution is to correct the time the video frames are
presented to match the variations in audio sample rate. Your audio is
still wrong, but at least the video will match it. However, that
requires variable frame rates, which the current version of Theora does
not support. Note that this is a limitation of Theora, not of Ogg.
I will say this again, because I want to emphasize it:
<p><p>NOTHING about Ogg limits streams to a fixed sample rate or frame rate.
<p><p>This limitation is imposed by current codecs, mostly for design
simplicity. Unfortunately, a lot of people seem to think that it applies
to the entire framework. This is one of the reasons that Ogg does not
define a generic audio header, or generic video header: such "generic"
headers impose implicit assumptions on the capabilities of any audio or
video codec that can be stored in the container. For example, AVIs
cannot possible store variable frame rate video because their header
specifies a fixed frame rate in it, for all codecs. Ditto for AVI audio.
One could change the headers for Theora tomorrow to allow the
specification of a display time for each frame in milliseconds, instead
of using a fixed frame rate. That also imposes the implicit assumption
that millisecond accuracy is enough. Knowing the trade-offs involved, we
chose to keep the frame rate fixed. Future codecs, or even future
versions, may make the other choice.
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'theora-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Theora-dev