[theora] Number of frames

Michael Smith msmith at xiph.org
Mon Feb 12 03:56:37 PST 2007


On 2/12/07, Morten Winkler Jørgensen <morten at thorsen-consulting.dk> wrote:
> Hi All
>
> I am coding an application capable of playing theora movies using libtheora and libogg.
> Now, I need to know the duration of a theora movie in frames.
>
> I seem to be unable to find that information in the using either libtheora or libogg.
> Google gave a hit proposing to read the file backwards till the magic "OggS" could be
> found and then scan forward to the framenumber field could be found.

Hi Morten,

That's approximately right. Because Ogg is designed as a streaming
format, it doesn't contain information about the length of the stream
in the header.

So basically, you need to find the final frame in the file, and get
the frame number of that. You'll also probably want to read the start
of the file, to check what frame number it starts from (it might be
non-zero if the file has been captured from a stream, or edited out of
a larger file, etc.)

Mike


More information about the theora mailing list