captions-and-music-bed
Generate, style, preview, and burn captions, and build music/percussion beds with ducking, loop/tail selection, fade-outs, and final silence. Use when captions are requested, captions are out of sync, subtitle style needs approval, background music competes with voiceover, or music must start/end at exact moments.
1How It Works & Mechanism
Hardcoded entry condition: Use strictly after the narration timeline is stabilized—preventing timing authority conflicts with audio-sync-assembly.
Use this skill after the narration timeline is stable.
Dual single-source-of-truth division: Verbiage is sourced from the original user script, while timing is taken from the final music-free narration master; the two remain distinct and never substitute for one another.
- Use the user's script as wording source. - Use the final narration-only master as timing source.
Ironclad caption timing rules: Captions appear at the very first word, only one line is displayed at a time, punctuation and casing are preserved, and silent hooks or silent CTAs show no captions.
Start the caption when the first word is spoken.
Style modifications require a single-frame preview before full burn-in: Pick the most visually dense frame for a static render to tune font size, bounding box opacity, margins, and width prior to burning the entire video.
Preview style before burning the full video when style changes.
Music bed acceptance is judged by being 'audible' rather than merely 'present in the stream': Provides ducking parameters and mixing chains, explicitly mandating raising the bed or lowering thresholds if technically present but inaudible.
If music is "technically there" but inaudible, raise bed or reduce ducking threshold.
Audio source tail strategy: If the source track ends earlier than the video, restart it from a musically viable later section, reserve enough duration without truncating the final beat, apply a smooth fade-out, and preserve user-requested trailing silence.
If the music source ends early, restart from a musically useful tail section.
A ten-step bed construction procedure enumerates subjective volume decisions (source offset, hook level, narration bed level, dense explanation level, ducking behavior across pauses, CTA level, end point, fade-out, limiter mix).
1. Probe source music duration. 2. Pick source start offset.
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| cli | ffmpeg 滤镜链(aresample / aformat / asplit / sidechaincompress / amix / alimiter)用于旁白与音乐床的 ducking 混音 |
| package | ASS(Advanced SubStation Alpha)字幕格式与样式头,由 templates/caption-style.ass 提供起点 |
| package | 仓库根脚本 scripts/build_ass_captions.py(把 JSON/CSV 的 start/end/text 事件展开为单行 ASS,默认每行 ≤58 字符)——本 skill 只点名样式模板未点名该脚本,脚本归属在仓库层 |
| package | 输入素材:用户提供的脚本文本、最终旁白母版、音乐源文件(本地资产,非外部服务) |
| package | 字体 Arial(写死在 ASS 样式行的 Fontname 字段;渲染机无此字体会被 libass 替换字体,影响观感) |
4Recommended Governance & Evidence
- scripts/: Executes local scripts or commands: (Executed by host agent) ffmpeg: caption burn-in and audio mixing chains (aresample/aformat/asplit/sidechaincompress/)
- 本地工作目录: File read/write & artifact generation: ASS caption files under captions/
5Second-Pass Verification
- [ok] 「无外部依赖、素材不出网」是否成立 — 本目录正则扫描零命中 URL/fetch/token;音乐源与脚本均声明为用户提供(Music source rules 只讲 offset/duck/tail)。无上传、无生成服务、无账号额度消耗,不构成橙档。
- [ok] ducking 片段是否是可执行 filter_complex — music-ducking.md 给的是四行完整链(asplit 出 narr/side 经 sidechaincompress 得 ducked 再 amix inputs=2 duration=first 后 alimiter=limit=0.95),参数(threshold=0.028:ratio=4:attack=18:release=260)具体非占位,可原样拼接。
- [ok] ASS 模板能否被仓库脚本直接复用 — templates/caption-style.ass 结构与 scripts/build_ass_captions.py 的 header_from_template 期望一致:脚本取 Dialogue: 之前的部分当 header;模板 [Events] Format 行的字段数(Layer,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text)与脚本输出的 Dialogue 行匹配。
- [discrepancy] 「本 skill 负责生成 ASS」是否被 SKILL.md 声明 — SKILL.md 只给样式起点与规则,未点名 scripts/build_ass_captions.py;把字幕文件从哪来写进脚本清单的是 render-qa-and-surgical-changes 与仓库 README。若只加载本件,agent 需自行决定生成方式(手写 ASS 或调仓库脚本)。
- [discrepancy] 字体依赖是否被声明 — ASS 样式行写死 Fontname=Arial,但 SKILL.md 与 references 均未提示字体缺失风险;Linux 渲染机常无 Arial,libass 会回退替换字体,字号与行宽观感与预览不同。该风险真实存在但文档未覆盖。
- [ok] QA 判据是否可自动验证 — SKILL.md 把听觉/视觉可读列为主判据(Check music is present and audible, not merely technically in the stream.),并给 probe 音频流作为辅助——即承认脚本只能验一半,另一半需人耳/人眼预览。
6Verdict & Scenarios
07c0b567449820c1…