Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Detecting bitrate of left / right channel (Read 3500 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Detecting bitrate of left / right channel

Hello!

As far as I know, Stereo encoding will not assign 50% of the bitrate to the left channel and 50% of the bitrate to the right channel, but determine how much bits each channel needs. Otherwise, it would be Dual Channel (some tools also call it Dual Mono).

Now, my question is: Is it possible to detect how much bits each channel received without decoding the main data (extract information from the frame header / ancillary data)?

Thank you in advance,
Sebastian Mares

Detecting bitrate of left / right channel

Reply #1
Quote
Now, my question is: Is it possible to detect how much bits each channel received without decoding the main data (extract information from the frame header / ancillary data)?

Yes, it is.

The so-called "side information" (SI) data that follows the frame header contains exactly the info you want. For each channel in each granule of the frame there is one SI group:
  • granule 1 - left channel
  • granule 1 - right channel  (exists only in 2-channel frames)
  • granule 2 - left channel    (exists only in MPEG-1 frames)
  • granule 2 - right channel  (exists only in 2-channel MPEG-1 frames)
That's one to four SI groups in total, depending on the MPEG-Version (1 or 2) and the number of channels (1 or 2) which are both stored in the frame header.
The first 12 bits in a SI group hold the number of bits in the respective part of the main data.

I don't remember the exact layout of the MPEG frame structure right now. Please have a look at some freely available decoder sources and/or documents yourself for the complete details.

Have fun! 


Detecting bitrate of left / right channel

Reply #3
How about when Mid/Side stereo is used? Does it even make sense to talk about how much bits were asigned to each channel in this case? In case it does, wouldn't it be more logical to talk then about bitrate assigned to left/central/right "channel"?

Detecting bitrate of left / right channel

Reply #4
Quote
How about when Mid/Side stereo is used? Does it even make sense to talk about how much bits were asigned to each channel in this case? In case it does, wouldn't it be more logical to talk then about bitrate assigned to left/central/right "channel"?

Hm yes, what I wrote above was not precise enough.    You are right that when joint-stereo coding is used, the bit numbers in the side info apply to the "mid" and "side" channels instead of "left" and "right".
Anyway, the original question by Sebastian was about stereo and dual channel encoding, so I think we have no problem here.