如何把 Claude 写的 HTML 动画转成 MP4
只要有渲染器逐帧推进动画的时钟,HTML 动画就能变成流畅的 MP4:HTML 用 HyperFrames,React 用 Remotion,现成的 JavaScript 页面用 timecut,canvas 用 CCapture.js。Team 和 Enterprise 套餐中的 Claude Motion 可直接导出 MP4。录屏在哪里都能用,但会丢帧。
AI 辅助写作:本指南由 Claude Opus 5.5 起草,每条事实都链接到对应来源。
核对于 2026-11-05。Claude 交给你的动画通常是一个 HTML 页面:Claude 应用里的 Artifact、Claude Code 生成的文件,或 Claude Design 里的设计稿。要发布出去,你需要一个视频文件。获取方式有两种:用渲染器把动画的时钟一帧一帧往前推,并保存每一帧;或者在页面实时播放时录屏。
该用哪种方法?
| 方法 | 适用对象 | 逐帧渲染? | 许可证或套餐 | 用法 |
|---|---|---|---|---|
| Claude Motion | 在 Claude Motion Artifact 中制作的动画 | 是,由 Claude 导出 | Team 和 Enterprise 套餐,测试版 | 从 Artifact 导出 MP4 |
| HyperFrames | 按 HyperFrames 合成(composition)编写的 HTML | 是 | Apache-2.0,免费 | `npx hyperframes render` |
| Remotion | 为 Remotion 编写的 React 组件 | 是 | 个人和小公司免费;超出范围需购买公司许可证 | `npx remotion render` |
| timecut | 现成的、用 JavaScript 驱动动画的页面 | 是,通过覆盖页面的时间函数实现 | BSD-3-Clause,最后更新于 2023 年 | `timecut` 加页面 URL,需安装 ffmpeg |
| CCapture.js | canvas 动画(Three.js、p5.js、2D canvas) | 是,按固定帧率 | MIT | 在渲染循环中加入 `capturer.capture(canvas)` |
| 录屏 | 任意页面 | 否:实时录制,复杂场景会丢帧 | 免费 | 录下浏览器画面,再用 ffmpeg 转成 MP4 |
为什么录屏会卡顿?
录屏只能捕捉浏览器每一刻来得及画出的内容,某一帧耗时太长,就直接漏掉了。渲染器则会暂停动画的时钟,等每一帧画完再保存。timecut 的 README 把这称为“慢于实时”的捕获,但得到的视频依然流畅(timecut)。HyperFrames 称其输出是确定性的:同一个项目每次都渲染出相同的 MP4(HyperFrames)。
如何用 HyperFrames 渲染 Claude 动画?
- 安装 Node.js 22 或更新版本,然后用 `claude plugin marketplace add heygen-com/hyperframes` 和 `claude plugin install hyperframes@hyperframes` 把 HyperFrames 加入 Claude Code(README)。
- 用 `npx hyperframes init my-video` 新建项目。
- 用 `/hyperframes` 让 Claude 制作视频,并描述场景、节奏和文字。
- 用 `npx hyperframes preview` 预览,让 Claude 修改,再运行 `npx hyperframes render` 生成 MP4。
如果你更习惯 React,Remotion 也是同样的思路,配有它自己的智能体技能;用 Claude Code + Remotion 制作发布视频一文完整演示了流程,Claude Motion、Remotion 还是 HyperFrames则对比了几条路线。
如果 Claude 已经做好了页面怎么办?
- 让 Claude 改写。 Claude Code 可以把做好的页面改写成 HyperFrames 或 Remotion 合成,这是得到流畅 MP4 最可靠的办法。
- JavaScript 驱动的动画:timecut 会在无头浏览器中打开页面,覆盖它的时间函数,再把帧交给 ffmpeg。它的 README 提醒,由 CSS transition 或 CSS animation 产生的变化很可能无法按预期渲染(timecut)。
- canvas 动画:CCapture.js 按固定帧率(30、60 或更高)捕获 canvas 帧,并能输出 MP4;你需要把捕获器加进页面的渲染循环(CCapture.js)。
- 简短或简单的片段:只要页面在你的电脑上播放流畅,录屏或许就够了。
如何把录屏转成 MP4?
浏览器和许多录屏工具保存的是 WebM。ffmpeg 可以把它转成几乎到处都能播放的 H.264 MP4:`ffmpeg -i input.webm -c:v libx264 -pix_fmt yuv420p output.mp4`。大多数播放器需要的正是 `yuv420p` 这种像素格式(FFmpeg H.264 guide)。
能导出透明背景的 Claude 动画吗?
MP4 不行。Claude Motion 只能导出 MP4(Claude Help Center),而 Claude Motion 的合作伙伴 Descript 表示,Motion 导出的 MP4 没有透明通道,因此无法作为下三分之一字幕条叠在素材上(Descript)。如果要做叠加层,就保留动画代码,让页面背景留空,并渲染成带 alpha 通道的格式:网页用 WebM,剪辑软件用 ProRes 4444 MOV。这个问题在实际中确实会遇到:r/ClaudeAI 上一个2026年9月9日的帖子,就是在 Claude Design 动画导出后背景变成黑色时问的这个问题(r/ClaudeAI)。
- Remotion:`npx remotion render` 加上 `--image-format=png --pixel-format=yuva444p10le --codec=prores --prores-profile=4444` 可输出带 alpha 的 MOV;`--image-format=png --pixel-format=yuva420p --codec=vp8` 则输出透明 WebM。Chrome 和 Firefox 能播放带 alpha 的 WebM,Remotion 建议为其他浏览器保留一个备用版本;在 Remotion Lambda 上,透明 WebM 可能在分块边界处闪烁,所以那里优先用 ProRes(Remotion docs)。
- HyperFrames:渲染器的 `webm` 格式是面向网页的透明视频,`mov` 是面向剪辑软件的透明 ProRes 4444;它也能输出 PNG 序列。透明格式以 SDR 渲染(HyperFrames producer docs)。
- 在 Claude 对话中用 HyperFrames:HeyGen 的 HyperFrames 连接器目前为测试版,需绑定 HeyGen 账号,在 HeyGen 的云端渲染,除 MP4 和 MOV 外,还提供用于透明叠加层的 WebM(HyperFrames MCP guide)。
- 手头没有渲染器:让 Claude 输出 PNG 序列,或者在纯绿色背景上渲染,再在剪辑软件里抠像,这是同一帖子的回复中给出的建议(r/ClaudeAI)。
常见问题
Claude 能把动画导出为 MP4 吗?
Claude Motion 可以,限 Team 和 Enterprise 套餐(Claude Help Center)。在普通对话中,Claude 也能编写并运行代码,直接返回 MP4:How-To Geek 于2026年11月4日在 Pro 套餐上用这种方式得到了一段 20 秒的 1080p 宣传片(How-To Geek)。除此之外,HyperFrames 或 Remotion 等渲染器可以在你的电脑上把代码转成 MP4。
Claude 动画可以是透明背景吗?
可以,前提是你自己渲染代码:Remotion 和 HyperFrames 能输出带 alpha 通道的 WebM 或 ProRes 4444 MOV(Remotion docs、HyperFrames producer docs)。从 Claude Motion 导出的 MP4 没有透明通道(Descript)。
把 HTML 转成视频,最好的免费方法是什么?
新项目的话,让 Claude Code 把它做成 HyperFrames 合成,再运行 `npx hyperframes render`;HyperFrames 免费,采用 Apache-2.0 许可证(HyperFrames)。现成的 JavaScript 页面则可以用 timecut 逐帧渲染。
为什么我录下的动画一卡一卡的?
录屏是实时进行的,浏览器画晚了的帧就丢了。HyperFrames、Remotion、timecut 和 CCapture.js 这类逐帧渲染器会等每一帧画完,所以无论场景多复杂,视频都能保持流畅。
timecut 支持 CSS 动画吗?
通常不行。timecut 控制的是 JavaScript 时间函数和视频播放,它的 README 说,由 CSS transition 或 animation 产生的变化很可能无法按预期渲染(timecut)。建议把页面改写成 HyperFrames 或 Remotion。
Why does Claude Design say video export isn't enabled?
Anthropic documents no video export for Claude Design: its Move guide lists Project HTML and a Project archive (.zip), and its Claude Design guide lists ZIP, PDF, PPTX, Google Slides and standalone HTML (Claude Help Center). We found no page that explains the exact message, so use a renderer such as HyperFrames or Remotion, or Claude Motion on Team and Enterprise. See also Claude Design moves into Artifacts.
来源
- Claude Help Center: Get started with Claude Motion
- HyperFrames on GitHub (README)
- Remotion docs: render
- timecut on GitHub (README, limitations)
- CCapture.js on GitHub
- FFmpeg wiki: H.264 video encoding guide
- Remotion docs: Transparent videos
- HyperFrames docs: Producer (output formats)
- HyperFrames docs: MCP in Claude, ChatGPT and Grok (beta)
- Descript: Claude Motion integration (partner page)
- r/ClaudeAI: MP4 with a transparent background? (2026-09-09)
- How-To Geek: a full animated promo in 4 prompts (2026-11-04)