caption-animation
This skill should be used when the user asks to "add animated captions", "make TikTok captions", "karaoke captions", "word-by-word subtitles", "auto subtitles", "highlight the active word", "burn in captions to a video", "sync captions to a voiceover/narration", or "turn an SRT/transcript into animated text". Covers word-level timing from Whisper, per-word pop/scale-in, active-word highlight, 9:16 safe-area placement, readable type, and burn-in vs sidecar SRT/VTT.
1How It Works & Mechanism
Establishes "word-level timestamps" as a non-negotiable rule, explicitly rejecting the most common lazy shortcut (evenly dividing sentence duration across words).
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.
Locks the pipeline into a six-stage table (transcription → normalization → pagination → animation → placement → export), designating specific tools for each stage to prevent agent improvisation.
| Transcribe | Audio → word-level timestamps | Whisper (`@remotion/install-whisper-cpp`), AssemblyAI |
Enforces a single data shape across the entire lifecycle: `{text, startMs, endMs}`, normalizing all sources (Whisper / SRT / Cloud API) into it.
type Token = { text: string; startMs: number; endMs: number };
Anchors each word's pop animation to its own startMs, utilizing Remotion spring overshoot to deliver a lively, organic feel.
const enter = (token.startMs / 1000) * fps; // word's own entrance frame
Defines pagination rules: 1–4 words per page, switching between two pacing dynamics using combineTokensWithinMilliseconds.
and tune `combineTokensWithinMilliseconds`: ~200–500ms for true word-by-word, ~1000–1500ms for short readable phrases.
Specifies legibility and safe-area guidelines as concrete numeric tables (56–80px font size, stroke, 62–70% vertical center band, avoiding bottom ~280px) rather than qualitative adjectives.
| Size | 56–80px (≈8% of frame height), min 45px | Legible muted on a phone |
Delivery discipline: Burn in captions for social platforms while exporting SRT/VTT from the exact same tokens to satisfy accessibility requirements.
Emit both: burn the animated captions for social, and write a plain SRT/VTT from the same tokens for accessible/SEO playback.
The deliver-and-verify loop relies on "human inspection of rendered still frames prior to encoding" rather than unit tests: frame-level checklist mandates that "the highlighted word at frame 90 must be the one covered by [startMs, endMs]".
the word highlighted at frame 90 is the word whose [startMs,endMs] contains 90/fps (no drift)
The reference provides complete, end-to-end runnable code (Whisper installation, SRT parsing, pagination, SRT/VTT export, platform safe areas, typographic specifications).
# Word-Timed Captions — End-to-End Build
Offers both offline and cloud routes on the transcription side (cloud appears only as a single-line alternative in reference).
npx @remotion/install-whisper-cpp # one-time: installs whisper.cpp + a model
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| 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(系统依赖) |
4Recommended Governance & Evidence
- scripts/: Local script or command execution: `npx @remotion/install-whisper-cpp`: One-time installation of whisper.cpp and model files into the project directory (offline transcription path)
- 网络端点: External network access declaration: (Optional, non-default) When selecting AssemblyAI / Deepgram / OpenAI Whisper API, user audio assets leave the local machine to third-party transcription services; re
- 本地工作目录: File I/O and artifact generation: Remotion projects (src/, Root/Composition, zod schema) constructed by the agent under this skill, along with out/capti
5Second-Pass Verification
- [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
6Verdict & Scenarios
1b958f9e09758504…