1实现原理 · 为什么它能做到
把「词级时间戳」写成不可谈判规则,并直接否掉最常见的偷懒做法(把句子均分到时长)。
1. **Word-level timing, not line-level.** Karaoke reads as magic only when each word lands on the syllable. Always transcribe to word timestamps; never fake them by splitting a line evenly over its duration — drift is instantly visible.
管线被钉成六段表格(转写→归一化→分页→动画→放置→导出),每段指定具体工具,避免 agent 自由发挥。
| Transcribe | Audio → word-level timestamps | Whisper (`@remotion/install-whisper-cpp`), AssemblyAI |
全流程只有一个数据形状:`{text, startMs, endMs}`,一切来源(Whisper / SRT / 云 API)都归一到它。
type Token = { text: string; startMs: number; endMs: number };
每个词的 pop 动画锚定它自己的 startMs,用 Remotion spring 的过冲做出「活着」的手感。
const enter = (token.startMs / 1000) * fps; // word's own entrance frame
分页规则:一次 1–4 词,用 combineTokensWithinMilliseconds 在两档手感之间切换。
and tune `combineTokensWithinMilliseconds`: ~200–500ms for true word-by-word, ~1000–1500ms for short readable phrases.
可读性与安全区被写成硬数字表(字号 56–80px、描边、居中带 62–70%、避开底部 ~280px),而不是形容词。
| Size | 56–80px (≈8% of frame height), min 45px | Legible muted on a phone |
交付纪律:烧录字幕给社交平台,同时从同一批 token 导出 SRT/VTT 以满足可访问性。
Emit both: burn the animated captions for social, and write a plain SRT/VTT from the same tokens for accessible/SEO playback.
验证回路(deliver-and-verify)不是跑测试,而是「先出静帧人工读图、再编码」:帧级检查项写明「第 90 帧高亮的词必须是被 [startMs,endMs] 覆盖的那个」。
the word highlighted at frame 90 is the word whose [startMs,endMs] contains 90/fps (no drift)
reference 把端到端可运行代码补齐(Whisper 安装、SRT 解析、分页、SRT/VTT 导出、平台安全区、字号规格)。
# Word-Timed Captions — End-to-End Build
转写侧给出离线与云端两条路(云端仅在 reference 里作为一行替代方案出现)。
npx @remotion/install-whisper-cpp # one-time: installs whisper.cpp + a model
2核心能力
3外部依赖
| 类型 | 依赖 |
|---|---|
| cli | npx remotion still / render / compositions |
| package | @remotion/captions(createTikTokStyleCaptions / Caption 类型) |
| cli | npx @remotion/install-whisper-cpp(一次性装 whisper.cpp + 模型) |
| api | AssemblyAI / Deepgram / OpenAI Whisper API(可选云转写替代,非默认路径) |
| cli | scripts/contact-sheet.sh + scripts/probe-mp4.sh(仓库根共享验证工具箱) |
| package | ffmpeg / ffprobe(系统依赖) |
4风险提醒 风险提醒:蓝色 · 知晓即可
- 云转写替代路径会让音频素材出网(触发条件式橙档) — reference §2 把 AssemblyAI / Deepgram / OpenAI Whisper API 列为替代方案:一旦选用,用户音频被送往第三方且需自备 API key。默认路径(本地 whisper.cpp)不触发,但若环境无本地模型又赶时间,agent 可能自发选择云路径——建议在提示中固定「只用本地 Whisper」。
- 首次安装会拉远程包与模型 — `npx @remotion/install-whisper-cpp` 一次性下载 whisper.cpp 与模型文件(体积不小),`npx remotion` 亦从 npm 取包;离线或受限网络环境下这一步会失败,且版本未 pin 在仓库内。
- 转写质量决定成败,但 skill 无法保证输入音频质量 — SKILL.md 自称「Karaoke reads as magic only when each word lands on the syllable」,而 reference 的 tip 也承认「Background music wrecks word boundaries」;带 BGM 的素材需要用户先分轨/降噪,skill 无此能力。
- 跨包协作依赖:读者若只安装本 skill 目录而漏掉仓库根 scripts/,contact-sheet/probe-mp4 的引用会悬空 — SKILL.md 以相对路径 `scripts/contact-sheet.sh` 调用仓库根脚本;单目录安装(只拷贝 skills/caption-animation)会得到不存在的路径。安装方式需包含整个 repo。
- 性能与精度声明无据 — 「medium.en ≈ 2x faster than large」等为文档声明,仓库内无基准数据(见 second_pass 的 unlocatable 条)。
5第二遍独立确认
- [ok] skill 目录内是否真的没有可执行代码(档位判定的关键证据) — `find iart-tiktok-video-skills/skills/caption-animation -type f` 只列出 SKILL.md / references/word-timed-captions.md / README.md;目录内没有 .mjs/.sh/.ts 等可执行文件。SKILL.md 引用的 scripts/*.sh 实际位于**仓库根**(三仓库各一份),并非 skill 目录内资产——本报告按「SKILL.md 明列的使用路径」把它们计入 scripts_executed,但档位判定仍以 skill 目录内行为为主,两者结论一致(蓝)。
- [ok] 全部外链是否只是文档链接而非运行时端点 — 对 skills/ 全域 grep `https?://`(排除 iart.ai)零命中;唯二命中是 reference 与 README 末尾的 `https://iart.ai/?utm_source=github&utm_medium=…` 营销/引流链接,以及 skill 内代码里的 `file://`? 无。因此不存在「执行期外发」。
- [ok] 云转写替代路径是否构成现实风险(要不要升橙) — reference §2 原文只有一行:`- Cloud alternatives (AssemblyAI, Deepgram, OpenAI Whisper API) also return word timing — map their words[] into Token the same way.`,SKILL.md 管线表也只在工具列把 AssemblyAI 与 Whisper 并列。源码未规定任何 endpoint、key 读取方式或上传动作;默认路径是本地 whisper.cpp。按批4 细则2(可选的替代方案不判级)维持蓝档,但已在 risks 写明触发条件。
- [ok] 验收断言的措辞是否与 reference 的实现一致(防第一遍想当然) — SKILL.md 要求「第 90 帧高亮的词必须是覆盖 90/fps 的 token」;reference §5 的窗口组件正是 `active={now >= t.startMs && now < t.endMs}`(now = frame/fps×1000 系);两侧同一判据,无漂移空间。
- [unlocatable] 性能声明「Whisper medium.en ≈ 2x faster than large」是否有据可查 — 仓库内无基准脚本、无数据文件、无引用来源;本次为只读侦查且不得运行转写,故不验证该倍数,仅作为文档声明记录,不作为结论。
- [discrepancy] light tier(seek-shot.sh + `?t=N` harness)对本 skill 是否可用 — scripts/README.md 把 seek-shot.sh 标为 Light tier(驱动页面的 `?t=N` seek harness),但 caption-animation 的 Web/CSS 路径(reference §6 的 renderTrack)只做 track 渲染,**没有提供 seek harness**;本 skill 的「Packaged helper」行也只点名 contact-sheet.sh 与 probe-mp4.sh(Heavy tier),未提 seek-shot.sh。结论:该脚本对本 skill 属仓库级通用件而非本 skill 承诺的能力,读者不应假定 light tier 可用——这是对 pin commit 有效的真实出入(非错误声明,因 SKILL.md 从未承诺)。
- [ok] 三仓库共享脚本是否同内容(跨包一致性) — 三仓库 scripts/ 逐字节相同:contact-sheet.sh b7dcc28034c9bf8fda5d48683e54d8b5、probe-mp4.sh 167b7977c50f492014e1a6fef8c9ed12、seek-shot.sh 24a4130cd1e64874154429b0b4af12da
6结论
1b958f9e09758504…2a775336b5