[vorbis] Finding length (time) of encoded birstream

Ross Levis ral at baycom.co.nz
Sun Mar 10 18:57:20 PST 2002



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.



More information about the Vorbis mailing list