open-standards/wai/identify-conformance/README.md
Transaction Science 2fd26925d3 wai identify: what any file is, from its bytes alone
`wai inspect` reads envelopes; most files a toolchain meets are not envelopes, and the
first question about one is what it is. `wai identify <file>` (operation media.inspect,
extensions/media-identify.md) answers it for any file:

- the formats the bytes fit, each with the offsets of the bytes that say so, how far its
  structure was followed and where and why that stopped;
- a container's tracks as it states them: codec, size, channels, rate, protection;
- the registered capabilities they map to, and what a format probe reads of them;
- signatures found inside the file;
- where no format is recognised, measures that still hold: how the byte values are
  spread, uniform windows, and the lags at which the bytes repeat.

The verdict is identified, ambiguous, signature_only or unknown, and there is no
confidence figure: a candidate's strength says what was checked. Nothing is decoded, no
protected track is opened, and unknown stays unknown. Walks cover ISO media, Matroska,
transport streams, Ogg, FLAC, RIFF, MPEG audio, ADTS, PNG, JPEG, GIF, IVF, YUV4MPEG2,
FLV, AV1 OBU and Annex B streams, and HLS and DASH text; 35 more formats are known by
their signature. Every walk is bounded, reads a file where its lengths lead (a large file
is never held whole), and has been given hostile bytes; it builds for wasm32.

The agent door has it as media_inspect, its results marked untrusted_content: a file's
author chooses the strings in it.

identify-conformance/ holds files written by real muxers and encoders from test patterns
and tones, what an independent media prober reads of them (prober.json), and generated
cases sitting on each rule's edge. identify_verify.py is a second implementation written
from the text; it reads the extension's tables, gives every file its whole result, and
holds ext/ to the prober's reading. tests/identify.rs holds the reference's tables to
the extension's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 05:20:15 -05:00

21 lines
1.4 KiB
Markdown

# identify-conformance — media identification
The corpus of [`extensions/media-identify.md`](../extensions/media-identify.md) §10.
**Feature equivalence.** A conforming implementation, given a vector's file, gives the whole result
`vectors.json` states for it: every candidate with its evidence, where its walk stopped and why, its
facts, tracks and capabilities; what was embedded; and the measures. A vector with `repeat` is its
file that many times over, for what happens past the head and past the scan (§3.2).
- `ext/` — files written by real muxers and encoders, from test patterns and sine waves. The
protected file uses an all-zero test key.
- `gen/` — what `wai_identify_vectors gen` writes: generated cases and negative controls, each saying
in `vectors.json` what it tests, many of them a change to a file of `ext/`.
- `vectors.json` — every vector's file, SHA-256, origin and whole result.
- `prober.json` — what an independent media prober reads of `ext/`: each file's format and streams.
`identify_verify.py` holds the result to it wherever both state a value, so the reference and the
second implementation agreeing is not all that is checked.
- `identify_verify.py` — the second implementation, written from the extension.
**Provenance.** `ext/` and `prober.json` are written by `tools/make_external.sh`, with open tools; it
is not run in CI, because it needs them. `tools/oracle.py` writes `prober.json`.