Skip to content

fix(media): Vorbis comment signatures, skip WAV sample data (69 s -> 0.04 s on 90 MB) - #36

Open
ksanyok wants to merge 1 commit into
mainfrom
fix/media-vorbis-signature
Open

ksanyok wants to merge 1 commit into
mainfrom
fix/media-vorbis-signature

Conversation

@ksanyok

@ksanyok ksanyok commented Oct 27, 2026

Copy link
Copy Markdown
Owner

Two fixes in the media watermark detector (found on PromoPilot's audio-watermark-detector).

  1. Vorbis/FLAC comments. software=Udio in an OGG file was missed: the value sits between = and the next field's binary length (or the framing byte \x01), and the exact-value patterns for Udio/Suno only accepted \x00, quotes and </>. Now = is accepted before and any control byte after; "title=Udio Studio take" still does not match.
  2. WAV sample data. _parse_riff ran every signature regex over the data chunk (PCM samples): ~0.7 s per MB, 69 s for a 90 MB master, and only chance matches. Sample/frame chunks (data, VP8 , VP8L, ALPH, ANMF, idx1, LIST movi) are skipped; metadata chunks are scanned as before.

Tests: two new cases, both fail on main and pass here (17 passed). Real files on PromoPilot: OGG with Udio metadata 0/4 → 4/4, MP3 and WAV unchanged, 24 human recordings 0 false positives before and after, 90 MB WAV 69 s → 0.04 s.

- 'software=Udio' in an OGG Vorbis comment was missed: the value boundary is
  '=' before and a binary length or framing byte after, not \x00/quote/<.
  Udio/Suno exact-value patterns now accept '=' before and any control byte after.
- _parse_riff scanned the WAV 'data' chunk (PCM samples) with every signature
  regex: ~0.7 s per MB, 69 s for a 90 MB master, and only chance matches.
  Sample/frame chunks (data, VP8, VP8L, ALPH, ANMF, idx1, LIST movi) are skipped.

Real files: OGG with Udio metadata 0/4 -> 4/4; MP3/WAV unchanged; 24 human
recordings: 0 false positives before and after.

This branch has not been deployed

No deployments
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.

1 participant