Skip to content
Skillpedia
Video editing14k Β· #11328

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.md

Copy 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

Use this skill to help me: https://github.com/XiaomiMiMo/MiMo-Code/blob/main/packages/cli/src/skill/builtin/.bundle/html-to-video-pipeline/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

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):

  1. viewport must exactly equal recordVideo.size β€” mismatch silently rescales the output soft/blurry.
  2. Freeze CSS animations via addInitScript before goto().
  3. goto with domcontentloaded, never load.
  4. Pre-inline data-composition-src sub-scenes β€” file:// blocks client-side fetch.
  5. Font wait = stylesheet <link> load β†’ face.load() per face β†’ fonts.ready β†’ 2 rAFs.
  6. Probe duration with infinite-iteration / repeat: -1 guards.
  7. Unfreeze = t=0; trim leadInMs βˆ’ 120ms with -ss before -i.
  8. Concat: same engine β†’ demuxer -c copy; mixed engines β†’ concat filter + re-encode.
  9. 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

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills