How to analyze MP3 data to extract numbered frames?

I am writing a streaming application for MP3 (CBR). This is all passthru, that is, I do not need to decode / encode, I just need to transfer the data, as I see it, it happened. I want to be able to count MP3 frames as they are passthru (and some other things like bandwidth calculations).

According to the title of the MP3 spec frame , the sync word is eleven (11) bits 1 s, however, I notice (naturally) that the payload of the frame, which I should safely consider binary, and therefore it is not entirely strange to see eleven (11) 1s in sequence.

My questions:

  • Is there a parser utility for Unix | Linux | Perl MP3 ( dd style) which can extract numbered frames from an MP3 / pipe file?
  • How to determine MP3 header block from any other binary payload data? and finally
  • Is MP3's constant bitrate (CBR) defined by payload bytes, or header bytes included in the collection of # bytes / bit for each given time interval?

Thanks,

+6
linux parsing mp3 frame
source share
1 answer

I'll take a hit at # 2.

I understand that the general way to sync with an MP3 stream (and thus for frame counting) is as follows:

  • Sync word search
  • When the sync word is found, check the rest of the header
  • If the frame title is valid, you must know the position of the next title.
  • If you click 3 or 4 headings in a row and they are valid, then the chances are very high that you found them.

I recently saw a page with documentation on this, but at the moment I can’t find it. If I find him again, I will send him.

+4
source share

All Articles