OneMoh/html-explainer

把一个主题做成有配音、字幕、封面的讲解分析类视频 —— 全本地、用 HTML 写画面,稳定音画同步。 面向 AI 编程智能体的确定性 HTML → MP4 渲染流水线。

What it solves

Making a narrated explainer video for any topic normally requires either expensive text-to-video models (which generate blurry text and charge per run) or manual editing tools. This project removes both pain points: it lets an AI agent write HTML/CSS animations and renders them deterministically into a real MP4 file — no video-generation model, no API keys for the core pipeline, and no per-minute fees. Every frame looks exactly the same if re-run, and all text stays crisp because the browser paints it.

How it works

You give the agent one sentence (like “make a 1-minute video explaining why the sky is blue”). The skill then guides it through a fixed pipeline:

  1. Research the topic and write a narration script (each fact with a source).
  2. Turn the narration into subtitles and generate speech with either the free edge-tts or Volcengine TTS (better quality, optional API key).
  3. Use word-level timestamps from the TTS to anchor subtitles and animations — no manual sync.
  4. Pick one of 23 visual styles from a catalog, then write one HTML scene per line of narration, using a motion library of 40+ pure-function animation keywords.
  5. Run three pre-render checks (beat references, layout lint, geometric layout check), then render frames by seeking through the animation timeline (not recording the screen) and combine them with ffmpeg.
  6. Generate thumbnails for 16:9, 3:4, and optionally 9:16, and run a quality-control report.

The whole thing runs locally on Python + Node + a browser (Chrome/Edge) + ffmpeg. A 2-minute video takes about 30 minutes in the fastest mode (1080p30), with 4K60 available at 8–12× the work.

Who it’s for

It’s for people who already use AI coding assistants (Claude Code, Codex, WorkBuddy, etc.) and prefer describing visuals in code rather than using motion-design software. It suits batch production of narrated explainer videos from articles or documents, especially when you need reproducible, offline output without usage fees. It is not for live-action editing, talking-head videos, or anyone wanting a drag-and-drop editor.

Highlights

  • No video model involved – visuals are HTML/CSS/GSAP rendered by a real browser, frame by frame, so text is always sharp and output is deterministic.
  • Beat-anchored subtitles – animations are tied to subtitle text, not hardcoded frames; changing the narration auto-resyncs everything.
  • Word-boundary timestamps – uses TTS word-level timing, so Chinese phrases with the same character count but different duration don’t get wrongly interpolated.
  • 23 visual styles + 40+ motion keywords – zero-shot template selection and a pure-function motion library allow arbitrary seeking and consistent rendering.
  • Multi-profile rendering – draft, balanced, final (4K60), master, with 180° shutter motion blur (sampled in linear light) and parallel workers.
  • Three render-time gate checks – beat resolution, frame contracts, geometric layout verification catch silent bugs before output.
  • Fully local and offline – zero API keys for the default path, all dependencies auto-installable, no GPU required.
  • Multi-format covers – 16:9 and 3:4 are re-laid-out separately (not cropped), plus optional 9:16.

Related

  • Project
  • Project
  • Project
  • Project