/framefields:framefields-renderfrom Framefields
Renders, inspects, tests, previews, and exports WebGPU video and frame grids using the framefields headless engine. Useful for verifying compositions, diagnosing blank frames, running pixel tests, exporting MP4/WebM or glTF models, and rendering without a GPU.
Ships in Framefields. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
framefields renders headlessly in Node.js on native WebGPU (Dawn), encoding through FFmpeg with a hardware encoder when one works (NVENC, VideoToolbox), else software. No browser. Project setup is in framefields; rendering on framefields' GPUs is in framefields-cloud.
Go in order: a layout or timing bug costs seconds at step 1–3 and minutes after a full export.
import { CompositorProgramSchema } from "framefields";
const parsed = CompositorProgramSchema.safeParse(comp.toSpec());
if (!parsed.success) { console.error(parsed.error.format()); process.exit(1); }
for (const d of comp.lint()) console.log(`${d.severity} ${d.code}: ${d.message}`); // renders, but not as intended
npx tsc --noEmit -p . typechecks.npx framefields check [name] --json imports the render's export in an isolated process and writes one versioned JSON result (no name: every render; a module: check src/film.ts --export buildFilm). Errors fail it; warnings with --warnings-as-errors; --timeout 60000 bounds it. The export must only build: importing it runs project code.--render (or pnpm check:render in scaffolded projects) adds a GPU smoke check: a frame and a three-point grid under output/check (--output <dir>). Not a substitute for pixel assertions or video QA.npx framefields api prints timing, grid and preflight type declarations for the installed version.renderFrame)import { HeadlessMediaRenderer } from "framefields";
const renderer = new HeadlessMediaRenderer();
await fs.writeFile("output/f45.png", await comp.renderFrame({ frame: 45, renderer }));
atMs wins over frame. Frames are nonnegative safe integers; fractional timestamps and FPS are fine. The composition's FPS is authoritative: a different render/grid FPS throws.
renderFrameGrid)const png = await comp.renderFrameGrid({
frames: [0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60],
columns: 4, cellWidth: 480, showLabels: true,
});
Shows hitches, easing, text wrap jumps, z-order and missing cuts at a glance. Automatic sampling stops before the exported frame count (max(1, round(durationMs * fps / 1000))); explicit frames may go past it. Order and duplicates are kept. At most 64 samples by default, 120 max.
it("renders the title on frame 30", async () => {
const comp = await buildFilm();
const png = await comp.renderFrame({ frame: 30, renderer: new HeadlessMediaRenderer() });
expect(png.length).toBeGreaterThan(1000); // decode and probe pixels at known coordinates
});
preview)When a person is in the loop, let them watch before the export. npx framefields preview <name> or startPreview serves a localhost player (sound, waveform timeline, frame stepping). The page runs the composition's own code with WebGPU in the browser in real time; a slow device skips frames to keep the sound in time. The soundtrack is the export's own mix.
import { startPreview } from "framefields";
const session = await startPreview({ entry: new URL("./film.ts", import.meta.url), export: "buildFilm" }, { title: "Launch film" });
console.log(`Preview at ${session.url}`);
await session.closed; // "idle" | "replaced" | "closed"
Composition or a (async) function returning one. node:path, fileURLToPath(import.meta.url) and synchronous fs reads work through shims; writes are skipped. Build asset paths from import.meta.url, not process.cwd(). Files inside the project (nearest .git or package.json) are served; pass root: [...] for others (e.g. a shared fonts folder).[framefields preview]) say when the page opened, each distinct page error once (build error, frame threw, missing font, no WebGPU), and why it stopped. Check them instead of assuming the film drew.idleCloseMs); just start it again.open: true. Needs current Chrome, Edge or Safari.note 3 at 0:12.50 (frame 750), spot 42%,31%: …) and is saved in .framefields/preview-notes/notes.json with note-<id>.jpg (the frame, spot marked; notesDir moves it, false disables). To act: read notes.json, open each open note's picture, find the layer from the moment and spot, change it, rerun the preview. You may set "done": true yourself.#t=12.5 or #frame=750 opens at a moment, and changing the fragment of an open page seeks there in place (paused, no reload). Keys: ←/→ a frame, ⇧←/→ a second, Space play/pause, Home/End. window.framefieldsPreview has seek(seconds) / seekFrame(n) (resolve once drawn: screenshot then), play(), pause(), notes(), state() ({ state, error, frame, time, playing, buffering, audio, audioMixed, audioMixer, connected, playbackFps, renderMs, meta }). <html data-preview="ready"> marks the first frame. Hidden tabs pause.<iframe src="…/?embed=1#t=5">). ?embed=1 drops the page's header (title, size, status) for the host's own. In a frame the page talks to window.parent over postMessage (protocol 1; types exported from framefields/preview, e.g. PreviewMessage, PreviewCommandMessage, readPreviewCommand):
{ type: "framefields-preview:ready", protocol: 1, seekByHash: true, meta: { title, width, height, fps, frames, duration } } once the first frame shows; { type: "framefields-preview:state", frame, time, playing } on play, pause and each finished seek, and at most 4 a second while playing; { type: "framefields-preview:build", status: "building" | "ready" | "error", message? } ("building" right before it reloads into a newer preview, whose ready ends it; "error" with the text when a build or a frame fails).window.parent): { type: "framefields-preview:command", id, command: "seek", time }, "seekFrame", frame, "play", "pause" or "state". Each is answered once done (a seek once drawn) with { type: "framefields-preview:reply", id, ok: true, state: { frame, time, playing } } or { …, ok: false, error }.#t= also seeks it; commands add a reply when it's drawn.renderVideo)const result = await comp.renderVideo({
outputPath: "output/film.mp4",
quality: "very_high", // very_low | low | high | very_high (default)
codec: "h264", // h264 (default) | vp9 | vp8 | gif; aac | mp3 | opus = audio only
qa: true, // see Video QA
});
await result.cleanup?.();
No HEVC or AV1; an unknown codec falls back to H.264. Or from the CLI: npx framefields render <name> uses the project's own tsx and framefields, calls the export with the render's args/select, downloads missing pinned assets first, and writes the render's output.
Always end render scripts with process.exit(0): native GPU and encoder threads keep Node alive.
exportModel)A frame's 3D scene exports as glTF 2.0 binary (.glb), the standard interchange format: Blender, Maya, Houdini, Unreal, Unity, three.js and every glTF viewer open it.
const { filePath, meshes, triangles, skipped } = await comp.exportModel({
frame: 30, // or atMs
outputPath: "output/scene.glb",
metersPerPixel: 0.01, // default: 100 px is a meter
// camera: false, lights: false, maxTextureSize: 4096
});
From the CLI: npx framefields render <name> --model [--frame 30] [--output scene.glb] (default: the video's path as .glb; local only).
resolution, so raise it for a finer file. Layers on 3D planes become textured quads. Scattered and instanced meshes become nodes that share one mesh. Materials go in as PBR with their maps and Khronos extensions: glass, clearcoat, sheen, iridescence and anisotropy, plus subsurface in extras. The camera and the directional, point and spot lights are included, and nodes are named by layer id.Layer.glb(file, { scale: 100, rotateX: 180 }).skipped lists what the frame drew that the file cannot carry: text on 3D planes (use Layer3D.extrudedText), rect lights, the environment's floor, rounded corners and borders of layers on planes, and GPU-computed motion (wind, audio deformation, crowds), which is written at rest. Print it.framefields.json)framefields.json names what the project renders. Add one per cut (teaser, vertical, language) rather than flags in render.ts; the CLI, framefields check, the cloud and the dashboard pick them by name.
{
"renders": {
"film": { "title": "Launch film", "entry": "src/film.ts", "export": "buildFilm", "workers": "auto", "output": "output/film.mp4" },
"teaser": { "title": "15 s teaser", "description": "Vertical cut", "entry": "src/film.ts", "export": "buildTeaser", "codec": "vp9" }
}
}
| Field | Meaning |
|---|---|
entry | Module that builds the composition (required) |
export | A Composition or a function returning one (default buildFilm) |
title, description | Shown to the user in the dashboard and framefields renders |
args / select | Arguments for a function export / which composition when it returns a Record |
workers, maxWorkers | Cloud GPUs: 1 (default), a number, or "auto" |
codec, quality | h264 / vp9; very_low … very_high |
output | Where the video is written |
Names: letters, digits, -, _, . (≤ 64). npx framefields renders [--json] lists them. After adding one, run framefields check <name>. Needs framefields 2.12+.
renderVideo logs about 15 short [framefields] lines to stderr however long the film:
[framefields] Preparing 1800 frames (60.0s) at 1920x1080, 30 fps, h264
[framefields] Rendered 10% (180/1800 frames) · 41.2 fps · eta 39.3s
[framefields] Mixing audio
[framefields] Muxing mp4
[framefields] Done in 51.4s (14.2 MB): prepare 1.2s · render 43.1s · audio 3.2s · audio-encode 1.1s · mux 0.8s
Rendered 100%: mixing decodes every clip's audio, then encode and mux. Not a hang; wait for Done in ….Still … lines after 10 s, 30 s, 70 s, then every 5 min. It's stuck only when no line arrives well past the last gap. Killing it leaves no video. Failures name their phase.LOG_LEVEL=warn|debug; NODE_ENV=production or FRAMEFIELDS_LOG_FORMAT=json gives pino JSON on stdout.onProgress receives { phase, frame, totalFrames, elapsedMs, phaseProgress?, fps?, etaSec?, detail? }; phases prepare, render, audio, audio-encode, mux, convert (GIF), done.renderVideo({ qa }))The engine measures every frame as it's read back and the audio as it's mixed: no second decode.
import { formatQaReport } from "framefields";
const result = await comp.renderVideo({ outputPath: "output/film.mp4", qa: { targetLufs: -14 } });
console.log(formatQaReport(result.qa!));
if (!result.qa!.passed) process.exitCode = 1;
issues[].code | Severity | Meaning |
|---|---|---|
frames_missing | error | Fewer frames encoded than the composition has |
black_frames | warning | ≥ minBlackSec (0.5 s) of black; startSec/endSec |
audio_clipping | warning | Samples at or beyond full scale |
loudness_off_target | warning | More than lufsTolerance (1 LU) from targetLufs |
animation_truncated | warning | Keyframes past a layer's window never play |
frozen_video | info | Unchanged for ≥ minFrozenSec (2 s) |
audio_silence / audio_silent | info | ≥ 2 s below silenceDbfs (-60) / whole track silent |
result.qa also includes every comp.lint() finding (invalid_gradient, unknown_color, low_contrast_text, offscreen_layer, duplicate_id, unsupported_image_format, shadow_unsupported_light, pbr_without_environment, static_track, …). passed is false on any error or warning. qa.audio.integratedLufs is BS.1770 (platforms normalize to about -14); qa.audio.peakDbfs is the sample peak.
For files rendered elsewhere:
ffprobe -v error -show_entries stream=codec_name,width,height,duration,r_frame_rate out.mp4
ffmpeg -i out.mp4 -vf "blackdetect=d=0.5:pix_th=0.10" -f null -
ffmpeg -i out.mp4 -af volumedetect -f null -
Each process renders a frame range without audio, the audio renders once, then the files join without re-encoding:
import { stitchChunks } from "framefields/renderer";
await comp.renderVideo({ outputPath: "out/chunk-0.mp4", frames: { start: 0, end: 900 }, audio: false }); // per worker
await comp.renderVideo({ outputPath: "out/audio.mp4", codec: "aac" }); // once
await stitchChunks({ chunks: ["out/chunk-0.mp4", "out/chunk-1.mp4"], audio: "out/audio.mp4", outputPath: "out/final.mp4" }); // no GPU
start: same picture, extra time.stitchChunks refuses mismatched codec, size or encoder parameters.FRAMEFIELDS_VISION_CACHE_DIR so no chunk re-tracks earlier frames.qa checks each chunk alone; check the stitched file with ffmpeg.planChunks({ totalFrames, samples, workers: "auto" }) picks count and cuts (adds workers while each spends ≥ 85% of its time rendering; splits at equal cost). renderer.probeRender(comp) measures samples.The cloud does all of this for you: framefields-cloud.
pathTrace)A scene with Layer.environment(..., { pathTrace: true }) traces its 3D layers instead of rasterizing them (framefields-compose covers the look). What changes when rendering:
"high", takes 128 samples per pixel: about 3 s per 960×540 frame and 12 s per 1080p frame on an Apple M1 Pro for a character, a ball, a glowing ring and a floor; desktop GPUs are several times faster. "standard" (32) takes about a quarter of that, "draft" (8) a sixteenth. Check frames and grids on quality: "draft", then render with the default.samples per pixel on any GPU, seeded by frame, so the same frame renders the same pixels every time and split renders (stitchChunks, --cloud) join without seams.framefields preview fits each traced frame to previewBudgetMs (33) of GPU time, measured on your GPU, with fewer samples or a lower resolution; the export does not.quality or samples). Bright dots that move from frame to frame on matte surfaces near shiny ones (a glossy floor, a chrome ball) are light bounced off them; raise filterGlossy (draft 0.7, standard 0.6, high 0.45) to soften it. "reference" (1024 samples, no denoiser, filterGlossy: 0) is the unbiased answer to compare against.transmissionBounces (high: 16).ssr/gi, outlines, volumetricFog and cube cameras do not combine with it. The render fails naming the feature, and framefields check flags the combinations.framefields falls back to the CPU with identical output for every feature (vision inference too).
apt-get install -y libvulkan1 mesa-vulkan-drivers (lavapipe). Without any Vulkan driver nothing renders.await describeGpu() reports software: true.framefields-cloud) or on a GPU machine.| Symptom | Cause | Fix |
|---|---|---|
| Whole frame black | Unregistered font or NaN in a signal | FontManager.register() every font before building; keep signals finite. |
| Media layer blank | Wrong path, LFS pointer, zero opacity | Check the file is real (git lfs pull, framefields assets pull). |
| Audio cuts out early | No durationFrames on Layer.audio() | Set it to the film's length. |
| Vision cutout empty on a single frame | Vision reads the previous frame | Render ≥ 2 consecutive frames with one renderer; renderVideo handles it. |
| Ghosted double in a cutout | Frames rendered out of order (grids, jumps) | Check vision with sequential frames or the export. |
Pause after Rendered 100% | Audio mix / encode / mux | Wait for Still … and Done in …. |
Script hangs after Done in … | Worker threads hold Node | process.exit(0). |
| Very slow on a Linux server | CPU adapter (lavapipe) | describeGpu(); fix the Vulkan driver (vulkaninfo --summary). |
Encoder fails to open (NVENC, h264_rkmpp) | framefields < 2.2 | Upgrade, or FRAMEFIELDS_HW_CODECS=off. |
| Jump at a chunk seam | Mismatched chunk settings, or an effect reading wall-clock time | One commit and settings for all chunks; deterministic effects. |
| Effect shows no change | Value on the wrong scale | Look it up in the framefields-effects catalog. |
| Text truncated | Box narrower than the text | Set width or width: "fill". |
pathTrace does not trace … yet | A traced scene uses a feature the tracer lacks | Drop the feature or pathTrace for that scene; extruded text instead of plane text. |
| Traced 3D sparkles or shimmers | Light bounced off shiny surfaces onto matte ones | More samples, or a higher filterGlossy. |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
webgpu, video-rendering, headless-rendering, ffmpeg, gltf-export
npx claudepluginhub gatewai-dev/framefields --plugin framefields7 skills in this plugin
/framefieldsStart a new framefields video project, or add framefields to an existing Node.js project. Use when the user wants to make a video with framefields and the project has no framefields setup yet, or asks how to install framefields, scaffold a composition and render script, get from an empty folder to a first MP4, store footage (asset buckets, Git LFS), generate images, video, music or voice for a film with AI models (`ai` from framefields, the framefields AI gateway), or add ready-made components (pointers, captions, title cards, device frames …) and library media (SFX, HDRIs) with `npx framefields add` / `npx framefields library`. Hands off to framefields-compose, framefields-effects, framefields-vision, framefields-render and framefields-cloud for the details./framefields-cloudRender framefields projects on framefields cloud GPUs (api.framefields.dev) or a self-hosted render worker. Use when running `framefields render --cloud`, calling `renderCloud` from `framefields/cloud`, planning cost and workers, splitting a long film across several GPUs, starting renders from the framefields dashboard, getting a project render-ready (push, lockfile, pinned assets, private repos), or fixing a cloud render error code such as ASSET_NOT_FOUND or LOCKFILE_MISSING./framefields-composeDesign, structure, and animate code-first video compositions using the framefields WebGPU SDK. Use when writing or changing a framefields film — scenes and transitions, layout trees, keyframes and easing, kinetic typography, shapes and morphs, charts, blend modes and mattes, 3D scenes (cameras, lights, materials, outlines, models), physics, GPU particles, procedural VFX layers, time remapping, or audio-synchronized motion./framefields-effectsApply, configure, and modulate WebGPU post-processing shaders, stylized looks (pixel art, ASCII, VHS, comic, watercolor, risograph, holographic — and which look fits which request), cinematic color grading, tone mapping, and procedural VFX in framefields. Use when adding blur, grain, LUTs, relighting, curves, greenscreen color keying, or effects driven by vision signals in framefields compositions; detection, cutouts, pose and SAM tracking themselves are in framefields-vision./framefields-stylesChoose and combine the creative direction of a framefields video — its look (Motion, Collage, Blueprint, Keynote …), format (widescreen, vertical 9:16, square, 15/30 s ad), genre (explainer, product launch, brand film, lyric video) and media (code-drawn, 3D, footage, AI-generated through the framefields gateway) — or start from a preset. Use when someone asks for a video "in the style of" something, names a platform or length, asks what kind of video to make, wants AI-generated clips to match drawn graphics, or before choosing palette, type, pacing or music for a new film./framefields-visionOn-device computer vision in framefields — object detection and tracking, instance segmentation, pose, person mattes and cutouts (RTMDet-Ins, RTMO, Selfie Segmenter), soft alpha matting of hair and motion blur (ViTMatte), and prompted video tracking of a specific object or several people with SAM 2.1 Tiny or Small (point/box prompts) and SAM 3 (text prompts such as "man in white shirt", multiple objects at once). Covers which API to use (withVision, comp.vision, analyzeVisionSequence), every pinned ONNX model with sizes and licenses, GPU/CUDA/CPU backends, model downloads and caching, performance, and troubleshooting. Use when a framefields composition needs to know where people or objects are, cut a subject out, follow someone through a clip, or select one person in a crowd.Other plugins' skills for the same job