anbeime/skill / skills/video-creation-suite/video-creation-suite
video-creation-suite
Unverified自媒体创作者与影片与视频编辑当需要从零原创、二次创作或深度分析视频时,请使用此套件。通过11个智能体协同,一键生成配音、音效与BGM并合成高质量视频,或自动抽帧提取分镜提示词,全流程大幅提升视频产出效率。
scripts/generate_narration.py
View on GitHub#!/usr/bin/env python3
"""
简单旁白音频生成脚本
使用系统TTS或占位音频
"""
import os
import json
import subprocess
def generate_narration_audio(script_path: str, output_dir: str):
"""
生成旁白音频(静音占位)
参数:
script_path: 分镜脚本路径
output_dir: 输出目录
"""
with open(script_path, 'r', encoding='utf-8') as f:
script = json.load(f)
total_duration = script['duration']
print(f"正在生成旁白音频(静音占位)...")
print(f"总时长: {total_duration}秒")
print(f"注意: 实际使用时需要替换为真实的旁白音频")
output_path = os.path.join(output_dir, "narration.mp3")
# 使用ffmpeg生成静音音频(作为占位)
cmd = [
"ffmpeg",
"-f", "lavfi",
"-i", f"anullsrc=r=44100:cl=mono",
"-t", str(total_duration),
"-q:a", "9",
"-y",
output_path
]
try:
result = subprocess.run(cmd, capture_output=True, text=True, timeout=60)
if result.returncode == 0:
# 获取文件大小
size = os.path.getsize(output_path)
print(f"\n✓ 旁白音频已生成: {output_path}")
print(f"大小: {size / 1024:.1f} KB")
print(f"注意: 这是静音占位音频,实际使用时需要替换为真实的旁白")
else:
print(f"\n✗ 旁白音频生成失败")
print(f"错误: {result.stderr}")
raise Exception(f"ffmpeg失败: {result.stderr}")
except Exception as e:
print(f"\n✗ 旁白音频生成失败: {str(e)}")
raise
if __name__ == "__main__":
script_path = "./output/script.json"
output_dir = "./output/audio"
os.makedirs(output_dir, exist_ok=True)
generate_narration_audio(script_path, output_dir)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |