[vorbis] Finding length (time) of encoded birstream

John Lundy jlundy at playnet.com
Sun Mar 10 21:54:58 PST 2002



This is kind of a 'doh!' answer. Search for the last page and get the vi
info. Nuff said. Thanks all!!!

John

----- Original Message -----
From: "Ross Levis" <ral at baycom.co.nz>
To: <vorbis at xiph.org>
Sent: Sunday, March 10, 2002 8:57 PM
Subject: RE: [vorbis] Finding length (time) of encoded birstream

<p>> AFAIK it needs to run through the entire file due to the fact that
> multiple streams could be included in the same file.  Since you are
> creating the Ogg files, they will be single stream so you can simply
> open the file directly and search for the last page header to determine
> the granulepos.  I do this in WinVorbis rather than using the library &
> it is very fast.  Let me know if you want more info.
>
> Ross Levis.
>
> John Lundy wrote:
> > OK, easy enough. And thanks.
> >
> > However, the implication is that the entire file needs to be
> > decoded in
> > order to determine the playtime. This sounds unreasonable
> > just to display a
> > files properties.
> >
> > Is there a more realistic alternative?
> >
> > John
> >
> > ----- Original Message -----
> > From: "Ed Sweetman" <ed.sweetman at wmich.edu>
> > To: <vorbis at xiph.org>
> > Sent: Sunday, March 10, 2002 7:28 PM
> > Subject: Re: [vorbis] Finding length (time) of encoded birstream
> >
> >
> > >
> > > ogg_page og;
> > > vorbis_info vi;
> > >
> > > final_granulepos = ogg_page_granulepos (&og); // (done
> > after last page
> > > has been decoded (your final position)
> > > final_granulepos / vi.rate;  // (gives you time of stream
> > in seconds)
>
> --- >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 'vorbis-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.
>
>

<p>--- >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 'vorbis-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 Vorbis mailing list