A
A
agp882014-09-21 15:56:43
Programming
agp88, 2014-09-21 15:56:43

How to correctly determine the beginning of a frame in an mp3 file?

Good afternoon. I am trying to learn C++ programming. Because I'm bored with solving abstract problems without practical application, so I decided to write a conditionally useful program that calculates the length of an mp3 file.
I was guided by this article: habrahabr.ru/post/103635
According to it, each frame has 11 synchronization bits at the beginning, which are set to one. My program looks for the values ​​0xFFFA and 0xFFFB in the file - these are the values ​​that the first half of the frame header can take. However, some frames have headers 0xFFFA 0000 . If this header is decrypted, then the "bitrate index" is equal to 0. According to all tables, this value corresponds to a certain "free bitrate", what does this mean, and what is it eaten with?
I'm also wondering if this combination (0xFFFA or 0xFFFB) might not be the start of a new frame, but just a piece of audio data? How then correctly to find the beginning of the frame?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-09-21
@agp88

"free" means free format. The free bitrate must remain constant, an must be lower than the maximum allowed bitrate. Decoders are not required to support decoding of free bitrate streams.

www.mp3-tech.org/programmer/frame_header.html
This is a custom format. That is, how the data is stored is not regulated in the specification. You don't have to support the processing of such frames.
The main point of these frames is how the data is stored. And they are stored stupidly in the stream, and not in fixed-length packets. This allows you to set a higher bitrate (up to 640 kilobits per second) and do some custom things for your codecs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question