Communitygithub.com

Remotion 转 HyperFrames

仅当用户明确要求将现有的 Remotion(React)合成源代码移植/转换/迁移/翻译到 HyperFrames HTML 时使用。不用于:编写新的 HyperFrames 合成、Remotion 被顺便提及、仅做参考的 Remotion 代码,或用户要求“与 Remotion 视频相同”但未明确请求迁移的情况。

Remotion 转 HyperFrames 是什么?

该技能专门用于将基于 Remotion(React)的视频合成翻译为 HyperFrames(HTML + GSAP)合成。它提供了机械化的 API 映射,覆盖约 80% 的典型合成,同时通过 lint 检查识别并拒绝翻译约 20% 不支持的模式(如 useState、useEffect、异步 calculateMetadata、第三方 React UI 库和 @remotion/lambda)。技能附带分层测试语料库(T1–T4),通过 SSIM 阈值验证翻译保真度。翻译流程包括:对 Remotion 源代码进行 lint 检查、基于 API 映射规划翻译、生成带有 data-* 属性和 GSAP 时间线的 index.html,并运行评估以确保视觉一致性。此技能仅支持 Remotion → HyperFrames 单向转换,不支持反向导出或非 Remotion 源(如 After Effects、Framer Motion)。

兼容平台~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 基于 seek 驱动模型的模式来防止丢失信息的 20%,并建议使用 PR #214 中的运行时互操作模式。

该技能附带一个 分层测试语料库(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:检查源代码

在 Remotion 源代码目录上运行 scripts/lint_source.py。该检查会检测无法干净翻译的模式:

  • 阻止项(拒绝 + 推荐互操作):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 设置每个动画属性的起始状态。
  • 底部一个单独的 <script> 标签,包含一个暂停的 gsap.timeline({paused: true})。每个 Remotion useCurrentFrame() 派生都成为此时间线上正确偏移处的补间。
  • window.__timelines["<composition-id>"] = tl; 将时间线注册到 HF 运行时。

自定义 React 子组件以内联方式重复为 HTML,使用 prop 接口作为模板(参阅 parameters.md 了解每个实例的 data-* 模式)。

步骤 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

阈值:比源代码复杂度等级的 p05 低约 0.02(参见 eval.md 中的已验证阈值表)。如果差异比较失败,运行 scripts/frame_strip.sh 查看哪些帧存在差异,然后重新阅读相关的时间/序列/媒体参考。

关键:两个渲染必须使用匹配的像素格式。在 Remotion 源代码的 remotion.config.ts 中设置 Config.setVideoImageFormat("png") + Config.setColorSpace("bt709")——否则差异比较会测量编码器差异(SSIM 降低约 0.05),而非翻译保真度。

步骤 5:记录差异

任何未能干净翻译的内容(丢弃的音量渐变、近似的自定义演示文稿、字体替换)都会在 HF 输出旁边生成一个 TRANSLATION_NOTES.md。参见 references/limitations.md 了解格式。

此技能明确不做什么

  • 翻译 React 状态机。 通过 useState + useEffect 驱动动画的合成在 HyperFrames 的 seek 驱动模型中不是确定性帧捕获目标。推荐运行时互操作模式。
  • 在 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多场景 + 弹簧 + 音频 + 图像0.9850.95
T3数据驱动、自定义子组件、计数0.9530.90
T4逃生舱(8 个 lint 用例)8/8 通过不适用

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.

相关技能