html-to-video-pipeline
What it does
This skill shows how to record an animated web page into a video file. It is for people who build motion graphics or explainer videos with HTML and want the output to be correct.
When to use it
- βWhen you want an animated web page turned into an MP4 video.
- βWhen your exported video has wrong timing, blurry text, or a long blank start.
- βWhen you build a pipeline that records HTML animations with a headless browser.
Skill link
https://github.com/XiaomiMiMo/MiMo-Code/blob/main/packages/cli/src/skill/builtin/.bundle/html-to-video-pipeline/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βI want to turn my animated HTML title card into a 10-second MP4 video with clean timing.β
5 new skills a week. 1 minute to read.
How it works
The agent records the page in a headless browser, trims the start, and encodes the result with ffmpeg. It checks the duration and quality of the output before you use it.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
HTML β Video: the pipeline that actually works
Turning a live HTML page into an MP4 sounds like a one-liner ("Playwright records, ffmpeg encodes") and the first draft always looks fine β until you play back the export and notice text flashing in a fallback font, three dead seconds at the start, or a "10-second" clip that clocks in at 35s. This skill captures the specific ordering, waits, and encoder flags that make the output trustworthy.
Think of the pipeline as five phases with a single invariant between them:
launch β hold @ frame 0 β align capture start with animation start β record β trim & encode
The invariant: no pixel of the animation should render before capture is ready, AND capture must not start before every asset that affects layout has loaded. Every gotcha below is a violation of that invariant.
Quick checklist (each item is expanded below):
viewportmust exactly equalrecordVideo.sizeβ mismatch silently rescales the output soft/blurry.- Freeze CSS animations via
addInitScriptbeforegoto(). gotowithdomcontentloaded, neverload.- Pre-inline
data-composition-srcsub-scenes βfile://blocks client-sidefetch. - Font wait = stylesheet
<link>load βface.load()per face βfonts.readyβ 2 rAFs. - Probe duration with infinite-iteration /
repeat: -1guards. - Unfreeze = t=0; trim
leadInMs β 120mswith-ssbefore-i. - Concat: same engine β demuxer
-c copy; mixed engines β concat filter + re-encode. - Verify with ffprobe duration + full decode + sampled frames. Always.
There are two capture modes, and picking the wrong one wastes a day:
- Mode A β real-time
recordVideo(the phases below). Simple, wall-clock = clip length. But the screencast is best-effort variable frame rate (~25fps) and competes with the animation for CPU. Good enough for previews and β€30fps deliverables on an idle machine. - Mode B β deterministic frame stepping (pause everything, seek to
i / fps, screenshot, encode the PNG sequence). Exact fps, every frame rendered, no lead-in trim, immune to machine load. Required when the output must be genuinely smooth β₯30fps or renders run on loaded CI. See "Deterministic frame stepping" below.
Prerequisites β install these first
Two hard requirements: a headless browser driver (Playwright or Puppeteer) and ffmpeg. Everything below assumes both are installed and on PATH.
1. Headless browser driver
Playwright is the default in this skill (its recordVideo API is what the pipeline is written against). Puppeteer works too but you'll wire recording yourself via CDP screencast β pick Playwright unless you have a reason not to.
# Playwright (recommended) β npm / pnpm / bun all work
npm install playwright
pnpm add playwright
bun add playwright
# Then install the actual browser binaries (this is the step people forget):
npx playwright install chromium # just Chromium β enough for this pipeline
npx playwright install --with-deps chromium # Linux/CI: also install shared libs
Verify: npx playwright --version prints the driver version, and node -e "require('playwright').chromium.launch().then(b => b.close())" exits cleanly.
Puppeteer alternative (only if you already have it in the project):
npm install puppeteer # bundles a matching Chromium automatically
# or, to reuse a system Chrome:
npm install puppeteer-core # no bundled browser β you supply executablePath
2. ffmpeg
The encode/trim/concat/verify steps all shell out to ffmpeg (and ffprobe, which ships in the same package). It is not an npm dependency β install it at the OS level.
# macOS
brew install ffmpeg
# Debian / Ubuntu
sudo apt-get update && sudo apt-get install -y ffmpeg
# Fedora / RHEL
sudo dnf install ffmpeg # requires RPM Fusion enabled
# Windows
winget install Gyan.FFmpeg # or: choco install ffmpeg
Verify: ffmpeg -version and ffprobe -version both print. If a script spawns ffmpeg and gets ENOENT, the binary isn't on PATH β see the graceful-failure snippet in references/ffmpeg-cheatsheet.md.
Do not rely on the ffmpeg-static / @ffmpeg-installer/ffmpeg npm packages for production: their bundled builds skip codecs and encoder flags you'll hit sooner or later (e.g. libx264 presets, tpad). A system ffmpeg is the durable choice.
3. Optional β ImageMagick (verification only)
Only needed if you want th
FAQ
What tools does it use?
It uses a headless browser such as Playwright or Puppeteer for recording, and ffmpeg for encoding.
Why does the video sometimes come out wrong?
The skill lists common causes, such as mismatched viewport sizes, late font loading, and animations starting before capture.
Does it verify the final file?
Yes. The skill includes verification steps to check the output.
Details
Original description by the author
Reliable HTML-to-MP4 rendering via headless browser recording (Playwright/Puppeteer) + ffmpeg β the ordering, gotchas, and verification steps you MUST get right or the output silently rots. Trigger whenever the user is building or debugging any pipeline that turns an HTML/CSS/JS page (single-file, multi-composition, GSAP-driven, or `@keyframes`-driven) into a video file, including headless recording, screen capture of a web page, deterministic frame-by-frame capture, multi-scene concatenation, or engine-mixed video output. Also trigger when the symptom sounds like: font swap flashing in the op
repo: XiaomiMiMo/MiMo-Code
Popularity
- GitHub stars
- 14k
- Ranking position
- #11328
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
effect
14kHelps your agent answer questions about the Effect TypeScript framework by checking its source code and docs instead of relying on memory.
arxiv
14kHelps your agent search, read, cite, and track academic papers on arXiv, including abstracts, BibTeX citations, PDF downloads, and citation links.
claude-code
14kHelps your agent hand a coding task to the Claude Code command line tool, as a one-shot run, an interactive session, or a background job.
codex
14kHelps your agent run the OpenAI Codex command line tool without a chat window, for coding tasks, scripts, and automated pipelines.
Similar skills
taste-application
280kHelps your agent create videos in a specific style. It can copy the editing rhythm from a reference video, generate new scenes, adjust colors, and edit everything together with other footage.
taste-distillation
280kLets your agent analyze videos to create a style pack. This includes colors, cutting rhythm, and visual elements that can be reused to create new videos with the same look.
ui-demo
280kHas your agent record polished UI demo videos. Useful for creating tutorials or showing how a web app works.