Sidecar/1: metadata a transcode stripped, put back by fingerprint
Per-frame measurement records ride inside the H.264 stream as SEI NAL units, one Sidecar/1 JSON envelope per access unit. Every copy path keeps them; a re-encode destroys every one. Each envelope also carries a 64-bit fingerprint of its own frame, so a receiver holding the envelopes from somewhere else can re-attach them to the transcoded pictures by aligning fingerprint sequences. Tab A reads the metadata out of the stream. Tab B loads the transcoded file, whose SEI is gone, decodes every frame in your browser, hashes it, and rebinds.
Everything runs on your device: the page fetches only its own files (sidecar.mp4, sidecar_transcoded.mp4, sidecar_rows.json, parity.json). No CDN, no server, no model download.
| Measured on this file (600 frames, 640×360, one Sidecar/1 envelope per frame) | |
|---|---|
| loading parity.json … |
Fingerprint survival on the same material, Python reference: the same frame before and after the 480×270 CRF 28 re-encode differs by – bits (median), max –; consecutive frames of this moving scene differ by –; monotone alignment rebinds – rows to the frame they came from, nearest-neighbour –.
Measured on: x264 output re-encoded and re-muxed by ffmpeg 8.0 on one machine, over one synthetic 640×360 scene (ffmpeg testsrc2 with a moving block) — a rendered test clip, not a recording. Deployment domain not tested: hardware encoders, RTSP/RTP camera pipelines, WebRTC SFUs, HLS through a CDN, HEVC (SEI is codec-specific), and real scenes of any kind.
Named failure: fingerprint rebinding cannot work on a static scene. Consecutive frames of a held picture are 0 bits apart, so the hash carries no ordering information and the alignment is arbitrary within a run (measured 0.10 correct on one degradation of a static clip and 1.00 on another — luck, not signal). The ambiguous flag is the detector: read it together with the consecutive-frame Hamming median, and when that median is 0 the receiver must bind by timestamp instead. Tab B prints both and refuses if it sees that combination.
Source: nanolab/sidecar1.py (envelope, validator, fingerprint, rebind) · docs/SIDECAR1.md (the spec) · nanolab/sidecar.py (the SEI transport) · make_sample.py (how both files were built) · sidecar_demux.js, sidecar_fp.js (the browser side, also runnable in Node).
Spec is the parity lab clip (moving test pattern). Real drive is a 12 s Tesla cabin crop around an overpass — dashboard-forward, road mostly occluded; road.lane is refused when windshield detail is under the Johnson 8 px recognise line. Filmed by the author; no faces.
Pixels-only view: with the sidecar ignored, the only number a decoder can hand you is what it can compute from the picture. The sharpness, the block-change count and the fingerprint computed before compression are gone; they existed at the edge device and the stream is the only thing that carried them.
One envelope, as carried
…
The envelope is sidecar/1: f the display index, t seconds, fp the fingerprint, src.res the original sensor frame, and m the measurement rows. Every row names what produced it (by.model, by.kind) and carries a gate whose passed is the only field a consumer may read as a validity signal — not p, which under distribution shift is worse than random. These three rows are cheap scalars over the whole frame (by.kind = "scalar"), so their gate has no pixels-on-target: nothing here is a nano model, and the page does not pretend otherwise. d is stamped by the transport at injection, because only the injector knows decode order.
ff against the frame it was bound toa diagonal means every row went back where it came from; the dot is the playhead
What tab B does
1. fetch("sidecar_transcoded.mp4") and demux it with the same box parser as tab A: it carries 0 sidecar SEI payloads, because it was re-encoded at a new resolution. 2. Decode every frame once and hash it — 32×32 block mean of the luma with integer cell boundaries, orthonormal 8×8 DCT-II, bit = coefficient > median of the 64, 16 hex chars (sidecar_fp.js, self-tested on load against the spec's check vector aa0a7f817e817e85). 3. fetch("sidecar_rows.json"): the 600 envelopes as a receiver might hold them from a data channel, in time order, with no frame binding at all. 4. Align the two fingerprint sequences with a banded Needleman-Wunsch (window 60, gap 6: a match costs its Hamming distance, so a pair is matched only when it beats skipping both). 5. Play the video with the overlay driven by the re-bound rows.
Nearest-neighbour matching is the obvious alternative and it is not good enough: the survival tolerance of the hash (p99 2–4 bits) is the same size as the distance between neighbouring frames (median 4), so the closest fingerprint inside a window is often a look-alike neighbour. Both sequences are monotone in time, and using that order is what recovers the binding.