🎥 Make videos programmatically with React
Simplify audio and interactive element sequencing
Jonny Burgere3647c3bf3c3
diff --git a/packages/brand/src/Compose/WhatIsRemotion.tsx b/packages/brand/src/Compose/WhatIsRemotion.tsxindex dec4b041ce..e685bdd691 100644--- a/packages/brand/src/Compose/WhatIsRemotion.tsx+++ b/packages/brand/src/Compose/WhatIsRemotion.tsx@@ -538,23 +538,22 @@ export const WhatIsRemotion = ({alignItems: 'center',}}>- <Sequence layout="none" from={100}>- <Interactive.Div- style={{- width: 393.75,- height: 700,- position: 'relative',- }}- >- {interpolate(frame, [175, 200], [0, 1], {- extrapolateLeft: 'clamp',- extrapolateRight: 'clamp',- easing: Easing.bezier(0.42, 0, 0.58, 1),- }) ? (- <EndCard cornerRadius={10} />- ) : null}- </Interactive.Div>- </Sequence>+ <Interactive.Div+ from={100}+ style={{+ width: 393.75,+ height: 700,+ position: 'relative',+ }}+ >+ {interpolate(frame, [175, 200], [0, 1], {+ extrapolateLeft: 'clamp',+ extrapolateRight: 'clamp',+ easing: Easing.bezier(0.42, 0, 0.58, 1),+ }) ? (+ <EndCard cornerRadius={10} />+ ) : null}+ </Interactive.Div></Interactive.Div></TranslateX></Interactive.Div>diff --git a/packages/brand/src/announcements/whats-new-in-remotion/AnimatedList.tsx b/packages/brand/src/announcements/whats-new-in-remotion/AnimatedList.tsxindex 1076f48bbd..d1484bd405 100644--- a/packages/brand/src/announcements/whats-new-in-remotion/AnimatedList.tsx+++ b/packages/brand/src/announcements/whats-new-in-remotion/AnimatedList.tsx@@ -1,7 +1,6 @@import {Audio} from '@remotion/media';import {AbsoluteFill,- Sequence,interpolate,spring,useCurrentFrame,@@ -80,9 +79,11 @@ export const AnimatedList: React.FC<AnimatedListProps> = ({title, items}) => {}}>{!isImmediate && (- <Sequence from={item.appearFrame} layout="none">- <Audio src={assetUrl('list-item-sfx.m4a')} volume={0.8} />- </Sequence>+ <Audio+ from={item.appearFrame}+ src={assetUrl('list-item-sfx.m4a')}+ volume={0.8}+ />)}{item.label}</div>diff --git a/packages/brand/src/announcements/whats-new-in-remotion/Composition.tsx b/packages/brand/src/announcements/whats-new-in-remotion/Composition.tsxindex c9ea2026f3..34ce4bb7a0 100644--- a/packages/brand/src/announcements/whats-new-in-remotion/Composition.tsx+++ b/packages/brand/src/announcements/whats-new-in-remotion/Composition.tsx@@ -1,7 +1,7 @@import {LightLeak} from '@remotion/light-leaks';import {Audio} from '@remotion/media';import {TransitionSeries} from '@remotion/transitions';-import {AbsoluteFill, Sequence} from 'remotion';+import {AbsoluteFill} from 'remotion';import {z} from 'zod';import {Scene1} from './Scene1';import {Scene2} from './Scene2';@@ -79,9 +79,11 @@ export const MyComposition: React.FC<MyCompositionProps> = ({platform}) => {<AbsoluteFill><LightLeak seed={10} style={{opacity: 0.7}} /></AbsoluteFill>- <Sequence name="Light leak whoosh" layout="none">- <Audio src="https://remotion.media/whoosh.wav" volume={0.1} />- </Sequence>+ <Audio+ name="Light leak whoosh"+ src="https://remotion.media/whoosh.wav"+ volume={0.1}+ /></TransitionSeries.Overlay><TransitionSeries.SequencedurationInFrames={1266}@@ -97,9 +99,11 @@ export const MyComposition: React.FC<MyCompositionProps> = ({platform}) => {<AbsoluteFill><LightLeak seed={19} style={{opacity: 0.7}} /></AbsoluteFill>- <Sequence name="Light leak whoosh" layout="none">- <Audio src="https://remotion.media/whoosh.wav" volume={0.1} />- </Sequence>+ <Audio+ name="Light leak whoosh"+ src="https://remotion.media/whoosh.wav"+ volume={0.1}+ /></TransitionSeries.Overlay><TransitionSeries.SequencedurationInFrames={1119}diff --git a/packages/brand/src/announcements/whats-new-in-remotion/NumberedChapter.tsx b/packages/brand/src/announcements/whats-new-in-remotion/NumberedChapter.tsxindex 5066bcaf8f..db373c740f 100644--- a/packages/brand/src/announcements/whats-new-in-remotion/NumberedChapter.tsx+++ b/packages/brand/src/announcements/whats-new-in-remotion/NumberedChapter.tsx@@ -3,7 +3,6 @@ import {AbsoluteFill,continueRender,delayRender,- Sequence,spring,useCurrentFrame,useVideoConfig,@@ -60,9 +59,7 @@ export const NumberedChapter: React.FC<NumberedChapterProps> = ({return (<AbsoluteFill>- <Sequence from={30} layout="none">- <Audio src={assetUrl('chime.mp3')} volume={0.05} />- </Sequence>+ <Audio from={30} src={assetUrl('chime.mp3')} volume={0.05} /><AbsoluteFillstyle={{diff --git a/packages/codex-plugin/skills/remotion-best-practices/remotion-interactivity/REFERENCE.md b/packages/codex-plugin/skills/remotion-best-practices/remotion-interactivity/REFERENCE.mdindex a49c81a6fc..c6c7e16453 100644--- a/packages/codex-plugin/skills/remotion-best-practices/remotion-interactivity/REFERENCE.md+++ b/packages/codex-plugin/skills/remotion-best-practices/remotion-interactivity/REFERENCE.md@@ -59,11 +59,13 @@ Avoid computed names, hardcode them.</>```-## Use AbsoluteFill directly for layers+## Set timing and names directly on supported components`<AbsoluteFill>` is already interactive and appears in the timeline.Give it a `name` and set `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` or `showInTimeline` directly on it.-Do not add an outer `<Sequence>` just to name or time a single `<AbsoluteFill>`.+The same applies to `<Interactive.Div>`, `<Img>`, `<CanvasImage>`, `<AnimatedImage>`, `<Gif>` and `<Audio>` / `<Video>` from `@remotion/media`.+Pass supported timing and naming props directly to these components instead of adding an outer `<Sequence>` for a single child.+The legacy `<Html5Audio>`, `<Html5Video>` and `<OffthreadVideo>` still need a `<Sequence>` for timing.```tsx title="Standalone background layer"<AbsoluteFilldiff --git a/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/audio.md b/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/audio.mdindex ad917a4c7b..3a31e8ff74 100644--- a/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/audio.md+++ b/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/audio.md@@ -58,18 +58,16 @@ The audio still starts playing at the beginning of the composition - only the sp## Delaying-Wrap the audio in a `<Sequence>` to delay when it starts:+Set `from` directly on `<Audio>` to delay when it starts:```tsx-import { Sequence, staticFile } from "remotion";+import { staticFile, useVideoConfig } from "remotion";import { Audio } from "@remotion/media";const { fps } = useVideoConfig();return (- <Sequence from={1 * fps}>- <Audio src={staticFile("audio.mp3")} />- </Sequence>+ <Audio from={fps} src={staticFile("audio.mp3")} />);```diff --git a/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/embedding-videos.md b/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/embedding-videos.mdindex 51d73a8d21..fd0dd42fce 100644--- a/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/embedding-videos.md+++ b/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/embedding-videos.md@@ -54,18 +54,16 @@ return (## Delaying-Wrap the video in a `<Sequence>` to delay when it appears:+Set `from` directly on `<Video>` to delay when it appears:```tsx-import { Sequence, staticFile } from "remotion";+import { staticFile, useVideoConfig } from "remotion";import { Video } from "@remotion/media";const { fps } = useVideoConfig();return (- <Sequence from={1 * fps}>- <Video src={staticFile("video.mp4")} />- </Sequence>+ <Video from={fps} src={staticFile("video.mp4")} />);```diff --git a/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/sequencing.md b/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/sequencing.mdindex 0c9649d659..3785181893 100644--- a/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/sequencing.md+++ b/packages/codex-plugin/skills/remotion-best-practices/remotion-markup/sequencing.md@@ -7,10 +7,12 @@ metadata:Use `<Sequence>` to delay when a group or custom component appears in the timeline.-## Use AbsoluteFill directly for layers+## Set timing and names directly on supported components`<AbsoluteFill>` already supports `name`, `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` and `showInTimeline`.-Pass these props directly to `<AbsoluteFill>` instead of wrapping it in a `<Sequence>` whose only child is that layer.+The same applies to `<Interactive.Div>`, `<Img>`, `<CanvasImage>`, `<AnimatedImage>`, `<Gif>` and `<Audio>` / `<Video>` from `@remotion/media`.+Pass supported timing and naming props directly to these components instead of adding an outer `<Sequence>` for a single child.+The legacy `<Html5Audio>`, `<Html5Video>` and `<OffthreadVideo>` still need a `<Sequence>` for timing.```tsx title="Standalone background layer"<AbsoluteFill@@ -21,7 +23,7 @@ Pass these props directly to `<AbsoluteFill>` instead of wrapping it in a `<Sequ/>```-Keep an outer `<Sequence>` when it groups multiple children or supplies features such as premounting, postmounting or `width` / `height` overrides.+Keep an outer `<Sequence>` when it groups multiple children or supplies layout or props that the child does not support. For example, `<AbsoluteFill>` needs a wrapper for premounting, postmounting or `width` / `height` overrides, while `<Audio>` and `<Video>` from `@remotion/media` support `premountFor` and `postmountFor` directly.Timing props on `<AbsoluteFill>` apply to its descendants, including their `useCurrentFrame()` calls.## Timing custom componentsdiff --git a/packages/codex-plugin/skills/remotion-interactivity/SKILL.md b/packages/codex-plugin/skills/remotion-interactivity/SKILL.mdindex a49c81a6fc..c6c7e16453 100644--- a/packages/codex-plugin/skills/remotion-interactivity/SKILL.md+++ b/packages/codex-plugin/skills/remotion-interactivity/SKILL.md@@ -59,11 +59,13 @@ Avoid computed names, hardcode them.</>```-## Use AbsoluteFill directly for layers+## Set timing and names directly on supported components`<AbsoluteFill>` is already interactive and appears in the timeline.Give it a `name` and set `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` or `showInTimeline` directly on it.-Do not add an outer `<Sequence>` just to name or time a single `<AbsoluteFill>`.+The same applies to `<Interactive.Div>`, `<Img>`, `<CanvasImage>`, `<AnimatedImage>`, `<Gif>` and `<Audio>` / `<Video>` from `@remotion/media`.+Pass supported timing and naming props directly to these components instead of adding an outer `<Sequence>` for a single child.+The legacy `<Html5Audio>`, `<Html5Video>` and `<OffthreadVideo>` still need a `<Sequence>` for timing.```tsx title="Standalone background layer"<AbsoluteFilldiff --git a/packages/codex-plugin/skills/remotion-markup/audio.md b/packages/codex-plugin/skills/remotion-markup/audio.mdindex ad917a4c7b..3a31e8ff74 100644--- a/packages/codex-plugin/skills/remotion-markup/audio.md+++ b/packages/codex-plugin/skills/remotion-markup/audio.md@@ -58,18 +58,16 @@ The audio still starts playing at the beginning of the composition - only the sp## Delaying-Wrap the audio in a `<Sequence>` to delay when it starts:+Set `from` directly on `<Audio>` to delay when it starts:```tsx-import { Sequence, staticFile } from "remotion";+import { staticFile, useVideoConfig } from "remotion";import { Audio } from "@remotion/media";const { fps } = useVideoConfig();return (- <Sequence from={1 * fps}>- <Audio src={staticFile("audio.mp3")} />- </Sequence>+ <Audio from={fps} src={staticFile("audio.mp3")} />);```diff --git a/packages/codex-plugin/skills/remotion-markup/embedding-videos.md b/packages/codex-plugin/skills/remotion-markup/embedding-videos.mdindex 51d73a8d21..fd0dd42fce 100644--- a/packages/codex-plugin/skills/remotion-markup/embedding-videos.md+++ b/packages/codex-plugin/skills/remotion-markup/embedding-videos.md@@ -54,18 +54,16 @@ return (## Delaying-Wrap the video in a `<Sequence>` to delay when it appears:+Set `from` directly on `<Video>` to delay when it appears:```tsx-import { Sequence, staticFile } from "remotion";+import { staticFile, useVideoConfig } from "remotion";import { Video } from "@remotion/media";const { fps } = useVideoConfig();return (- <Sequence from={1 * fps}>- <Video src={staticFile("video.mp4")} />- </Sequence>+ <Video from={fps} src={staticFile("video.mp4")} />);```diff --git a/packages/codex-plugin/skills/remotion-markup/sequencing.md b/packages/codex-plugin/skills/remotion-markup/sequencing.mdindex 0c9649d659..3785181893 100644--- a/packages/codex-plugin/skills/remotion-markup/sequencing.md+++ b/packages/codex-plugin/skills/remotion-markup/sequencing.md@@ -7,10 +7,12 @@ metadata:Use `<Sequence>` to delay when a group or custom component appears in the timeline.-## Use AbsoluteFill directly for layers+## Set timing and names directly on supported components`<AbsoluteFill>` already supports `name`, `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` and `showInTimeline`.-Pass these props directly to `<AbsoluteFill>` instead of wrapping it in a `<Sequence>` whose only child is that layer.+The same applies to `<Interactive.Div>`, `<Img>`, `<CanvasImage>`, `<AnimatedImage>`, `<Gif>` and `<Audio>` / `<Video>` from `@remotion/media`.+Pass supported timing and naming props directly to these components instead of adding an outer `<Sequence>` for a single child.+The legacy `<Html5Audio>`, `<Html5Video>` and `<OffthreadVideo>` still need a `<Sequence>` for timing.```tsx title="Standalone background layer"<AbsoluteFill@@ -21,7 +23,7 @@ Pass these props directly to `<AbsoluteFill>` instead of wrapping it in a `<Sequ/>```-Keep an outer `<Sequence>` when it groups multiple children or supplies features such as premounting, postmounting or `width` / `height` overrides.+Keep an outer `<Sequence>` when it groups multiple children or supplies layout or props that the child does not support. For example, `<AbsoluteFill>` needs a wrapper for premounting, postmounting or `width` / `height` overrides, while `<Audio>` and `<Video>` from `@remotion/media` support `premountFor` and `postmountFor` directly.Timing props on `<AbsoluteFill>` apply to its descendants, including their `useCurrentFrame()` calls.## Timing custom componentsdiff --git a/packages/skills/skills/remotion-interactivity/SKILL.md b/packages/skills/skills/remotion-interactivity/SKILL.mdindex 647ca10fc4..5206ed5ba0 100644--- a/packages/skills/skills/remotion-interactivity/SKILL.md+++ b/packages/skills/skills/remotion-interactivity/SKILL.md@@ -59,11 +59,13 @@ Avoid computed names, hardcode them.</>```-## Use AbsoluteFill directly for layers+## Set timing and names directly on supported components`<AbsoluteFill>` is already interactive and appears in the timeline.Give it a `name` and set `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` or `showInTimeline` directly on it.-Do not add an outer `<Sequence>` just to name or time a single `<AbsoluteFill>`.+The same applies to `<Interactive.Div>`, `<Img>`, `<CanvasImage>`, `<AnimatedImage>`, `<Gif>` and `<Audio>` / `<Video>` from `@remotion/media`.+Pass supported timing and naming props directly to these components instead of adding an outer `<Sequence>` for a single child.+The legacy `<Html5Audio>`, `<Html5Video>` and `<OffthreadVideo>` still need a `<Sequence>` for timing.```tsx title="Standalone background layer"<AbsoluteFilldiff --git a/packages/skills/skills/remotion-markup/audio.md b/packages/skills/skills/remotion-markup/audio.mdindex ad917a4c7b..3a31e8ff74 100644--- a/packages/skills/skills/remotion-markup/audio.md+++ b/packages/skills/skills/remotion-markup/audio.md@@ -58,18 +58,16 @@ The audio still starts playing at the beginning of the composition - only the sp## Delaying-Wrap the audio in a `<Sequence>` to delay when it starts:+Set `from` directly on `<Audio>` to delay when it starts:```tsx-import { Sequence, staticFile } from "remotion";+import { staticFile, useVideoConfig } from "remotion";import { Audio } from "@remotion/media";const { fps } = useVideoConfig();return (- <Sequence from={1 * fps}>- <Audio src={staticFile("audio.mp3")} />- </Sequence>+ <Audio from={fps} src={staticFile("audio.mp3")} />);```diff --git a/packages/skills/skills/remotion-markup/embedding-videos.md b/packages/skills/skills/remotion-markup/embedding-videos.mdindex 51d73a8d21..fd0dd42fce 100644--- a/packages/skills/skills/remotion-markup/embedding-videos.md+++ b/packages/skills/skills/remotion-markup/embedding-videos.md@@ -54,18 +54,16 @@ return (## Delaying-Wrap the video in a `<Sequence>` to delay when it appears:+Set `from` directly on `<Video>` to delay when it appears:```tsx-import { Sequence, staticFile } from "remotion";+import { staticFile, useVideoConfig } from "remotion";import { Video } from "@remotion/media";const { fps } = useVideoConfig();return (- <Sequence from={1 * fps}>- <Video src={staticFile("video.mp4")} />- </Sequence>+ <Video from={fps} src={staticFile("video.mp4")} />);```diff --git a/packages/skills/skills/remotion-markup/sequencing.md b/packages/skills/skills/remotion-markup/sequencing.mdindex 0c9649d659..3785181893 100644--- a/packages/skills/skills/remotion-markup/sequencing.md+++ b/packages/skills/skills/remotion-markup/sequencing.md@@ -7,10 +7,12 @@ metadata:Use `<Sequence>` to delay when a group or custom component appears in the timeline.-## Use AbsoluteFill directly for layers+## Set timing and names directly on supported components`<AbsoluteFill>` already supports `name`, `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` and `showInTimeline`.-Pass these props directly to `<AbsoluteFill>` instead of wrapping it in a `<Sequence>` whose only child is that layer.+The same applies to `<Interactive.Div>`, `<Img>`, `<CanvasImage>`, `<AnimatedImage>`, `<Gif>` and `<Audio>` / `<Video>` from `@remotion/media`.+Pass supported timing and naming props directly to these components instead of adding an outer `<Sequence>` for a single child.+The legacy `<Html5Audio>`, `<Html5Video>` and `<OffthreadVideo>` still need a `<Sequence>` for timing.```tsx title="Standalone background layer"<AbsoluteFill@@ -21,7 +23,7 @@ Pass these props directly to `<AbsoluteFill>` instead of wrapping it in a `<Sequ/>```-Keep an outer `<Sequence>` when it groups multiple children or supplies features such as premounting, postmounting or `width` / `height` overrides.+Keep an outer `<Sequence>` when it groups multiple children or supplies layout or props that the child does not support. For example, `<AbsoluteFill>` needs a wrapper for premounting, postmounting or `width` / `height` overrides, while `<Audio>` and `<Video>` from `@remotion/media` support `premountFor` and `postmountFor` directly.Timing props on `<AbsoluteFill>` apply to its descendants, including their `useCurrentFrame()` calls.## Timing custom componentsdiff --git a/packages/template-prompt-to-motion-graphics/src/skills/sequencing.md b/packages/template-prompt-to-motion-graphics/src/skills/sequencing.mdindex fdcc511a39..e8dc240fb2 100644--- a/packages/template-prompt-to-motion-graphics/src/skills/sequencing.md+++ b/packages/template-prompt-to-motion-graphics/src/skills/sequencing.md@@ -5,10 +5,12 @@ impactDescription: controls when elements appear and enables complex choreographtags: sequence, series, timing, delay, choreography----## Use AbsoluteFill directly for layers+## Set timing and names directly on supported components`<AbsoluteFill>` already supports `name`, `from`, `durationInFrames`, `trimBefore`, `freeze`, `hidden` and `showInTimeline`.-Pass these props directly to `<AbsoluteFill>` instead of wrapping it in a `<Sequence>` whose only child is that layer.+The same applies to `<Interactive.Div>`, `<Img>`, `<CanvasImage>`, `<AnimatedImage>`, `<Gif>` and `<Audio>` / `<Video>` from `@remotion/media`.+Pass supported timing and naming props directly to these components instead of adding an outer `<Sequence>` for a single child.+The legacy `<Html5Audio>`, `<Html5Video>` and `<OffthreadVideo>` still need a `<Sequence>` for timing.```tsx title="Standalone background layer"<AbsoluteFill@@ -19,7 +21,7 @@ Pass these props directly to `<AbsoluteFill>` instead of wrapping it in a `<Sequ/>```-Keep an outer `<Sequence>` when it groups multiple children or supplies features such as premounting, postmounting or `width` / `height` overrides.+Keep an outer `<Sequence>` when it groups multiple children or supplies layout or props that the child does not support. For example, `<AbsoluteFill>` needs a wrapper for premounting, postmounting or `width` / `height` overrides, while `<Audio>` and `<Video>` from `@remotion/media` support `premountFor` and `postmountFor` directly.Timing props on `<AbsoluteFill>` apply to its descendants, including their `useCurrentFrame()` calls.## Sequence for Delayed Elementsdiff --git a/packages/template-prompt-to-video/src/components/AIVideo.tsx b/packages/template-prompt-to-video/src/components/AIVideo.tsxindex 6fdae87731..813da5ad1d 100644--- a/packages/template-prompt-to-video/src/components/AIVideo.tsx+++ b/packages/template-prompt-to-video/src/components/AIVideo.tsx@@ -98,14 +98,13 @@ export const AIVideo: React.FC<z.infer<typeof aiVideoSchema>> = ({);return (- <Sequence+ <Audiokey={`element-${index}`}from={startFrame}durationInFrames={duration}premountFor={3 * FPS}- >- <Audio src={staticFile(getAudioPath(id, element.audioUrl))} />- </Sequence>+ src={staticFile(getAudioPath(id, element.audioUrl))}+ />);})}</AbsoluteFill>