Communitygithub.com

libz-renlab-ai/TeamBrain

HyperFrames 合成素材预处理工具集 — 文本转语音(Kokoro)、音视频转录(Whisper)及背景移除(u2net)

TeamBrain 是什么?

这是一个专为 HyperFrames 合成框架设计的素材预处理工具集,提供三个独立的 CLI 命令(tts、transcribe、remove-background),分别用于文本转语音、音频/视频转录以及背景移除。每个命令在首次运行时自动下载并缓存相应的 AI 模型(TTS 使用 Kokoro-82M,转录使用 OpenAI Whisper,背景移除使用 u2net_human_seg),无需配置 API 密钥。工具特别强调语音的多语言支持(通过语音 ID 首字母编码语言)和转录的语言安全规则(禁止默认使用 .en 模型,避免非英语音频被错误翻译)。用户可以将这些命令串联使用(例如 TTS → 转录 → 字幕),实现从文本到带时间戳字幕的完整工作流。输出结果可直接放入 HyperFrames 项目中使用。

兼容平台~Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/libz-renlab-ai/TeamBrain/tree/HEAD/.agents/skills/hyperframes-media

在你喜欢的 AI 中提问

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

文档

HyperFrames 媒体预处理

三个 CLI 命令用于生成合成素材:tts(语音)、transcribe(时间戳)和 remove-background(透明视频)。每个命令在首次运行时下载模型并缓存至 ~/.cache/hyperframes/。将输出放入项目后,即可在合成 HTML 中引用——音频/视频元素的相关约定请参见 hyperframes 技能。

文本转语音 (tts)

使用 Kokoro-82M 在本地生成语音音频。无需 API 密钥。

npx hyperframes tts "Text here" --voice af_nova --output narration.wav
npx hyperframes tts script.txt --voice bf_emma --output narration.wav
npx hyperframes tts --list                       # 全部 54 种语音

语音选择

根据内容匹配语音。默认为 af_heart。

内容类型语音原因
产品演示af_heart/af_nova温暖、专业
教程 / 操作指南am_adam/bf_emma中立、易于理解
营销 / 宣传af_sky/am_michael充满活力或权威感
文档bf_emma/bm_george清晰的英式英语,正式
休闲 / 社交af_heart/af_sky亲和力、自然

多语言

语音 ID 的首字母编码语言:a=美式英语,b=英式英语,e=西班牙语,f=法语,h=印地语,i=意大利语,j=日语,p=巴西葡萄牙语,z=普通话。CLI 会根据前缀自动检测音素器区域设置——当语音与文本匹配时无需 --lang 参数。

npx hyperframes tts "La reunión empieza a las nueve" --voice ef_dora --output es.wav
npx hyperframes tts "今日はいい天気ですね" --voice jf_alpha --output ja.wav

仅当需要覆盖自动检测(例如风格化口音)时使用 --lang。有效代码:en-us,en-gb,es,fr-fr,hi,it,pt-br,ja,zh。非英语音素化需要系统中安装 espeak-ng(brew install espeak-ng / apt-get install espeak-ng)。

语速

  • 0.7-0.8 — 教程、复杂内容、无障碍场景
  • 1.0 — 自然语速(默认)
  • 1.1-1.2 — 开场白、过渡、欢快内容
  • 1.5+ — 通常不推荐;请仔细测试

长文本

对于超过几段的内容,请写入 .txt 文件并传入路径。超过约 5 分钟语音的输入可能更适合拆分为多个片段。

要求

Python 3.8+,需安装 kokoro-onnx 和 soundfile(pip install kokoro-onnx soundfile)。模型在首次使用时下载(约 311 MB + 约 27 MB 语音,缓存于 ~/.cache/hyperframes/tts/)。

转录 (transcribe)

生成带有词级时间戳的规范化 transcript.json。

npx hyperframes transcribe audio.mp3
npx hyperframes transcribe video.mp4 --model small --language es
npx hyperframes transcribe subtitles.srt          # 导入现有字幕
npx hyperframes transcribe subtitles.vtt
npx hyperframes transcribe openai-response.json

语言规则(不可协商)

除非用户明确说明音频是英语,否则绝不使用 .en 模型。 .en 模型(small.en,medium.en)会翻译非英语音频为英语而非转录。这会静默地破坏原始语言。

  1. 语言已知且非英语 → --model small --language <code>(不加 .en 后缀)
  2. 语言已知且为英语 → --model small.en
  3. 语言未知 → --model small(不加 .en,不加 --language)——whisper 自动检测

默认模型是 small,而非 small.en。

模型大小

模型大小速度使用场景
tiny75 MB最快快速预览、测试流程
base142 MB快短片段、清晰音频
small466 MB中等默认——大多数内容
medium1.5 GB慢重要内容、嘈杂音频、音乐
large-v33.1 GB最慢生产级质量

含人声的音乐:至少从 medium 开始;已制作完成的曲目通常需要手动导入 SRT/VTT。关于字幕质量检查(每次转录后必须执行)、清洗 JS、重试规则以及 OpenAI/Groq API 导入路径,请参见 hyperframes/references/transcript-guide.md。

输出结构

合成使用扁平化的词对象数组。id 字段(w0,w1,...)在规范化过程中添加,用于字幕覆盖时的稳定引用;为向后兼容可选。

[
  { "id": "w0", "text": "Hello", "start": 0.0, "end": 0.5 },
  { "id": "w1", "text": "world.", "start": 0.6, "end": 1.2 }
]

背景移除 (remove-background)

从视频或图像中移除背景,使其可以作为透明叠加层放置在合成中(例如,漂浮在背景画板上的头像)。

npx hyperframes remove-background avatar.mp4 -o transparent.webm  # 默认:VP9 alpha WebM
npx hyperframes remove-background avatar.mp4 -o transparent.mov   # ProRes 4444(编辑用)
px hyperframes remove-background portrait.jpg -o cutout.png      # 单张图像抠图
npx hyperframes remove-background avatar.mp4 -o transparent.webm --device cpu
npx hyperframes remove-background --info                          # 检测到的提供者

使用 u2net_human_seg(MIT 协议)。首次运行时将约 168 MB 的权重下载到 ~/.cache/hyperframes/background-removal/models/。

输出格式

格式使用场景
.webm(VP9 + alpha 通道)默认。合成直接通过 <video> 播放。
.mov(ProRes 4444)在 DaVinci/Premiere/FCP 中编辑。文件较大。
.png单张图像抠图(静态主体,叠加在背景之上)。

Chrome 浏览器原生解码 VP9 alpha 通道,因此 .webm 可以像其他静音自动播放视频一样嵌入合成中——<video> 轨道相关约定请参见 hyperframes 技能。

TTS → 转录 → 字幕

当没有预先录制的配音时,先生成配音再将其转录回来,以获得字幕所需的词级时间戳:

npx hyperframes tts script.txt --voice af_heart --output narration.wav
npx hyperframes transcribe narration.wav   # → transcript.json

Whisper 从生成的音频中提取精确的词边界,因此字幕时间与配音完全匹配,无需手动调整。

Individual skills in this repo

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

libz-renlab-ai/TeamBrain

Install and wire registry blocks and components into HyperFrames compositions. Use when running hyperframes add, installing a block or component, wiring an installed item into index.html, or working with hyperframes.json. Covers the add command, install locations, block sub-composition wiring, component snippet merging, and registry discovery.

libz-renlab-ai/TeamBrain

Create video compositions, animations, title cards, overlays, captions, voiceovers, audio-reactive visuals, and scene transitions in HyperFrames HTML. Use when asked to build any HTML-based video content, add captions or subtitles synced to audio, generate text-to-speech narration, create audio-reactive animation (beat sync, glow, pulse driven by music), add animated text highlighting (marker sweeps, hand-drawn circles, burst lines, scribble, sketchout), or add transitions between scenes (crossfades, wipes, reveals, shader transitions). Covers composition authoring, timing, media, and the full video production workflow. For CLI commands (init, lint, preview, render, transcribe, tts) see the hyperframes-cli skill.

libz-renlab-ai/TeamBrain

Translate an existing Remotion (React-based) video composition into a HyperFrames HTML composition. Use ONLY when the user explicitly asks to port, convert, migrate, translate, or rewrite a Remotion composition as HyperFrames — for example "port my Remotion project to HyperFrames", "convert this Remotion code to HyperFrames", "migrate from Remotion", "translate this Remotion comp", or "rewrite this as HyperFrames HTML". Do NOT use when (a) the user is authoring a NEW HyperFrames composition, even if they have or are A/B-testing a similar Remotion video; (b) the user mentions Remotion in passing without asking for migration; (c) the user shares Remotion code as reference material rather than asking for a translation; (d) the user asks for "the same video as my Remotion one" without explicitly asking to migrate the source — treat that as a fresh HyperFrames build. When in doubt, default to authoring a native HyperFrames composition with the `hyperframes` skill instead. Skill detects unsupported patterns (use...

libz-renlab-ai/TeamBrain

Capture a website and create a HyperFrames video from it. Use when: (1) a user provides a URL and wants a video, (2) someone says "capture this site", "turn this into a video", "make a promo from my site", (3) the user wants a social ad, product tour, or any video based on an existing website, (4) the user shares a link and asks for any kind of video content. Even if the user just pastes a URL — this is the skill to use.

libz-renlab-ai/TeamBrain

HyperFrames CLI tool — hyperframes init, lint, inspect, preview, render, transcribe, tts, doctor, browser, info, upgrade, compositions, docs, benchmark. Use when scaffolding a project, linting, validating, inspecting visual layout in compositions, previewing in the studio, rendering to video, transcribing audio, generating TTS, or troubleshooting the HyperFrames environment.

相关技能