Skip to content

FLAC: read tags from a later VORBIS_COMMENT block if the first is empty - #719

Open
augboz wants to merge 1 commit into
quodlibet:mainfrom
augboz:fix/flac-empty-vorbiscomment
Open

FLAC: read tags from a later VORBIS_COMMENT block if the first is empty#719
augboz wants to merge 1 commit into
quodlibet:mainfrom
augboz:fix/flac-empty-vorbiscomment

Conversation

@augboz

@augboz augboz commented Jun 28, 2026

Copy link
Copy Markdown

Closes #692.

Some FLAC files in the wild contain an empty first VORBIS_COMMENT block followed by a populated one (the issue has a sample file). mutagen kept the first block and discarded the rest (per #377), so these files read as having no tags, while FFmpeg, metaflac, and macOS read the populated block.

This changes the load logic: when the current comment block is empty and a later VORBIS_COMMENT block is found, the populated block is preferred and the empty leading block is dropped (leaving a single, spec-compliant comment block on re-save). Files with a single block, or a populated first block followed by extras, are unaffected (#377 behaviour preserved).

Added a regression test that injects an empty VORBIS_COMMENT block before a populated one and checks the tags are read; it fails on main and passes with this change. Full tests/test_flac.py passes and flake8 is clean.

Happy to add a NEWS entry if you'd like; I left it out since I didn't have a PR number to reference yet.

Some FLAC files in the wild contain an empty first VORBIS_COMMENT block
followed by a populated one. mutagen kept the first block and discarded
the rest (quodlibet#377), so these files read as having no tags, while FFmpeg and
the reference implementation read the populated block.

When the current comment block is empty and a later one is found, prefer
the populated block and drop the empty leading block. Adds a regression
test.

Closes quodlibet#692
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tolerate multiple VORBIS_COMMENT blocks in FLAC files (read tags from later blocks if the first is empty)

1 participant