Repository avatar
AI Tools
v0.8.0
active

video

dev.leclap/video

Compose and render video from one JSON template. Deterministic, runs locally, no generative model.

Documentation

Clappy, the LeClap mascot

LeClap is the deterministic video engine for AI agents. It is a JSON template engine: your agent writes the template once, LeClap compiles it to FFmpeg, and every render gives the same video per platform for zero tokens. Node, browser or phone.

LeClap in one loop: a JSON template is written, compiled into an FFmpeg timeline, rendered, fanned out into landscape, portrait and square videos, then rendered again to the same digests.

CI npm: ffmpeg-video-composer npm: @leclap/cli npm: @leclap/mcp License: MIT

Try it · Why LeClap · Use cases · Examples · Connect an agent · Docs · Showcase

⏱ Try it in 30 seconds

Node 24.11 or later and pnpm. FFmpeg is optional: the CLI brings ffmpeg-static along and uses it when there is no ffmpeg on your PATH.

pnpm dlx @leclap/cli init hello
cd hello && pnpm install && pnpm render

That writes build/output.mp4: three seconds of "Hello, LeClap" on a navy card, from the template.json next to it. Edit the JSON, render again. The project also carries a .mcp.json that wires @leclap/mcp for your agent client. npm works too: npx @leclap/cli init hello, npm install, npm run render.

If the title is missing, the ffmpeg on your PATH was built without drawtext (Homebrew's current build is one). npx leclap diagnose lists what your FFmpeg can and can't do.

Rather not install anything? Open the same template in the web builder, where it renders in the tab through WebAssembly. The template travels in the URL fragment, which browsers don't send to servers. leclap studio template.json prints that link for any template.

🧭 Why LeClap

Three things, in this order.

1. A template engine. One JSON file, validated against a schema, describes the whole video: sections, effects, music, transitions. One template, many videos: swap the footage and the copy, keep the structure. The template schema and the descriptor reference list every field.

2. Deterministic. There is no generative model in the render path. The same template, assets, configuration and runtime give the same video, and a manifest lets you prove it:

leclap render template.json --output out.mp4 --manifest
leclap verify out.mp4.manifest.json --rerender

--manifest writes out.mp4.manifest.json next to the video, with the template, asset, filtergraph and output digests. verify --rerender renders the recorded template again and compares every digest. That holds per platform, not across platforms: Node and the browser encode with libx264, Android with libopenh264, iOS with h264_videotoolbox. Same composition, different pixels. Keep the template and its manifest in git and a changed effect shows up as a failing diff or a golden test.

3. AI-driven. Agents author templates through @leclap/mcp: get_capabilities, get_template_schema, validate_template, then compose_video. The agent writes the template; LeClap renders it locally. No AI generates the video. The agent spends tokens once, writing the template; every render after that, re-renders and variants included, calls no model and costs zero tokens.

{
  "mcpServers": {
    "leclap": {
      "command": "npx",
      "args": [
        "-y",
        "@leclap/mcp",
        "--media-dir",
        "/absolute/path/to/video-assets",
        "--output-dir",
        "/absolute/path/to/video-renders"
      ]
    }
  }
}

It runs on Node, in the browser (WebAssembly) and on-device, with no server in between, and there is a CLI.

🧰 What people build with it

Eight jobs the showcase already renders, each with its template. Click a frame to open the sample.

USED AT  —  Carrefour

Product launches and promos: a frame of the web-app-promo sample
Product launches and promos
A screenshot, a headline and a camera tilt. Swap the screenshot, keep the launch.
Reels in three formats: a frame of the formats sample
Reels in three formats
One template: a 16:9 film, a 9:16 cut and a square post. Recomposed, not cropped.
Real-estate listings: a frame of the html-card sample
Real-estate listings
Address, price and rooms are typed fields. One template lists every property.
Conference openers and lower thirds: a frame of the html-speaker sample
Conference openers and lower thirds
Date, venue, speaker and talk title, laid out in HTML and CSS, rendered by FFmpeg.
Word-timed captions: a frame of the word-captions sample
Word-timed captions
Speech-to-text timings in; a karaoke highlight or loud capitals out.
Pull request evidence in CI: a frame of the pr-evidence sample
Pull request evidence in CI
An agent writes the template, LeClap renders the review clip. This repo does it on its own pull requests.
Recaps and stat cards from data: a frame of the html-stats sample
Recaps and stat cards from data
The numbers are typed fields. leclap render --set fills them, one render per row.
Shot and rendered on a phone: a frame of the present-yourself sample
Shot and rendered on a phone
Film a clip, add effects and music, render it on the device. Nothing is uploaded.

🎥 Demo

https://github.com/user-attachments/assets/eaaf6266-7549-41ba-ae27-bf08becc6637

Watch the LeClap showcase above, or watch with captions on leclap.dev.

🎞 Template in, video out

Three templates from this repo and what they render to. Click a frame to play the render.

TemplateRenderWhat it shows
footage-edit.json
4 KB of JSON
Footage edit renderFive recorded clips, five edits: a portrait clip over its own blur, a keyframed pan under a LUT, a speed ramp, a freeze frame, a B-roll cutaway.
before-after.json
a PR review clip
Before/after PR evidence renderThe video an agent attaches to a pull request: the change named, the old behaviour, a wipe to the new one, what to check.
effects-tour.json
ten chapters, one template
The effects tour renderSeven minutes of kinetic type, camera moves, transitions, captions, light effects, looks, footage edits, sound and music.

Every sample and its template is on the showcase. Each effect, one frame at a time, in the gallery.

For a video, editable JSON and step-by-step rendering instructions, start with animated titles, HTML motion graphics, or AI-agent PR evidence.

🤖 Connect an agent

  • Structured authoring: discover samples and motion primitives, then write against the template schema.
  • Precise revisions: validate, inspect rendered frames, and patch the scenes that need work.
  • Human control: keep the editable JSON and open it in the visual builder.
  • Local rendering: use the CLI or MCP server on your computer; the same core also runs in browsers and native apps.

Make product demos, branded social clips or before/after review videos. LeClap composes existing assets; your agent writes the template. Reproducible renders require the same inputs, configuration and runtime. An external AI provider has its own data handling, separate from local rendering.

Start with the agent guide: MCP setup, a first prompt, a CLI alternative and a revision workflow. The same tools are reachable from browser agents in the builder (WebMCP), and the agent-made PR video shows the loop end to end.

🖥 Platforms and CLI

WhereHow it rendersEncoder
NodeSystem FFmpeg, falling back to ffmpeg-staticlibx264
BrowserFFmpeg compiled to WebAssembly, in the tab; nothing is uploadedlibx264
Android, on-deviceAn LGPL build of FFmpeg linked into the applibopenh264
iOS, on-deviceAn LGPL build of FFmpeg linked into the apph264_videotoolbox

The leclap command covers init, render, validate, samples, verify, snapshot, compare, timeline, resolve, style, studio and diagnose; see the CLI reference. Engine settings, environment variables and encoder tiers are in the engine configuration.

🆚 How it compares

Four ways to get a video out of JavaScript, and when each one is the right call. Claims about the others come from their own docs; a "—" means their docs don't say. The full comparison has the sources and the caveats, ours first.

LeClapRemotioneditlyfluent-ffmpeg
What it isA JSON template compiled to FFmpegVideos written as React componentsDeclarative editing, as a CLI and a Node APIA chainable Node API over the ffmpeg CLI
You writeJSON, validated against a schemaReact (TypeScript)A JSON5 spec or CLI flagsChained method calls
Node✅✅ also Lambda and Vercel✅ needs ffmpeg, ffprobe, headless GL✅ needs ffmpeg, ffprobe
Browser✅ WebAssembly✅ WebCodecs, since 4.0.491——
React Native, on-device✅ FFmpeg linked into the app———
Same input, same output✅ per platform¹✅ if animations derive from the frame number——
Agent tooling✅ @leclap/mcp: schema, validate, render✅ a system prompt for LLMs writing React——
LicenceMITFree for individuals, non-profits and for-profit companies up to 3 employees; paid aboveMITMIT, archived in May 2025
Pick it whenThe render happens in an app, or a program writes the videoYou think in components, render on servers, or want the ecosystemYou want a slideshow from the terminalYou already use it; its README says it's unmaintained

¹ Per platform, not across them: Node and the browser encode with libx264, Android with libopenh264, iOS with h264_videotoolbox, and the on-device build drops boxblur and rewrites eq to lutyuv. Same composition, different pixels.

Remotion wins more of this than a comparison table usually admits: LeClap vs Remotion spells out where.

📦 Packages

PackageOne line
ffmpeg-video-composerThe engine: compile() a JSON template on Node, in the browser or in React Native.
@leclap/cliThe leclap command: init, render, validate, snapshot, verify, studio, diagnose.
@leclap/mcpThe engine as tools an agent can call: read the schema, validate a template, render it.

The rest of the monorepo is private: the creative kit (templates, fonts, media), the web builder (React, FFmpeg in WebAssembly), the Expo app (camera to render, on the phone) and the Rust engine that links FFmpeg into it. Working on the repo itself: CONTRIBUTING.md and AGENTS.md.

📚 Read next

🤝 Contributing & licence

Issues and PRs welcome: start with CONTRIBUTING.md. The code is MIT.

The LeClap name and logo are trademarks of Alexandre Mogère. Fork and reuse the code freely, but give your fork a different name and don't imply endorsement. See TRADEMARK.md.

NPM
@leclap/mcp
Install Command
npm install @leclap/mcp
Runtime: npx