[Vorbis] Length of an Ogg Vorbis file?

Ralph Giles giles at xiph.org
Sat Dec 1 15:35:11 PST 2007

On Sat, Dec 01, 2007 at 01:06:46PM +1100, Erik de Castro Lopo wrote:

> Is there a way of finding out the length of an Ogg Vorbis file without
> decoding the whole file and counting samples?

You can parse the header(s) for the sample rate, then use it to decode 
the first and last timestamps on each chain segment. Modulo holes, the 
sum of the differences will give you the duration. See ov_time_tell in 


More information about the Vorbis mailing list