An MP3 parser to extract numbered frames?

Posted by Xepoch on Stack Overflow See other posts from Stack Overflow or by Xepoch
Published on 2011-01-04T23:52:01Z Indexed on 2011/01/04 23:53 UTC
Read the original article Hit count: 189

Filed under:
|
|
|

I am writing a streaming application for MP3 (CBR). It is all passthru, meaning I don't have to decode/encode, I just need to pass on the data as I see it come through. I want to be able to count the MP3 frames as they passthru (and some other stuff like throughput calculations).

According to the MP3 frame header spec, the sync word appears to be 11 bits of 1s, however I notice (naturally) that the frame payload which I should safely assume to be binary and thus it is not odd at all to see 11 1s in sequence.

My questions:

  1. Is there a Unix/Linux MP3 parser utility (dd-style) that can pull numbered frames from an MP3 file/pipe? Any perl wisdom here?
  2. How does one delineate an MP3 header block from any other binary payload data? and lastly:
  3. Is a constant bitrate (CBR) MP3 defined by payload bytes or are the header bytes included in the aggregate # of bytes/bits per any given timeslice?

Thanks,

© Stack Overflow or respective owner

Related posts about linux

Related posts about parsing