MP3: detect headerless VBR after parsing finishes - #2633
Open
bernardwiesner wants to merge 1 commit into
Open
Conversation
bernardwiesner
force-pushed
the
fix/mp3-headerless-vbr-detection
branch
from
June 2, 2026 05:13
22edc6a to
02ac14e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Headerless MP3 with late bitrate change is incorrectly reported as CBR
MediaInfoLib reports a headerless MP3 as CBR when its first frames use one bitrate but later frames use different bitrates.
This occurs with both the default
ParseSpeedandParseSpeed=1.0.Reproduction
Use an MP3 without Xing, Info, or VBRI metadata. The file should begin with CBR frames and switch to VBR frames later.
Example fixture structure:
kalimba_60s_cbr_then_vbr_no_xing.mp3
Run:
The audio stream reports:
"BitRate_Mode": "CBR"
Expected result:
"BitRate_Mode": "VBR"
Problem
File_Mpega::Streams_Fill()detects headerless VBR files by checking whether more than one bitrate has been observed:This check runs after the initial frames are parsed. If those frames all use the same bitrate, the stream is initially classified as CBR.
Later frames continue to update BitRate_Count, including frames inspected after the default tail seek. However, the bitrate mode is not re-evaluated during finalization.
As a result, a headerless MP3 that begins with CBR frames and changes bitrate later can incorrectly remain classified as CBR.