Repository navigation
feat(fled): self-describing video container with embedded screenmap (Phase 1) - #126
Merged
Merged
Conversation
Introduces the FLED v1 container format. Recorded LED-data videos and
their screenmap now travel as a single .fled file instead of as a
separate .rgb + screenmap.json pair. See docs/fled-format.md for the
canonical spec.
Wire format (12-byte fixed header):
offset size field
0 4 magic "FLED"
4 1 version = 1
5 1 pixel_format (enum)
6 2 reserved
8 4 json_length (u32 LE)
12 N json_bytes (UTF-8)
12+N ... payload (frames)
Pixel format goes in the binary header so consumers can slice frames
without parsing JSON. v1 emits rgb8 (0x00); the enum reserves 0x01–0x04
for gray8/rgba8/rgbw8/rgb565le, each of which can ship later without a
version bump. Unknown formats reject cleanly. JSON gains an optional
video.fps field next to the existing map.
Generator (src/moviemaker/recording.ts): wraps the flat RGB buffer in a
FLED header carrying the active screenmap JSON. Download extension is
now .fled. IndexedDB persistence saves the headered buffer.
Consumer (src/movieplayer): the side-loaded screenmap workflow is gone.
Movie Player only accepts .fled files; the embedded JSON drives the
screenmap and the LED count derives from it. Legacy headerless videos
in IndexedDB are dropped silently on startup. The screenmap upload
input, the screenmap drop zone, the preset buttons, and the dependency
on screenmap-store / preset-loader were removed.
Shared parser (src/render/rgb-video.ts): single source of truth for
both ends. buildFledHeader, prependFledHeader, hasFledMagic, and an
extended parseRgbFrames returning embeddedJson / pixelFormat / fledError.
Tracking issues:
- #122 (generator, this PR closes Phase 1)
- FastLED/FastLED#3063 (consumer side)
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…hase1 # Conflicts: # src/movieplayer/movieplayer.ts # src/movieplayer/template.html
…hase1 # Conflicts: # src/moviemaker/moviemaker.ts
This was referenced Jun 15, 2026
zackees
added a commit
that referenced
this pull request
Jun 15, 2026
PR 1 of 6 for the layered single-page consolidation (#133). - Demo's three sample videos (color_line_bubbles, video, video1) are converted from raw .rgb to self-describing .fled (one-shot scripts/convert-rgb-to-fled.mjs prepends the 12-byte FLED header + embedded 32x32 quad serpentine screenmap). - demo.ts loads /demo/video.fled in one fetch + parseRgbFrames pass instead of chunk-streaming raw .rgb. The ~100 lines of ReadableStream bookkeeping (videoReader, videoBuffer, streamVideoData, processNewFrames, stopVideoStream) all drop out — parseRgbFrames already handles the FLED header. - demo's upload + download flows operate on .fled. Download wraps the in-memory frames with the screenmap-embedding FLED header via prependFledHeader. - src/demo/template.html: file input accepts="*.fled". - src/hub/template.html: Movie Player tile copy updated. - CLAUDE.md: Data Formats + tools table reflect .fled. - src/types/domain.ts + src/video-store.ts: comments updated. No behavioral change for the Movie Player (it already required .fled after #126). The remaining .rgb references in moviemaker.ts shaders / pixel-format names refer to the rgb8 pixel format *inside* the FLED container, not the deprecated container. Verified locally: tsc, lint, build, 433 unit tests, 6/6 smoke tests all pass. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #122 (Phase 1). Companion: FastLED/FastLED#3063.
Summary
.fledcontainer: 12-byte header (magic + version + pixel_format + reserved + json_length) followed by UTF-8 JSON (screenmap + optionalvideo.fps) followed by the raw frame payload. Pixel format lives in the binary header so consumers can slice frames without parsing JSON. v1 emitsrgb8; the enum reservesgray8 / rgba8 / rgbw8 / rgb565lefor future PRs (no version bump needed).src/moviemaker/recording.ts) wraps the flat RGB payload in a FLED header carrying the live screenmap JSON. Download extension is now.fled. IndexedDB persistence saves the headered buffer.src/movieplayer/) is rewritten as embedded-only: the screenmap upload UI, drop zone, preset buttons, and dependencies onscreenmap-store/preset-loaderare removed. The embedded JSON drives the screenmap; LED count derives from it. Legacy headerless videos in IndexedDB are dropped silently on startup.src/render/rgb-video.ts) is the single source of truth for both ends. ExportsbuildFledHeader,prependFledHeader,hasFledMagic, plus an extendedparseRgbFramesreturningembeddedJson/pixelFormat/fledError.docs/fled-format.md— full binary layout, pixel format enum table, JSON schema, versioning rules, backwards-compat rules, and a 46-byte reference vector.Verification
npm run lint— cleannpm test— 424/424 pass (14 new intests/unit/rgb-video.test.ts)npm run build— succeedstests/integration/movieplayer.spec.tsfor embedded-only UX;tests/integration/moviemaker-recording.spec.tsstrips the FLED header before per-frame byte checksOut of scope
gray8/rgba8/rgbw8/rgb565legenerator support — spec is locked, encoders land with their use casesjsSetScreenMapsFromJsonbinding — FastLED side, tracked in #3063🤖 Generated with Claude Code