Hyperframes Media — Hyperframes 媒体
v3为HyperFrames组合提供资产预处理——文本转语音旁白(Kokoro),音频/视频转录(Whisper),以及为透明叠加层去除背景(u2net)。在以下情况下使用:从文本生成语音旁白,转录语音以生成字幕,从视频或图像中去除背景以用作透明叠加层,选择TTS语音或Whisper模型,或将这些功能链接起来(TTS → 转录 → 字幕)。每个命令在首次运行时下载其自身的模型。
运行时依赖
安装命令
点击复制技能文档
HyperFrames 媒体预处理 三个 CLI 命令用于生成合成资产:tts(语音)、transcribe(时间戳)和 remove-background(透明视频)。每个命令在第一次运行时下载模型并将其缓存到 ~/.cache/hyperframes/。将输出放入项目中,然后从合成 HTML 中引用它 —— 参见 hyperframes 技能中的音频/视频元素约定。
文本转语音(tts) 使用 Kokoro-82M 在本地生成语音音频。无需 API 密钥。 npx hyperframes tts "文本内容" --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 自动检测 phonemizer 区域从前缀 —— 无需 --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) 生成带有单词级时间戳的 normalized 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)将非英语音频转换为英语,而不是转录它。这会默默地破坏原始语言。
已知语言且非英语 —— --model small --language (无 .en 后缀)
已知语言且英语 —— --model small.en
未知语言 —— --model small(无 .en,无 --language)—— whisper 自动检测
默认模型为 small,而不是 small.en。
模型大小
模型大小 速度 何时使用
tiny 75 MB 最快 快速预览、测试管道
base 142 MB 快 短片段、清晰音频
small 466 MB 中等 默认 —— 大多数内容
medium 1.5 GB 慢 重要内容、嘈杂音频、音乐
large-v3 3.1 GB 最慢 生产质量
带有人声的音乐:从 medium 最低开始;生成的音轨通常需要手动导入 SRT/VTT。对于字幕质量检查(在每次转录后强制执行),请参阅 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 subject.mp4 -o transparent.webm # 默认:VP9 alpha WebM
npx hyperframes remove-background subject.mp4 -o transparent.mov # ProRes 4444(编辑)
npx hyperframes remove-background portrait.jpg -o cutout.png # 单图像切割
npx hyperframes remove-background subject.mp4 -o transparent.webm \
--background-output plate.webm # 一次性生成两个图层
npx hyperframes remove-background subject.mp4 -o transparent.webm --device cpu
npx hyperframes remove-background --info # 检测到的提供者
使用 u2net_human_seg(MIT)。第一次运行时下载 ~168 MB 的权重到 ~/.cache/hyperframes/background-removal/models/。
图层分离(--background-output)
传递 --background-output 以生成两个图层。