1实现原理 · 为什么它能做到
真正的选型面是一张 35 行的身份目录(10 classic DNA + 25 themed),引擎与作者文件由查表推导;SKILL.md 明确禁止把后端引擎名当作问题抛给用户。
**Never surface "Standard vs Cinematic vs Theme" as a question** — those are backend names (a product has one UX even with several engines). The catalog encodes everything routing needs: reading surface, voice, recommend-for, scene needs, adjacency notes for the genuinely-close pairs (loud↔ordnance, neon↔neonsign, cream↔stardust).
字幕被建模成三态:drop(填充词,不显示)/ rail(逐字下三分之一字幕,在前,承载大部分文本)/ embed(被提升的高峰词,合成到主体背后,由抠像产生遮挡)。embed 被规定为稀缺品。
| **rail** | the default — ordinary spoken content (verbatim) | clean lower-third subtitle, **in front**, readable. A punch word can get an inline `emphasis` highlight (accent colour / active-word pop) — it stays on the rail. | | **embed** | a promoted peak — the headline beat | one big word composited **behind the subject** (matte occlusion), designed entrance + exit |
预处理是一条并行命令:抠像 ∥ 转录 ∥ 音频包络 三路同时跑,再串行算 safe-zones——把「手跑三步容易漏」变成一次调用。
# matte.cjs (CPU-heavy ONNX) ∥ transcribe.cjs (whisper) → then safe-zones.cjs # (matte and transcribe are independent; safe-zones needs the matte's frames_fg.) # Replaces hand-running steps 2 / 3 / 3b — one call, nothing forgotten, ~the cost # of the slower of the two instead of their sum.
转录走本地 WhisperX(经 uvx,版本钉死),以 wav2vec2 强制对齐换取词级时间戳,因为下游门禁是 80ms 严格对齐;失败再退到本仓 whisper.cpp。
// Pin whisperx so `uvx` fetches a reproducible build instead of resolving // "latest" on every run (a supply-chain + determinism foot-gun). Override // with $WHISPERX_VERSION if you've validated a different release. const whisperxSpec = `whisperx==${process.env.WHISPERX_VERSION || "3.8.6"}`;
抠像不自带权重,而是 shell 本仓 CLI 的 remove-background(u2net_human_seg),首次运行联网下载约 168MB 到用户缓存目录;VFR 源会先归一化成 CFR 再抠。
const r = cp.spawnSync("node", [hfCli(), "remove-background", matteSrc, "-o", mov], { stdio: ["ignore", "pipe", "pipe"], encoding: "utf8", });
合成阶段用 ffmpeg 把抠像当遮挡层:embed 走「先渲背景+字幕,再用人物 alpha 覆盖」;rail 走「渲成透明 WebM,再叠到最前」;帧率以 matte.fps 为唯一权威以保持帧对齐。
# FPS: matte.fps (written by matte.cjs at the source's NATIVE rate) is authoritative # so the matte overlay stays frame-aligned with the render. Falls back to plan.fps / # frame-count inference / 24. Warn if plan.json fps disagrees with the matte.
几何门禁靠 headless Chromium 的 DOM 矩形 × 抠像 alpha 做像素级判定(遮挡、出框、rail/climax 撞车),并用 --strict 卡 80ms 时间对齐;先出的预览帧只需 ~2s/帧,逼你在付渲染费之前发现版面问题。
`node scripts/preview-frames.cjs <project> [t…]` composites **faithful preview frames in ~2s each** (caption layers screenshotted at seek-time + real video frame + matte occlusion + rail overlay = what the final composite will look like at that moment).
2核心能力
3外部依赖
| Kind | Dependency / Endpoint |
|---|---|
| cli | ffmpeg / ffprobe(系统) |
| cli | hyperframes CLI(init / remove-background / render / lint / check / snapshot / preview) |
| cli | uvx(Python 运行器,按需拉取 whisperx==3.8.6) |
| network | 抠像权重下载(u2net_human_seg.onnx,约 168MB,仅首次) |
| network | GSAP CDN(仅示例渲染与引擎模板 HTML 里引用) |
| package | sharp(图像/alpha 数学)与 puppeteer(版面度量、截图) |
| package | python3(Theme 的 drawon setpiece 在编译期调用 gen-stroke-path.py) |
| cli | hyperframes skills update(自刷新,需网络) |
4管控建议与判定依据
- scripts/: 执行本地脚本或命令: bash scripts/prepare.sh <project>(并行起 node matte.cjs / transcribe.cjs / aud
- 网络端点: 声明外部网络访问: uvx 按需从 PyPI 拉取 whisperx==3.8.6 及其依赖(版本钉死,防『latest』不可复现)
- 本地工作目录: 文件读写与工件输出: <project>/frames_fg/、frames_bg/、matte.fps、audio.mp3、_wx_audio.wav、_wx_out/(
5第二遍独立确认
- [ok] 是否隐藏凭证读取(与同批 HeyGen 系 skill 的差异) — 对整目录 grep `\.heygen|HEYGEN|api[_-]?key|TOKEN|SECRET|keychain|Bearer|Authorization` → 0 命中;process.env 命中 12 处全部是 HYPERFRAMES_ROOT / WHISPER_MODEL / WHISPER_LANG / TRANSCRIBE_ENGINE / WHISPERX_VERSION 等行为开关。『全本地、无凭证』成立。
- [ok] 网络外发是否全部可预期 — 逐条回查:uvx 拉 whisperx(版本钉死 3.8.6,注释明说是为防供应链与不可复现);模型下载由 hyperframes CLI 自管且路径固定在 ~/.cache/hyperframes/;CDN 引用仅在 engine.html / example-renders / _archive 模板内;无其它域名。未发现隐藏上报或遥测。
- [ok] 实现原理与功能声明是否相符 — 'runs locally end to end, including transcription and subject matting' 成立(本地 WhisperX + 本地 ONNX 抠像);'without editing the footage' 成立(Standard/Cinematic 只叠加,脚本注释与 SKILL.md 均强调不调色/不覆盖);唯一被允许改原片的是 Theme 的 PLATE 反应预算,SKILL.md 已显式标注为例外。
- [discrepancy] SKILL.md 的三引擎描述与脚本实际状态不一致(文档漂移) — SKILL.md 开篇仍把 Standard 描述为默认模式('**Standard** (default) builds a clean verbatim **rail** … + an **embed** climax'),并在多处按 rail.html + index.html 描述两轨产出;但同 commit 的 scripts/render-and-composite.sh 第 35-37 行写着 'Standard mode retired 2026-06-12 — rail-surface needs are served by theme DNAs like "anchor"',dna/README.md 第 15-16 行同样写 'Standard/rail mode was retired 2026-06-12',make-composition.cjs 第 253-257 行则在检测到 standard 派生的 plan.json 时直接报错退出。然而 scripts/ 下仍保留完整的 STANDARD 合成分支(第 392 行起 'STANDARD mode (rail + embed) — detected by rail.html')、modes/standard/ 目录与 44 个字体仍在包内。结论:**rail + peak embed 的实现仍在,但文档层(SKILL.md)已落后于引擎层(dna/README、render 脚本注释)**,两处关于『默认模式』的说法互相矛盾。这是对 pin commit 有效的真实出入,非第一遍误读。
- [ok] 『35 身份』等数量声明的准确性 — 实测 CATALOG.md 身份行 = 35;dna/*.json = 10(chrome/cream/documentary/editorial/glitch/ink/keynote/loud/neon/velocity);themes/*.json = 25;references/*.md = 14。与 SKILL.md 自述一致。
- [ok] 门禁是否真的会执行(而非只写在文档里) — render-and-composite.sh 内确实依次调用 check-timing(plan+transcript 存在时)、measure-layout + check-occlusion(plan + frames_fg 存在时)、check-overflow(无 plan 的 custom 模式告警)、check-rail-climax(rail.html 存在时,支持 RAIL_CLIMAX_SKIP=1 覆盖),并把结果汇总进 _gates.txt;与 SKILL.md 的门禁描述对应。
6结论
9cdab9186d817c12…