Communitygithub.com

delorenj/skills

HyperFrames 合成的前置資產處理 — 文字轉語音旁白 (Kokoro)、音訊/影片轉錄 (Whisper) 以及透明疊層的背景移除 (u2net)。適用於從文字生成語音、轉錄語音以製作字幕、移除影片或圖片背景作為透明疊層、選擇 TTS 語音或 Whisper 模型,或串聯這些步驟 (TTS → 轉錄 → 字幕)。每個指令在首次執行時會下載其模型。

skills 是什麼?

此技能提供三個 CLI 指令,用於為 HyperFrames 合成預先處理媒體資產:`tts` 使用本地 Kokoro-82M 模型從文字生成語音 (無需 API 金鑰),`transcribe` 透過 Whisper 產生含逐字時間戳記的標準化 `transcript.json`,而 `remove-background` 使用 u2net_human_seg 從影片或圖片移除背景,輸出透明疊層。它支援多種語言、不同語者選擇、以及從快速預覽到生產品質的各種模型大小。其獨特之處在於能創建「空洞切割」背景層 (`--background-output`),在主題與背景之間放置文字或圖形,並提供清晰的指引,避免常見錯誤如混合語言的 `.en` 模型或將空洞切割與修復混淆。這些資產會輸出至專案目錄,並可透過 `hyperframes` 技能所述的慣例在合成 HTML 中引用。

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

在你喜歡的 AI 中提問

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

預覽

來自技能 README

說明文件

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 會自動從前綴檢測音素化器地區設定 — 當語者與文字匹配時,無需 --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。關於字幕品質檢查 (每次轉錄後必須執行)、清理 JavaScript、重試規則以及 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,但阿爾法通道為 255 − mask 而非 mask。去背素材是帶有透明背景的主體;底板是帶有透明主體空洞的原始周圍環境。

檔案阿爾法通道是…用途
-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 反向阿爾法底板填充除主體區域外的所有內容 -->
<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 + 阿爾法通道)預設。合成透過 <video> 直接播放此檔案。
.mov (ProRes 4444)在 DaVinci/Premiere/FCP 中剪輯。檔案較大。
.png單一圖片去背 (靜態主體,分層放置於背景之上)。

Chrome 原生解碼 VP9 阿爾法通道,因此 .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> 中,並對包裝器的不透明度進行動畫處理,而不是影片元素本身。框架會對啟用的片段(任何帶有 data-start/data-duration 屬性的元素)強制設置不透明度為 1,因此直接對影片的不透明度進行動畫處理會被默默地覆蓋。包裝器沒有 data-* 屬性,因此它由您的 CSS/GSAP 控制。
  2. 兩個影片都使用 data-start="0" 和 data-media-start="0",這樣框架會從 t=0 開始同步解碼它們。延遲掛載去背素材 (data-start=3.3) 會引入一次搜尋+預熱,導致與基礎 mp4 偏差一個影格 — 在切換處可見為一個影格的不對齊。

然後使用 GSAP 在切換處翻轉包裝器的不透明度: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.json

然後使用 hyperframes 技能中的慣例將生成的 transcript.json 附加到您的合成中。

Individual skills in this repo

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

delorenj/skills

Plan and generate terminal ASCII animations/screensaver-style output (FPS, refresh rules, loop policy, low-flicker guidance), with a static poster frame and an optional local demo script.

delorenj/skills

ASCII video: convert video/audio to colored ASCII MP4/GIF.

delorenj/skills

Plan, build and quality-check a premium short commercial for a real business (roofing, property, ecommerce, B2B software) using AI-generated footage, code-built motion (HTML/GSAP), selective Three.js and an independent-critic "Gauntlet" loop. Use when asked to make a launch-style / SaaS-style video, business ad, explainer, sample reel or pitch video, or to review and improve one. Encodes motion principles distilled from 28 professional launch films, a quality bar, audio rules and a business-offer playbook.

delorenj/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.

delorenj/skills

Generate professional voiceovers using ElevenLabs AI. Use when the user needs to create voiceovers for videos, audio narration, or text-to-speech content. Supports multiple voices with character presets (narrator, salesperson, expert) for natural delivery. Includes single scene regeneration for fine-tuning.

delorenj/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.

delorenj/skills

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.

delorenj/skills

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 dev-loop CLI commands (init, lint, inspect, preview, render) see the hyperframes-cli skill; for asset preprocessing commands (tts, transcribe, remove-background) see the hyperframes-media skill.

delorenj/skills

Manim CE animations: 3Blue1Brown math/algo videos.

delorenj/skills

Join a Google Meet or Zoom call as a video meeting agent via PikaStreaming. Trigger: user drops a Google Meet or Zoom link, or asks to join a meeting.

delorenj/skills

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 (e.g. "port my Remotion project to HyperFrames"). Do NOT use when (a) authoring a NEW HyperFrames composition (even if A/B-testing a Remotion video); (b) Remotion is mentioned in passing; (c) Remotion code is shared as reference, not for translation; (d) the user wants "the same video as my Remotion one" without explicitly asking to migrate the source — treat as a fresh HyperFrames build. When in doubt, default to the `hyperframes` skill. Detects unsupported patterns (useState, useEffect side effects, async calculateMetadata, third-party React component libraries, `@remotion/lambda`) and recommends the runtime interop escape hatch instead of a lossy translation.

delorenj/skills

Generate speech using the self-hosted voxxy (vox) TTS service at https://vox.delo.sh. Use when the user asks to speak, say, narrate, synthesize speech, clone a voice, create a voice, add or register a voice, pipe TTS, or control voice qualities by description (e.g. "a young woman with a cheerful voice"). Handles HTTP API usage, voice profile management, description-based voice design, cloning, MCP registration, and integration patterns for new platforms.

delorenj/skills

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.

delorenj/skills

YouTube transcripts to summaries, threads, blogs.

相關技能