Communitygithub.com

Amartileyton/autovideo

使用 ElevenLabs AI 生成专业画外音。适用于为用户创建视频配音、音频旁白或文本转语音内容。支持多种声音和角色预设(旁白、销售员、专家),实现自然流畅的表达。提供单场景重新生成功能,便于精细调整。

autovideo 是什么?

此技能(Amartileyton/autovideo)是一个基于 ElevenLabs API 的专业画外音生成工具,专为 Remotion 视频项目设计。它允许用户通过简单的命令行界面,将文本转换为高质量、自然的语音音频。该技能的核心优势在于其丰富的角色预设系统(如叙事者、销售员、专家),能够根据内容场景自动调整语气和表达方式,避免机械的文本朗读。此外,它支持场景式生成和“请求拼接”(request stitching),可为一个视频的多个场景生成风格一致的画外音,并输出独立的音频文件及组合文件。开发者还可以利用其定时验证功能,通过 ffprobe 检查音频时长、静音段和语速,确保与视频画面精确同步。该技能还集成了缩略图嵌入功能,可将自定义缩略图嵌入 MP4 视频,提升在社交平台上的显示效果。它适用于 Claude Code、Cursor 等 AI 编程助手,极大简化了视频配音工作流。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Amartileyton/autovideo/tree/HEAD/.agent/skills/elevenlabs-remotion

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

ElevenLabs 画外音生成

使用 ElevenLabs API 为 Remotion 视频生成专业的 AI 画外音。

前置要求

  • .env.local 文件中包含 ELEVENLABS_API_KEY

快速开始

# 从文本生成画外音
node .claude/skills/elevenlabs-remotion-skill/generate.js --text "你的文本在此" --output public/audio/voiceover.mp3

# 使用叙事者风格(更自然)
node .claude/skills/elevenlabs-remotion-skill/generate.js --text "你的文本" --character narrator --output voiceover.mp3

# 生成带有请求拼接的场景
node .claude/skills/elevenlabs-remotion-skill/generate.js --scenes remotion/scenes.json --output-dir public/audio/project/

# 重新生成单个场景
node .claude/skills/elevenlabs-remotion-skill/generate.js --scenes scenes.json --scene scene2 --new-text "更新后的文本"

# 列出可用声音和角色预设
node .claude/skills/elevenlabs-remotion-skill/generate.js --list-voices
node .claude/skills/elevenlabs-remotion-skill/generate.js --list-characters

角色预设

使用角色预设可以获得更自然的画外音,而不是照本宣科地朗读屏幕文本:

角色描述最佳用途
literal完全按文本原样朗读屏幕文本、引言
narrator专业讲述者,流畅吸引人解说、纪录片
salesperson热情、有说服力、充满活力营销、广告
expert权威、自信、知识渊博法律内容、教程
conversational随意、友好、自然社交媒体、休闲内容
dramatic强烈、富有情感、有冲击力开场吸引力、问题陈述
calm舒缓、安心、温和建立信任、结尾
# 全局使用叙事者风格
node .claude/skills/elevenlabs-remotion-skill/generate.js --scenes scenes.json --character narrator --output-dir public/audio/

# 或在 scenes.json 中按场景设置
{
  "scenes": [
    { "id": "scene1", "text": "问题陈述", "character": "dramatic" },
    { "id": "scene2", "text": "解决方案", "character": "calm" }
  ]
}

基于场景的生成与请求拼接

使用 ElevenLabs 请求拼接功能,为多个场景生成一致的韵律:

scenes.json 格式

{
  "name": "product-demo",
  "voice": "George",
  "character": "narrator",
  "scenes": [
    {
      "id": "scene1",
      "text": "通用的文本转语音听起来很机械。你的品牌值得更好的。",
      "duration": 4.5,
      "character": "dramatic"
    },
    {
      "id": "scene2",
      "text": "通过语音克隆,你可以用自己的声音制作无限的内容。",
      "duration": 5.5
    },
    {
      "id": "scene3",
      "text": "录制一个简短的样本。克隆它。在几分钟内创建专业的画外音。",
      "duration": 6,
      "delay": 0.3
    }
  ]
}

生成所有场景

node .claude/skills/elevenlabs-remotion-skill/generate.js \
  --scenes remotion/product-demo-scenes.json \
  --output-dir public/audio/product-demo/

这将创建:

  • product-demo-scene1.mp3 到 sceneN.mp3
  • product-demo-combined.mp3(所有场景拼接)
  • product-demo-info.json(包含时长信息的元数据)

单场景重新生成

如果某个场景开始过早、时序错误或需要不同的文本:

# 使用新文本重新生成 scene2
node .claude/skills/elevenlabs-remotion-skill/generate.js \
  --scenes remotion/scenes.json \
  --scene scene2 \
  --new-text "更新后的场景2文本" \
  --output-dir public/audio/project/

# 使用不同角色重新生成 scene3
node .claude/skills/elevenlabs-remotion-skill/generate.js \
  --scenes remotion/scenes.json \
  --scene scene3 \
  --character salesperson \
  --output-dir public/audio/project/

# 仅重新生成(相同文本,相同角色)
node .claude/skills/elevenlabs-remotion-skill/generate.js \
  --scenes remotion/scenes.json \
  --scene scene1 \
  --output-dir public/audio/project/

# 将缩略图嵌入 MP4 视频
node .claude/skills/elevenlabs-remotion-skill/generate.js \
  --embed-thumbnail public/videos/my-video.mp4 \
  --thumbnail public/videos/my-thumbnail.png \
  --output public/videos/my-video-with-thumb.mp4

该工具会自动:

  • 使用前一个场景的请求拼接,确保一致的韵律
  • 使用新的元数据更新 info.json 文件
  • 如果提供了 --new-text,则更新 scenes.json

缩略图嵌入

将缩略图图像嵌入 MP4 视频,以便 Twitter、YouTube 和视频播放器等平台显示你自定义的缩略图,而不是视频的第一帧。

将缩略图嵌入视频

# 基本用法 - 输出到 video-thumb.mp4
node .claude/skills/elevenlabs-remotion-skill/generate.js \
  --embed-thumbnail public/videos/promo.mp4 \
  --thumbnail public/videos/thumbnail.png

# 自定义输出路径
node .claude/skills/elevenlabs-remotion-skill/generate.js \
  --embed-thumbnail public/videos/promo.mp4 \
  --thumbnail public/videos/thumbnail.png \
  --output public/videos/promo-final.mp4

与 Remotion 配合使用的工作流

# 1. 渲染你的视频
npx remotion render MyVideo public/videos/my-video.mp4

# 2. 渲染你的缩略图(使用 Still composition)
npx remotion still MyVideoThumbnail public/videos/my-thumbnail.png

# 3. 嵌入缩略图
node .claude/skills/elevenlabs-remotion-skill/generate.js \
  --embed-thumbnail public/videos/my-video.mp4 \
  --thumbnail public/videos/my-thumbnail.png \
  --output public/videos/my-video-final.mp4

支持的格式

  • 视频:MP4(H.264/H.265)
  • 缩略图:PNG、JPG、JPEG

嵌入功能使用 ffmpeg 的 -disposition:v:1 attached_pic 标志将缩略图设置为附加图片,大多数视频播放器和平台都会识别。

定时验证

此技能在生成后会自动使用 ffprobe 验证定时:

检查内容

检查项阈值描述
时长不匹配>15%如果实际时长与预期不同则发出警告
开头静音>200ms音频开始延迟(画外音延迟)
结尾静音>500ms末尾不必要的静音
语速2-4.5 wps最佳约 3 字/秒

验证现有音频

# 验证项目中的所有场景
node .claude/skills/elevenlabs-remotion-skill/generate.js --validate public/audio/product-demo/

输出示例:

🔍 正在验证 product-demo(6 个场景)

❌ scene1:3.00秒(预期:4.5秒)
   ❌ 音频比预期短 1.50秒
   👍 8 个单词 @ 3.1 字/秒
⚠️ scene2:6.35秒(预期:5.5秒)
   ⚠️ 开头静音:235 毫秒(可能开始延迟)
   🐢 10 个单词 @ 1.8 字/秒
✅ scene4:4.36秒(预期:4秒)
   👍 9 个单词 @ 2.3 字/秒

📊 总时长:30.80秒(预期:30.00秒)

更新后的 info.json

验证后,info.json 包含实际测量结果:

{
  "scenes": [
    {
      "id": "scene1",
      "duration": 4.5,
      "actualDuration": 3.0,
      "leadingSilence": 0.05,
      "wordsPerSecond": 3.1
    }
  ]
}

在你的 Remotion composition 中使用 actualDuration 实现精确同步。

选项

选项描述默认值
--text, -t要转换为语音的文本必需(或 --file/--scenes)
--file, -f从文件读取文本-
--output, -o输出文件路径output.mp3
--output-dir场景的输出目录public/audio
--voice, -v声音名称或 IDGeorge
--model, -m模型 IDeleven_multilingual_v2
--character, -c角色预设literal
--scenes包含场景的 JSON 文件-
--scene重新生成单个场景的 ID-
--new-text场景重新生成的新文本-
--validate验证现有的音频目录-
--skip-validation跳过自动验证false
--embed-thumbnail要嵌入缩略图的视频文件-
--thumbnail缩略图图像文件(PNG/JPG)-
--stability语音稳定性(0-1)因角色而异
--similarity语音相似度(0-1)因角色而异
--style风格夸张程度(0-1)因角色而异
--no-combined跳过组合文件false

推荐声音

声音风格最佳用途
George温暖、迷人的英式叙事、解说
Antoni专业、温暖法律内容、教程
Arnold权威、深沉企业、严肃话题
Josh友好、对话式营销、休闲内容

与 Remotion 集成

生成场景画外音后,在 composition 中使用它们:

import { Audio, Sequence, staticFile } from "remotion";

// 使用单独的场景音频文件实现精确同步
const SCENE_DURATIONS = {
  scene1: 4.5,  // 来自 info.json
  scene2: 5.5,
  scene3: 8.0,
};

export const VideoWithVoiceover: React.FC = () => {
  const { fps } = useVideoConfig();

  const scene1Frames = Math.round(SCENE_DURATIONS.scene1 * fps);
  const scene2Frames = Math.round(SCENE_DURATIONS.scene2 * fps);

  return (
    <>
      <Sequence from={0} durationInFrames={scene1Frames}>
        <Audio src={staticFile("audio/project/project-scene1.mp3")} />
        <Scene1Visual />
      </Sequence>

      <Sequence from={scene1Frames} durationInFrames={scene2Frames}>
        <Audio src={staticFile("audio/project/project-scene2.mp3")} />
        <Scene2Visual />
      </Sequence>
    </>
  );
};

获取最佳效果的技巧

  1. 使用角色预设:不要逐字朗读屏幕文本 - 使用 narrator 或 expert 实现自然流畅
  2. 标点符号很重要:使用句号表示停顿,逗号表示短暂停顿
  3. 数字:为了自然发音,拼写出数字("五百" 而非 "500")
  4. 缩写:写出完整的单词("二十四小时" 而非 "24h")
  5. 逐个场景:不同的场景可以使用不同的角色(戏剧性的开场、平静的呼吁行动)
  6. 精细调整:使用 --scene 重新生成单个场景,无需重做所有内容
  7. 请求拼接:确保所有场景的语音保持一致

工作流示例

# 1. 使用你的脚本创建 scenes.json
# 2. 使用叙事者风格生成所有场景
node .claude/skills/elevenlabs-remotion-skill/generate.js \
  --scenes remotion/my-video-scenes.json \
  --character narrator \
  --output-dir public/audio/my-video/

# 3. 在 Remotion 中预览,发现 scene2 开始过早
# 4. 仅重新生成 scene2,并使用更新后的文本
node .claude/skills/elevenlabs-remotion-skill/generate.js \
  --scenes remotion/my-video-scenes.json \
  --scene scene2 \
  --new-text "稍长一点的文本以填充视觉时序" \
  --output-dir public/audio/my-video/

# 5. 使用 info.json 中的新时长更新视频 composition
# 6. 重复直到时序完美

Individual skills in this repo

This repo contains 3 individual skills — each has its own dedicated page.

相关技能