Expand description
MP3 stream info the way mutagen computes it. A transcription of
mutagen.mp3.MPEGInfo and mutagen.mp3._util.
The Python pipeline reads durations and bit rates from mutagen headers,
not from a decode, and mutagen disagrees with ffprobe on roughly one
file in six of the real library (encoder delay handling, LAME padding,
CBR estimates). A report that says 2.4s where Python says 2.5s
fails parity, so the arithmetic here follows mutagen line for line,
including its file-size fallback and its half-to-even bit rate rounding.
StructsΒ§
- Frame π
- One parsed frame header plus whatever the Xing/VBRI/LAME tags in it
said.
lengthisNonewhere mutagen leaves the attribute unset. - Mpeg
Info MPEGInfoβs useful attributes.- Xing π
EnumsΒ§
- Mpeg
Error - What mutagen raises, by the name Python code prints via
type(exc).__name__β that name reaches CSV output insfx-impact. - Version π
FunctionsΒ§
- bitrate_
table π - Per-
(version, layer)bit rate tables in kbps, index by the 4-bit field. - clone_
frame π - duration_
ms _mp3_duration_ms:int(info.length * 1000).- info
MP3(path).info.- info_
from MPEGInfo(fileobj): sync to the first believable frame run and derive length and bit rate from it.- intround π
intround:Decimal.from_float(v).to_integral_value(ROUND_HALF_EVEN).- parse_
frame π - Parse the frame at
pos.Noneis mutagenβsHeaderNotFoundError. - parse_
lame π LAMEHeader.parse_version+ the two fields ofLAMEHeaderthe length needs.Nonewherever mutagen raisesLAMEErroror reports no extended header.- parse_
vbr_ πheader - A Xing/Info tag trumps the headerβs bit rate and gives a real length; failing that, a Fraunhofer VBRI tag. Neither raises.
- parse_
vbri π VBRIHeader:(bytes, frames)when a valid tag sits atpos.- parse_
xing π - read_
exact_ πat - sample_
rates π - skip_
id3 π skip_id3: step over every leadingID3tag (WMP stacks them).- u16be π
- u32be π