zenstory-ai/video-recap-skills / skills/video-recap
video-recap
Verified把一段或多集视频做成带画框字幕的中文解说成片或纯原声高光短片。用户提供 .mp4 / .mov / .mkv / .webm,要求做影视解说、短剧二创、加旁白配音、跨集混剪或导出剪映草稿时使用;串联完成看片识台词、定主线与留原声、按台词停顿切镜头、写词检查、TTS 配音与混音加字幕。触发词:视频解说、影视解说、视频旁白、生成解说、视频 recap、video recap、voiceover、narration、recap。
scripts/providers/fish_audio.py
View on GitHub"""Fish Audio TTS transport for voiceover.py.
The provider returns audio bytes rather than JSON. Keep the request, response validation,
and secret-safe error handling isolated here so voiceover.py only selects an engine.
"""
import json
import os
import urllib.error
import urllib.request
from pathlib import Path
from lib import CONFIG, _sanitize_api_error
def fish_speed(rate):
"""The numeric prosody speed Fish Audio receives for a '+5%'-style rate."""
return 1.0 + float(rate.rstrip("%")) / 100.0
def _fish_payload(text, rate):
payload = {
"text": text,
"format": "wav",
"normalize": True,
"prosody": {
"speed": fish_speed(rate),
"volume": 0,
"normalize_loudness": True,
},
}
reference_id = CONFIG["fish_tts_reference_id"]
if reference_id:
payload["reference_id"] = reference_id
return payload
def synthesize_fish_audio(text, output_path, rate="+0%"):
"""Synthesize one narration block and atomically write the WAV response."""
api_key = CONFIG["fish_api_key"]
if not api_key:
raise RuntimeError("请设置 FISH_API_KEY 用于 Fish Audio TTS")
body = json.dumps(_fish_payload(text, rate), ensure_ascii=False).encode("utf-8")
request = urllib.request.Request(
CONFIG["fish_tts_api_url"],
data=body,
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
"Accept": "audio/wav",
"model": CONFIG["fish_tts_model"],
"User-Agent": "video-recap/1.0",
},
method="POST",
)
try:
with urllib.request.urlopen(request, timeout=CONFIG["tts_timeout"]) as response:
audio = response.read()
content_type = response.headers.get("Content-Type", "").lower()
except urllib.error.HTTPError as exc:
detail = _sanitize_api_error(
exc.read().decode("utf-8", errors="replace"),
extra_secrets=(api_key,),
)
if exc.code == 401:
raise RuntimeError("Fish Audio 认证失败 (401),请检查 FISH_API_KEY") from exc
if exc.code == 402:
raise RuntimeError("Fish Audio 请求被拒绝 (402),请检查模型额度或计费状态") from exc
raise RuntimeError(f"Fish Audio TTS 请求失败 (HTTP {exc.code}): {detail}") from exc
except urllib.error.URLError as exc:
raise RuntimeError(
"Fish Audio TTS 网络错误: "
f"{_sanitize_api_error(exc.reason, extra_secrets=(api_key,))}"
) from exc
if "json" in content_type:
detail = _sanitize_api_error(
audio.decode("utf-8", errors="replace"),
extra_secrets=(api_key,),
)
raise RuntimeError(
f"Fish Audio TTS 返回了 JSON 而不是音频: {detail}"
)
if (
len(audio) <= 44
or audio[:4] != b"RIFF"
or audio[8:12] != b"WAVE"
):
raise RuntimeError("Fish Audio TTS 返回的内容不是有效 WAV")
output = Path(output_path)
partial = Path(str(output) + ".part")
partial.write_bytes(audio)
os.replace(partial, output)
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: 196k | 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: 196k | 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: 196k | Updated | Claude CodeCodex | Verified | Install |