html-to-video-pipeline
できること
このスキルは、アニメーションするWebページを動画ファイルに録画する方法を示します。HTMLでモーショングラフィックスや解説動画を作り、出力を正しくしたい人向けです。
使う場面
- ✓アニメーションするWebページを、MP4動画にしたいとき。
- ✓書き出した動画のタイミングがずれたり、文字がぼやけたり、最初に長い空白があったりするとき。
- ✓ヘッドレスブラウザでHTMLのアニメーションを録画するパイプラインを作るとき。
スキルのリンク
https://github.com/XiaomiMiMo/MiMo-Code/blob/main/packages/cli/src/skill/builtin/.bundle/html-to-video-pipeline/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“アニメーションするHTMLのタイトルカードを、きれいなタイミングの10秒のMP4動画にしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、ヘッドレスブラウザでページを録画し、冒頭を切り取ります。そのあとffmpegで結果をエンコードします。使う前に、出力の長さと品質を確認します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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
よくある質問
どのツールを使いますか?
録画にはPlaywrightやPuppeteerなどのヘッドレスブラウザを、エンコードにはffmpegを使います。
動画がおかしくなるのはなぜですか?
ビューポートのサイズの不一致、フォントの読み込みの遅れ、キャプチャ前にアニメーションが始まることなど、よくある原因を挙げています。
最終ファイルは確認しますか?
はい。出力を確かめる検証の手順が含まれています。
詳細
作者による元の説明
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
人気
- GitHubのスター
- 14k
- ランキング
- #11328
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
effect
14kエージェントが、Effect TypeScriptフレームワークに関する質問に、記憶に頼らず、ソースコードとドキュメントを確認して答えられるよう支援します。
arxiv
14kエージェントが、arXivの学術論文を検索、閲覧、引用、追跡できるよう支援します。要約、BibTeXの引用、PDFのダウンロード、引用リンクを扱います。
claude-code
14kエージェントが、Claude Codeのコマンドラインツールにコーディング作業を任せられるよう支援します。一回だけの実行、対話セッション、バックグラウンドのジョブのいずれにも対応します。
codex
14kエージェントが、チャット画面なしでOpenAI Codexのコマンドラインツールを実行できるよう支援します。コーディングの作業、スクリプト、自動化されたパイプラインに使えます。
似ているスキル
taste-application
280kエージェントが、特定のスタイルの動画を作成するのを助けます。参考動画の編集のリズムを真似したり、新しいシーンを生成したり、色味を調整したりして、他の素材と合わせて編集できます。
taste-distillation
280kエージェントが動画を分析して、スタイルパックを作成できるようにします。色味、カットのリズム、ビジュアル要素などを含み、同じ雰囲気の新しい動画を作るときに再利用できます。
ui-demo
280kエージェントに、洗練されたUIのデモ動画を録画させます。チュートリアルの作成や、Webアプリの動作の紹介に役立ちます。