2

i want to ask about marker byte for each MP3 frame? How we to know that it is a frame from MP3? In some article said that the marker is Hexa (FF FB) for each frame header. Is it true?

hippietrail
  • 15,848
  • 18
  • 99
  • 158
haidey
  • 37
  • 1
  • 4

1 Answers1

12

All MP3 frames have a sync word marker at the beginning. This sync word is 11 bits long and it is all 1s. So MP3 frames will start with either FFF or FFE. See below link for more details on MP3 frame structure

This does not mean that any sequence of bytes that start with 0xFFE or 0xFFF is MP3 frame header. There could be many other cases
(a) Other formats like ADTS(AAC) also have similar sync word. More details of ADTS frame are here .
(b) Data within MP3 frame can contain FFF/FFE sequence too.

So best way to determine if sequence of bytes is MP3 or not is to do following
(o) Search for syncword (FFF or FFE) sequence
(o) Find the length of the frame by parsing header block after sync word
(o) Seek in file by frame length and see if there is another sync word.
If it is an MP3 file, then you should find another sync word after adding frame length to current sync word.

Sudarshan
  • 18,140
  • 7
  • 53
  • 61
Oak Bytes
  • 4,649
  • 4
  • 36
  • 53