[linux-audio-dev] question about time and compressed formats

drclaw at dogsolitude.org drclaw at dogsolitude.org
Fri Nov 14 15:12:29 UTC 2003


On Fri, Nov 14, 2003 at 09:20:47AM -0500, Fred Gleason wrote:
> On Thursday 13 November 2003 16:48, J_Zar wrote:
> 
> > 		I' ve done some tests on a bunch of songs in different compressed formats
- snip -
> > different values for Ogg and Mp3? Ogg will be affected by bitrate?
> 
> An MPEG frame always contains 1152 PCM frames, as per the standard.  This is 
> true of Layers One, Two and Three.  Thus, the time length of an MPEG frame 
> would be:
> 
> 	l=1152/fs
> 
> where
> 	l = Length of frame in mS
> 	fs = Sample rate in kHz
> 
> Thus, for your example case, the calculated length would be:
> 
> 	1152/44.1 = 26.1 mS
> 
> thus yielding good agreement with your measured results.
> 
> I don't know how it is with Vorbis, but I'd suspect something similar.  See:
> 
> 	http://www.xiph.org/

FYI, from the vorbis docs:

	Vorbis provides none of its own framing, synchronization or protection
	against errors; it is solely a method of accepting input audio,
	dividing it into individual frames and compressing these frames into
	raw, unformatted 'packets'. The decoder then accepts these raw packets
	in sequence, decodes them, synthesizes audio frames from them, and
	reassembles the frames into a facsimile of the original audio stream.
	Vorbis is a free-form variable bit rate (VBR) codec and packets have
	no minimum size, maximum size, or fixed/expected size. Packets are
	designed that they may be truncated (or padded) and remain decodable;
	this is not to be considered an error condition and is used
	extensively in bitrate management in peeling. Both the transport
	mechanism and decoder must allow that a packet may be any size, or end
	before or after packet decode expects.

	Vorbis packets are thus intended to be used with a transport mechanism
	that provides free-form framing, sync, positioning and error
	correction in accordance with these design assumptions, such as Ogg
	(for file transport) or RTP (for network multicast).

So, if I'm reading this correctly, the vorbis framesize is not fixed
within the general spec, so you'd have to be prepared for all sorts of
frame sizes.  

784 - Michael C. Piantedosi - drclaw at dogsolitude.org



More information about the Linux-audio-dev mailing list