subtitle-skill
Deterministic subtitle validation, SRT/WebVTT generation, and video caption burn-in. Given an already-decided, typed subtitle document (cue text, timing, optional speaker/style), validate its timeline, generate an SRT or WebVTT file, or burn it into a video by delegating to ffmpeg-skill's caption tool. Use this skill only after another agent has already decided what the subtitle cues should say and how they should be split -- it performs no transcription, no diarization, no cue-splitting judgement, and no "does this look right" visual check.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- subtitle-skill
- description
- Deterministic subtitle validation, SRT/WebVTT generation, and video caption burn-in. Given an already-decided, typed subtitle document (cue text, timing, optional speaker/style), validate its timeline, generate an SRT or WebVTT file, or burn it into a video by delegating to ffmpeg-skill's caption tool. Use this skill only after another agent has already decided what the subtitle cues should say and how they should be split -- it performs no transcription, no diarization, no cue-splitting judgement, and no "does this look right" visual check.
02 资源文件 36
- 参考文档.github/workflows/ci.yml611 B
- 参考文档.github/workflows/vendor-drift.yml1.0 KB
- 其他.gitignore66 B
- 资产文件assets/logo.png1.4 MB
- 资产文件brand/app-icon-dark.png59.1 KB
- 资产文件brand/app-icon.png54.4 KB
- 资产文件brand/logo/subtitle-skill-wordmark-black.svg3.5 KB
- 资产文件brand/logo/subtitle-skill-wordmark-white.svg3.5 KB
- 资产文件brand/subtitle-skill.icon/Assets/captions.svg380 B
- 资产文件brand/subtitle-skill.icon/Assets/screen.svg351 B
- 参考文档brand/subtitle-skill.icon/icon.json1.7 KB
- 参考文档CLAUDE.md18.1 KB
- 许可证LICENSE1.0 KB
- 其他pyproject.toml1.2 KB
- 参考文档README.md28.1 KB
- 脚本scripts/check_vendor_drift.py2.7 KB
- 参考文档skill.contract.json11.0 KB
- 脚本tests/conftest.py106 B
- 许可证tests/fixtures/ffmpeg_skill_vendor/LICENSE1.0 KB
- 参考文档tests/fixtures/ffmpeg_skill_vendor/README.md2.8 KB
- 脚本tests/fixtures/ffmpeg_skill_vendor/scripts/_common.py36.5 KB
- 脚本tests/fixtures/ffmpeg_skill_vendor/scripts/_contract.py65.2 KB
- 脚本tests/fixtures/ffmpeg_skill_vendor/scripts/caption.py26.1 KB
- 脚本tests/fixtures/ffmpeg_skill_vendor/scripts/probe.py2.6 KB
- 脚本tests/test_cli.py5.1 KB
- 脚本tests/test_doctor.py2.5 KB
- 脚本tests/test_engine_boundaries.py5.5 KB
- 脚本tests/test_engine_layout.py1.9 KB
- 脚本tests/test_engine_render.py30.9 KB
- 脚本tests/test_engine_style.py8.6 KB
- 脚本tests/test_formats.py5.1 KB
- 脚本tests/test_installer.py2.5 KB
- 脚本tests/test_models.py2.3 KB
- 脚本tests/test_pathpolicy.py1.5 KB
- 脚本tests/test_security.py1.7 KB
- 脚本tests/test_validation.py1.9 KB
03 SKILL.md 正文
subtitle-skill
This document is for an agent deciding whether and how to call
subtitle-skill. It is not a substitute for reading README.md
(architecture, data model, validation rules, security) or
contract --json (the machine-readable operation/format/error list) —
read both before integrating.
When to use this skill
Use subtitle-skill when you already have subtitle cues — text with start/end timestamps, decided by you or an upstream step — and need to:
- validate that timeline (catch overlaps, bad timestamps, unreadable cues) before shipping it,
- turn it into an SRT or WebVTT file,
- burn it into a video.
Do not use subtitle-skill to:
- transcribe audio (that's
transcription-skill), - decide how to split a long sentence into cues, whether to show a
speaker label, or word subtitle text — that judgement is yours; hand
subtitle-skill the finished
SubtitleCues, not aTranscriptSegment, - translate, summarize, or rewrite subtitle text,
- decide whether a render "looks good" — subtitle-skill's render
verification is limited to what a machine can check (file exists, has
a video stream, duration preserved); it does not run or interpret
ffmpeg-skill's
look(visual contact sheet). If you need to confirm the captions are legible/well-placed, runffmpeg-skill/lookon the output yourself and inspect it — that is your judgement call, not subtitle-skill's.
Never delegate the "did this render correctly" decision to
subtitle-skill. A successful render response means: the request was
valid, ffmpeg-skill's caption tool exited with status: "completed",
and the output file exists with a video stream and unchanged duration.
It does not mean the captions are positioned, sized, or timed the
way you wanted — that is a visual judgement outside this skill's scope.
Building a SubtitleDocument
{
"id": "doc-1",
"language": "en",
"cues": [
{"id": "c1", "start": 0.0, "end": 2.5, "text": "Hello and welcome"},
{"id": "c2", "start": 2.5, "end": 5.0, "text": "to the show.", "speaker": "Host"}
]
}
start/endare seconds,start < end, both finite and>= 0.idmust be unique per document — subtitle-skill rejects duplicates.speakeris rendered as a plain"Speaker: "text prefix on the cue's first line — it is not a caption-styling decision, just a fixed convention (see README §5).styleis an allowlisted, per-cue object (align,position,line,size,bold,italic,color) forgenerate's SRT/WebVTT output. Forrender'smode: "burn", onlycolor/bold/sizeare additionally forwarded to ffmpeg-skill'scaptiontool, as its own--color/--bold/--sizeflags — see "SubtitleStyle → caption.py" below for the exact mapping (includingsize's percent-to-points conversion) and whyalign/position/line/italichave no caption.py equivalent and are never forwarded. Because caption.py's styling is one whole-burn setting, not per-cue, every cue that setscolor/bold/sizemust agree on the value — a document that genuinely wants different values on different cues is rejected (INVALID_INPUT) forrender, not silently resolved by keeping one cue's request and dropping the rest.mode: "mux"forwards none of it — caption.py's own docs say styling has no effect there, so settingcolor/bold/sizewithmode: "mux"is rejected up front (UNSUPPORTED_FORMAT) rather than silently accepted and ignored. If you needalign/position/line/font/outline/animation control on a burned-in video, call ffmpeg-skill'scaptiontool yourself with those flags instead of going through subtitle-skill'srender.
SubtitleStyle → caption.py (render, mode: "burn" only)
| field | caption.py flag | conversion |
|---|---|---|
color |
--color |
forwarded verbatim (caption.py validates the hex format itself) |
bold |
--bold |
True → flag present; False/None → omitted |
size (0..100 percent) |
--size |
round(size / 100 × 288) — caption.py's --size is in ASS points relative to its own 288-line nominal baseline |
align / position / line / italic |
(none) | no clean caption.py equivalent — left unmapped, not guessed at; see README "SubtitleStyle → caption.py" for the full per-field reasoning |
Fatal vs. warning: read observation, don't assume success means "clean"
A successful response can still carry a non-empty observation array —
these are warnings, not failures, and subtitle-skill never auto-fixes
them (no cue is deleted, merged, or shifted):
| code | meaning |
|---|---|
CUE_OVERLAP |
two cues' time ranges overlap |
TOO_MANY_LINES / LINE_TOO_LONG |
exceeds constraints.max_lines / max_chars_per_line |
CUE_TOO_SHORT / CUE_TOO_LONG |
outside constraints.min_duration / max_duration |
READING_SPEED_TOO_HIGH |
more text than constraints.reading_speed_cps allows for the cue's duration |
Fatal problems (VALIDATION_ERROR, INVALID_TIME_RANGE, ...) raise
before any file is written — there is no partial output to clean up.
If you want subtitle-skill to enforce your own house style (e.g. max 32
chars/line), pass constraints in the request — do not treat the
built-in defaults as "the correct" values; they exist only so a caller
can omit constraints entirely.
generate vs. render
generate: no video I/O. Validates the document, writes an SRT or WebVTT file. Use this when you only need the subtitle file (e.g. to hand to another tool, or to review before committing to a burn-in).render: requiresvideo_input;formatmust be"srt". Validates, generates the SRT, then delegates the actual burn-in to ffmpeg-skill'scaptiontool. Requestingrenderwithformat: "vtt"fails immediately withUNSUPPORTED_FORMAT— do not retry with a different format expecting it to work; ffmpeg-skill has no WebVTT support to fall back to.rendermeasures the real video duration itself before rendering and rejects a cue past it — you do not need to (and cannot rely on) passing a correctvideo_durationhint for this; it exists only as an optional, non-authoritative early check.mode(optional, default"burn"):"burn"renders subtitles into the picture;"mux"copies the video/audio streams untouched and adds the SRT as a separate, player-toggleable subtitle stream instead. Pick"mux"when the caller wants a soft/removable subtitle track (e.g. building a multi-language set by rendering once per language into the same growing container) rather than a permanently burned-in one.audio_stream(optional, 0-based integer): which audio track of a multi-track input (dubbed languages, M&E stems) to keep, for either mode. An out-of-range value is rejected asINVALID_INPUT— this skill does not guess which track you meant.subtitle.languageis forwarded as the new subtitle stream's language tag whenmode: "mux"(a no-op for"burn", which has no subtitle stream to tag). It is forwarded exactly as given, not normalized — a.mp4/.movoutput'smov_textcodec only honors a 3-letter ISO 639-2 code there (confirmed against real ffmpeg, not assumed); a plain 2-letter BCP47 tag like"ja"/"en"can be silently dropped from that container's stream tags with no error. Use.mkv/.webmoutput when the exact tag value must survive.
ffmpeg-skill dependency
render only works when an ffmpeg-skill install with a working caption
tool is reachable. Call doctor --json first if you are not sure:
"render" only appears in supported_operations when ffmpeg-skill was
actually found and its required capabilities
(ffmpeg, ffprobe, encoder:libx264, encoder:aac, filter:subtitles)
are confirmed available. If render is missing from that list, do not
call it and expect it to work — read problems for why, and either fix
the environment (install ffmpeg-skill / ffmpeg) or fall back to
generate and hand the SRT to whatever can burn it in.
Unsupported operation / format
Only generate and render are implemented; only those two appear in
contract --json's operations. If you need convert, validate
(standalone), offset, or merge, they do not exist yet — do not guess
at a request shape for them; they return UNSUPPORTED_OPERATION.
Failure handling
Every failure is a JSON envelope: {"status": "error", "error": {"code", "message", "retryable", "details"?}}. code is one of the values in
contract --json's errors.codes. Check retryable before deciding
whether to retry as-is — VALIDATION_ERROR/INVALID_TIME_RANGE/
PATH_NOT_ALLOWED/etc. will fail identically on retry (fix the request);
a DEPENDENCY_ERROR talking to ffmpeg-skill may be transient. Never
retry a failed request by loosening subtitle-skill's own validation —
if a cue is genuinely invalid (negative start, duplicate id, ...), that
is a bug in whatever built the SubtitleDocument, not something to paper
over here.
04 同仓库更多 Skills
video-editing-skill
Deterministic video editing from a typed edit request (trim, cut, concat with transitions, speed change, fit / fill / resize, still-image overlay) with an exact source-to-timeline mapping and per-operation provenance. Executes through ffmpeg-skill; never takes commands, argv, filter strings or executables. Use when an agent has already decided what to edit and needs the edit performed, verified and traced. Not for deciding what to cut, transcribing, captioning, colour grading or audio mastering.
thumbnail-skill
Deterministic thumbnail rendering execution Skill for the AI Video Production Ecosystem. Use it when a caller (normally video-production-agent) has already decided exactly what a thumbnail should show - which still image or which explicit video timestamp, what text, what layout - and needs it rendered safely to PNG/JPEG with provenance. Do NOT use it to choose what a thumbnail should show, pick a "best" video frame, detect faces, generate a title, judge design quality, or run arbitrary ffmpeg/image commands (it refuses them); those decisions belong to the caller.
ffmpeg-skill
Edit video and audio with local FFmpeg from natural-language requests: cut, trim, join, resize/reframe (9:16, 1:1), speed change, captions and subtitles (SRT/ASS, animated, karaoke), logos and text overlays, lower-thirds and titles, silence removal, multicam and external-mic sync, loudness normalisation, HDR/Dolby Vision to SDR, LUTs, background music with ducking, platform exports (YouTube, Reels, TikTok, X), compliance checks, scene detection and highlight reels, contact sheets to inspect results, and whole-edit project files. Use this skill whenever the user mentions a video or audio file (mp4, mov, mkv, wav, m4a), footage, a clip, captions, subtitles, a reel or short, YouTube/Instagram/TikTok delivery, LUFS, sync, transcoding, ffmpeg, or asks to make something "60 seconds", "vertical", "louder", "captioned" — even when they do not say "edit". Python 3.9 standard library only, no cloud, no API keys.
skillpact
Write and check SkillPact contracts (skill.contract.json) for Agent Skills with the skillpact CLI - draft a contract from a SKILL.md, validate it, run its conformance tests network-isolated, hash and sign every file, report the level L1 / L2 / L3, match it against a harness policy (allow / ask / deny) and compile that decision to Claude Code, Cursor, Codex or Gemini CLI settings or export it to HushSpec, Rego, APS or ACS. Use when the user wants a skill's permissions declared or reviewed before install, a contract drafted, validated, signed or migrated, a conformance level or badge, a policy check, or harness permission settings made from a policy. Python 3.11+; bubblewrap on Linux for L2 and L3. Not a runtime sandbox and not a malware scanner - L3 means these files, signed by a trusted author, passed their tests, not that the skill is safe.