360 Secure SkillHub
360 安全技能中心

add narration to a video automatically

该 Skill 从无声屏幕录制视频中按间隔抽取关键帧,分析画面后撰写演示式旁白脚本,调用 Microsoft Edge 神经 TTS 生成分段语音,并按视频时长调整语速与片段间隔,最后将 AAC 音频合并到原视频,输出带旁白视频和配音脚本文档。依赖 ffmpeg、python3 与 edge-tts,需联网合成语音。

ryanzhang-oss
ryanzhang-oss
热度 39.86
最近更新 2026-05-11 17:40:12
分类:创作依赖:代码执行 / 读写文件 / 第三方 API / 内部调用大模型应用场景:视频编辑 / 文案创作 / 自动化脚本 / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add video-auto-narration
Metadata
name
video-narration
description
Generate narration for silent screen-recording videos. Extracts key frames, analyzes on-screen content, writes a presentation-style voiceover script, synthesizes natural-sounding speech with Microsoft Edge neural TTS, and merges the audio onto the original video. Outputs a narrated video and a companion voiceover script.
metadata
{"openclaw":{"emoji":"🎬","requires":{"anyBins":["ffmpeg","python3"]}}}

Video Narration Skill

You generate professional voiceover narration for silent screen-recording demo videos.

Workflow

1. Analyze the Video

Extract key frames and understand what is happening on screen:

# Extract one frame every 5 seconds
./scripts/extract-frames.sh <video_path> [output_dir]
  • View every extracted frame to build a complete understanding.
  • Identify the narrative arc: what is the setup, the action, the key moments, and the result.

2. Write the Voiceover Script

Write a presentation-style narration — not a dry description. Follow this structure:

Section Purpose
Context Tell the audience what they're about to see and why it matters
Background Explain the setup / scenario
Prompt / Action Show what the user actually did (keep it minimal)
Walkthrough Narrate each major step, highlighting insights and turning points
Result Land the payoff — what was found, what was fixed, why it's impressive

Guidelines:

  • Use conversational, confident language — like presenting to peers.
  • Use short punchy sentences for emphasis. Vary sentence length for rhythm.
  • Highlight "aha moments" — the points where something surprising or clever happens.
  • Name specific tools, commands, and values when they matter to the story.
  • End with a memorable one-liner that captures the value.
  • Total word count must fit the video duration (~2.5 words/second at normal pace).

Save the script as <video_name>_voiceover.md alongside the video.

3. Generate TTS Audio

Use the generate script to synthesize each narration segment:

./scripts/generate-tts.sh <script_sections_file> <output_dir> [voice] [rate]

Or generate directly via Python with edge-tts:

  • Voice: en-US-GuyNeural (natural male) or en-US-AvaNeural (natural female)
  • Rate: Adjust between +0% and +10% to fit the video duration
  • Generate each section as a separate audio segment for precise timing control
  • Concatenate segments with ~0.4s silence gaps between them
  • Verify total duration matches the video (±2 seconds)

4. Merge Audio onto Video

./scripts/merge-audio.sh <video_path> <narration_audio> [output_path]
  • Preserves the original video codec (copy, no re-encode)
  • Encodes audio as AAC at 192kbps
  • Uses -shortest to match the shorter of video/audio
  • Verify the output has both video and audio streams

Timing Strategy

  1. Generate all segments, measure each duration
  2. Sum total speech time vs video duration
  3. If speech is >105% of video: tighten the script or increase rate
  4. If speech is <85% of video: the pacing may feel rushed — add detail or slow the rate
  5. Concatenate with 0.3–0.5s gaps, target total within ±2s of video

Prerequisites

Install dependencies if not present:

pip3 install edge-tts   # Microsoft neural TTS (free, no API key)
brew install ffmpeg      # or apt-get install ffmpeg

Output

The skill produces:

  1. <name> (with narration).mov — the video with baked-in voiceover
  2. <name>_voiceover.md — the timestamped script for reference or re-recording