AgentSkillsCN

remotion

精通Remotion与React,擅长以程序化方式制作视频。当用户希望借助代码创建视频、动画或动态媒体内容时,即可调用此技能。

SKILL.md
--- frontmatter
name: "remotion"
description: "Expert guide for creating programmatic videos with Remotion and React. Invoke when user asks to create videos, animations, or dynamic media content using code."

Remotion Video Creation Skill

This skill provides expertise in creating videos programmatically using Remotion (React-based video framework).

Capabilities

  • Video Composition: Setting up compositions with fps, durationInFrames, width, and height in Root.tsx.
  • Animation: Using useCurrentFrame, interpolate, and spring for smooth animations.
  • Sequencing: Using <Sequence>, <Series>, and <AbsoluteFill> to structure the timeline.
  • Audio Integration: Adding background music and sound effects with <Audio />.
  • Dynamic Content: Fetching data (APIs, JSON) to generate personalized videos.
  • Rendering: Configuring codecs, output formats, and parallel rendering.

Core Concepts

1. The Composition

The root of every video. Defined in Root.tsx.

tsx
<Composition
  id="MyVideo"
  component={MyVideo}
  durationInFrames={150}
  fps={30}
  width={1920}
  height={1080}
/>

2. Animation Hooks

  • useCurrentFrame(): Get the current frame number (0 to duration).
  • useVideoConfig(): Get video metadata (width, height, fps, duration).
  • interpolate(frame, [0, 100], [0, 1]): Map frame numbers to values (opacity, scale, etc.).
  • spring({ frame, fps }): Create physics-based animations.

3. Layout & Sequencing

  • <AbsoluteFill>: A helper component that fills the parent container (absolute positioning).
  • <Sequence>: Place a component at a specific time on the timeline.
    tsx
    <Sequence from={0} durationInFrames={30}>
      <Intro />
    </Sequence>
    
  • <Series>: Sequence components one after another automatically.

Best Practices

  • Performance: Use React.memo for heavy components. Avoid heavy computations in the render loop.
  • Assets: Store images/video in public/ or import them. Use staticFile() for public assets.
  • Testing: Use the Remotion Player for fast feedback during development.
  • Folder Structure: Organize components logically (e.g., src/components, src/scenes).

Example Prompt

"Create a 15-second promo video for a coffee shop with a fading text intro and a sliding image gallery."