Remotion Best Practices
/install abm-remotion-best-practices
Remotion Best Practices
You help users create videos programmatically using React and Remotion. Your goal is to scaffold projects, write compositions, build animated scene components, and render final video output -- all following Remotion v4 conventions and best practices.
Before Starting
Check for product marketing context first:
If .agents/product-marketing-context.md exists (or .claude/product-marketing-context.md in older setups), read it before asking questions. Use that context and only ask for information not already covered or specific to this task.
Understand what the user needs (ask if not provided):
- What video to create -- subject, purpose, and visual style
- Target duration and dimensions -- e.g., 15 seconds at 1920x1080
- New or existing project -- whether to scaffold fresh or add to an existing Remotion project
Workflow
Step 1: Set Up Project
Check if a Remotion project already exists:
- Look for
package.jsonwith@remotion/coreindependenciesordevDependencies - If found: skip scaffolding and add a new composition to the existing
src/Root.tsx - If not found: scaffold a new project:
npx create-video@latest my-video
After scaffolding, verify all @remotion/* packages are on the same version:
npm ls | grep remotion
For detailed setup configuration, read references/setup.md.
Step 2: Define Composition in Root.tsx
Register your video as a Composition in src/Root.tsx:
import { Composition } from "remotion";
import { MyScene } from "./MyScene";
export const RemotionRoot: React.FC = () => {
return (
\x3CComposition
id="MyVideo"
component={MyScene}
durationInFrames={900} // 15s at 60fps
fps={60}
width={1920}
height={1080}
defaultProps={{ title: "My Video" }}
/>
);
};
Key points:
- Use
fps={60}as the project default (60fps for smooth animation) - Use PascalCase for composition IDs (e.g.,
MyVideo,ProductDemo) - Calculate
durationInFramesasseconds * fps(15s at 60fps = 900 frames)
Step 3: Build Scene Components
Use AbsoluteFill as the root layout container. Use useCurrentFrame() and useVideoConfig() for animation state. Use \x3CSequence> for timeline positioning.
Minimal animated component:
import { useCurrentFrame, useVideoConfig, interpolate, AbsoluteFill } from "remotion";
export const MyScene: React.FC\x3C{ title: string }> = ({ title }) => {
const frame = useCurrentFrame();
const { fps } = useVideoConfig();
const opacity = interpolate(frame, [0, 30], [0, 1], {
extrapolateRight: "clamp",
});
return (
\x3CAbsoluteFill style={{ justifyContent: "center", alignItems: "center" }}>
\x3Ch1 style={{ opacity, fontSize: 80, color: "white" }}>{title}\x3C/h1>
\x3C/AbsoluteFill>
);
};
For physics-based animation, use spring():
import { spring } from "remotion";
const scale = spring({
frame,
fps,
config: { damping: 12, stiffness: 100 },
});
For detailed animation patterns including spring() configuration, multi-step interpolation, and easing functions, read references/animations.md.
Step 4: Add Multi-Scene Timeline
Use \x3CSequence> to compose multiple scenes on a timeline:
import { Sequence, AbsoluteFill } from "remotion";
export const MyVideo: React.FC = () => {
return (
\x3CAbsoluteFill style={{ backgroundColor: "black" }}>
\x3CSequence durationInFrames={180}>
\x3CIntroScene />
\x3C/Sequence>
\x3CSequence from={180} durationInFrames={600}>
\x3CMainContent />
\x3C/Sequence>
\x3CSequence from={780} durationInFrames={120}>
\x3COutroScene />
\x3C/Sequence>
\x3C/AbsoluteFill>
);
};
Each \x3CSequence> resets useCurrentFrame() to 0 for its children, so each scene animates independently. The from prop sets when the scene starts on the parent timeline.
Step 5: Render Video
Preview in browser:
npx remotion preview src/index.ts
Render locally:
npx remotion render src/index.ts MyVideo out/video.mp4
Render with custom props:
npx remotion render src/index.ts MyVideo out/video.mp4 --props='{"title":"Hello"}'
For output formats, quality settings, and advanced render options, read references/rendering.md.
For AWS Lambda rendering at scale, read references/lambda.md.
See tools/integrations/remotion.md for the full CLI command reference.
Key Rules
- Version pinning -- All
@remotion/*packages must be the same version. Never update one independently. Seetools/integrations/remotion.mdfor details. - Deterministic rendering -- Never use
Math.random(). Userandom('seed')from theremotionpackage for deterministic random values. - FPS from config -- Always get fps from
useVideoConfig(). Never hardcode fps values in animation calculations. - Clamp interpolation -- Use
interpolate()withextrapolateRight: "clamp"to prevent values exceeding the target range. - Default 60fps -- All compositions use
fps={60}unless the user specifies otherwise.
Output Format
Deliver a working Remotion project with:
src/Root.tsx-- Composition registration with correct dimensions, fps, and duration- Scene components -- One
.tsxfile per scene with animations - Render command -- The exact
npx remotion rendercommand to produce the final video - Preview command --
npx remotion preview src/index.tsfor browser preview
If adding to an existing project, deliver the new composition entry for Root.tsx and the new scene component files.
Related Skills
- video-ad-creation: Standard ad format compositions (15s/30s/60s) with product showcase templates
- social-video-content: Social platform video formats (9:16 vertical, 1:1 square, 16:9 landscape)
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install abm-remotion-best-practices - 安装完成后,直接呼叫该 Skill 的名称或使用
/abm-remotion-best-practices触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Remotion Best Practices 是什么?
When the user wants to create videos programmatically with React using Remotion. Also use when the user mentions 'create video,' 'Remotion,' 'React video,' '... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 300 次。
如何安装 Remotion Best Practices?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install abm-remotion-best-practices」即可一键安装,无需额外配置。
Remotion Best Practices 是免费的吗?
是的,Remotion Best Practices 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Remotion Best Practices 支持哪些平台?
Remotion Best Practices 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Remotion Best Practices?
由 Mario Karras(@mariokarras)开发并维护,当前版本 v1.0.0。