SkillsGrove
SkillsGrove/Videoproduktion/ZJU-REAL/Easel/multi-voice-dubbing

multi-voice-dubbing

Installation

$npx skills add https://github.com/ZJU-REAL/Easel --skill multi-voice-dubbing
$git clone --depth 1 https://github.com/ZJU-REAL/Easel.git /tmp/Easel && mkdir -p ~/.claude/skills && cp -r /tmp/Easel/skills/builtin/multi-voice-dubbing ~/.claude/skills/multi-voice-dubbing
Bitte installiere diesen Agent Skill für mich: https://github.com/ZJU-REAL/Easel/tree/011e10d86711c7ace3cbb01153f8915dbd018020/skills/builtin/multi-voice-dubbing – lies zuerst seine SKILL.md und seine Skripte und installiere ihn erst dann in meinen Skills-Ordner, wenn du bestätigt hast, dass er sicher ist.

Zusammenfassung

Originalbeschreibung · Apache-2.0多角色对话配音:按 cast 和逐行对白为不同角色分配音色与情绪,合成多声线音轨和带角色名字幕。 当用户说“多角色/双人/剧本/对话配音、多人对白、不同角色不同声音、有声剧配音”时使用。 单一公共音色用 tts-voiceover;克隆本人音色用 voice-clone;整部短剧制作由 short-drama 编排。
Die folgende SKILL.md ist aus ZJU-REAL/Easel (Commit 011e10d) unter der Lizenz Apache-2.0 wiedergegeben. Der Text ist unverändert; lediglich die Metadaten im Dateikopf sind weggelassen, Bilder werden als Links angezeigt und sehr lange Dateien werden gekürzt. Copyright owner or entity authorized by. Lizenz: LICENSE. Es wird nur die Anleitungsdatei angezeigt; etwaige Skripte finden Sie im Original-Repository.

多角色 / 对话配音(Multi-voice Dubbing)

把「多人对话 / 多角色脚本」合成为多声线音轨——每个角色一个符合其人设的声音, 不再是「全程一个声音」。核心引擎 skills/shared/scripts/multivoice.py: 逐行调 tts.py(edge-tts 免费多音色)或 voice_clone.py(云端表现力 provider / 克隆音色)合成, 把每行 emotion 喂进 provider 的真情感通道,ffmpeg 拼成一轨 + 生成对齐的说话人字幕。

创意(谁说什么、什么情绪)由你 LLM 产出;音色映射在 cast。确定性 IO(逐行合成/拼接/字幕)走引擎。 产物 voice.mp3 可直接当 narration 喂 auto-short-video/assemble.py 或加进任意视频;voice.srt 是带角色名的字幕。

配音质量分层(重要:治「像 AI 平读」)

edge-tts 没有情感引擎,只能变速变调,再怎么调也像机器平读。要"像人"必须用有情感通道的云 provider(用户自备 key,无需 GPU):

引擎(cast 里 engine) 质量 需要 情感机制
edge(默认,免费兜底) ⚠️ 平、机器感,仅供草稿 无 key、外网 仅 rate/pitch/volume 微调
clone+openai-compatible→SiliconFlow CosyVoice2(推荐) 好、中文自然 VOICE_API_KEY(便宜/新用户赠额) 内联 <|endofprompt|> 指令
clone+gemini 好、真免费 GEMINI_API_KEY(Google 免费层,国内需代理) 自然语言前缀
clone+minimax / dashscope 好、有情绪 各家 key emotion 枚举 / instruct

推荐 SiliconFlow(云端 CosyVoice2、无需 GPU、中文最稳)配置落 .env:

VOICE_PROVIDER=openai-compatible
VOICE_BASE_URL=https://api.siliconflow.cn/v1
VOICE_API_KEY=<你的key>
VOICE_MODEL=FunAudioLLM/CosyVoice2-0.5B
VOICE_INSTRUCT_MODE=inline

cast 里角色:--engine clone --provider openai-compatible --voice-id FunAudioLLM/CosyVoice2-0.5B:alex(8 音色 alex/anna/benjamin/…)。

  • 逐行 emotion 自动驱动演绎:lines.json 每行的 emotion(愤怒/崩溃大哭/冷笑/温柔…)→ 引擎按 provider 转成对应情感参数。写具体越贴戏越好。
  • 想要「像人」→ 至少给主角/关键角色配一个云 provider(engine=clone);配了 key 才有情绪,没 key 自动回退 edge(平)并告警。
  • provider 配置见 voice_clone.py 头部(各家 env);voice_clone.py check --provider <名> 离线校验 key 是否齐。

谁会用到

短剧对白(short-drama 已内部委派)、论文双人问答讲解(paper-explainer:主讲+提问者)、 访谈/播客脚本、有声剧、任何「多个说话人」的口播。单人整段口播用 tts-voiceover 即可。

输入

字段 必填 说明
cast.json 是 选角表:每个说话人 → 音色(edge 音色 + pitch/rate,或克隆音色)。含「旁白/主讲」条目
lines.json 是 逐行对白:有序 [{speaker, text, emotion}](speaker 用 cast 里的名字;emotion 如 冷/怒/紧张/温柔,自动匹配语气)
输出路径 否 voice.mp3(默认与调用方约定);voice.srt 同名

执行步骤

1. 选角(cast.json)——读选角指南定音色

先读 skills/shared/references/voice-casting.md(音色→人物原型对照 + 同性别区分 + 旁白独立 + 情绪韵律)。 为每个说话人定一个符合其性别/年龄/气质/身份的音色,旁白/主讲单列且与所有角色不同:

python skills/shared/scripts/multivoice.py cast init  --cast <路径>/cast.json
python skills/shared/scripts/multivoice.py cast add   --cast <路径>/cast.json \
    --name 林策 --role male_lead --engine edge --voice zh-CN-YunxiNeural --rate=-5% --pitch=-3Hz --note "冷峻男主"   # 负值参数用等号
python skills/shared/scripts/multivoice.py cast add   --cast <路径>/cast.json \
    --name 苏晚 --role female_lead --engine edge --voice zh-CN-XiaoxiaoNeural --note "温婉女主"
python skills/shared/scripts/multivoice.py cast check --cast <路径>/cast.json    # 校验:音色有效/旁白独立/无撞音色

cast.json 也可直接写(就是 JSON)。想让某角色像真人有情绪(治 AI 平读)→ 该角色用云 provider:

python skills/shared/scripts/multivoice.py cast add --cast <路径>/cast.json \
    --name 霸总 --role male_lead --engine clone --provider minimax --voice-id <你的音色id> --note "克隆/表现力音色"

需在 .env 配对应 provider 的 key(voice_clone.py check --provider minimax);缺 key 该角色自动回退 edge(平)并告警。

2. 逐行对白(lines.json)

把脚本 / 对话稿拆成有序逐行:

{"lines":[
  {"speaker":"主讲","text":"这篇论文解决了一个关键问题。","emotion":"平"},
  {"speaker":"提问","text":"等等,为什么现有方法不行?","emotion":"惊"},
  {"speaker":"主讲","text":"因为它们忽略了时序依赖。","emotion":"坚定"}
]}

speaker 必须与 cast 里的名字一致(不一致会回退旁白音色并告警);emotion 可选。

3. 合成多声线音轨 + 字幕

python skills/shared/scripts/multivoice.py dub \
    --cast <路径>/cast.json --lines <路径>/lines.json -o <路径>/voice.mp3

产出 voice.mp3(每角色独立声线、情绪自动调韵律)+ voice.srt(带角色名,时序按逐行实测时长对齐)。 dub 会打印用了几种声线——确认 ≥2 种(多人对话不该只有一个声音)。

4. 用到视频里

  • voice.mp3 作 narration + voice.srt 作字幕,喂 auto-short-video/scripts/assemble.py(图/视频合成)。
  • 或与 BGM 混音(audio-mix)、加进已有视频(video-editing)。

降级

  • 缺外网/edge-tts 不通 → 无法合成,如实告知(多声线依赖 edge-tts)。
  • cast 指定克隆音色但缺 key/失败 → 该角色自动回退 edge 免费音色并告警,不阻断。
  • 说话人不在 cast → 回退旁白音色并告警(建议补进 cast)。

Profile 感知

  • 有 Profile:style.md 融进音色气质选择(角色气质→音色);preferences.md 红线过滤台词。
  • 无 Profile:按 voice-casting.md 默认对照选音色。

规则

  1. 多人对话必须多声线:每个说话人独立音色、旁白/主讲单列——绝不允许全程一个声音(cast check + dub 声线数把关)。
  2. 要像人就上云 provider:edge 只配草稿;成品/关键角色用 engine=clone+provider(有真情感通道),无需 GPU。
  3. 音色贴人物:按 voice-casting.md 的原型对照 + 同性别用 pitch/rate 区分。
  4. 情绪标注要具体:lines 每行标 emotion(愤怒/崩溃大哭/冷笑/温柔…),会喂进 provider 情感通道驱动演绎。
  5. 确定性留档:cast.json / lines.json 落文件,改台词/换音色重跑 dub 即可,不必重来。

参考来源

见 EASEL-META.md。多声线配音(cast + 逐行 lines + 按角色音色逐行合成 + ffmpeg 拼接 + 说话人字幕)为 Easel 自研; 底层封装 edge-tts(tts.py)与云端克隆(voice_clone.py)。

Vollständigen Lizenztext ansehen (Apache-2.0)
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.