--- name: remotion-video description: This skill should be used when the user asks to "make a video with Remotion", "create a programmatic/data-driven video in React", "render an MP4/GIF from code", "animate with useCurrentFrame/interpolate/spring", "sync video to audio/beats", or "render a templated video per record headlessly". Covers building React compositions and rendering them via CLI or @remotion/renderer. version: 0.1.0 --- # Remotion (Programmatic Video) Build real MP4/GIF/WebM videos in React. Every frame is a pure function of `useCurrentFrame()`, so output is deterministic, scrubbable, diffable, and renderable in CI. The code-first alternative to After Effects for templated and data-driven motion graphics. ## When to use - Render MP4/GIF/WebM from code (social clips, title cards, explainers). - Templated/data-driven videos: one composition, many outputs from props (per-user, per-record, per-row of a CSV/DB). - Motion graphics that must be versioned, code-reviewed, and rendered in CI without a GUI. - Programmatic audio sync, charts that animate from data, or embedding shaders/Three.js into video. ## Core techniques ### Frame-driven animation Animation is derived from the current frame, never from `setState` or `requestAnimationFrame`. `interpolate` maps an input range to an output range; `spring` produces physically natural motion. ```jsx import {useCurrentFrame, useVideoConfig, interpolate, spring} from 'remotion'; export const Title = () => { const frame = useCurrentFrame(); const {fps} = useVideoConfig(); // Fade in over frames 0-30, then stay (clamp prevents over/undershoot). const opacity = interpolate(frame, [0, 30], [0, 1], { extrapolateLeft: 'clamp', extrapolateRight: 'clamp', }); // Spring entrance; divide by spring duration is unnecessary — drive transforms directly. const scale = spring({frame, fps, config: {damping: 200, mass: 1, stiffness: 100}}); return

Hello

; }; ``` Always clamp `interpolate` unless an intentional overshoot is desired — by default it extrapolates linearly past the range, which produces opacity > 1 or negative values. ### Scheduling: Sequence and Series `` shifts time: children see `frame` reset to 0 at the sequence's `from`. Use it to place clips on a timeline. `` lays out back-to-back segments without manual offset math. ```jsx import {Sequence, Series, AbsoluteFill} from 'remotion'; export const Timeline = () => ( {/* Series auto-sequences; offset overlaps the previous segment for crossfades */} ); ``` ### Composition registration + parametric props The `` declares id, size, fps, duration, and `defaultProps`. A zod schema makes props type-safe and editable in the Studio sidebar. ```jsx import {Composition} from 'remotion'; import {z} from 'zod'; export const schema = z.object({ title: z.string(), accent: z.string(), fps: z.number().default(30), }); export const Root = () => ( ); ``` To make duration data-dependent, use `calculateMetadata` on the Composition to compute `durationInFrames` from props (e.g. number of rows × frames per row) before render. ### Audio and beat sync ```jsx import {Audio, staticFile, useCurrentFrame, useVideoConfig} from 'remotion'; const BEATS_SEC = [0.5, 1.0, 1.5, 2.0]; // detected offline export const Music = ({children}) => { const frame = useCurrentFrame(); const {fps} = useVideoConfig(); const t = frame / fps; const onBeat = BEATS_SEC.some((b) => Math.abs(t - b) < 1 / fps); return ( <>