Re: MP3 Frames vs Packets
Re: MP3 Frames vs Packets
- Subject: Re: MP3 Frames vs Packets
- From: Doug Wyatt <email@hidden>
- Date: Mon, 7 Nov 2005 13:50:07 -0800
On Nov 7, 2005, at 13:35, Dominic Feira wrote:
Hello.
Can anybody explain to me the relation between mp3 frames and
packets? The ASBD description that I have found for mp3 is this:
desc.mSampleRate = 44100.00;
desc.mFormatID = kAudioFormatMPEGLayer3;
desc.mFramesPerPacket = 1152;
desc.mChannelsPerFrame = 2;
Assume all other fields are set to zero.
yes, this is what afinfo reports for a random MP3 on my disk ...
Now, if I have mp3 data that is 44100.00Hz and 128kbps, I have
found online that a frame length can be calculated as:
frameLength = ((144 * (bitRate * 1000)) / sampleRate) + padding
For 128kbps and 44100.00hz this equals 417 or 418 bytes depending
on wether or not padding is required. So, it seems that an audio
converter that needs 1 packet of mp3 audio data needs
approximately: 1 packet * (1152 frames / packet) * (417 bytes /
frame) = 480384 bytes (469k).
Is this correct? It sure seems like an awful lot of data to read
in one pass. What if there is only 32k available? How can I
return less than 1 packet of data that isn't at the end of the stream?
No, this is not true. The source of confusion is that an MP3 "frame"
is a Core Audio "packet". In Core Audio a "frame" is more like a
"sample frame"; we might have called it a "sample" except that in the
case of multichannel, there are technically N samples per frame (N=2
for stereo).
So that formula is saying an MP3 Core Audio *packet* is 417-418 bytes.
Doug
--
Doug Wyatt
Core Audio, Apple
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden