Shape
A descriptor is a single JSON document the engine compiles into a finished video — the same source on Node, in the browser via WebAssembly, and on-device in React Native. Field tables come from the engine's schema. An effect section needs a host renderer to resolve it into a clip before composition.
New to the workflow? Start with the AI motion graphics guide, then connect the MCP video tools or render JSON templates with the CLI.
Structure
The two keys
A descriptor is organized around two keys: { global, sections[] }. global holds project-wide defaults; sections is an ordered list where each entry can define a visual clip, audio, a form step or a reusable partial. Both keys are optional so partial descriptors validate incrementally, but a useful template has at least one section. An optional meta object carries a human name and description and creativeDirection authoring brief; partials carries reusable section definitions. The brief does not select effects or change rendering automatically. See the complete field reference, effect contracts and creative direction guide.
The descriptor has two layers you can mix freely. The structured-sugar fields — transition, look, grade, motion, audio, layers, caption and framingGuide — are high-level intents that compile down to ordinary FFmpeg filters for you. Prefer this layer: it is portable, validated, and on-device-safe.
When the sugar doesn't cover something, the raw filters[] and maps[] passthrough sends FFmpeg filter names and arguments through verbatim — so its keys stay FFmpeg-native (x, fontsize, boxcolor…), while sugar keys use editor-friendly camelCase. Keep the two mental models separate.
Native descriptor durations are in seconds — options.duration, transition.duration, audioFade.in.duration, and the rest. Registered-effect props use the units declared by their contract, which can include frame counts.
Separate layers
Host and engine configuration
Template JSON defines scenes, timing, motion and global.orientation / global.fps. The library's ProjectConfig supplies asset/build paths, media and field bindings, locale, codec, quality and segment concurrency. Orientation comes from the descriptor; its fps overrides host fps.
Default landscape output is 1280×720 at 30 fps; portrait swaps the base dimensions and square uses 1080×1080. The encoder preset defaults to ultrafast, even when quality tier changes. WASM and native segments run serially; Node/static defaults to up to three concurrent segments.
MCP server settings configure media containment, deadlines and opt-ins. See the complete engine configuration reference.
Pipeline
How rendering works
Boundaries decide the render path. A cut-only template concatenates its clips with a fast stream-copy — no re-encode, so it's quick even on-device.
Any non-cut transition (a fade, wipeleft, …) triggers a single xfade / acrossfade re-encode pass that stitches the whole timeline together.
CLI
Get started
Scaffold a project, install, and render — the fastest way to see a descriptor compile.
# Scaffold a project
pnpm dlx @leclap/cli init my-video# Install it
cd my-video && pnpm install# Render the starter video
pnpm renderinit also offers to wire the @leclap/mcp server. Then leclap diagnose to check your FFmpeg, or leclap --help for every command.
Reference
Project-wide config
global sets defaults inherited by every section and declares what a builder UI may expose to end users. The audio sub-object has its own page.
meta
Optional template metadata — display name, description and creative direction.
| Field | Type | Constraints |
|---|---|---|
| name Human-readable template name for catalogs and editors. | string | |
| description Short human-readable template summary for catalogs and agents. | string | |
| creativeDirection Authoring brief (1..4000 characters): audience, visual hierarchy, typography, palette, motion, pacing, avoidances and review criteria. Guides humans/agents; never interpreted or executed by the renderer. Implement the direction explicitly in sections, filters and effect props. | string | |
| brief The production brief this template answers (a one-liner or a path such as "brief.md"). Setting it opts the template into the section_without_purpose advisory. Never rendered. | string | |
| requirePurpose When true, every rendering section should declare a `purpose` (advisory section_without_purpose). | boolean | |
| resolved What resolve passes pinned into this descriptor; renders only read the pinned values. | object |
global
Project-wide defaults and the choices a builder exposes to users.
| Field | Type | Constraints |
|---|---|---|
| variables Template-wide variable definitions referenced via {{ varName }} syntax. | object | |
| fields Typed inputs filled into {{ name }}; a whole-string placeholder takes the typed value. | object | object[] | |
| scopes Merged scopes, read as {{ <scope>.<path> }}: the defaults, then the project block, then the values of the render, the later winning key by key (objects merge, lists replace, null switches a key off). Filled into partial ref variables before the partials expand, then everywhere else; a whole-string placeholder with no value, or null, drops its key. | object | |
| orientation Output format; controls the frame size at 720p — landscape 16:9 1280x720, portrait 9:16 720x1280, square 1:1 1080x1080, feed 4:5 720x900, classic 4:3 960x720, cinema 21:9 1680x720, tall 2:3 720x1080 (default: landscape). The frame follows global.resolution (its short side); a $format marker falls back from feed and tall to portrait, from classic and cinema to landscape. | string | landscape, portrait, square, feed, classic, cinema, … |
| aspect A custom frame ratio "W:H", integers within 1:4 to 4:1 (e.g. "5:4", "1:5" is refused). Wins over global.orientation; a ratio equal to a named format is that format. The short side is global.resolution (720p default) and the long side is rounded to an even number: "5:4" at 720p is 900x720. Pixel values in the template are written for the nearest base format (landscape, portrait or square) and grow with the short side. Errors: aspect_invalid, aspect_out_of_range. | string | |
| resolution Output resolution: the short side of the frame, 720p, 1080p or 4k (2160). landscape is 16:9 (1280x720, 1920x1080), portrait 9:16 (720x1280, 1080x1920), square N:N (720x720, 1080x1080), feed 4:5 (720x900, 1080x1350), classic 4:3, cinema 21:9 (1680x720), tall 2:3, or a custom global.aspect. Omitted: 720p, 1080p for square, so a template renders the size it always had. Pixel values in the template are written for that default size and grow with the frame (a 40 px title is 60 px at 1080p), so the layout is the same, only sharper. 4k is not available yet and fails validation with resolution_unsupported. A host-supplied videoConfig.scale still overrides it. | string | 720p, 1080p, 4k |
| platform Delivery platform the video is made for: tiktok, reels (aliases ig, instagram), shorts (aliases yt-shorts, youtube-shorts), youtube, x (alias twitter), linkedin, facebook, square-feed, instagram-feed (alias ig-feed) or pinterest. Sets the default orientation when global.orientation is omitted (portrait for tiktok/reels/shorts, square for square-feed, feed for instagram-feed, tall for pinterest, landscape otherwise); validation then warns about text under the app UI (per-edge safe zones, e.g. the bottom 22% under TikTok captions), a timeline longer than the platform accepts and an unusual fps; the default caption position is lifted clear of the bottom UI; and loudnorm targets the platform loudness (-14 LUFS, -1 dBTP). Rendering is otherwise unchanged. | string | tiktok, reels, shorts, youtube, x, linkedin, … |
| emoji How colour emoji in drawn text render (drawtext itself only draws monochrome outlines). "image" (default): each emoji leaves the text, a measured gap takes its place and a bundled colour image (~250 common emoji, skin tones and flags included) is composited there, sharing the text's timing, motion and fades; an emoji with no bundled image is stripped with an emoji_missing_asset warning, and at most 24 images are composited per section. "strip": remove emoji silently (warning only). "error": fail validation with emoji_unsupported. | string | image, strip, error |
| seed Root seed (uint32, default 0) for every procedural effect: each element derives its own stream as hash(seed, element path), so the same seed always renders the same shake, grain and scramble. | integer | 0…4294967295 |
| motion Motion tokens: one design system for time, shared by every animated field. | object | |
| theme | object | |
| fonts Font faces the template brings for its HTML layers and its drawn text ({ family, src, weight?, style? }, one entry per weight/style of a family). An HTML layer selects one with font-family in its css, drawn text (kinetic, captions, title cards, comparison labels) with its font; it wins over a bundled family of the same name. Drawn text takes the nearest declared weight (the lighter on a tie). CSS @font-face is not supported: declare the face here. | object[] | |
| beats | object | |
| fps Output frame rate for the rendered video (integer 1..120, default 30). | integer | 1…120 |
| colorsList Palette of colours offered to the user for customisation, as CSS hex strings. | string[] | |
| musicEnabled Whether background music is enabled for this template (default true). | boolean | |
| transition Default transition applied between sections when no per-section transition is set. | object | |
| audio Global audio mix settings (volumes, normalisation, ducking). | object | |
| sfx Sound effects on the whole-video timeline. `at`: video seconds, "beat:n" / "bar:n", "<section>.start" / "<section>.end" (a section name), "cue:<name>" (the first section with that cue), "50%" or "end" of the video, each with an optional offset. | object[] | |
| music Default background music track for the template. | object | |
| animations Whole-video animation overlays composited over the final joined video, spanning all sections. | object[] | |
| overlays Whole-video text overlays (e.g. a brand watermark) composited onto every section. | object[] | |
| poster The still written next to the render: where it is taken and an optional HTML footer strip. | object | |
| cover Frame 0 of the video replaced by the frame at a moment, so an inline player shows a drawn frame before play. | object | |
| watermark A still-image watermark (e.g. a logo) composited over the whole video, authored once per template. | object | |
| look Colour-grade preset applied across every section (whole-video look); string or { preset, strength }. | string | object | cinematic, warm, cool, vintage, noir, vivid, … |
| grade Fine-grained colour grade applied across every section. | object | |
| allowedMusic Allowlist of music track identifiers the user may choose from. | string[] | |
| allowUploadMusic Whether the user is allowed to upload a custom music file (default false). | boolean | |
| allowedBackgrounds Allowlist of background asset identifiers the user may choose from. | string[] | |
| allowUploadBackground Whether the user is allowed to upload a custom background image (default false). | boolean |