video-explainer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Video Explainer

视频讲解器

Input: a topic, article, codebase, or rough notes. Output: a single
renders/<slug>-vN.mp4
at 1920x1080 (
16:9
) and 30 fps (or
9:16
/
1:1
when requested), plus the
script.md
,
media/
, and
graphics/
files that produced it (pass
--share
to
render.py
only when a smaller 720p copy in
renders/share/
is requested).
You write the script, narration, and scene code; the scripts fetch media, synthesize voice, align words, compile HyperFrames, render MP4, run 10-check QA, and serve the review page. Commands,
script.md
syntax, engine APIs, and
style.json
keys live in reference.md.
On first use, run
setup.sh
(or
setup.sh --voice
when using spoken narration). If tools are missing, list them and ask before installing. Put optional
GEMINI_API_KEY=...
in
~/.config/video-explainer/.env
rather than chat.
输入:主题、文章、代码库或粗略笔记。输出:一个
renders/<slug>-vN.mp4
文件,分辨率为 1920x1080(
16:9
)、帧率为 30 fps(用户另有要求时为
9:16
/
1:1
),以及生成该视频的
script.md
、
media/
和
graphics/
文件(仅当用户请求在
renders/share/
中生成较小的 720p 副本时,才向
render.py
传入
--share
)。
你负责编写脚本、旁白和场景代码;这些脚本负责获取媒体、合成语音、对齐词语、编译 HyperFrames、渲染 MP4、执行 10 项检查 QA,并提供评审页面。命令、
script.md
语法、引擎 API 和
style.json
键都记录在 reference.md 中。
首次使用时,运行
setup.sh
(使用口播旁白时运行
setup.sh --voice
)。如果缺少任何工具,先列出工具并征得同意后再安装。可选的
GEMINI_API_KEY=...
应放在
~/.config/video-explainer/.env
中,而不是放在聊天里。

1. Pick a visual mode

1. 选择视觉模式

Support three visual modes (
Mode:
in
script.md
, default
motion
):
  1. Motion (default) (
    Mode: motion
    ): Full-frame 2D kinetic graphics, live SVG routes and charts, CSS 3D cards or devices, and documentary press clippings on
    ExplainerStage
    . Fastest and cheapest.
  2. Illustrated (
    Mode: illustrated
    ): Hand-drawn picture-book animation with gouache, pastel, paper grain, 10 fps line boil, and word-synced characters on
    StoryBrush
    and
    IllustratedStage
    . Uses about 6x the tokens of Motion.
  3. 3D (
    Mode: 3d
    ): Single-take Three.js camera flythroughs with studio lighting, bloom, camera-facing labels, and optional Blender meshes on
    Studio3D
    . Uses about 7x the tokens of Motion.
If the user already named a mode or asked to run with defaults, proceed immediately (
Mode: motion
, captions on). Otherwise, show the numbered list above with its token costs, ask whether they want burned-in captions (on by default), and wait for their reply before building.
支持三种视觉模式(
script.md
中的
Mode:
,默认值为
motion
):
  1. Motion(默认)(
    Mode: motion
    ):全屏 2D 动态图形、实时 SVG 路径与图表、CSS 3D 卡片或设备,以及
    ExplainerStage
    上的纪实报刊剪报。速度最快,成本最低。
  2. Illustrated(
    Mode: illustrated
    ):手绘绘本式动画,采用水粉画、粉彩、纸张纹理、10 fps 的 line boil,以及
    StoryBrush
    和
    IllustratedStage
    上与词语同步的角色。token 用量约为 Motion 的 6 倍。
  3. 3D(
    Mode: 3d
    ):使用 Three.js 摄像机一镜到底地穿越场景,配以工作室灯光、bloom、始终面向摄像机的标签,以及
    Studio3D
    上可选的 Blender 网格模型。token 用量约为 Motion 的 7 倍。
如果用户已指定模式或要求使用默认设置直接运行,请立即继续(
Mode: motion
,字幕开启)。否则,显示上述带编号的列表及其 token 成本,询问用户是否需要烧录字幕(默认开启),并等待用户回复后再开始制作。

2. Research, source media, and write
script.md

2. 调研、获取媒体并编写
script.md

Create one project folder named with a short slug (
graphics/
,
media/
,
captures/
) where the user asks, else
projects_dir
from
style.json
, else the current folder.
Verify every claim, number, quote, and step against the user's files or primary sources. Pull real photos, product visuals, clips, or page captures when they ground the story (
media.py image
,
media.py clip
,
capture.py
), and inspect each downloaded image so broken or irrelevant assets stay out of the render. Write
script.md
:
  • Keep runtime to 60 to 75 seconds (2-minute cap). Target
    135 to 185
    spoken words across
    5 to 8
    scenes when voiced, or
    8 to 12
    beats when
    Voice: none
    (
    45 to 60s
    /
    100 to 150
    words for
    Audience: eli5
    ). Stay at or under
    120s
    (
    ~260
    words). When the user asks for another length, write about 2.5 spoken words per second of it and set
    Max duration: <seconds>
    . Cut tangents rather than rushing speech.
  • Default to
    Audience: general
    (smart non-engineer).
    Use plain English, concrete mental models, and everyday cause-and-effect without raw file paths, internal variable or function names, error codes, CLI flags, or unexplained acronyms in speech or visuals. Switch to
    eli5
    (physical metaphors, zero jargon) or
    technical
    (architecture names, protocols, tradeoffs) only when requested.
  • Land the hook in 3 seconds and follow one example end-to-end. Open with a concrete question, tension, or number that reads with the sound off, trace one specific request, dollar, star, or user through every step, and close by answering the opening question.
  • Write clean spoken copy. Skip throat-clearing openers, binary contrasts, colon reveals, and hype adjectives. Use short sentences and active verbs.
  • Set audio and theme headers:
    Mode: motion | illustrated | 3d
    ,
    Audience: general
    ,
    Voice: kokoro:af_heart
    (or
    gemini:Kore
    , an audio file, or
    none
    ),
    Music: synth:cosmic
    (
    synth:warm
    ,
    synth:minimal
    , path, or
    none
    ),
    Sound effects: on
    with word-anchored
    ## Sound
    cues (
    - @s05:iron: rumble 0.8
    ),
    Captions: auto
    (or
    off
    when the user turned them off), and
    Style: default | paper | blueprint
    .
Go straight from
script.md
into narration, graphics, QA, and the browser review page unless the user asked to approve the script first or requested a paid Gemini API call without a configured key.
在用户指定的位置创建一个以简短 slug 命名的项目文件夹(包含
graphics/
、
media/
、
captures/
);如果未指定,则使用
style.json
中的
projects_dir
;再否则使用当前文件夹。
对照用户文件或一手来源核实每一项主张、数字、引述和步骤。当真实照片、产品图、视频片段或页面截图有助于支撑叙事时,获取这些素材(
media.py image
、
media.py clip
、
capture.py
),并逐张检查下载的图片,避免损坏或与主题无关的素材进入渲染。编写
script.md
:
  • 将时长控制在 60 至 75 秒(上限 2 分钟)。 有配音时,目标是在
    5
    至
    8
    个场景中讲
    135
    至
    185
    个口语词;使用
    Voice: none
    时,设置
    8
    至
    12
    个节拍;使用
    Audience: eli5
    时,保持在
    45
    至
    60s
    /
    100
    至
    150
    个词。总时长保持在
    120s
    (约
    260
    个词)以内。当用户要求其他长度时,按每个所要求秒数约 2.5 个口语词撰写,并设置
    Max duration: <seconds>
    。应删减旁支内容,而不是加快语速。
  • 默认使用
    Audience: general
    (面向具备理解力、但非工程背景的受众)。
    使用通俗易懂的语言、具体的心智模型和日常因果关系;在语音或画面中不要出现原始文件路径、内部变量或函数名、错误码、CLI 标志或未加解释的缩写。仅在用户要求时切换为
    eli5
    (使用物理类比,完全不用行话)或
    technical
    (使用架构名称、协议和权衡)。
  • 在前 3 秒内用钩子抓住注意力,并从头到尾讲透一个具体示例。 用一个具体的问题、冲突点或数字开场,即使静音观看也能理解;贯穿追踪一个具体请求、金额、星标或用户的每一步;最后回到并回答开篇的问题。
  • 编写简洁、自然的口语稿。 跳过清嗓式开场、二元对比、冒号式揭示和炒作性形容词。使用短句和主动语态。
  • 设置音频和主题标头:
    Mode: motion | illustrated | 3d
    、
    Audience: general
    、
    Voice: kokoro:af_heart
    (或
    gemini:Kore
    、音频文件或
    none
    )、
    Music: synth:cosmic
    (
    synth:warm
    、
    synth:minimal
    、路径或
    none
    )、
    Sound effects: on
    ,并添加以词语为锚点的
    ## Sound
    提示(
    - @s05:iron: rumble 0.8
    )、
    Captions: auto
    (用户关闭字幕时使用
    off
    ),以及
    Style: default | paper | blueprint
    。
除非用户要求先审批脚本,或要求使用未配置 key 的付费 Gemini API 调用,否则完成
script.md
后直接进入旁白、图形、QA 和浏览器评审页面流程。

3. Narrate and align

3. 配音并对齐

Run
narrate.py
to synthesize cached per-scene audio, trim dead air, align words with Parakeet, sync
start
and
end
times back into
script.md
, and write
work/transcript.md
. Read
work/transcript.md
before coding graphics so animations and sound cues hit exact spoken words via
stage.cue("s03", "keyword", 1.2)
.
运行
narrate.py
以合成按场景缓存的音频,修剪静音空白,使用 Parakeet 对齐词语,将
start
和
end
时间同步回
script.md
,并写入
work/transcript.md
。在编写图形代码前阅读
work/transcript.md
,这样可通过
stage.cue("s03", "keyword", 1.2)
让动画和音效提示精确对应实际说出的词语。

4. Build graphics efficiently

4. 高效构建图形

Point consecutive rows in
## Scenes
at
graphics/world.html
so
build.py
mounts one continuous composition and auto-injects
stage.css
,
stage.js
,
explainer-data.js
, plus
illustrated.js
(
Mode: illustrated
) or
three.min.js
and
studio3d.js
(
Mode: 3d
).
Build in one agent; the engines are designed for it. The engine APIs and a starter composition per mode are in reference.md.
  • Build on the engines. Use
    ExplainerStage
    ,
    StoryBrush
    /
    IllustratedStage
    ,
    Studio3D
    , and
    blender_export.py
    instead of writing your own noise, shaders, or mesh packers.
  • Make it a moving film, never slides. One hero visual fills 60 to 85% of the frame and visibly transforms every 2 to 3 seconds: the camera dives, pans, or draws a live path, and objects morph rather than swap. Cards or text on a flat background with no moving hero visual read as a slide deck. Save the built-in single-beat visuals (
    card:
    ,
    flow:
    ,
    number:
    , and the rest) for one-off moments.
  • Keep labels readable. Callouts are 1 to 4 words (
    28px+
    labels,
    88px to 160px
    hero numbers) with WCAG AA contrast, above the caption band (
    y < 860
    on
    16:9
    ,
    y < 1400
    on
    9:16
    ).
  • Spend tokens where they show (Illustrated and 3D). Pick one setting and move the camera through it instead of building a new world per scene. In Illustrated, bake each prop and character once and reuse it across scenes. In 3D, use procedural meshes and turn to Blender only when sculpted or fractured geometry clearly adds value.
  • Keep every frame deterministic on seek. Bind updates to
    stage.onTick
    /
    stage.onDraw
    and end with
    .finalize()
    . Load 3D assets synchronously. Skip
    Math.random()
    and CSS
    transform
    rules on GSAP-animated elements, and put
    data-layout-allow-overflow
    on full-bleed
    <canvas>
    or offscreen art.
让
## Scenes
中连续的行都指向
graphics/world.html
,这样
build.py
就能挂载一个连续构图,并自动注入
stage.css
、
stage.js
、
explainer-data.js
,以及
illustrated.js
(
Mode: illustrated
)或
three.min.js
和
studio3d.js
(
Mode: 3d
)。
在一个 Agent 中完成构建;这些引擎正是为此设计的。引擎 API 和每种模式的起始构图见 reference.md。
  • 基于引擎构建。 使用
    ExplainerStage
    、
    StoryBrush
    /
    IllustratedStage
    、
    Studio3D
    和
    blender_export.py
    ,而不是自行编写 noise、shader 或 mesh packers。
  • 让它成为一部会动的影片,而不是幻灯片。 一个主视觉应占据画面的 60% 至 85%,并且每 2 至 3 秒都要有明显变化:摄像机推进、平移或绘制实时路径,对象要发生变形,而不是直接替换。如果平面背景上只有卡片或文字、没有动态主视觉,就会像幻灯片。内置的单节拍视觉(
    card:
    、
    flow:
    、
    number:
    等)只适合偶尔使用。
  • 保持标签清晰可读。 标注文字控制在 1 至 4 个词(标注为
    28px+
    ,主视觉数字为
    88px
    至
    160px
    ),达到 WCAG AA 对比度,并放在字幕带上方(
    16:9
    下为
    y < 860
    ,
    9:16
    下为
    y < 1400
    )。
  • 把 token 花在能被看见的地方(Illustrated 和 3D)。 选择一个场景设定,并让摄像机在其中移动,而不是每个场景都构建一个新世界。在 Illustrated 中,每个道具和角色只烘焙一次,然后在各场景中复用。在 3D 中,优先使用程序化网格;只有当雕刻或碎裂几何体能明显增加价值时,才使用 Blender。
  • 确保每次跳转时每一帧都确定一致。 将更新绑定到
    stage.onTick
    /
    stage.onDraw
    ,并以
    .finalize()
    结束。同步加载 3D 资产。不要在 GSAP 动画元素上使用
    Math.random()
    或 CSS
    transform
    规则;对于全屏
    <canvas>
    或超出画布的艺术元素,添加
    data-layout-allow-overflow
    。

5. Preview, draft, QA, review, and final

5. 预览、草稿、QA、评审和最终交付

  1. Token-light pre-flight: Run
    render.py "$P" --preview
    (~3s) and inspect the single tiled
    work/preview/contact.jpg
    first to catch framing, contrast, or whiteout bugs. Open individual
    work/preview/frame-*.png
    files only when diagnosing a specific beat.
  2. Draft and QA: Run
    render.py "$P" --draft
    and
    qa.py "$P"
    . Fix any failed check (
    10/10
    required) and inspect
    work/qa/contact.jpg
    and
    work/qa/opening.jpg
    (plus
    work/qa/cuts/*.jpg
    only around suspect transitions).
  3. Fresh-eyes check before the user sees it:
    qa.py
    measures motion, not whether the video looks like slides. Give
    work/qa/contact.jpg
    and
    work/qa/opening.jpg
    to a fresh subagent with only the mode and the hook line (judge them yourself if your agent has no subagents), and ask: Does any frame read as a slide, meaning text or cards on a flat background with no moving hero visual? Do the first 15 seconds open on a striking visual that changes every 2 to 3 seconds? Does any art look like generic clip art? Fix every yes, re-render the draft, and check again.
  4. Browser review loop: Start
    review.py "$P"
    in a background shell, share its URL, and run
    review.py --poll "$P/work"
    in the foreground. Apply feedback, re-run
    narrate.py
    only if spoken words changed, render
    --draft
    , refresh with
    review.py "$P" --no-open
    , run
    review.py --ack "$P/work" BATCH_ID
    , and poll again until approved.
  5. Final delivery: Run
    render.py "$P"
    and
    qa.py "$P"
    , verify eval.md, ask the user to check voice pacing and mix balance, and report the final
    .mp4
    path, duration, and loudness. Offer to save custom theme/caption tweaks to
    ~/.config/video-explainer/style.json
    .
  1. 低 token 成本的预检: 运行
    render.py "$P" --preview
    (约 3 秒),先检查单张拼贴总览图
    work/preview/contact.jpg
    ,以发现构图、对比度或画面泛白等问题。仅在诊断某个特定节拍时,才打开单独的
    work/preview/frame-*.png
    文件。
  2. 草稿和 QA: 运行
    render.py "$P" --draft
    和
    qa.py "$P"
    。修复所有未通过的检查(要求
    10/10
    ),并检查
    work/qa/contact.jpg
    和
    work/qa/opening.jpg
    (仅在可疑转场附近查看
    work/qa/cuts/*.jpg
    )。
  3. 在用户看到之前进行“新鲜视角”检查:
    qa.py
    衡量的是动态效果,而不是视频看起来是否像幻灯片。让一个全新的 subagent 查看
    work/qa/contact.jpg
    和
    work/qa/opening.jpg
    ,且只提供模式和钩子台词(如果你的 agent 没有 subagent,则自行判断),然后询问:任何一帧是否会被读作幻灯片,即平面背景上只有文字或卡片而没有动态主视觉?前 15 秒是否以令人印象深刻的视觉开场,并每 2 至 3 秒发生变化?任何美术是否像通用剪贴画?修复每一个答案为“是”的问题,重新渲染草稿,再次检查。
  4. 浏览器评审循环: 在后台 shell 中启动
    review.py "$P"
    ,分享其 URL,并在前台运行
    review.py --poll "$P/work"
    。应用反馈;仅当口播文字发生变化时重新运行
    narrate.py
    ;渲染
    --draft
    ;使用
    review.py "$P" --no-open
    刷新;运行
    review.py --ack "$P/work" BATCH_ID
    ;然后继续轮询,直至获得批准。
  5. 最终交付: 运行
    render.py "$P"
    和
    qa.py "$P"
    ,核验 eval.md,请用户检查语音节奏和混音平衡,并报告最终
    .mp4
    路径、时长和响度。询问是否将自定义主题和字幕微调保存到
    ~/.config/video-explainer/style.json
    。