Subject: [AVT] question about payload format for MP3 audio

From: Andreas Schorr <[email-masked]>
Date: Fri, 10 Feb 2006 10:16:39 +0100

Hi all,

Can someone help me with the following question?

MP3 audio frames contain a fixed number of samples, but the frame size 
after compression can be variable. Now RFC3551 says:

"The receiver can tell the number of frames contained in an RTP packet, 
if all the frames have the same length, by dividing the RTP payload 
length by the audio frame size which is defined as part of the 
encoding.  This does not work when carrying frames of different sizes 
unless the frame sizes are relatively prime.  If not, the frames MUST 
indicate their size."

Since the MP3 frame header does not contain information about the length 
of an MP3 frame, I would expect that the payload format (RFC2250) would 
define some means to indicate the number of MP3 frames in an RTP packet 
(multiple frames are allowed according to RFC2250). But actually, 
RFC2250 does not define such a means (at least, I didn't find it).

So how is it possible to determine the number of MP3 frames in an RTP 
packet?

Thanks in advance,
Andreas Schorr

-- 
Andreas Schorr
Dept. Distributed Systems
University of Ulm
James-Franck-Ring, O-27/347
89069 Ulm, Germany
Tel: ++49 / (0)731 502 4147
Fax: ++49 / (0)731 502 4142
eMail: [email-masked]
WWW: http://www-vs.informatik.uni-ulm.de/dept/staff/schorr/

_______________________________________________
Audio/Video Transport Working Group
[email-masked]
https://www1.ietf.org/mailman/listinfo/avt

---

From: Ross Finlayson <[email-masked]>
Date: Fri, 10 Feb 2006 02:05:01 -0800

At 01:16 AM 2/10/2006, Andreas Schorr wrote:
>Since the MP3 frame header does not contain information about the 
>length of an MP3 frame

That's not the case.  The length of the MP3 frame can be computed 
from information that's in the MP3 frame's (4-byte) header, as follows:

unsigned ComputeFrameSize(unsigned bitrate, unsigned samplingFreq,
                           Boolean usePadding, Boolean isMPEG2,
                           unsigned char layer) {
   unsigned const bitrateMultiplier = (layer == 1) ? 12000*4 : 144000;
   unsigned framesize;

   framesize = bitrate*bitrateMultiplier;
   framesize /= samplingFreq<<isMPEG2;
   framesize = framesize + usePadding;

   return framesize;
}

where
- bitrate is in kbps
- samplingFreq is in Hz
- usePadding is 1 if the frame header's padding bit is set; 0 otherwise
- layer is 1, 2 or 3 (i.e., 3 for MP3)

	Ross Finlayson
	Live Networks, Inc. (LIVE555.COM)
	<http://www.live555.com/>