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外部依赖
| 类型 | 依赖 |
|---|---|
| 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风险提醒 风险提醒:黄色 · 留意使用
- 首次运行的供应链面:联网拉取第三方 Python 包与 ~168MB 模型权重 — uvx 从 PyPI 取 whisperx==3.8.6(版本已钉死,注释自述是为防供应链;但仍是运行期第三方包拉取),hyperframes CLI 首次下载 u2net_human_seg 权重到 ~/.cache。离线/受限网络环境会失败,需要预置缓存。
- 处理的是用户本地原始视频,抠像帧整段落盘 — prepare.sh 会把视频抽成 frames_fg/frames_bg 每帧 PNG(含人物影像)写入项目目录,并有 history/ 迭代快照与 _prepare_*.log。敏感素材需自行管理目录权限与事后清理(SKILL.md 未包含清理步骤)。
- 计算成本高且不可忽视(CPU-only 抠像约 2fps@1080p) — SKILL.md 明确 'budget for it on long clips'(10s 片约 2-3 分钟),渲染期还有 Chromium 挂起问题(脚本用 HF_TIMEOUT_S 与『输出已存在即视为成功』的僵尸进程处理兜底)——长片段会显著变慢,且这套兜底本身是启发式。
- 文档漂移:SKILL.md 仍以 Standard 为默认,引擎侧已宣告其退役 — 见 verification.second_pass 的 discrepancy 条:SKILL.md 与 scripts/render-and-composite.sh / dna/README.md 对『默认模式』说法互相矛盾(retired 2026-06-12),而脚本里 STANDARD 分支仍在。使用者应按 CATALOG.md 选 `anchor` 主题而不是照 SKILL.md 的 Standard 描述操作。
- 内容层提示注入面:转录文本逐词进入模型上下文 — 视频语音转成的 transcript 会被 agent 当长文细读(并判级 hero/rail/drop);若素材含指令式语句,属于把不可信字符串喂进上下文。有『近静音幻觉』与『垃圾转录判退』两条守卫,但无隔离机制。
- 第三方依赖多且重(sharp/puppeteer/ffmpeg/uvx/python3) — 缺任一硬依赖时 SKILL.md 要求 STOP 并问用户而不是静默跳过;实际使用中容易在环境缺件上卡住(尤其 python3 与 uvx)。
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…b8328f9573