[Vorbis-dev] Determining the duration of an ogg vorbis file

xiphmont at xiph.org xiphmont at xiph.org
Thu Mar 20 04:49:16 PDT 2008


On Thu, Mar 20, 2008 at 4:34 AM, Conrad Parker <conrad at metadecks.org> wrote:

>  The granulpos field of the last page in the vorbis stream should tell
>  you the duration in samples, divide it by the samplerate to get the
>  duration in seconds.

...that tells you the end time.  In the event that the beginning time
is at a positive offset (like in a typical live stream) you also need
to subtract the starting time (granpos on the first audio page)

Monty


More information about the Vorbis-dev mailing list