Show HN: I'm build open-souce video as code A developer released motigen, an open-source tool published as the npm package motigenjs, that renders video by treating a web page as the film: the page draws frame t on demand in HTML or Canvas, and motigen opens it headless in Chromium, renders every frame in order and pipes them into ffmpeg so one project produces the same MP4 on every run. The tool ships four templates (scenes, guide, canvas, dom) behind a single contract, window.__film = { ready, dur, renderAt(t) }, records real terminals through node-pty and real browsers via CDP screencast, generates narration through ElevenLabs, and masters audio to −14 LUFS / −1 dBTP; it requires Node 22 or newer and ffmpeg in PATH, and includes a skill/SKILL.md file so coding agents can drive the commands themselves. The coding-agent sessions behind this repository: the prompts, where the agent went wrong and what the human did about it. Video as code, for developers and their coding agents. A web page is the film: it draws frame t on demand, in plain HTML, Canvas or anything else a browser runs. motigen opens it headless, renders every frame in order and pipes them into ffmpeg, so one project gives the same MP4 on every run. Real terminals and real browsers are recorded and replayed inside the same page; the narration, the sound effects and the music are mixed from the timeline the page exports; the subtitles come from the same cues. Everything is a file in git and every step is one command, which is exactly what a coding agent needs to make a product video on its own. npm i -g motigenjs && npx playwright install chromium Node 22+, ffmpeg in PATH; the command is motigen motigen init scenes my-launch && cd my-launch edit film.js the scenes and audio/lines.txt the voice ; put ELEVENLABS API KEY=… into .env motigen vo narration from audio/lines.txt ElevenLabs , one file per line motigen build events → mix → render 16:9 and 9:16 → subtitles, into out/ motigen preview scrub it, play it with sound, render from a button For a screencast of a real product: motigen init guide my-guide , then motigen record take.mjs records a real browser and a real terminal into take/ , and edit.js cuts them. - Four kinds of film, one contract. A page registers window. film = { ready, dur, renderAt t } . The scenes template makes a launch video from a list of scenes kinetic titles, statements with a marker, counting numbers, charts, a comparison table, a phone with a notification, feature cards, a product window with a push-in and a callout, a typed terminal, a before/after split, a quote, an end card with varied transitions and three themes; the guide template is a screencast player browser window, terminal window, chapters, key badges, cards driven by one edit list; the canvas template is a hand-drawn 2D engine paper, letterpress type, ink strokes, a thread, cards, a pencil with its own offline mix; the dom template is the bare contract in 80 lines. - A recorder for the real thing. Term records a shell through a pty with script -style timing, so the player replays the actual bytes through xterm.js; Browser records a CDP screencast with the mouse path, the clicks, the keys and the URLs, and can serve a local folder or a local instance of your site under its real domain. - Sound from the timeline. motigen events asks the page where the voice lines, clicks and key presses fall; motigen vo makes the narration one ElevenLabs call with timestamps, split per line, or your own recordings ; motigen mix lays everything out, ducks the music under the voice and masters to −14 LUFS / −1 dBTP; motigen srt writes the subtitles. - Deterministic, parallel rendering. Every frame depends on t alone, so -j 4 renders four slices at once and joins them losslessly, and the preview scrubs to any moment instantly. - Made for agents. skill/SKILL.md tells a coding agent how to take a script to a finished video with these commands; the whole project is text it can read and change. Node 22 or newer and ffmpeg in your PATH. Playwright downloads its Chromium once; --channel chrome uses an installed Chrome instead. npm i -g motigenjs npx playwright install chromium The npm package is motigenjs ; the command it installs is motigen . As a project dependency, npx motigen … works the same way. The terminal recorder uses node-pty an optional dependency with prebuilt binaries for Windows, macOS and Linux . Without it, record in a container: backend: 'docker' . | Command | What it does | |---|---| | motigen init