--- name: narrate-video metadata: version: "1.0.3" description: Generate professional voiceover narration for a video with audio-video sync using Azure TTS by default, or Gemini 3.1 Flash TTS when configured. Use this skill whenever the user wants to add narration, voiceover, commentary, or voice dubbing to any video file — even if they just say "add audio to this video" or "make a narrated version." Also trigger when the user has a screen recording, demo, tutorial, or presentation video that needs a voice track. Trigger on Chinese requests like "视频配音", "给视频加旁白", "录屏解说", "视频加语音", "视频添加声音", "生成视频旁白", "自动配音", "视频解说词". --- # Video Narration Add professional voiceover to a video. Analyze the video, write or refine a timed script, generate speech via Azure TTS or Gemini 3.1 Flash TTS, and merge — producing a narrated video where audio and visuals stay in sync. **Input**: $ARGUMENTS ## Additional resources - Voice table and timing estimates: [references/voices.md](references/voices.md) - Gemini TTS API and AI Studio request shape: [references/gemini-tts.md](references/gemini-tts.md) - Python script template: [scripts/narration_script_template.py](scripts/narration_script_template.py) — copy into the video's directory as `narration_script.py` and fill in the placeholders --- ## Phase 0: Setup ### Provider Default to `azure` unless the user explicitly asks for Gemini or already has `GEMINI_API_KEY` configured. When using Gemini, use the official Gemini TTS request pattern documented in [references/gemini-tts.md](references/gemini-tts.md). ### Language 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: - English narration: set `NARRATION_LANGUAGE = "en"`; use `en-US-Jimmie:DragonHDFlashLatestNeural`. - All other narration, including mixed Chinese and English: set `NARRATION_LANGUAGE = "other"`; use `zh-CN-Yunxiao:DragonHDFlashLatestNeural`. 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](references/voices.md) for timing estimates and optional voices. ### Environment Use Python 3.11 or newer. Install or update the stable dependencies in the active virtual environment (`` is this skill's directory): ```bash python -m pip install --upgrade -r /requirements.txt ``` ```bash # 1. Check provider credentials exist (NEVER read or display their values) scripts/check_env.py azure # or scripts/check_env.py gemini # 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 ``` 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 ``` Then stop — the key is sensitive, only check whether it exists, never read or display its value. --- ## Phase 1: Video Analysis ### 1.1 Metadata ```bash ffprobe -v quiet -print_format json -show_format -show_streams