---
catalog_id: "R-029"
kind: "repo"
domain: "frontend"
domain_label: "前端动效 / Frontend & Motion"
date: "2026-11-27"
title: "berlinify/motion-lab"
verdict: "可复用GSAP寻帧与EDL定长拟合，但宣传的3D运镜名不副实"
summary: "无许可证、17 次提交 / 2 星的个人 Remotion 4 实验仓：一个 package.json 并存 Remotion（主管线，GSAP / R3F 在其内按 useCurrentFrame 驱动）、Motion Canvas（仅 8 行示例场景）与 Satori 缩略图三条管线，外加 4 个自写 Claude Code 素材技能（ffmpeg 镜头/响度分析、whisper.cpp 逐词字幕、EDL 定长拟合、位图转分层 SVG）和整套官方 remotion-dev/skills；真正可复用的是「GSAP 暂停时间线 + 双 useLayoutEffect seek」与「EDL 定长拟合器」，文章宣传的『3D 相机运动』在代码里几乎不存在（唯一 3D 场景是固定相机下自转的环面结）。"
summary_en: "Remotion 4 experiment offering a reusable GSAP seek pattern and EDL length fitter, though its touted 3D camera motion is barely present."
canonical_url: "https://oumuatown.com/repos/berlinify__motion-lab/"
markdown_url: "https://oumuatown.com/repos/berlinify__motion-lab.md"
og_image_zh: "https://oumuatown.com/og/zh/R-029.png"
og_image_en: "https://oumuatown.com/og/en/R-029.png"
cite_count: 55
repo: "berlinify/motion-lab"
github_url: "https://github.com/berlinify/motion-lab"
commit: "06daab8"
tags:
  - "code-video"
  - "remotion"
  - "gsap"
  - "three-js"
  - "motion-canvas"
  - "claude-code-skills"
  - "ffmpeg-analysis"
github_repos:
  - "https://github.com/berlinify/motion-lab/tree/06daab8"
---

# R-029 · berlinify/motion-lab

> **结论 / Verdict**: 可复用GSAP寻帧与EDL定长拟合，但宣传的3D运镜名不副实
> **EN Summary**: Remotion 4 experiment offering a reusable GSAP seek pattern and EDL length fitter, though its touted 3D camera motion is barely present.

## Provenance & Evidence

- Primary Repository: https://github.com/berlinify/motion-lab (@06daab8)
- Verified Source Citations (#Lxx): 55
- Web Reader: https://oumuatown.com/repos/berlinify__motion-lab/

# berlinify/motion-lab

> 仓库地址：https://github.com/berlinify/motion-lab · 审计版本：`berlinify/motion-lab@06daab8` · 审计日期：2026-11-27
> 来源文章：[关联文章](../articles/2026-11-27-theozguratillay-8-code-video-repos.md)

## 定位与解决的真问题

- **核心定位与目标用户**：作者自用的「用代码做视频」实验室，三条渲染管线共享一个 `package.json`：Remotion（React → MP4，主输出）、Motion Canvas（生成器场景 → 帧 / MP4）、Satori + resvg（JSX → SVG → PNG 缩略图）（`CLAUDE.md#L7-L13`、`package.json#L5-L12`）。面向用 Claude Code 写 Remotion 合成的个人开发者，`CLAUDE.md` 即 Agent 操作手册。
- **相比常规做法解决的关键痛点**：
  1. **把「多引擎混用时的确定性坑」写成 Agent 不变量**：所有 Remotion 帧必须是 `useCurrentFrame` 的纯函数；GSAP 必须暂停时间线后按 `frame/fps` seek；three.js 必须走 `@remotion/three` 的 `<ThreeCanvas>` 且不用 `useFrame`；无头 WebGL 需 ANGLE（`CLAUDE.md#L43-L51`、`remotion.config.ts#L5-L6`）。
  2. **真实素材剪辑工作流**：自写 4 个 Claude Code 技能把「分析素材 → 转写 → 定长剪辑 → 渲染」串成可脚本化流程（`CLAUDE.md#L21-L24`，脚本见下）。
- **成熟度与许可**：GitHub API 显示 2 stars / 2 forks、共 17 个提交、创建于 2026-10-21、最后推送 2026-10-25；**仓库无 LICENSE 文件、API `license: null`**，默认保留全部权利，不能直接拷代码入商业项目。无测试套件，验证靠 `npm run still` 看 PNG（`CLAUDE.md#L39`）。

## 技术栈与核心目录结构

- **语言 / 运行时 / 关键依赖**：TypeScript + React 19.2（`~19.2` 锁死，因 R3F v9 需 React < 19.4）；`remotion` 及全部 `@remotion/*` 精确钉在 `4.0.537`；`@motion-canvas/*` 3.17、`gsap` 3.15、`three` 0.186 + `@react-three/fiber` 9 + `drei` 10、`satori` + `@resvg/resvg-js`、`mediabunny`；Vite 5 只为 Motion Canvas 插件（`package.json#L13-L49`、`CLAUDE.md#L48`）。
- **关键目录树与职责划分**：
  - `src/remotion/`：`index.ts` 注册 `Root.tsx`；每支片一个子目录（`promo/` Claude Code 宣传片、`payments/` 虚构 Acme Pay 金融片、`captioned/`、`highlights/`），共享件在 `shared/`（`RevealText`、`blurZoom`、`Captions`）。
  - `src/motion-canvas/`：`project.ts` + 唯一场景 `scenes/intro.tsx`，独立 `tsconfig.json`。
  - `scripts/thumbnail.tsx`：Satori 缩略图。
  - `.claude/skills/`：4 个自写技能（`video-analyze`、`video-transcribe`、`video-highlights`、`raster-to-svg`）+ 官方 `remotion-*` 技能（由 `skills-lock.json` 以 `computedHash` 钉版本，`skills-lock.json#L1-L77`）。

## 核心实现源码级剖析（附文件路径与行号）

1. **Remotion 合成注册表**（`src/remotion/Root.tsx#L10-L92`）：共 9 个 `<Composition>`——`PaymentsPromo`（1920×1080·30fps·300 帧）、3 个 512×512 图标循环、`CaptionedVideo` 与 `Highlights`（二者用 `calculateMetadata` 从视频 / EDL 动态决定尺寸与时长，`#L44-L65`）、`ClaudeCodePromo`、`GsapTitle`、`ThreeScene`。没有任何参数化「镜头库」或场景 DSL，全是手写 TSX。
2. **宣传片骨架：连续背景 + TransitionSeries**（`src/remotion/promo/ClaudeCodePromo.tsx#L10-L41`）：`<Backdrop/>` 放在 `TransitionSeries` 之外贯穿全片；四个 `Sequence`（2.8 s / 4 s / 1.8 s / 2.6 s）用 `springTiming(damping 200, 0.4 s)` + 自定义 `blurZoom` 转场连接，注释明示「场景和 11.2 s 减去 3 个 0.4 s 重叠 = 10 s」（`#L10`），对应 `CLAUDE.md#L19` 的时长守恒不变量。`blurZoom` 只是按 `presentationProgress` 线性插值 scale / blur / opacity（`src/remotion/shared/blurZoom.tsx#L8-L16`）。
3. **GSAP 确定性桥接**（`src/remotion/GsapTitle.tsx#L5-L38`）：`useMemo` 建 `gsap.timeline({ paused: true })`（`#L12`），第一个 `useLayoutEffect` 建 tween 并在清理时 `tl.clear`（`#L14-L24`），第二个 `useLayoutEffect` 执行 `tl.seek(frame / fps, false)`（`#L27-L29`）。依赖 React 按声明顺序执行 effect，保证 seek 时 tween 已存在；README 说明否则 `remotion still` 出空白帧。**这是本仓最值得复用的一段**。
4. **three.js 场景**（`src/remotion/ThreeScene.tsx#L7-L25`）：`<ThreeCanvas camera={{ position: [0, 0, 5], fov: 50 }}>`——**相机固定不动**，唯一动画是环面结 `rotation = interpolate(frame, [0, duration], [0, 2π])`（`#L10`、`#L18`）。`<Environment preset="city">` 会在渲染时从 CDN 下 HDRI（`#L17`，`CLAUDE.md#L45`），离线 / CI 渲染不可复现。
5. **「3D 感」实为 CSS 透视**：`payments/Backdrop.tsx#L61-L67` 的 `perspective: 700` + `rotateX(72deg)` 网格地板、`payments/FeaturesScene.tsx#L20-L29` 与 `promo/TerminalScene.tsx#L30-L39`、`promo/FeaturesScene.tsx#L17-L34` 的卡片 `rotateX/rotateY` 入场——全是 2.5D CSS transform，非三维相机。
6. **Motion Canvas**（`src/motion-canvas/project.ts#L1-L6`、`scenes/intro.tsx#L1-L8`）：仅一个圆做 scale + fill 往返的 8 行示例；渲染需在 Vite 编辑器 UI 里手点（`CLAUDE.md#L34`），**不能 CLI 批量出片**，与 Remotion 管线互不相通（独立 JSX runtime 与 tsconfig，`src/motion-canvas/tsconfig.json#L1-L4`、`tsconfig.json#L14`）。
7. **`video-analyze` 素材分析器**（`.claude/skills/video-analyze/scripts/analyze.ts`）：视频单遍 `scale=320,fps=N,signalstats,scdet` 写 metadata 文件（`#L166-L171`），音频单遍 `ebur128` + `silencedetect`（`#L173-L190`），据此切镜头、找响度峰、按字幕切语音段（`#L193-L262`），输出缩略图 / 联系表 / 时间线图 / summary.md（`#L264-L331`、`#L411`）；ffmpeg 非零退出抛错并带 stderr 尾 1500 字（`#L96-L99`），自带并发池（`#L102-L119`）。
8. **`video-highlights` EDL 定长拟合器**（`.claude/skills/video-highlights/scripts/plan.ts`）：plan 的 clip 联合类型含 `priority / focusX / kenBurns / transition`（`#L19-L20`）；`adjust` 先让照片、再让视频按当前长度比例吸收差值，视频加长时先推后出点、源尽再前移入点（`#L107-L134`）；仍超长则按「priority 数值最大、其次最短」逐个丢 clip（`#L139-L145`）；素材不足直接 `process.exit(1)` 并提示（`#L146-L149`）。结果保证 EDL 精确等于 `targetSeconds`。
9. **`raster-to-svg`**（`.claude/skills/raster-to-svg/scripts/trace.ts`）：Lab 空间 k-means 量化，自动取「内部像素平均 ΔE≈2.5 内」的最小 k（`#L182-L270`），每色层上采样平滑后 potrace（`#L316-L343`），再渲回比较 ΔE 打分并出 preview（`#L362-L436`），`--ts` 产出 `{ VIEWBOX, LAYERS }` 供逐层动画。
10. **官方技能大量重复**：`.claude/skills/remotion-markup/` 与 `remotion-best-practices/remotion-markup/` 两份内容不一致（`diff -rq` 显示 `SKILL.md` vs `REFERENCE.md` 及多文件 differ），`remotion-maps` 也有四份副本；`remotion-best-practices/SKILL.md#L1-L30` 只是路由器。仓库 7.2 万行中绝大部分是这些 vendored 文档与示例 JSON。

## 种子文章说法核对

| 文章说法 | 代码事实 | 结论 |
|---|---|---|
| 用 Remotion、Three.js、GSAP、Motion Canvas 写视频 | 四者确在依赖中（`package.json#L13-L36`），但 Motion Canvas 仅 8 行 demo，Three.js 仅一个 25 行 demo | **部分成立**：Remotion 是唯一实质管线 |
| 尤其适合 3D 相机运动 | `ThreeScene.tsx#L14` 相机固定；全仓无相机路径 / rig；「3D」来自 CSS `perspective`（见 §5） | **不成立** |
| 解释性动画、视觉特效 | 有 per-glyph 弹簧显字（`shared/RevealText.tsx#L15-L42`）、blurZoom 转场、图标描线循环；无任何解释性图解场景 | **弱成立** |

## 亮点设计 vs 局限/坑点

- **值得借鉴的设计**：
  - 把引擎特有的确定性陷阱写进 `CLAUDE.md` 的「Architecture & invariants」，让 Agent 每次改代码前都读到（`CLAUDE.md#L41-L51`）。
  - GSAP 双 `useLayoutEffect` seek 模式（`GsapTitle.tsx#L14-L29`）；版本钉死表与原因（`CLAUDE.md#L46`）。
  - `skills-lock.json` 用 `computedHash` 钉住第三方技能版本，`npx skills update` 升级。
  - EDL 拟合器的「照片先伸缩 → 视频裁/延 → 按优先级丢弃 → 不足即报错」四级降级策略。
- **局限、隐含假设与潜在坑点**：无许可证；无测试；`<Environment preset>` 渲染期联网；Motion Canvas 只能 GUI 渲染；官方技能多份不一致副本会让 Agent 读到冲突指引；Remotion 自带 ffmpeg 缺 `-vf`，分析脚本必须系统完整版 ffmpeg（`CLAUDE.md#L15`）。

## 可复用的模块或设计模式

- **如何迁移到未来项目**：对确定性 HTML/Canvas→MP4 管线，可直接借鉴 (1) GSAP「paused timeline + 按 `t` seek」写法，等价于我们的 `window.seek(t)` 契约；(2) `TransitionSeries` 外置连续背景 + 「场景和 − 转场重叠 = 总长」校验；(3) `plan.ts` 的定长拟合算法用于把素材自动对齐到配乐长度；(4) `analyze.ts` 的 `scdet + signalstats + ebur128 + silencedetect` 单遍分析组合用于成片 QA。因无许可证，只借思路、不拷代码。
- **关联 Pattern**：（由 `synthesizer` 补全）

## Cross-Referenced Specimens

- [A-018 · 不烧视频额度，用 Claude / Codex 写代码出电影感短片的 8 个 GitHub 仓库](https://oumuatown.com/articles/2026-11-27-theozguratillay-8-code-video-repos.md) — 源码核验八个代码出片仓：全系纯代码渲染且四处宣发注水
- [P-001 · Agent 驱动视频剪辑、2D/3D 动画与跨宿主技能选型矩阵（Agentic Video, 3D & Skill Toolchain Matrix）](https://oumuatown.com/patterns/agentic-video-and-3d-toolchain-matrix.md) — 视频生成、三维自动化与跨宿主技能选型边界与避坑矩阵
- [P-004 · 确定性代码成片帧契约与无损流式渲染管线（Deterministic Code-Film Contract）](https://oumuatown.com/patterns/deterministic-code-film-contract.md) — 纯时间函数、单主时钟与无头流式直写消除代码成片漂移
