Retrieved article excerpt
Open article ยท Retrieved 2026-10-11T15:42:40.212529+00:00
# Frame Grid
**ConsciousNode SoftWorks** ยท Browser-native video and GIF contact-sheet generator with ElasticTOK frame fingerprinting.
[Live](https://consciousnode.github.io/frame-grid)
[Version](https://github.com/ConsciousNode/frame-grid)
[License](https://github.com/ConsciousNode/frame-grid/blob/main/LICENSE)
[Xinu](https://github.com/ConsciousNode)
```
camera feed, uploaded video, or GIF
โ temporal frame sampling / GIF frame extraction
โ ROSA ElasticTOK fingerprinting
โ labeled contact-sheet grids (PNG)
โ JSON frame manifests (FPSS-compatible)
```
Single HTML file. Zero dependencies. Zero uploads. Runs entirely in your browser.
---
## What it does
Frame Grid samples frames from a video or GIF at a configurable rate, assembles them into labeled contact-sheet grids, and exports them as downloadable PNGs. With ElasticTOK enabled, each frame also gets a ROSA suffix automaton fingerprint โ a structural signature that captures how repetitive or complex the frame's content is, independent of pixel-level appearance.
Originally designed as a proof of concept for the ManosNowAware visual pipeline. The GIF ingestion pipeline (v2.2โ2.3) extends this to animated GIFs, enabling AI models to "watch" GIFs as a contact-sheet grid.
---
## Features
### Core
- **Camera, video, or GIF source** โ live camera capture with recording, uploaded video files, or animated GIFs
- **Configurable sampling** โ FPS, frame dimensions, grid columns/rows, max grids
- **Label styles** โ minimal (F##), standard (F## | time), full (F## | time | fps), ROSA (F## | time | โCR)
- **Download** โ PNG per grid with header bar showing grid number, frame range, and timestamps
### GIF Ingestion (v2.2โ2.3)
Native animated GIF support. Drop a GIF โ get a contact-sheet grid of every frame, timestamped to the GIF's own timing. Designed so AI models can receive the full temporal content of an animated GIF as a single image.
- **Primary decoder**: browser-native `ImageDecoder` API (Chrome 94+, Safari 17+, Firefox 113+) โ handles all GIF compositing, disposal methods, interlace, and edge cases natively
- **Fallback decoder**: pure-JS GIF89a parser with LZW decompression, interlace support, and per-frame compositing for older browsers
- Animated preview via `<img>` element while frames are processed
- Frame timing labels use the GIF's native cumulative timestamps
- Dedup and ElasticTOK work identically on GIF frames as on video frames
### ElasticTOK (v2.0)
ROSA suffix automaton fingerprint per frame. Toggle in sidebar; `โ ELASTICTOK` chip appears in header when active.
- 16ร16 patch grid over the frame โ RGB mean per patch โ 768 quantized tokens
- Suffix automaton built on token sequence โ compression ratio (CR) + state count
- b1.58 ternary packing of Float32[128] transition-density fingerprint โ Uint8[32]
- CR displayed in frame label bar (ROSA label style)
- **JSON manifest download** per grid when ElasticTOK is on โ FPSS-compatible format:
```
{
"tool": "FrameGrid v2.3",
"grid": 1,
"frames": [
{
"index": 0,
"time": 0.000,
"isDup": false,
"cr": 2.34,
"stateCount": 328,
"packed": [0, 1, 2, ...]
}
]
}
```
High CR = structurally repetitive frame (static shot, uniform background).
Low CR = structurally complex frame (busy scene, high detail).
### Frame Deduplication (v2.0)
Mean Absolute Difference comparison between consecutive kept frames. Configurable threshold (MAD 1โ30, default 8).
- **Skip mode** โ duplicate frames are dropped entirely; grid is denser with unique content
- **Mark mode** โ duplicates kept but highlighted with red label bar and `[DUP]` tag
- Session panel shows kept / duped / dup% stats
---
## Usage
**[Open Frame Grid โ](https://consciousnode.github.io/frame-grid)**
1. Select **Camera**, **Upload** (video), or **GIF**
2. Set FPS, frame size, and grid dimensions in Parameters
3. Enable **ElasticTOK** for ROSA fingerprinting (optional)
4. Enable **Dedup** to filter near-identical frames (optional)
5. Hit **Process** (or **Capture** โ **Stop** for camera)
6. Download grids as PNG. Download JSON manifests if ElasticTOK is on.
Works offline. No data leaves your device.
---
## Stack integration
Frame Grid's JSON manifests are designed to flow into the ConsciousNode stack:
| Manifest field | Destination |
| --- | --- |
| `packed` (Uint8[32] fingerprint) | FPSS `.cns` image entry ยท SheafMemory ingestion |
| `cr` (ROSA compression ratio) | RAG Time corpus-driven embedding signal |
| `isDup`, `time` | ManosNowAware visual pipeline metadata |
---
## Architecture
```
Source (camera / video file / GIF)
โโ Video path
โ โโ resolveDuration() โ WebM Infinity fix (mobile Chrome)
โ โโ seekTo() ร N โ frame-accurate temporal sampling
โ โโ proc-canvas โ single reusable extraction canvas
โโ GIF path
โโ gifDecode() โ routes to native or pure-JS
โโ gifDecodeNative() โ ImageDecoder API (primary)
โโ gifDecodePureJS() โ GIF89a parser + LZW (fallback)
โโ gifLZW() โ variable-width LZW decompressor
โโ frameMad() โ MAD dedup vs previous kept frame
โโ elasticTok() โ ROSA fingerprint (if enabled)
โโ 16ร16 patch โ tokens
โโ SuffixAutomaton
โโ CR + state count
โโ b1.58 pack โ Uint8[32]
โโ scratch-canvas โ single reusable draw canvas
โโ Grid assembly โ label bars, header bar, border
โโ PNG download โ hdrCanvas.toDataURL()
โโ JSON manifest โ Blob โ URL โ <a download>
```
---
## Changelog
### v2.3 โ 2026-10-11 ยท Komorebi Interim
- **LZW bug fixed.** `dict.length > codeMask + 1` โ `dict.length > codeMask`. The code-size growth check was off by one: the decoder read 9-bit codes when the bitstream had already switched to 10-bit codes, producing garbage indices that all failed the color table bounds check and silently rendered every frame black. Root cause of all-black output in v2.2.x.
- **`ImageDecoder` API as primary GIF decoder.** Native browser GIF decoding (Chrome 94+, Safari 17+, Firefox 113+). Handles compositing, disposal methods, interlace, and all edge cases automatically. Pure-JS decoder retained as fallback for older browsers.
- `gifDecode()` is now async and routes to native or fallback automatically. Log reports which path was taken.
- `index.html` updated to v2.3.
- Version string updated throughout.
### v2.2 โ 2026-10-11 ยท Komorebi Interim
- **GIF ingestion pipeline.** Animated GIFs can be loaded as a source alongside camera and video upload. Pure-JS GIF89a decoder with full LZW decompression, interlace support, and per-frame compositing respecting all three disposal methods (leave, restore-background, restore-previous).
- GIF source button (๐) added to source panel.
- Animated preview via `<img>` element while frames are decoded and processed.
- Frame timing labels use GIF's native cumulative timestamps.
- `processSource()` router added โ PROCESS button works for both video and GIF.
- Note: v2.2.x builds produced all-black GIF grids due to the LZW bug fixed in v2.3.
### v2.1 โ 2026-06-07 ยท Kehai Interim
- **GIF export** โ pure JS GIF89a encoder, zero dependencies, Xinu-compliant. Toggle in Analysis panel.
- LZW compression with numeric-keyed Map
- 8ร8ร4 uniform 256-color palette, O(1) quantization per pixel
- Frames sub-sampled evenly up to configurable max (default 60)
- Configurable GIF width (160โ480px), frame delay (4โ50 centiseconds)
- NETSCAPE2.0 loop extension for infinite loop
- Mobile Chrome WebM blob duration=Infinity splice fix (Kehai Interim, 2026-10-11).
### v2.0 โ 2026-06-07 ยท Kehai Interim
- **Xinu compliance** โ Google Fonts CDN import removed. System monospace stack. Zero external calls.
- **Viewport** โ `user-scalable=no` removed. Browser zoom restored.
- **ElasticTOK** โ `SuffixAutomaton` class inline. ROSA CR + state count + b1.58 packed fingerprint per frame.
- **Frame deduplication** โ `frameMad()` MAD comparison. Configurable threshold. Skip or mark mode.
- **Single scratch canvas** โ eliminates N canvas allocations per grid assembly pass.
### v1.3 โ Ed Interim
- Mobile Chrome WebM blob duration=Infinity fix. `resolveDuration()` force-seeks to 1e10 and waits for `durationchange` event.
### v1.0โ1.2 โ Kham / Ed Interim
- Initial implementation. Proof of concept for the ManosNowAware visual pipeline.
---
## License
MIT โ ConsciousNode SoftWorks