# motlab
A video engine where every scene is code, and an agent skill that writes the scenes for you.
npm install -g @motlab/cli && npx @motlab/cli setup
[Demo](#watch-the-demo) · [Install](#install) · [Quick start](#quick-start) · [Speed](#speed) · [How it works](#how-it-works) · [Docs](#documentation) · [FAQ](#faq) · [Roadmap](ROADMAP.md)
[](https://github.com/staryone/motlab/actions/workflows/ci.yml)
[](#license)
[](package.json)
---
Every scene is a canvas page with one function, `renderAt(t)`, that draws the frame at time `t`. motlab plays the pages in a web viewer where you step through them frame by frame, and renders them to MP4 in headless Chrome. You hand your agent a folder of references (logos, screenshots, footage, fonts, music, voice) and a direction, and it builds every scene, opens the viewer and revises from your notes. No AI image or video model is involved.
The ad above (19 seconds, 7 scenes) was made with motlab and its skill, reviewed in the viewer and exported at 4K. The preview is silent; [watch it with sound](https://github.com/user-attachments/assets/5e2ff219-697c-459f-a273-f36cb11db1d1).
## What it does
- Your agent writes each scene as a canvas page, from your references and a short brief.
- The viewer plays the real pages with their audio, frame by frame, with a timeline you can zoom and step through.
- You point at what to change: click a frame, drag a box over a part of it, or mark a time range, and type a note on it. The agent reads every note from `selection.json` and works through them by number.
- Versions of a project sit side by side in the viewer, so a second cut does not overwrite the first.
- Export renders 720p, 1080p, 1440p or 4K MP4, with the scenes' transitions, music and voice mixed in. Scenes render three at a time by default (fewer on a small machine, and the Export menu lets you pick 1 to 4), which took a project of 12 short scenes from 93 to 53 s at 4K, and `"qp"` in `project.json` makes the file smaller (about 30% at `22`) when you need that.
- The viewer can run on your own server behind a domain and a password, so you can review and export from your phone.
- Notes are a box, a point or a pencil drawing on the frame. The viewer loads a scene again by itself when the agent saves it, and marks the scenes the agent says it is working on.
- A long talking-head take is cut at its pauses and can be split into one scene per section, with captions placed from a transcript.
- Frames are encoded with WebCodecs inside the page, so they never leave Chrome as images. On a GPU that made it 2 to 4 times as fast as Remotion and HyperFrames on the [benchmark scene](#speed).
- A second skill, `motlab-assets`, builds reusable asset kits the same way: icons, illustrations, 2D characters with a rig, transitions, 3D objects and textures, rendered to transparent PNG plus SVG, or GLB, FBX and OBJ with PBR textures. Every video that uses the kit shares one look.
## Watch the demo
Two minutes in English, made with motlab too: the install, the brief to the agent, the build, playing it in the viewer, notes on frames, versions, the revision and the export.
https://github.com/user-attachments/assets/8f70bc60-5f56-4c4f-b55e-bf9f87ba1e34
## Install
You need Node 24 or newer, Google Chrome or Chromium, and ffmpeg with ffprobe on PATH. Python 3 is optional and only used by the skills' helper scripts. Blender is optional too, for the asset skill's main 3D path.
```bash
npm install -g @motlab/cli
npx @motlab/cli setup
```
npm installs the engine. Setup copies both skills to your agent's skill folder, checks the machine, and makes sure the `motlab` command works: where npm's folder is not on PATH (nvm for Windows), it adds the command to `~/.local/bin`. After that it is `motlab` everywhere, and `motlab doctor` checks the machine again at any time.
Setup installs the skills for Claude Code unless you name another agent:
| Your agent | Setup command |
|---|---|
| Claude Code | `npx @motlab/cli setup` |
| Codex, Cursor, OpenCode, GitHub Copilot, Gemini CLI, Amp, Windsurf, Muse Code | `npx @motlab/cli setup --skill agents` |
| Antigravity (App and CLI) | `npx @motlab/cli setup --skill antigravity` |
| Hermes Agent | `npx @motlab/cli setup --skill hermes` |
| Several of them | `npx @motlab/cli setup --skill claude,agents,antigravity` |
| Any other agent | `npx @motlab/cli setup --skill-dir ` |
Running it again for another agent adds the skills there too. `--dry-run` shows every step first, and `--link` links the skills instead of copying them. Start a new agent session afterwards so it loads them.
From a clone instead, to work on motlab
```bash
git clone https://github.com/staryone/motlab.git
cd motlab
node install.js
```
The installer runs `npm ci`, puts a `motlab` command in `~/.local/bin` and copies the skills. It takes the same options, plus `--skill none` for no skills.
The skills first, with npx skills (skills.sh)
```bash
npx skills add staryone/motlab -g
```
This installs only the two skills, for the agents it finds on your machine. The first time the motlab skill runs, it sees that the engine is missing and gives you the two commands to install it: `npm install -g @motlab/cli` and then `npx @motlab/cli setup --skill none`, so setup adds only the command. Setup and `motlab uninstall` leave skills that came from npx skills alone; update them with `npx skills update -g`. Without `-g`, npx skills puts the skills in the current project only.
Later, `motlab update` tells you when a new version is out and how to get it (from a clone it pulls it from GitHub itself), and `motlab uninstall` removes the skills and motlab's own files again.
[Install guide and per-OS notes](docs/install.md) · [Instructions for an agent doing the install](docs/install-for-agents.md)
## Quick start
1. Run `motlab edit example` in a folder that holds the sample project. In a clone that is the clone itself; after an npm install, copy `example/` out of the engine folder that `motlab --help` prints. It starts the viewer in the background, opens the sample project and prints its address, `http://127.0.0.1:4173/p/example/`. Space plays, the arrow keys on the timeline step one frame, Ctrl+scroll zooms the timeline, and a drag on the preview marks a box.
2. To make your own video, put your references in a folder and ask your agent, for example:
```text
Make a 20 second portrait promo for my app with motlab. The references are in ./promo-refs.
```
3. The agent plans the shots, writes the scenes and starts the viewer. Click the frame you mean, drag a box over the part, or circle it with the pencil (`P`), and type a note right on it. Notes can be left all over the video and handed over at once, so "this one" or "all the notes" is enough.
4. When you are happy, press Export in the top right. The video goes to the project's `out/` folder.
The viewer keeps running in the background for every project: `motlab stop` ends it, `motlab restart` starts it again, and `motlab start` starts it without opening a project. `motlab help` lists every command. Its text is in English or Indonesian, following your browser, and the project menu switches it. You can also render from the command line:
```bash
motlab render example --scale 1
```
## Speed
The same scene (a moving gradient, 160 animated cards with numbers, text) at 1080p, 300 frames, rendered by three tools on one laptop (Ryzen 7 5800H, RTX 3060 Laptop, Windows 11) with the same Chrome:
| Tool | Render time | Frames per second | Compared with motlab |
|---|---|---|---|
| **motlab** | 9.5 s (`--encoder sw`), 12.6 s (default) | 31.5, 23.7 | |
| HyperFrames 0.9.52, fastest setting (1 worker) | 27.2 s | 11.0 | 2.2 to 2.9 times as long |
| Remotion 4.0.543, fastest setting (concurrency 1) | 30.7 s | 9.8 | 2.4 to 3.2 times as long |
Time is the whole command, the median of three runs. At 4K the same scene took motlab 13.1 to 19.4 s and the fastest of the other two 48.9 s.
Remotion and HyperFrames drew on the laptop's integrated Radeon. motlab on the same Radeon took 8.0 to 12.0 s at 1080p and 13.2 to 22.5 s at 4K. With Chrome drawing in software instead of on a GPU, motlab was still the fastest at 1080p (19.2 s against 28.3 s for HyperFrames), but at 4K HyperFrames was faster (43.4 s against 60.7 s).
This is one scene on one machine; macOS and Linux were not measured. The other settings, quality (SSIM) and file sizes are in [the benchmark](docs/rendering.md#against-remotion-and-hyperframes), and [bench/](bench/README.md) runs it again.
## How it works
1. A project is a `project.json` that lists scene pages and audio files.
2. A scene page is plain HTML with a `