/lattifai-skills:lai-youtubefrom lattifai-skills
One-command YouTube pipeline that downloads media, fetches or transcribes captions, and runs forced alignment to produce aligned subtitles.
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.
YouTube URL → aligned captions in one command. Requires an API key (/lai-setup) and yt-dlp (pip install yt-dlp).
All outputs land in the current directory by default (no subdirectories). Use the YouTube video ID as <base> and chain pipeline files as <base>.<derivation>.<ext>:
<base>.mp4 # downloaded media
<base>.en.vtt # YouTube auto-caption
<base>.meta.md # metadata
<base>.aligned.json # forced-alignment output (when caption.output.format=json)
<base>.srt # final SRT (when caption.output.format=srt)
<base> is the YouTube ID (e.g. la0CaZ2R8EY); the agent extracts it from the URL.
This command uses nemo_run config syntax (key=value), not -o / --output.
# `<base>` = la0CaZ2R8EY (the YouTube video ID)
lai youtube align "https://youtu.be/la0CaZ2R8EY" \
caption.output.path=la0CaZ2R8EY.aligned.json \
caption.output.format=json
# shortcut:
lai-youtube "https://youtu.be/la0CaZ2R8EY" caption.output.path=la0CaZ2R8EY.aligned.json
Add -Y (skip confirmation) for non-interactive runs. caption.output.format is inferred from the path suffix but passing it explicitly is safest. Supported: srt, vtt, ass, json, ttml, lrc, … (see /lai-caption).
yt-dlp downloads media into the current directory by default (media.output_dir=.); files named <video_id>.mp4 etc.use_transcription=true)yt-dlp --list-subs "URL"
caption.input.split_sentence=true if the auto-captions break mid-sentence and you want cleaner segments for downstream karaoke / translation / summarization. Default in examples is false to preserve the source's original cue boundariesuse_transcription=true (needs a Gemini key — see /lai-transcribe)All use key=value syntax, dot-nested:
use_transcription=true — transcribe with Gemini instead of using YouTube captionscaption.input.split_sentence=false (default in examples) — preserve source cue boundaries. Set to true to re-segment into clean sentences (helpful for messy auto-captions)caption.render.word_level=true — per-word timestamps (needed for karaoke; pair with a JSON or ASS output)caption.output.path=<base>.aligned.json / caption.output.format=json — output destination (use <base>.<derivation>.<ext> naming)media.prefer_audio=true — audio-only download (faster, smaller)media.prefer_audio=false — keep the video. Pair with media.output_format=mp4 explicitly; prefer_audio=false alone may still emit audio-only output, which breaks downstream karaoke (no width/height for probe_media.py)media.output_dir=. — where downloaded audio / vtt land (default: current directory)media.streaming_chunk_secs=300 — long-video chunkingFull list: lai youtube align --help. Discover the full config tree with lai youtube align --to-yaml /tmp/cfg.yaml URL (exports and exits without running).
lai youtube download)When you need just the media (no alignment), or want to manage the media + caption files yourself:
lai youtube download --direct -Y \
yt_url="https://youtu.be/la0CaZ2R8EY" \
media.output_dir=. \
media.output_format=mp4 \
media.prefer_audio=false
media.output_format: mp4 (default with prefer_audio=false), mp3, wav, …only=meta — re-download metadata only (writes <id>.meta.md, no media)The downloaded files follow the pattern <id>.mp4, <id>.en.vtt, <id>.meta.md inside media.output_dir (current directory by default). Pipe the pair into /lai-align afterwards.
<base> = YouTube video ID (e.g. la0CaZ2R8EY):
# Step 1 — YouTube → aligned JSON with word-level timestamps
lai youtube align -Y "https://youtu.be/la0CaZ2R8EY" \
caption.output.path=la0CaZ2R8EY.aligned.json \
caption.output.format=json \
caption.input.split_sentence=false \
caption.render.word_level=true
# Step 2 — JSON → ASS with per-word karaoke highlighting (see /lai-caption)
laicap-convert -Y la0CaZ2R8EY.aligned.json la0CaZ2R8EY.karaoke.ass \
ass.karaoke_effect=sweep \
ass.karaoke_color_scheme=azure-gold
(render.word_level is not needed on the convert side — it's default word-scope. The upstream caption.render.word_level=true in Step 1 is what populates the words arrays that karaoke reads.)
For bilingual karaoke, run /lai-translate on la0CaZ2R8EY.aligned.json first (it preserves words), then run step 2 on the bilingual JSON.
For long alignments (Step 3 lattice search can take minutes on long-form video), redirect to a log file so you can see EXIT code and stderr after truncation:
lai youtube align -Y URL caption.output.path=la0CaZ2R8EY.aligned.json ... > la0CaZ2R8EY.align.log 2>&1
echo "EXIT=$?"
tail -50 la0CaZ2R8EY.align.log
| Problem | Fix |
|---|---|
yt-dlp not installed | pip install yt-dlp |
| Video private / unavailable | URL must be publicly accessible |
| No captions and no Gemini key | Set one up — see /lai-transcribe |
| Region-restricted | Use a VPN or fetch from an unrestricted region |
| Age-restricted | yt-dlp --cookies-from-browser chrome to download, then /lai-align |
| API key invalid | /lai-setup |
media.prefer_audio=false but downloaded file is still mp3 / m4a | Add media.output_format=mp4 explicitly — they're separate flags |
Couldn't load entrypoint youtube: No module named 'lattifai' on lai startup | Stale editable install — see /lai-setup Common Issues |
/lai-setup — first-time install and auth/lai-align — when media + captions are already local/lai-transcribe — transcribe without alignment (Gemini accepts YouTube URLs too)/lai-diarize — speaker labels on aligned output/lai-translate — translate captions/lai-caption — convert output formatWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub lattifai/lattifai-skills --plugin lattifai-skills9 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-captionConvert between 30+ caption/subtitle formats (SRT, VTT, ASS, JSON, TextGrid, LRC, FCPXML, Premiere, …) and shift timing. Trigger on "convert captions", "SRT to VTT", "转换字幕格式", "shift timing", "ASS styling", "karaoke effect", "导入Premiere", or any caption-format question. Do NOT trigger to fix timing accuracy (`/lai-align`) or translate (`/lai-translate`)./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-karaokeGenerate viral-ready karaoke / lyric-video subtitles with per-word highlighting in one command. Adaptive font size from media resolution. Ready-made style presets for TikTok, Reels, Shorts, 抖音, 小红书, YouTube, and cinematic long-form. Trigger on "karaoke 字幕", "卡拉OK", "lyric video", "逐词歌词", "按字高亮", "TikTok 字幕", "抖音字幕", "Reels caption", "Shorts caption", "小红书歌词", "viral subtitles", "爆款字幕", or when a song / podcast / video clip is given and per-word highlighted captions are asked for. For general caption format conversion without karaoke styling, use /lai-caption./lai-setupInstall LattifAI and get a free trial API key. Trigger on first mention of LattifAI / `lai`, authentication errors, trial requests, or "how do I get started with alignment" / "我想做字幕对齐" before `lai --version` is verified. Do NOT trigger when already authenticated — route to `/lai-align`, `/lai-transcribe`, etc./lai-summarizeSummarize a transcript, podcast, or long caption file into structured markdown (TL;DR, chapters with timestamps, quotes, entities). **Primary path uses this session's LLM directly — no API key, no model config.** Trigger on "summarize", "生成摘要", "总结", "TL;DR", "episode summary", "what was discussed", or when the user has a long caption and wants key points. CLI `lai summarize caption` is the secondary path for oversized transcripts / headless runs.Other plugins' skills for the same job