[Vorbis-dev] How to get the actual bitrate?

Gregory Maxwell gmaxwell at gmail.com
Tue Jan 26 06:11:29 PST 2010


On Tue, Jan 26, 2010 at 7:00 AM, Mathias Kunter <mathiaskunter at yahoo.de> wrote:
> Hello,
>
> I've also implemented it the way Silvia said. However, is there a better (or
> faster) way of finding the last Ogg page in a stream than scanning the last
> 64 K (which is the maximum possible page size) of the stream for a page
> header capture pattern?


Um... Scan the last 65050 bytes?  (thats the actual maximum size for
an ogg page, I believe ;))

If you have the data handy, scanning for the sync should be quite
fast. There is no other way, regardless.

You'll need to be somewhat careful here, checking the last page can
fail to get you a usable granpos... the file might be truncated and
end with a continued page (GP = '-1'). If the page you get has a GP of
-1, continue backwards.  You would likely never hit this case except
on a truncated moderate to high bitrate theora file, but you should be
aware of it.


More information about the Vorbis-dev mailing list