Communitygithub.com

shengdabai/Tony-Claude-Code-Skills

HyperFrames 組合的素材前置處理:文字轉語音旁白 (Kokoro)、音訊/影片轉錄 (Whisper)、以及移除背景以產生透明疊層 (u2net)。

Tony-Claude-Code-Skills 是什麼?

這組技能提供三個 CLI 指令,專為 HyperFrames 影音組合工作流程進行前置素材處理。`tts` 指令利用 Kokoro-82M 模型在本地端將文字轉為語音,無需 API 金鑰,並支援 54 種多語言聲音,能根據內容類型自動選擇合適的語調。`transcribe` 指令使用 Whisper 模型,從音訊或影片中產生包含逐字時間戳記的 JSON 檔案,可匯入現有字幕格式並支援語言自動偵測,同時提供不同模型大小以因應速度與品質需求。`remove-background` 指令則使用 u2net_human_seg 模型,從影片或圖片中移除背景,產出具有透明背景的 WebM (VP9) 或 MOV (ProRes 4444) 格式素材,並可選擇同時輸出前景主體層與背景底層,方便在組合中彈性疊加文字或圖形。這些指令完善地支援從文字生成語音、將語音轉錄為字幕,以及製作透明疊層的完整流程,所有模型皆於首次執行時下載並快取於 `~/.cache/hyperframes/` 目錄下,適合需要快速迭代影音內容的開發者。

相容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/shengdabai/Tony-Claude-Code-Skills/tree/HEAD/skills/hyperframes-hyperframes-media

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

預覽

來自技能 README

說明文件

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 <代碼>(無 .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 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 subject.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(或 -b)來與去背畫面一起輸出第二個透明影片:與來源相同的 RGB,但 alpha 為 255 - 遮罩 而非 遮罩。去背畫面的主體具有透明背景;底層則是原始背景,主體所在位置為透明空洞。

檔案Alpha 是…用途
-o subject.webm遮罩 — 主體不透明、背景透明前景圖層,放置於頂層
--background-output plate.webm反向 — 背景不透明、主體區域透明底層;可將文字或圖形置於此層與主體層之間

兩個輸出共享相同的 --quality 預設,並從單次推論處理中執行——編碼成本約為兩倍,但分割成本不變。僅適用於影片輸入和 .webm/.mov 輸出。

是挖洞的底層,而非修補過的乾淨背景。 plate.webm 中的主體區域是完全透明的——在其下方合成不透明內容以填補空洞。判斷 --background-output 是否為正確工具的單一測試是:在主體原本所在的位置,是否曾經有任何東西會透過主體的剪影被看到?

使用場景正確工具
文字/圖形位於去背畫面與底層之間(此指令存在的原因)挖洞 (--background-output)
將主體置於不相關的場景上僅使用 subject.webm;忽略底層
在沒有任何其他內容的背景上單獨顯示「沒有那個人的房間」乾淨背景 — 需要修補工具(LaMa、ProPainter、E2FGVI)。不是此指令。
用不同的主體替換現有主體乾淨背景 — 同上

如果使用者要求「移除人物後的房間」並且打算單獨顯示它,請不要使用 --background-output。告知他們需要一個修補工具。

典型的圖層組合(標準的挖洞使用案例):

<!-- z=1 反向 alpha 的底層填滿主體區域以外的整個畫面 -->
<video
  src="plate.webm"
  data-start="0"
  data-duration="6"
  data-track-index="0"
  muted
  playsinline
></video>

<!-- z=2 圖形/文字位於兩個圖層之間 -->
<h1 id="headline" style="z-index:2; ...">MAKE IT IN HYPERFRAMES</h1>

<!-- z=3 去背畫面將主體浮在上方,蓋過標題 -->
<div class="cutout-wrap" style="position:absolute;inset:0;z-index:3">
  <video
    src="subject.webm"
    data-start="0"
    data-duration="6"
    data-track-index="1"
    muted
    playsinline
  ></video>
</div>

這在功能上等同於下列的文字在主體後方模式,但你不需要在專案中保留原始的 presenter.mp4 —— 底層取代了它。當你想要僅提供兩個透明圖層,並讓使用者在其之間放置任意內容時,這非常有用。

輸出格式

格式何時使用
.webm(VP9 + alpha)預設。組合透過 <video> 直接播放。
.mov(ProRes 4444)在 DaVinci/Premiere/FCP 中剪輯。檔案較大。
.png單張圖片去背(靜態主體,疊加於背景之上)。

Chrome 原生解碼 VP9 alpha,因此 .webm 可以像其他任何靜音自動播放影片一樣插入組合——請參閱 hyperframes 技能以了解 <video> 軌道慣例。

品質預設

--quality fast|balanced|best 僅控制 VP9 編碼器的 CRF——分割品質是固定的。

預設CRF何時使用
fast30疊代開發、較小檔案、顏色匹配較鬆散
balanced18預設。對於大多數使用情況視覺上相同
best12母版/最終交付。檔案最大、匹配最嚴格

合成模式 — 選擇正確的

去背後的 webm 是來源 mp4 RGB 的重新編碼副本。這個選擇會對其背後放置的內容產生影響:

模式去背畫面背後是什麼結果
去背畫面疊在另一個場景上(最常見)靜態圖片、漸層或不相關的影片看起來很棒。去背畫面的 RGB 是主體的唯⼀來源——沒有重疊、沒有邊緣光暈。這是 remove-background 的設計用途。
去背畫面疊在其自身的來源 mp4 上(文字在主體後方)產生去背畫面時相同的 mp4同一個人有兩個 RGB 來源。在預設 --quality balanced(crf 18)下,重疊幾乎不可見;在 --quality fast(crf 30)下,你會看到微弱的色偏 / 邊緣光暈。製作母版時請使用 --quality best(crf 12)。
去背畫面疊在同一個人的_不同_鏡頭上同一位主體的不同片段看起來會像兩個不同的人重疊。請勿這樣做。

文字在主體後方(標題位於簡報者背後):

<video
  src="presenter.mp4"
  id="bg"
  data-start="0"
  data-duration="6"
  data-track-index="0"
  muted
  playsinline
></video>
<h1 id="headline" style="z-index:2; ...">MAKE IT IN HYPERFRAMES</h1>
<div class="cutout-wrap" style="position:absolute;inset:0;z-index:3;opacity:0">
  <video
    src="presenter.webm"
    data-start="0"
    data-duration="6"
    data-track-index="1"
    muted
    playsinline
  ></video>
</div>

兩個關鍵規則:

  1. 將去背影片包在一個非計時的 <div> 中,並動畫化該 wrapper 的不透明度,而不是影片元素本身。框架會強制啟用中的片段(任何具有 data-start/data-duration 屬性的元素)的不透明度為 1,因此直接動畫化影片的不透明度會被靜默覆蓋。Wrapper 沒有 data-* 屬性,因此它由你的 CSS/GSAP 控制。
  2. 兩個影片都使用 data-start="0" 和 data-media-start="0",這樣框架從 t=0 開始同步解碼它們。延遲掛載去背畫面(data-start=3.3)會引入一次 seek 和暖機,導致其畫面與基礎 mp4 相差一格——在切換時會出現一格的錯位。

然後使用 GSAP 在切換點翻轉 wrapper 的不透明度:tl.set(cutoutWrap, { opacity: 1 }, 3.3)。

TTS → 轉錄 → 字幕

當沒有預先錄製的旁白時,可生成一個並將其轉錄回來,以獲得用於字幕的逐字時間戳記:

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

…

[為翻譯而截斷]

Individual skills in this repo

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

shengdabai/Tony-Claude-Code-Skills

Downloads videos from YouTube and other platforms for offline viewing, editing, or archival. Handles various formats and quality options.

shengdabai/Tony-Claude-Code-Skills

接收抖音、小红书、微信视频号等短视频链接或分享文案,查询作品/账号数据并提取语音文字稿,按作者和标题归档为 Markdown。用户希望完整解析短视频、取得数据或文字稿时使用;运行前检查 TikHub 与轻抖使用凭证,缺少时用新手能理解的方式引导购买和安全配置。

shengdabai/Tony-Claude-Code-Skills

Read-only queue dashboard for workspace-aware ship. (gstack)

shengdabai/Tony-Claude-Code-Skills

Anime.js adapter patterns for HyperFrames. Use when writing Anime.js animations or timelines inside HyperFrames compositions, registering animations on window.__hfAnime, making Anime.js seek-driven and deterministic, or translating Anime.js examples into render-safe HyperFrames HTML.

shengdabai/Tony-Claude-Code-Skills

Author a new HyperFrames registry block (caption style, VFX block, transition, lower third) or component (text effect, overlay, snippet) and ship it as an upstream PR to the hyperframes repo. Use ONLY when the user wants to CONTRIBUTE to the public catalog — for in-project caption/transition authoring use the `hyperframes` skill, for installing existing registry items use the `hyperframes-registry` skill.

shengdabai/Tony-Claude-Code-Skills

CSS animation adapter patterns for HyperFrames. Use when authoring CSS keyframes, animation-delay based timing, animation-fill-mode, animation-play-state, or CSS-only motion that HyperFrames must seek deterministically during preview and rendering.

shengdabai/Tony-Claude-Code-Skills

GSAP animation reference for HyperFrames. Covers gsap.to(), from(), fromTo(), easing, stagger, defaults, timelines (gsap.timeline(), position parameter, labels, nesting, playback), and performance (transforms, will-change, quickTo). Use when writing GSAP animations in HyperFrames compositions.

shengdabai/Tony-Claude-Code-Skills

HyperFrames CLI dev loop — `npx hyperframes` for scaffolding (init), validation (lint, inspect), preview, render, and environment troubleshooting (doctor, browser, info, upgrade). Use when running any of these commands or troubleshooting the HyperFrames build/render environment. For asset preprocessing commands (`tts`, `transcribe`, `remove-background`), invoke the `hyperframes-media` skill instead.

相關技能