AgentSkillsCN

Remotion

Remotion

SKILL.md

Remotion Video Generation Skill

<!-- INSTALL_MODE: lite -->

Remotion is a framework for creating videos programmatically using React.


Forbidden Patterns

These will break your renders (flickering, desynced, or failed):

PatternWhy BrokenUse Instead
CSS transition-*Not frame-synchronizedinterpolate()
CSS animationNot frame-synchronizedspring()
Tailwind animate-*Uses CSS animationsuseCurrentFrame() + inline styles
Tailwind transition-*Uses CSS transitionsinterpolate()
Framer MotionAsync, not frame-basedRemotion's spring()
GSAPAsync, not frame-basedRemotion's interpolate()
setTimeout / setIntervalWall-clock time, not video timeFrame-based logic
requestAnimationFrameBrowser-controlleduseCurrentFrame()
R3F useFrame()Not Remotion-controlleduseCurrentFrame()

Golden Rule: ALL animations MUST be driven by useCurrentFrame().

tsx
// WRONG - will flicker
<div className="transition-opacity duration-300" style={{ opacity: show ? 1 : 0 }}>

// CORRECT - frame-synchronized
const frame = useCurrentFrame();
const opacity = interpolate(frame, [0, 30], [0, 1], { extrapolateRight: 'clamp' });
<div style={{ opacity }}>

Quick Start

bash
npx create-video@latest      # Create project
npx remotion studio          # Start development

Essential Pattern

tsx
import { useCurrentFrame, useVideoConfig, interpolate, AbsoluteFill } from 'remotion';

export const MyVideo: React.FC = () => {
  const frame = useCurrentFrame();
  const { fps } = useVideoConfig();

  // Always use fps for time-based values (e.g., 2 seconds = 2 * fps)
  const opacity = interpolate(frame, [0, 1 * fps], [0, 1], {
    extrapolateRight: 'clamp',
  });

  return (
    <AbsoluteFill style={{ backgroundColor: 'white' }}>
      <h1 style={{ opacity }}>Hello Remotion!</h1>
    </AbsoluteFill>
  );
};

Register in Root.tsx

tsx
import { Composition } from 'remotion';
import { MyVideo } from './MyVideo';

export const RemotionRoot: React.FC = () => {
  return (
    <Composition
      id="MyVideo"
      component={MyVideo}
      durationInFrames={5 * 30}  // 5 seconds at 30fps
      fps={30}
      width={1920}
      height={1080}
    />
  );
};

Technical Reference (Remotion Official)

For detailed patterns, see Remotion's official rules:

Note: Local paths work if installed with --deep flag. Otherwise, use the GitHub URLs.


Our Guides (Original Content)


CLI Commands

Development

bash
npx remotion studio              # Start Studio
npx remotion studio --port=3001  # Custom port

Rendering

bash
# Basic render
npx remotion render src/index.ts CompositionId out/video.mp4

# With props
npx remotion render src/index.ts MyVideo out/video.mp4 \
  --props='{"title":"Hello"}'

# Specific frames
npx remotion render src/index.ts MyVideo out/video.mp4 --frames=0-100

# Custom codec & quality
npx remotion render src/index.ts MyVideo out/video.mp4 \
  --codec=h264 --crf=18

# Render still image
npx remotion still src/index.ts MyVideo out/thumb.png --frame=30

# List all compositions
npx remotion compositions src/index.ts

Codecs

CodecFormatUse Case
h264MP4Default, most compatible
h265MP4Smaller files
vp9WebMWeb delivery
proresMOVProfessional editing
gifGIFShort loops

Packages

PackagePurposeInstall
remotionCore libraryIncluded
@remotion/cliCLI toolsIncluded
@remotion/mediaVideo/Audio componentsnpx remotion add @remotion/media
@remotion/playerWeb playernpx remotion add @remotion/player
@remotion/transitionsScene transitionsnpx remotion add @remotion/transitions
@remotion/three3D with Three.jsnpx remotion add @remotion/three
@remotion/captionsSubtitlesnpx remotion add @remotion/captions
@remotion/google-fontsGoogle Fontsnpx remotion add @remotion/google-fonts
@remotion/lottieLottie animationsnpx remotion add @remotion/lottie

AI Workflow: MANDATORY Verification

You MUST follow this workflow when generating Remotion code.

Step 1: Generate

Create video components following the patterns above. Respect forbidden patterns.

Step 2: Register

Add composition to src/Root.tsx.

Step 3: Verify (REQUIRED)

Run render and fix ALL errors:

bash
npx remotion render src/index.ts MyVideo out/video.mp4

Step 4: Fix Loop

If render fails:

  1. Read error message
  2. Fix the source code
  3. Run render again
  4. Repeat until success

DO NOT notify user until render passes.

Step 5: Report

Only after successful render:

  • Confirm video rendered
  • Output path and file size

Common Errors

ErrorCauseFix
Cannot find moduleMissing importAdd import statement
input range must be monotonicKeyframes not ascendingFix array order in interpolate()
fps must be positiveMissing fpsPass fps from useVideoConfig()
Composition not foundNot registeredCheck Root.tsx

Attribution

Technical patterns reference Remotion's official skill. AI workflow, CLI reference, and rendering/player guides are original content.