Video as code: canvas scenes rendered with WebCodecs in headless Chrome, a review viewer, and agent skills that build the video from your references.
Docs: --only needs the same --scale as the last render
StaryOne2eda781d9e0b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cd07a54..6a1b006 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,7 +7,7 @@ Changes are listed by release, newest first. The sections dated before 0.1.0 rec### Added- With no system Chrome, motlab uses the newest Chromium that Playwright downloaded, from Playwright's folder (`~/.cache/ms-playwright` on Linux, `~/Library/Caches/ms-playwright` on macOS, `%LOCALAPPDATA%\ms-playwright` on Windows, or `PLAYWRIGHT_BROWSERS_PATH`), so `motlab doctor` passes without `CHROME` on a machine set up for Playwright (issue #8). The folder names come from Playwright's own code, and a test checks the lookup on folders made for it. Not tried: a real Playwright download found this way. The render in issue #8 used that Chromium with `CHROME` set.-- `motlab render --only 3` (or `--only 3,5`) re-renders only the scenes you name, plus the transitions touching them, and takes the rest from the cache in `~/.cache/motlab/parts` (`%LOCALAPPDATA%\motlab\parts` on Windows, or `MOTLAB_CACHE_DIR`), which a full render leaves behind. A scene with no cached part is rendered, so `--only` on a project that was never rendered works like a full render. A finished render removes the cached parts it did not use, and the cache key holds the motlab version, so parts made by an older version are rendered again after an update. The cache keys on the scene page itself: a file the scene loads changing (a shared script, a font, a picture) is not noticed, so render the whole project again then. Checked on the example project (3 scenes, 9 s, 1080p) on Ubuntu 24.04 with no GPU, SwiftShader, while other builds were running on the same machine: a full render took 44 to 49 s, `--only 3` took 17 to 24 s. The --only output differs from a full render by the same amount two full renders differ from each other (average PSNR 68.9 dB in both cases, from the encoder's run-to-run variation). `test/render.test.js` renders a project, changes one scene, re-renders with `--only` and checks the frame count, the cached log line, the colours of the cached, transition and re-rendered frames, and that the old parts are gone.+- `motlab render --only 3` (or `--only 3,5`) re-renders only the scenes you name, plus the transitions touching them, and takes the rest from the cache in `~/.cache/motlab/parts` (`%LOCALAPPDATA%\motlab\parts` on Windows, or `MOTLAB_CACHE_DIR`), which a full render leaves behind. A scene with no cached part is rendered, so `--only` on a project that was never rendered works like a full render. A finished render removes the cached parts it did not use, so the cache holds the last render only and `--only` needs the same `--scale` as that render. The cache key holds the motlab version, so parts made by an older version are rendered again after an update. The cache keys on the scene page itself: a file the scene loads changing (a shared script, a font, a picture) is not noticed, so render the whole project again then. Checked on the example project (3 scenes, 9 s, 1080p) on Ubuntu 24.04 with no GPU, SwiftShader, while other builds were running on the same machine: a full render took 44 to 49 s, `--only 3` took 17 to 24 s. The --only output differs from a full render by the same amount two full renders differ from each other (average PSNR 68.9 dB in both cases, from the encoder's run-to-run variation). `test/render.test.js` renders a project, changes one scene, re-renders with `--only` and checks the frame count, the cached log line, the colours of the cached, transition and re-rendered frames, and that the old parts are gone.### Changeddiff --git a/docs/cli.md b/docs/cli.mdindex 53ef87d..e68d1f8 100644--- a/docs/cli.md+++ b/docs/cli.md@@ -48,7 +48,7 @@ When the page throws while loading, the error names the file, line and column, f| `--bitrate` | Use variable bitrate at this many Mbit/s instead of constant QP || `--mux` | `auto`, `mediabunny` or `raw`. Auto tries the in-page MP4 muxer, then a raw bitstream wrapped by ffmpeg || `--reprobe` | Time the encoders again instead of using the saved timings |-| `--only` | Re-render only these scenes (1-based, comma separated), for example `--only 3` or `--only 3,5`, and reuse the cached parts of the rest. The transitions touching a re-rendered scene are re-rendered too. Only for `render`, see [Rendering a project](projects.md#rendering-a-project) |+| `--only` | Re-render only these scenes (1-based, comma separated), for example `--only 3` or `--only 3,5`, and reuse the cached parts of the rest. The transitions touching a re-rendered scene are re-rendered too. The cache holds the last render's parts, so pass the same `--scale` as that render. Only for `render`, see [Rendering a project](projects.md#rendering-a-project) || `--root` | Folder to serve. Default is the nearest folder above the page with a `project.json`, else the page's folder || `--chrome` | Path to Chrome. Default: found automatically, or the `CHROME` environment variable || `--format` | `png` or `jpg`, for `stills` |diff --git a/docs/projects.md b/docs/projects.mdindex 2e099e8..4e9b92c 100644--- a/docs/projects.md+++ b/docs/projects.md@@ -64,7 +64,7 @@ motlab render example out/promo.mp4 --scale 1This renders every scene, joins them and adds the audio. The result is `example/out/example.mp4` unless you give a path. The default `--scale 2` turns 1920x1080 pages into 4K; `--scale 1` gives 1080p. The viewer's Export button does the same thing at a resolution you pick.-To change one scene without rendering the rest again, pass `--only` with its number: `motlab render example --only 3`. The scenes you name are rendered again, the transitions touching them too, and every other scene comes from the cache in `~/.cache/motlab/parts` (`%LOCALAPPDATA%\motlab\parts` on Windows, or `MOTLAB_CACHE_DIR`), where a full render leaves each scene's part. A finished render removes the cached parts it did not use. A scene with no cached part is rendered, so `--only` on a project that was never rendered works like a full render. The cache key holds the motlab version and the scene page itself, so if a file the scene loads changes (a shared script, a font, a picture), render the whole project again, or delete the cache folder.+To change one scene without rendering the rest again, pass `--only` with its number: `motlab render example --only 3`. The scenes you name are rendered again, the transitions touching them too, and every other scene comes from the cache in `~/.cache/motlab/parts` (`%LOCALAPPDATA%\motlab\parts` on Windows, or `MOTLAB_CACHE_DIR`), where a full render leaves each scene's part. A finished render removes the cached parts it did not use, so the cache holds the parts of the last render only: pass the same `--scale` as that render (for a 1920x1080 page, the viewer's 4K Export is `--scale 2` and 1080p is `--scale 1`), or every scene is rendered again. A scene with no cached part is rendered, so `--only` on a project that was never rendered works like a full render. The cache key holds the motlab version and the scene page itself, so if a file the scene loads changes (a shared script, a font, a picture), render the whole project again, or delete the cache folder.How it works:diff --git a/skills/motlab/SKILL.md b/skills/motlab/SKILL.mdindex 5205ed7..e8e1b8e 100644--- a/skills/motlab/SKILL.md+++ b/skills/motlab/SKILL.md@@ -88,7 +88,8 @@ ask; never stash, reset or discard their changes. The new skills load in a new s9. **The render is the user's.** They press Export in the viewer and pick 720p, 1080p, 1440p or 4K. The file lands in`<video>/out/<folder>-<resolution>.mp4` (4K as `-2160p`). After fixing one scene, they can re-render just that scenefrom the command line instead of a full export: `motlab render <project> --only N`, where N is the scene's number- in `project.json`; the rest comes from the cache. To look at an export they ask about, tile one frame a+ in `project.json`; the rest comes from the cache of the last render, so give the same `--scale` as that render+ (for a 1920x1080 page, 2 for a 4K export and 1 for 1080p), or every scene is rendered again. To look at an export they ask about, tile one frame asecond into a single image: `ffmpeg -i out.mp4 -vf "fps=1,scale=480:-1,tile=6x10" -frames:v 1 sheet.jpg`.**Paid tools:** generating a voice, music or anything else on a paid service (ElevenLabs, Suno and the like) spends the