How to find frame length of stereo mp3

40 Views Asked by At

Related question in stack overflow

Here

FrameSize = 144 * BitRate / (SampleRate + Padding)

gives the frame length. So is it the same for stereo data ? I have a mp3 file with bit rate 128kbps, sample rate constant 44100 Hz and is stereo.

Using the above formula I tried to read mp3 as open(file_path, 'rb')

frame_data = mp3_file.read(int(frame_size))

then, only first time I get proper header, then not! So I think the above formula is for mono data. How to get the frame length for stereo file?

1

There are 1 best solutions below

2
Brad On

The bitrate is the bitrate regardless of the channel count. MP3 takes advantage of the fact that most content between the left and right channels is going to be the same, and only encodes the differences. (Unless of course there is discrete channel encoding happening, but that is super rare and almost always a bug in the encoding software or its configuration.)