/lattifai-skills:lai-captionfrom lattifai-skills
Converts between 30+ caption/subtitle formats (SRT, VTT, ASS, JSON, TextGrid, LRC, FCPXML, Premiere) and shifts timing. Supports ASS styling and karaoke effects.
Ships in lattifai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Convert, shift, and style caption files. Format is auto-detected from file extension.
laicap-convert and lai caption convert are the same command — the former is the shortcut entry-point. For pipeline / non-interactive use, add --direct -Y (direct execution, skip confirmation).
laicap-convert (== lai caption convert) takes two positional args: input_path and output_path. All styling/rendering keys are flat top-level config (render.*, ass.*), not caption.*.
All examples assume a single <base> (media stem or YouTube ID) reused across the pipeline; outputs land in the current directory.
# <base> = podcast
laicap-convert podcast.srt podcast.vtt
Common pairs:
laicap-convert podcast.aligned.json podcast.srt # JSON → playback formats
laicap-convert podcast.srt podcast.ass # basic → styled
laicap-convert podcast.transcript.md podcast.srt # Gemini markdown → SRT
laicap-convert podcast.aligned.json podcast.TextGrid # → Praat
Add -Y for non-interactive runs. Use input_format=srt (top-level flag) to override auto-detection when the extension is wrong.
laicap-shift podcast.srt podcast.shifted.srt 2.5 # forward 2.5 s
laicap-shift podcast.srt podcast.shifted.srt -1.0 # backward 1 s
Top-level ass.* keys (see lai caption convert --help for the full list):
laicap-convert podcast.srt podcast.ass \
ass.font_name="Noto Sans CJK SC" \
ass.font_size=48 \
ass.primary_color="#FFFFFF"
Requires word-level JSON input (produced by /lai-align with caption.render.word_level=true, or /lai-youtube with the same flag — the upstream flag populates words arrays in the JSON).
laicap-convert podcast.aligned.json podcast.karaoke.ass \
ass.karaoke_effect=sweep \
ass.karaoke_color_scheme=azure-gold
render.word_levelscope — default is word-scope (per-word\k/\kf/\koemission). Only passrender.word_level=falseto switch to line-scope (a single override at event start, whole text block animates together — CapCut-style "fade in"). You don't needrender.word_level=trueto enable karaoke;ass.karaoke_effectalone does it.
ass.karaoke_effect: sweep (classic karaoke fill), instant (hard on/off), outline (outline-only highlight)ass.karaoke_color_scheme (12 presets, each tunes primary/secondary/outline/back):
azure-gold, sakura-purple, mint-ocean, gardenia-green, sunset-warm,
prussian-elegant, burgundy-classic, langgan-spring, mars-teal,
spring-field, navy-pink, apricot-darkass.kinetic_style (orthogonal per-word animation, 15 options grouped by feel):
bounce, pop, shake, pulse, swingfade, zoom, rise, typewriter, blur_inglow, neon, wave, flicker, staggerFormat selection, typography conventions (line order / color / font-size ratio), and four scenario recipes (learning SRT / social ASS / karaoke / dual-track upload) all live in /lai-translate §Bilingual Delivery Guide — don't duplicate. Minimal one-liner for a bilingual JSON from /lai-translate:
# `<base>.translated.json` is the merged JSON (source + translation) from
# `/lai-translate merge.py --bilingual`.
laicap-convert podcast.translated.json podcast.zh.translated.ass \
ass.primary_color="#FFFFFF" \
ass.translation_color="#FFC209"
Add ass.karaoke_effect=sweep ass.karaoke_color_scheme=... for per-word karaoke on the source line.
ass.speaker_color=... paints dialogue per speaker (needs /lai-diarize output in the source). Accepts:
"" — disabled (default)"auto" — 10-color LattifAI palette (cycles for >10 speakers)"#RRGGBB,#RRGGBB,..." — CSV of explicit colors, one per speaker in appearance order# Host = cyan-blue, Guest = pink — short CSV palette
laicap-convert diarized.json out.ass \
render.include_speaker_in_text=true \
ass.speaker_color="#658AE4,#F7C3D9"
standardization.* reflows segments to meet CPL/CPS/duration rules before writing. Useful for delivering SRT/VTT to Netflix-class platforms or tighter YouTube specs.
Fields (all top-level):
standardization.min_duration / max_duration — segment duration bounds (s)standardization.min_gap — minimum inter-segment gap (s)standardization.max_lines / max_chars_per_line — line wrapping limitsstandardization.optimal_cps — target characters-per-second for readabilitystandardization.start_margin / end_margin — pre/post roll per segmentstandardization.margin_collision_mode — trim (default), drop, …Ready-made profiles:
# Netflix-ish: 42 CPL × 2 lines, 0.8-7 s
laicap-convert diarized.json out.netflix.srt \
standardization.min_duration=0.8 \
standardization.max_duration=7.0 \
standardization.min_gap=0.08 \
standardization.max_lines=2 \
standardization.max_chars_per_line=42 \
standardization.start_margin=0.05 \
standardization.end_margin=0.15
# YouTube-ish: shorter cues, narrower lines
laicap-convert diarized.json out.youtube.srt \
standardization.min_duration=0.5 \
standardization.max_duration=5.0 \
standardization.max_chars_per_line=35 \
standardization.start_margin=0.03 \
standardization.end_margin=0.10
start_margin / end_margin also benefit karaoke exports (give lyrics breathing room) — combine with the karaoke recipe above.
| Category | Formats (read & write unless noted) |
|---|---|
| Standard | .srt, .vtt, .ass / .ssa, .lrc, .txt, .md |
| Data | .json, .tsv, .csv, .aud |
| Linguistic | .TextGrid, .ttml / .xml |
| NLE | .fcpxml; .prproj.xml (write-only) |
Full list: lai caption convert --help.
Convert to .json first to keep word-level timing, speakers, and translations — then fan out to delivery formats.
| Problem | Fix |
|---|---|
| Unknown input format | Specify input_format=srt (top-level flag, not caption.input_format) |
| Encoding error | Re-save the file as UTF-8 |
| Karaoke has no highlighting | Source JSON needs words arrays — re-run /lai-align with caption.render.word_level=true, then convert with just ass.karaoke_effect=sweep (no render.word_level needed; default is word-scope) |
No parameter named 'caption' / 'input' | For laicap-convert, styling keys are flat (render.*, ass.*) and input/output are positional (input_path/output_path) — there is no caption.* namespace here |
| Plain text missing timing | Add timing via /lai-align first |
/lai-align — fix timing accuracy (conversion doesn't change timing)/lai-transcribe — generate captions from audio first/lai-translate — translate before bilingual conversion/lai-diarize — add speaker labels for speaker-colored outputWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
subtitle-conversion, caption-format, ass-styling, karaoke, timing-shift
9 skills in this plugin
/lai-alignAlign existing captions to audio/video with word-level precision using the Lattice-1 model. Trigger when the user has both a media file AND a caption/transcript that need to be synchronized, or says "fix caption timing", "字幕对不上", "对齐字幕", "word-level timestamps", "karaoke timing", "timestamps are off". Do NOT trigger without existing text — use `/lai-transcribe` first./lai-diarizeIdentify speakers ("who said what") in aligned captions via pyannote.audio. Real speaker names come from the agent's own reasoning over transcript + context (default), with a CLI-LLM fallback for headless runs. Trigger on multi-speaker content (podcasts, interviews, meetings) or phrases like "diarize", "speaker detection", "说话人识别", "区分说话人", "label the speakers". Requires aligned captions — run `/lai-align` first./lai-npx claudepluginhub lattifai/lattifai-skills --plugin lattifai-skillsOther plugins' skills for the same job