Communitygithub.com

Remotion 轉 HyperFrames

僅在使用者明確要求將現有 Remotion (React) 合成專案移植/轉換/遷移/翻譯至 HyperFrames HTML 時使用。

Remotion 轉 HyperFrames 是什麼?

此技能專門處理 Remotion (React) 影片合成原始碼至 HyperFrames (HTML + GSAP) 的機械式轉換。它包含一個階層式測試語料庫 (T1-T4),用於驗證轉譯品質,確保 SSIM 指標落在可接受範圍內。技能會先對 Remotion 原始碼進行 lint 檢查,識別無法順暢轉譯的「阻斷器」(如 useState、useEffect、async calculateMetadata 等)並建議使用執行時期互通模式,對於「警告」則在轉譯後記錄差異。整個工作流程遵循固定步驟:lint 檢查、規劃 API 對應、生成 HF 合成、驗證比對,最後撰寫轉譯註記。此轉換是單向的、僅限 Remotion,不支援逆向匯出或非 Remotion 來源。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/9018/mychat/tree/HEAD/OpenMontage/.agents/skills/remotion-to-hyperframes

在你喜歡的 AI 中提問

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

說明文件

Remotion 轉 HyperFrames 是做什麼的?

在開始建構之前,請確認路線。 僅在要將現有的 Remotion (React) 合成原始碼移植到 HyperFrames 時使用此技能。要創作 新的 合成 (即使是受 Remotion 影片啟發) → 請使用創作流程 /general-video。超出範圍 (單向、僅限 Remotion):不支援逆向匯出 (HyperFrames → Remotion 或任何框架),且 非 Remotion 來源 (After Effects、Framer Motion、純 React / CSS) 沒有 Remotion 原始碼可翻譯 → 請透過 /general-video 重新建立。不確定,或只是順便提到 Remotion?請先閱讀 /hyperframes。

概觀

將 Remotion (基於 React) 影片合成翻譯成 HyperFrames (HTML + GSAP) 的合成。大多數 Remotion 慣用法在 HyperFrames 中都有直接對應 — 對於約 80% 的典型合成,此翻譯是機械性的。此技能編碼了這個對應關係,並透過拒絕翻譯不適合 HF 搜尋驅動模型的模式,以及推薦 PR #214 中的執行時期互通模式,來防範那有損的 20%。

該技能附帶一個分層測試語料庫 (T1–T4,共 4 個固定測試案例),根據測量的 SSIM 閾值對翻譯進行評級。不要在不執行評測的情況下進行翻譯 — 一個「看起來正確」但 SSIM 比經過驗證的基準低 0.05 的翻譯是無聲的錯誤。

使用時機

僅在使用者明確要求從 Remotion 遷移時使用此技能。 觸發範例短語:

  • "將我的 Remotion 專案移植到 HyperFrames"
  • "將此 Remotion 程式碼轉換為 HyperFrames"
  • "從 Remotion 遷移"
  • "翻譯此 Remotion 合成"
  • "將其重寫為 HyperFrames HTML"

在以下情況請勿使用此技能:

  • (a) 使用者正在創作新的 HyperFrames 合成,即使他們擁有或正在 A/B 測試類似的 Remotion 影片。
  • (b) 使用者只是順帶提及 Remotion,但沒有要求遷移。
  • (c) 使用者分享 Remotion 程式碼作為參考資料,而不是要求翻譯。
  • (d) 使用者要求「與我的 Remotion 一樣的影片」,但沒有明確要求遷移原始碼 — 將其視為全新的 HyperFrames 建構。

不支援 (拒絕 — 這不是此技能的用途):

  • 反向方向。 將 HyperFrames 合成匯出回 Remotion (或任何其他框架) 不是一個工作流程 — 翻譯僅限於 Remotion → HyperFrames。要直說。
  • 非 Remotion 來源。 After Effects 專案 (.aep)、Framer Motion / 純 React / CSS 動畫,或任何其他工具的原始碼都不是 Remotion 合成 — 沒有 Remotion 原始碼可翻譯。請透過 /general-video 原生重新建立它,或者如果 HyperFrames 無法表示它,則拒絕。

如有疑問,預設使用 /general-video (一般 HyperFrames 創作流程) 來創作原生 HyperFrames 合成。

工作流程

步驟 1:Lint 原始碼

在 Remotion 原始目錄上執行 scripts/lint_source.py。該 lint 會偵測無法順利翻譯的模式:

  • 阻斷器 (拒絕並建議互通):useState、useReducer、帶有非空依賴項的 useEffect/useLayoutEffect、非同步 calculateMetadata、第三方 React UI 函式庫 (MUI、Chakra、Mantine、antd、shadcn、Radix、NextUI)。
  • 警告 (在丟棄該結構後進行翻譯):@remotion/lambda 配置、delayRender、useCallback、useMemo、自訂鉤子。
  • 資訊 (附上註記進行翻譯):staticFile、interpolateColors。

如果任何阻斷器觸發,請停止。閱讀 references/escape-hatch.md 並呈現建議訊息。警告不會阻止翻譯 — 在步驟 3 中丟棄有問題的結構,並在 TRANSLATION_NOTES.md 中記錄差距。@remotion/lambda 配置是典型的警告案例:該技能會丟棄該匯入及 renderMediaOnLambda(...) 呼叫,但會翻譯合成的其餘部分。

步驟 2:規劃翻譯

閱讀 references/api-map.md — 這是每個 Remotion API 及其 HF 對應或每個主題參考文件的索引。根據原始碼使用的內容,識別您將需要哪些主題參考文件:

原始碼包含載入參考文件
Composition、defaultProps、schema、calculateMetadataparameters.md
Sequence、Series、Loop、AbsoluteFill、Freezesequencing.md
useCurrentFrame、interpolate、spring、Easing、interpolateColorstiming.md
Audio、Video、Img、IFrame、staticFile、delayRendermedia.md
TransitionSeries、@remotion/transitionstransitions.md
@remotion/lottielottie.md
@remotion/google-fonts/<Family>、Font.loadFont、@font-facefonts.md

不要全部載入 — 只載入特定原始碼需要的部分。

步驟 3:生成 HF 合成

輸出 index.html,包含:

  • 根 <div id="stage">,帶有合成的 data-composition-id、data-start="0"、data-duration (以秒為單位)、data-fps、data-width、data-height,以及每個標量 prop 的 data-*。
  • 一個包含場景 div 的扁平列表,帶有 data-start / data-duration / data-track-index。
  • 用於佈局的內聯 <style>;CSS 設置每個動畫屬性的 from 狀態。
  • 底部一個包含單個暫停的 gsap.timeline({paused: true}) 的 <script> 標籤。每個 Remotion useCurrentFrame() 推導都變成這個時間軸上一個位於正確偏移量的補間動畫。
  • window.__timelines["<composition-id>"] = tl; 將時間軸註冊到 HF 的執行時期。

自訂 React 子組件使用 prop 介面作為模板,內聯為重複的 HTML (有關每個實例的 data-* 模式,請參閱 parameters.md)。

步驟 4:驗證

執行評測框架 — 完整指南請參閱 references/eval.md。快速路徑:

# 渲染 Remotion 基準 (在固定測試案例中執行 npm install 後)
cd remotion-src && npx remotion render <CompositionId> out/baseline.mp4

# 渲染 HF 翻譯
cd ../hf-src && npx hyperframes render --skill=remotion-to-hyperframes --output ../hf.mp4

# SSIM 差異
../../scripts/render_diff.sh ./remotion-src/out/baseline.mp4 ./hf.mp4 ./diff

閾值:低於原始碼複雜度等級的第 5 個百分位數約 0.02 (請參閱 eval.md 中經過驗證的閾值表)。如果差異檢查失敗,請執行 scripts/frame_strip.sh 來查看哪些影格發生偏差,然後重新閱讀相關的時序/排序/媒體參考文件。

關鍵:兩個渲染必須使用匹配的像素格式。在 Remotion 原始碼的 remotion.config.ts 中設定 Config.setVideoImageFormat("png") + Config.setColorSpace("bt709") — 否則差異檢查會測量編碼器差異 (約 0.05 SSIM 損失),而不是翻譯保真度。

步驟 5:記錄差距

任何未順利翻譯的內容 (音量曲線被丟棄、自訂演示被近似、字型被替代) 都會在 HF 輸出旁產生一個 TRANSLATION_NOTES.md。格式請參閱 references/limitations.md。

此技能明確不做的事

  • 翻譯 React 狀態機。 透過 useState + useEffect 驅動動畫的合成在 HyperFrames 的搜尋驅動模型中不是確定性的影格擷取目標。建議使用執行時期互通模式。
  • 在 HyperFrames 旁執行 Remotion 的渲染管線。 這是來自 PR #214 的執行時期互通模式 — 一個針對未通過此技能 lint 檢查的合成的獨立解決方案。

(@remotion/lambda 不是阻斷器 — Lambda 配置是部署,不是動畫。該技能將其作為警告丟棄並翻譯其餘部分。請參閱 references/escape-hatch.md。)

如何為自己的翻譯評分

執行測試語料庫協調器:

./assets/test-corpus/run.sh

它會執行 T1、T2、T3 (渲染 + 差異檢查) 和 T4 (lint 驗證),列印一個按等級顯示通過/失敗的表格,並輸出一個彙總的 JSON 報告。使用這個來驗證該技能在一個乾淨的檢出環境中是否能端到端工作 — 並作為編輯任何參考文件後的迴歸檢查。

已驗證的基準 (截至 2026-04-27):

等級合成形狀平均 SSIM閾值
T1單一元素淡入0.9740.95
T2多場景 + spring + 音訊 + 圖片0.9850.95
T3資料驅動、自訂子組件、計數遞增0.9530.90
T4逃生艙 (8 個 lint 案例)全部通過不適用

Individual skills in this repo

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

9018/mychat

Generate AI videos from text prompts using multiple provider gateways. Use when: (1) Generating videos from text descriptions, (2) Creating AI-generated video clips for content production, (3) Image-to-video generation with a reference image, (4) Choosing between video generation providers (VEO, Kling, Sora, Runway, Seedance, MiniMax, Gemini Omni). Supports gateways: HeyGen API, fal.ai API, Kling official direct API, and the Gemini API (Gemini Omni Flash).

9018/mychat

Create AI avatar videos with precise control over avatars, voices, scripts, scenes, and backgrounds using HeyGen's v2 API. Use when: (1) Choosing a specific avatar and voice for a video, (2) Writing exact scripts for an avatar to speak, (3) Building multi-scene videos with different backgrounds per scene, (4) Creating transparent WebM videos for compositing, (5) Using talking photos as video presenters, (6) Integrating HeyGen avatars with Remotion, (7) Batch video generation with exact specs, (8) Brand-consistent production videos with precise control.

9018/mychat

Use p5.js/canvas for local procedural character effects: particles, weather, squash/stretch, walk cycles, and environmental motion.

9018/mychat

Review local character animation with schema checks, Playwright browser previews, frame sampling, and FFmpeg/ffprobe final output checks.

9018/mychat

Create videos from a text prompt using HeyGen's Video Agent. Use when: (1) Creating a video from a description or idea, (2) Generating explainer, demo, or marketing videos from a prompt, (3) Making a video without specifying exact avatars, voices, or scenes, (4) Quick video prototyping or drafts, (5) One-shot prompt-to-video generation, (6) User says "make me a video" or "create a video about X".

9018/mychat

Generate Mandarin and multilingual narration with Volcengine Doubao Speech 2.0. Use when creating Chinese voiceovers, when the user prefers Doubao/Volcengine/火山引擎/豆包 TTS, or when narration needs character-level timestamp metadata for subtitles.

9018/mychat

Video and audio processing with FFmpeg. Use for format conversion, resizing, compression, audio extraction, and preparing assets for Remotion. Triggers include converting GIF to MP4, resizing video, extracting audio, compressing files, or any media transformation task.

9018/mychat

Use when implementing Disney's 12 animation principles with Framer Motion in React applications

9018/mychat

All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). HyperFrames-native: single paused timeline, seek-safe, deterministic.

9018/mychat

HyperFrames CLI dev loop. Use when running npx hyperframes init, add, catalog, capture, lint, validate, inspect, layout, snapshot, preview, play, render, publish, lambda, doctor, browser, info, upgrade, skills, compositions, docs, benchmark, telemetry, transcribe, tts, or remove-background, or when troubleshooting the HyperFrames build/render environment. Entry point for AWS Lambda cloud rendering (`hyperframes lambda deploy / render / progress / destroy / policies`).

9018/mychat

The HyperFrames composition contract — build one renderable project. Use for composition structure, the `data-*` timing attributes, `class="clip"`, tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.

9018/mychat

Non-animation creative direction for HyperFrames videos. Use for design spec (frame.md / design.md) handling, palettes, typography, narration, beat planning, audio-reactive visuals, composition patterns, and brand / style decisions. For atomic motion patterns and scene blueprints, use `hyperframes-animation`.

9018/mychat

Audio and media assets for HyperFrames compositions, produced by one shared audio engine (`scripts/audio.mjs`) — multi-provider TTS (HeyGen / ElevenLabs / Kokoro local), background music + sound effects (HeyGen audio-library retrieval by default, with local Lyria / MusicGen BGM generation and a bundled SFX library as the no-credential fallback), Whisper transcription, background removal, and caption authoring. Use for voiceover / TTS, BGM, SFX / sound effects, transcription, captions / subtitles / lyrics / karaoke / per-word styling, voice + provider selection, and music-mood prompting.

9018/mychat

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, registry discovery, and authoring a new block or component to contribute upstream (idea → scaffold → validate → PR).

9018/mychat

Use when the user wants a short, design-led motion graphic where motion is the message: kinetic typography, stat or number count-up, chart/data-viz hit, logo sting, brand lockup, lower-third, callout, social overlay, animated headline/tweet/news item, motion poster, or quick captured-page highlight. Usually under 10s and up to ~30s, with no narration arc, voice-over, or live-action subject. Can render to MP4 or transparent overlay. Not for longer, multi-scene, narrated, or brand-reel pieces (use general-video), narrated website videos (website-to-video), topic explainers (faceless-explainer), product promos (product-launch-video), PR videos (pr-to-video), or captions on existing footage (embedded-captions). When unsure whether it's a quick motion-first piece or a longer / narrated treatment, see /hyperframes.

9018/mychat

Use when the user has a music track (an audio file, or a video to pull audio from) and wants a beat-synced HyperFrames video, calm to hard-hitting. The music drives everything: one analyzer reads it once, the orchestrator lays out the frames and fills a per-frame plan, and one sub-agent builds each frame. Typography and templates are the floor — a complete video needs zero assets — but any images or videos the user supplies are cut into the frames on the same beat grid (beat-cut / ken-burns). The genre (lyric video, slideshow, kinetic promo) falls out of the per-frame choices; the pipeline never branches on it.

9018/mychat

Toolkit-specific Remotion patterns — custom transitions, shared components, and project conventions. For core Remotion framework knowledge (hooks, animations, rendering, etc.), see the `remotion-official` skill.

9018/mychat

Animate SVG character rigs with GSAP, CSS transforms, Remotion frame control, and HyperFrames-compatible browser previews.

9018/mychat

Three.js animation - keyframe animation, skeletal animation, morph targets, animation mixing. Use when animating objects, playing GLTF animations, creating procedural motion, or blending animations.

9018/mychat

Download video and audio from YouTube and 1000+ sites using yt-dlp. No API keys needed. Use when: (1) Downloading a video from YouTube or other sites, (2) Extracting audio from a video URL, (3) Downloading subtitles/captions from a video, (4) Getting video metadata without downloading.

相關技能