Skip to content
Projetos

Sobre

Vídeo como código: cenas em canvas renderizadas com WebCodecs no Chrome headless, um visualizador para revisão e habilidades de agentes que criam o vídeo a partir das suas referências.

Design e mídia

Como estes números são medidos

Crescimento medido de estrelas

em 24 h
+5
em 7 dias
+156
em 15 dias
Coletando histórico
em 1 mês
Coletando histórico

Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.

README.md

Original

The motlab ad: a prompt asks the agent for a coffee shop promo, the agent builds the scenes, notes are marked on frames in the viewer, the fixes appear, and the video is exported at 4K

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

Website · Demo · Install · Quick start · Speed · How it works · Docs · FAQ · Roadmap

CI License: MIT OR Apache-2.0 Node.js 24+


Every scene is a canvas page with one function, renderAt(t), that draws the frame at time t. motlab plays the pages in a viewer where you step through them frame by frame, and renders them to MP4 in headless Chrome. Give 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.

What it does

  • Your agent writes each scene as a canvas page from your references and a short brief, in the look your references set.
  • The viewer plays the real pages with their audio, frame by frame, on a timeline you can zoom and step through.
  • You mark what to change on the frame itself, with a click, a box, a pencil stroke or a time range, and a note on each. The agent reads the notes from selection.json and works through them by number.
  • The viewer reloads a scene as soon as the agent saves it, shows which scenes the agent is working on, and keeps a history of the project to compare and restore.
  • Versions of a project sit side by side, so a second cut does not overwrite the first.
  • Export renders MP4 at 720p, 1080p, 1440p or 4K with the transitions, overlays, music and voice, three scenes at a time. For video to lay over footage in an editor, it writes ProRes 4444 with alpha.
  • Animation can sit inside real footage. track.py follows points, flat surfaces and the camera, Blender solves a moving camera for three.js, motlab matte finds an object in every frame so animation passes behind it, and comp.js matches the shot's light and grain.
  • Scene pages get a camera with keys, shake and parallax, depth layers cut from a photo, and sprite sheets and sprite stacks.
  • Scenes can be timed to a music track: beats.py finds its beats and bars, and the viewer shows them on the timeline.
  • A long talking-head take is cut at its pauses and split into scenes, with captions from a transcript.
  • Frames are encoded with WebCodecs inside the page and never leave Chrome as images. On a GPU that made motlab 2 to 4 times as fast as Remotion and HyperFrames on the benchmark scene.
  • The viewer runs on your own server behind a domain and a password, so you can review and export from your phone.
  • Two more skills come with it: motlab-assets builds asset kits as code (icons, illustrations, rigged 2D characters, transitions, 3D objects with PBR textures) so every video shares one look, and motlab-styles holds ready-made styles for when you ask for one.

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

motlab runs on Windows, macOS and Linux. You need Node 24 or newer, Google Chrome or Chromium, and ffmpeg with ffprobe on PATH. Python 3 runs the skills' helper scripts and Blender the asset skill's main 3D path; both are optional.

npm install -g @motlab/cli
npx @motlab/cli setup

npm installs the engine. Setup copies the three skills to your agent's skill folder, checks the machine and makes sure the motlab command works, adding it to ~/.local/bin where npm's folder is not on PATH (nvm for Windows). 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 <its skill folder>

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
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)
npx skills add staryone/motlab -g

This installs only the three 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 · Instructions for an agent doing the install

Quick start

  1. Run motlab new my-video for a copy of the sample project, then motlab edit my-video. The viewer starts in the background, opens the project and prints its address, http://127.0.0.1:4173/p/my-video/. Space plays, the arrow keys step one frame, and Ctrl+scroll zooms the timeline.

  2. To make your own video, put your references in a folder and ask your agent, for example:

    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 opens the viewer. Click the frame you mean, drag a box over the part or circle it with the pencil (P), and type a note on it. Leave notes all over the video, then tell the agent "all the notes".

  4. Press Export in the top right. The video goes to the project's out/ folder.

The viewer keeps running for every project until motlab stop, and its text follows your browser in English or Indonesian. motlab help lists every command. To render from the command line:

motlab render my-video --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.

The benchmark has the other settings, Chrome drawing in software, quality (SSIM) and file sizes, and bench/ runs it again on your machine.

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 <canvas id="c">, window.renderAt(t), window.TOTAL and window.ready. Everything visible is a function of time, so the preview, the stills and the render draw the same frames.
  3. The viewer (motlab start, or motlab edit to open a project in it) shows the real pages in iframes with their audio through WebAudio, saves your clicks and notes to selection.json, and loads a scene again when its file is saved.
  4. motlab render opens headless Chrome for each scene and transition, three at a time, and encodes the frames with VideoEncoder inside the page. ffmpeg only copies streams, joins the parts, sets the colour tags and adds the audio.
project.json + scene pages (canvas, renderAt(t)) + audio files
  |
  +-- motlab edit    viewer: the real pages in iframes, WebAudio audio, selection.json
  +-- motlab render  headless Chrome per part, 3 at a time -> VideoEncoder in the page -> MP4 parts
                     -> ffmpeg -c copy: join, colour tags, audio -> out/<name>.mp4

Footage is decoded inside the page with Mediabunny, so a scene can cut and trim video files and draw over them. DOM-based engines take a screenshot of every frame and pipe the images to ffmpeg; encoding inside the page skips that, which is where the gap in Speed comes from. The encoder rules and the measured quirks are in rendering.

Documentation

Need Read
Install, update, per-OS notes Install, Agent install
Projects, scenes, audio and footage Projects
The viewer, keys, selection.json, the viewer on a VPS Viewer
Commands, options and the page contract Command line
What every 1.x release keeps working, and what is experimental Stability
How a render works, encoders, file size, measurements, quirks Rendering
What the skill does and its references SKILL.md, skill references
Asset kits: tokens, 2D, 3D motlab-assets SKILL.md, its references
Ready-made looks motlab-styles SKILL.md, its styles
The viewer's visual design DESIGN.md
What comes next and what each release shipped Roadmap
Changes Changelog

FAQ

Does motlab use AI image or video models?

No. Your agent writes every scene as code, and motlab draws it frame by frame in Chrome. The pictures come from your references and from what the code draws.

Two models are used to measure pictures, never to make them: motlab depth runs Depth Anything V2 Small to find how far each part of a photo is, so the photo can be cut into layers that move apart when the camera moves, and motlab matte runs SAM 2.1 tiny to find which pixels of a clip are one object, so animation can pass behind it. Models that make images or video stay out.

Do I need a GPU?

No. It renders faster with one, and every render prints the GPU it got on its first line. Without a GPU, Chrome draws in software: CI renders every end-to-end test that way on Ubuntu and Windows, and a 42 s, 1080x1920 video was made on Ubuntu 24.04 with no GPU. On the test laptop, drawing in software took 2.8 to 4.5 times as long as the GPU.

Does it run on macOS and Linux?

Yes. CI runs every test on Ubuntu, Windows and macOS on each change, the end-to-end renders included. A 42 s, 1080x1920 project was made on Ubuntu 24.04 with no GPU and rendered in about 82 s (issue #8), and the npm package renders the example at 1080p on an Apple M5 with Chrome on Metal (install notes).

Can I review on my phone?

Yes. Run the viewer on a server of yours with motlab start --domain viewer.example.com behind a reverse proxy such as Caddy and a password you set (the viewer docs); an agent can set it up from its install steps. Without a domain, tailscale serve on the server keeps the viewer private to your own devices, a setup that has opened the viewer on a Linux VPS from a laptop and a phone.

Can the files be smaller?

Set "qp": 22 in project.json: a busy 4K render came out 30% smaller with nearly the same quality (SSIM 0.9964 to 0.9960). HEVC, AV1 and a second encoding pass were measured too and did not do better at the same quality. The numbers are in File size.

Can I use it without an agent?

Yes. A scene is a plain HTML page you can write by hand, motlab edit opens the viewer, and motlab render exports from the command line. The page contract is in the command line docs.

Where do my notes go?

Into selection.json in the project folder, with a picture of each box or point in selection/. The agent reads that file, so you do not have to describe the frame in chat.

Tested on

Every change runs the whole test suite on Ubuntu, Windows and macOS in CI, the end-to-end renders included. motlab is built and measured on Windows 11 (Ryzen 7 5800H, RTX 3060 Laptop), the npm package renders on macOS (Apple M5), and a 42 s portrait video was made on Ubuntu 24.04 without a GPU. The skill has made two real videos from start to finish, a 2-minute demo of motlab in 10 scenes and a 19-second ad in 7, both rendered at 4K, and the viewer runs a 45-scene project. The Blender path has rendered a whole sequence on Blender 5.2, played by a scene page into an MP4, and the asset skill has baked, exported and re-imported its assets, a Rigify rig among them.

Contributing

Read CONTRIBUTING.md first. Agents working in this repository follow AGENTS.md. Report security issues privately, as described in SECURITY.md.

npm test

Star history

License

Your choice of MIT or Apache 2.0. Contributions come under both (CONTRIBUTING.md). The scene transitions come from gl-transitions (MIT); THIRD_PARTY_NOTICES.md has their licence and the libraries motlab installs or loads. Fonts, footage, music and other files you bring into a project keep their own licences.

Explore projetos relacionados

Carregando…