Is the leading structure in an MP3 file a real frame?

Now I am working on decoding MP3 files, but just have some basic knowledge about the MP3 file. These days I am implementing a simple MP3 decoder. When comparing the decoded result with the Maaate decoder , I encounter this problem.

My decoder extracts one more frame than the Maaate decoder. After examining the result of the sample MP3 file, I think the first frame is abnormal. For my example file, the first frame with a length of 413 bytes with a frame header of 0xfffb9064 is different from all other frames with a length of 100 bytes and with a header of 0xfffb1064 .

My question is : Is the first β€œframe” as a result a real frame? So why does it seem different from others? If not, then what is this structure used for and how to distinguish it from others for which they share a 0xfff synchronization frame code?

+4
source share
2 answers

MP3 streams do not have a file header. It sounds a little strange that you have only one frame at the beginning, which is longer than the rest, but it is completely legal.

A quick description of the bits in the header: http://www.datavoyage.com/mpgscript/mpeghdr.htm

In your case, both types of shared partitions are shared:

  • MPEG-1
  • Level 3
  • Not protected
  • 44.1
  • Lack of gasket
  • Not private
  • M / S joint stereo
  • No copyright
  • Original media
  • Without attention

The first frame is different from the rest:

  • 128 kbps (resulting in 417 byte frames minus 4 byte headers)

Rest:

  • 32 kbps (resulting in 104 byte frames minus 4 byte headers)

This page has a formula for calculating the frame size based on the header: 144 * bitrate / samplerate + padding.

I suspect that the 128-bit first frame is an artifact (error) of the encoder used to generate the sample. It is still a constant 32 Kbps bit after the first frame. Considering that an MP3 decoder cannot give an output signal until it has several frames, and it does not suddenly hit the bitrate half way, this is unlikely to be upset.

+2
source

It is possible that the first frame is a VBR frame. check [here] and use the hexa editor. Hope this helps.

-1
source

All Articles