/video-skills:narrate-videofrom video-skills
Generates professional voiceover narration for videos with audio-video sync using Azure TTS, Gemini TTS, or ElevenLabs. Supports Mandarin narration, voice cloning, and timed script generation.
Ships in video-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.
Read when SKILL.md points to them; scripts run unread.
Analyze the video, write or refine a timed script, generate speech with the selected provider, and merge the segments at their timestamps.
Input: $ARGUMENTS
narration_script.py and fill in the placeholdersUse the provider the user requests. Select elevenlabs when they ask for ElevenLabs or supply an ElevenLabs voice ID. Without a provider request, use Azure unless GEMINI_API_KEY is configured. An ElevenLabs key on its own does not switch providers. For Gemini, follow references/gemini-tts.md.
Use the language of the actual narration text, not the language of the user's instructions. For Azure, unless the user explicitly chooses a voice:
NARRATION_LANGUAGE = "en". The template uses VOICE_EN_NAME from ~/.narrate_video.env, defaulting to en-US-Jimmie:DragonHDFlashLatestNeural.NARRATION_LANGUAGE = "other". The template uses VOICE_NAME from the same file, defaulting to zh-CN-YunyangNeural.Do not ask for language confirmation when the narration text is already provided. An explicit voice choice overrides these defaults. Gemini voice selection remains provider-specific. See references/voices.md for timing estimates and optional voices.
For ElevenLabs, default to Mandarin (NARRATION_LANGUAGE = "zh") for a new script with no requested language. For supplied text, use its spoken language ("en" for English; "other" for automatic detection when no single language fits). Keep the default Mandarin narrator unless a voice ID is configured or requested.
Use Python 3.11 or newer. Install or update the stable dependencies in the active virtual environment (<skill_directory> is this skill's directory):
python -m pip install --upgrade -r <skill_directory>/requirements.txt
# 1. Check provider credentials exist (NEVER read or display their values)
scripts/check_env.py azure
# or
scripts/check_env.py gemini
# or
scripts/check_env.py elevenlabs
# 2. Check tool dependencies
command -v ffmpeg && command -v ffprobe && command -v python3
# 3. Check Python dependencies
python3 -c "import dotenv" 2>&1
# 4. Azure only
python3 -c "import azure.cognitiveservices.speech" 2>&1
If Azure is selected and AZURE_SPEECH_KEY or AZURE_SPEECH_REGION is missing, ask the user to add them to ~/.narrate_video.env:
AZURE_SPEECH_KEY=your-key-here
AZURE_SPEECH_REGION=your-region-here
# Optional Azure voice overrides (defaults shown)
# VOICE_NAME=zh-CN-YunyangNeural
# VOICE_EN_NAME=en-US-Jimmie:DragonHDFlashLatestNeural
If Gemini is selected and GEMINI_API_KEY is missing, ask the user to add it to ~/.narrate_video.env:
GEMINI_API_KEY=your-key-here
# Optional override
GEMINI_TTS_MODEL=gemini-3.1-flash-tts-preview
For ElevenLabs, set the key in ~/.narrate_video.env or export it in the shell. The voice ID is optional:
ELEVENLABS_API_KEY=your-key-here
# ELEVENLABS_VOICE_ID=your-library-or-cloned-voice-id
If the selected provider's credentials are missing, stop before synthesis. Check only whether they exist; never display them.
ffprobe -v quiet -print_format json -show_format -show_streams <video>
Record total duration, resolution, frame rate, and whether an audio track exists.
Extract frames at 3–4 second intervals to identify scene transitions:
mkdir -p /tmp/narration-frames
for t in $(seq 0 3 <duration>); do
ffmpeg -y -ss $t -i <video> -frames:v 1 -q:v 2 /tmp/narration-frames/frame_${t}s.jpg 2>/dev/null
done
Review the frames (use Read tool to view images). For each scene transition, note the precise timestamp. Where timing is ambiguous, extract additional frames at 1–2 second intervals to pinpoint the exact moment.
Build a scene transition table mapping timestamps to visual content:
0s - Opening screen
3s - User starts typing
8s - System begins processing
34s - Response appears
Narration describing something on screen should start after that content is already visible. Viewers notice when audio arrives before the visuals — it feels disorienting. Narrating slightly after the visual appears feels natural, like a presenter walking you through what you're seeing.
Each narration segment is a (start_seconds, text) tuple:
SEGMENTS = [
(0, "Opening narration here."),
(8, "Next segment narration..."),
]
Timing: Leave at least 1 second of silence between segments — this breathing room makes narration feel conversational rather than rushed. Use the timing estimates from references/voices.md to estimate whether text fits: for English, multiply the window (in seconds) by 2.5 words/sec, then take 80% as the safe word count.
Flow: Each segment should connect logically to the next. Transition words ("And", "Now", "So") help, but vary them — three consecutive "And now" transitions sound robotic.
Adapting to input: If the user provided a draft, calibrate its timestamps against the scene analysis, trim text that overflows its time window, and polish the language — but preserve their intent and key points. Without a draft, write narration for each scene based on what's visible.
Gemini prompt hygiene: If using Gemini, keep style instructions separate from the spoken transcript. The script template already wraps text in a safe TRANSCRIPT: preamble because Gemini 3.1 Flash TTS can occasionally read metadata aloud or reject vague prompts.
Before generating audio, verify each segment fits:
window = next_segment_start - this_segment_start
max_words = window * words_per_second * 0.8
If a segment is too long, shorten the text now — trimming words is much cheaper than regenerating audio.
Copy scripts/narration_script_template.py into the video's directory as narration_script.py. Fill in:
TTS_PROVIDER: azure, gemini, or elevenlabs.NARRATION_LANGUAGE: follow the provider-specific language rules in Phase 0.VOICE_NAME empty so the template selects the configured voice for the narration language. Set it directly only for an explicit per-video voice choice. For Gemini, set a Gemini voice such as Kore in the script.ELEVENLABS_VOICE_ID as written to use the configured ID or the default, Adam Li. If the user supplies an ID for this video, set it directly in the copied script. Use the same field for an existing authorized clone; no recording upload is needed. See ElevenLabs voices for access and setup.INPUT_VIDEO and OUTPUT_VIDEO (relative paths only)SEGMENTS from Phase 2These choices come from debugging real production issues:
normalize=0 on amix: ffmpeg's amix divides volume by input count by default. With 20 segments, output would be 1/20th volume — essentially silent..mp3) and Gemini (.wav) cache by segment number. For those providers, use a fresh directory or remove the matching seg_XXX.* after changing text or voice. ElevenLabs MP3s have separate cache names keyed by text, model, voice ID and language; changing any of these regenerates the affected audio.500 errors. The template retries a few times automatically before failing.python3 narration_script.py
If the timing report shows overlaps (gap < 0), shorten the text or push the next segment's start time later. After editing Azure or Gemini text, delete the corresponding cached audio file in narration_segments/. For ElevenLabs, or if only start times change, re-run directly.
Keep iterating until all gaps are non-negative.
Run all three checks after every successful build:
ffmpeg -i <output> -ss 0 -t 30 -af "volumedetect" -vn -f null - 2>&1 | grep -E "mean_volume|max_volume"
Expect mean_volume between -25 and -15 dB, max between -10 and 0 dB. If mean is below -40 dB, the normalize=0 fix isn't applied — check the filter string.
ffmpeg -i <output> -af "silencedetect=noise=-30dB:d=0.3" -vn -f null - 2>&1 | grep -E "silence_(start|end)" | head -20
Confirm clean silence between segment transitions. Silence boundaries should match expected segment end/start times.
Extract frames at 5–8 key segment start times and view them:
for t in <timestamps>; do
ffmpeg -y -ss $t -i <output> -frames:v 1 -q:v 2 /tmp/verify_${t}s.jpg 2>/dev/null
done
The on-screen content should already be visible when the narration for that scene begins.
| Symptom | Cause | Fix |
|---|---|---|
| Two voices playing | Original audio was mixed in | Only map [final] audio track, never 0:a |
| Audio nearly silent | amix divided volume by input count | Add :normalize=0 to amix parameters |
| Narration out of sync | Imprecise scene timestamps | Re-extract frames at 1–2s intervals around the problem area |
| Overlap at segment boundary | Previous segment runs too long | Shorten that segment's text or delay the next segment |
| Text changed but audio didn't | Old cached audio file still exists | Delete narration_segments/seg_XXX.* and re-run |
| Audio cut off at video end | Last segment overflows video duration | Shorten to finish 3–4s before video ends |
Gemini returns 500 | Preview model emitted text tokens instead of audio | Re-run; the template already retries transient failures |
| Gemini reads prompt labels aloud | Prompt classifier failed or prompt was too vague | Keep the transcript explicit and use the template's TRANSCRIPT: wrapper |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub feiskyer/video-skills --plugin video-skills3 skills in this plugin
/download-videoDownload videos from 1000+ websites (YouTube, Bilibili, Twitter/X, TikTok, Vimeo, Instagram, Twitch, etc.) using yt-dlp. Use this skill whenever a user shares a video URL, asks to save or download a video, wants to extract audio from an online video, needs a specific quality like 1080p or 4K, or mentions downloading a playlist. Also trigger on "下载视频", "保存视频", "提取音频", or any URL from a supported video platform./transcribe-videoExtract transcript or subtitles from a local video file. Use this skill whenever the user asks to transcribe a video, extract speech-to-text, get subtitles, or wants a text version of what's said in a video. Also trigger on "提取字幕", "视频转文字", "语音转文字", "transcribe", "extract audio text", or when the user references getting a script/transcript from any video file (mp4, mkv, mov, avi, webm). This skill is for LOCAL video files — for YouTube or other online URLs, use the download-video skill first to get the file, then transcribe it.Other plugins' skills for the same job