Calculate MPEG Frame Length (ms)

I am looking around the Internet for information on calculating the frame length, and it was difficult ... I was able to successfully calculate the frame length in ms MPEG-4, AAC, using:

frameLengthMs = mSamplingRate/1000

This works because there is one pattern for each frame on AAC. For MPEG-1 or MPEG-2, I am confused. There are 1,152 samples per frame, alright, so what can I do about it ?: P

Frame Example:

MPEGDecoder(23069): mSamplesPerFrame: 1152
MPEGDecoder(23069): mBitrateIndex: 7
MPEGDecoder(23069): mFrameLength: 314
MPEGDecoder(23069): mSamplingRate: 44100
MPEGDecoder(23069): mMpegAudioVersion 3
MPEGDecoder(23069): mLayerDesc 1
MPEGDecoder(23069): mProtectionBit 1
MPEGDecoder(23069): mBitrateIndex 7
MPEGDecoder(23069): mSamplingRateFreqIndex 0
MPEGDecoder(23069): mPaddingBit 1
MPEGDecoder(23069): mPrivateBit 0
MPEGDecoder(23069): mChannelMode 1
MPEGDecoder(23069): mModeExtension 2
MPEGDecoder(23069): mCopyright 0
MPEGDecoder(23069): mOriginal 1
MPEGDecoder(23069): mEmphasis 0
MPEGDecoder(23069): mBitrate: 96kbps
+3
source share
1 answer

MPEG audio frame duration is a function of the sampling rate and the number of samples per frame. Formula:

frameTimeMs = (1000/SamplingRate) * SamplesPerFrame

In your case it will be

frameTimeMs = (1000/44100) * 1152

~ 26 . . MPEG audio , .

+12

All Articles