1实现原理 · 为什么它能做到
整套方法建立在「一个模板 × 一张数据表 → 每行一部片」上:先给一行记录定义类型化 schema,整部视频是该记录的纯函数,不能用一行数据填满的场景不该出现在 Wrapped 里。
Define a typed schema for one record. The whole video is a pure function of it.
第二条不可协商项是「为截图而设计」:每个场景要 2 秒内读完、冻结成静帧也要好看,因为被分享出去的就是那张静帧。
2. **Built to be screenshotted.** Each scene must read in under 2 seconds and look good frozen
场景语法固定为 5–7 个短场景类型(Intro / Big-number / Top-X / Superlative / Comparison / Time-heatmap / Outro),每段约 2.5–4s;每年只换数据与配色,语法不变。
A Wrapped is a fixed sequence of short scene *types*, each ~2.5–4s.
叙事按「升序冲击」编排:把统计量按情绪载荷(大小、稀有度、体面程度)从小到大排,主角数字压轴并停留最久;绝不先出最大数字,否则后面无处可爬。
**Sequence stats for rising impact — smallest first, biggest last.**
主角必须是观众本人:前两秒出现其名字、用 per-user accent 色、文案全用第二人称;若某一帧对两个不同用户读起来一模一样,这帧就没在做事。
If a frame would read identically for two different users, it isn't pulling its weight.
签名动效是大数字计数:必须由 useCurrentFrame + spring 驱动(禁用 setState/setInterval——渲染器逐帧快照会闪),到 locale 格式化并用 tabular-nums 防数字滚动时宽度抖动。
Drive it from `useCurrentFrame()` (never `setState`/`setInterval` — that flickers on render), ease it with a spring, and format with `toLocaleString()`.
竖屏安全区被量化到像素:渲染 1080×1920,关键内容(名字、数字、列表、CTA)必须落在中心 80% 高度内,避开顶部 12% 与底部 18%(平台 UI 覆盖区)。
Render **1080×1920**. Stories/Reels/TikTok crop and overlay UI, so keep all type and key numbers inside the **center 80% height**, clear of the **top 12%** and **bottom 18%**.
批量渲染是这套方法的价值兑现:bundle 一次后逐行 selectComposition + renderMedia 传 inputProps,按稳定 id 命名保证幂等,校验失败的行跳过并记日志而不渲染半成品。
The payoff. Render every data row to its own MP4 with `renderMedia`, passing the row as `inputProps`.
2核心能力
3外部依赖
| 类型 | 依赖 |
|---|---|
| cli | npx remotion still / render / compositions(单行验证与正式编码) |
| cli | npx tsx(运行批量脚本 render-all.ts) |
| package | @remotion/bundler 与 @remotion/renderer(bundle + 逐行渲染) |
| package | zod(行级 schema 校验)、p-limit(并发上限)、csv-parse(CSV 解析)、@remotion/transitions(转场) |
| network | @remotion/google-fonts:批量渲染时把字体内联进 bundle(避免 headless 缺字形/FOUT) |
| api | 可选:Remotion Lambda(AWS 无服务器扇出),面向万级批量 |
| cli | ffmpeg / ffprobe(contact-sheet.sh 与 probe-mp4.sh) |
4风险提醒 风险提醒:橙色 · 评估后使用
- 渲染与批量链依赖远程包并在本地执行项目代码 — `npx remotion`/`npx tsx` 会从 npm 取包并 bundle 执行;离线或私有 registry 环境需先本地锁定依赖,否则验证与批量都不可复现。
- 数据面成为主要输入风险 — 整张表作为 props 注入并直接上屏(含 share card);schema 只校验类型不校验内容,异常/超长/恶意文本会破版或被当作官方口吻展示。上线前应对数据表做净化与长度约束。
- 可选 Lambda 路径的凭据与成本 — reference 的万级扩容方案需要在 AWS 侧配置权限并产生费用;这是「按需接入」的能力,但接入后凭据管理与计费由使用者承担,文档未涉及权限最小化。
- 「冻结好看」与「动态好看」的验收靠人工 — skill 要求逐帧检查中心 80%/避开 12%/18%,但没有自动化的安全区断言;批量场景下应在模板层加一次性的布局自测(如叠加平台 UI 蒙版)而不是每行目检。
- per-user 配色的对比度责任在使用者 — accent 由数据行提供并直接用于大字与背景,若数据方给出低对比或低饱和色,可读性会崩;skill 未给配色校验规则。
5第二遍独立确认
- [ok] 外部依赖调用点复核(npx remotion / npx tsx / @remotion/* / zod / Lambda) — SKILL.md Verify loop 确有 `npx remotion still Wrapped out/f-start.png --frame=0 --props='{...one user...}'` 与 `npx tsx render-all.ts`;batch-pipeline 确有 `import { renderMedia, selectComposition } from "@remotion/renderer";`、`p-limit` 与 `renderMediaOnLambda`;remotion-recipes 确有 @remotion/google-fonts 与 @remotion/transitions 用法。全部落地,非推测。
- [ok] 是否隐含云端凭据需求 — 本地路径(renderMedia)不需要任何云端凭据;仅可选 Lambda 路径会引入 AWS 配置。SKILL.md/reference 中无 AWS key、无 access token 字面量,也无读取 env 的代码——故按「不读凭据」处理,但在 security.reason 与 verdict.risks 中标注了 Lambda 接入时的凭据/计费含义。
- [ok] 帧驱动纪律的内部一致性 — SKILL.md 输出契约与 remotion-recipes 开篇「The one rule that prevents broken renders」一致禁止 setState/setInterval/Date.now()/CSS @keyframes 计时;大数字组件示例也确实只用 useCurrentFrame + spring + interpolate。
- [ok] 数据契约与场景语法的耦合 — wrappedSchema 字段(name / year / minutesListened / topArtists / topGenre / percentile / accent)与场景类型表逐项对应(Intro 用 name+year、Big-number 用 minutesListened、Top-X 用 topArtists、Superlative/Comparison 用 percentile+topGenre、per-user accent 贯穿);未见场景需要而 schema 未提供的字段。
- [ok] 安全区数值与 storyboard 的自洽性 — 1080×1920 下 top 12% = 0–230px、bottom 18% = 1575–1920px、center 80% = ~230–1575px,与 scene-grammar 的安全区表一致;垂直中心 ~960px 落在中心区内。数值互相自洽。
- [ok] 跨目录 / 跨 skill 引用可解析性 — 正文引用的 `scripts/contact-sheet.sh`、`scripts/probe-mp4.sh` 位于仓库根(单装本 skill 目录会悬空,需装整个 repo);本 skill 自成闭环,未强依赖兄弟 skill(只需 Remotion 本体)。
- [ok] 功能声明 vs 实际能力 — frontmatter 宣称覆盖「数据行 → 一条可分享视频」的范式、场景语法、计数动效、9:16 取景与批量渲染,SKILL.md 与三份 reference 逐项兑现(含 CLI 与 Node 两套批量变体);未夸大——不声称自动产出数据或自动分发。
6结论
16427a3a8db59d32…3e2d411b72