π₯ Make videos programmatically with React
Skills: Remove premounting recommendations
JonnyBurger37f13df97497
diff --git a/.agents/skills/remotion-new-markup/SKILL.md b/.agents/skills/remotion-new-markup/SKILL.mdindex a0bf596476..4c6cddc0a8 100644--- a/.agents/skills/remotion-new-markup/SKILL.md+++ b/.agents/skills/remotion-new-markup/SKILL.md@@ -13,7 +13,7 @@ additional wrapper around the content.Use built-in interactive components, media components that support timing, orcustom components created with `Interactive.withSchema({wrapInSequence: true})`.-Pass `from`, `durationInFrames`, `trimBefore`, `playbackRate`, `premountFor`, and+Pass `from`, `durationInFrames`, `trimBefore`, `playbackRate`, and`name` directly to the component that supports them.Avoid wrapping one timing-aware component in a `<Sequence>` just to schedule@@ -37,7 +37,7 @@ an additional timeline layer that does not represent useful content. Prefertimeline item.The inner component can return a fragment. Put instance styles, timing,-premounting, `width`, and `height` on the exported interactive component. Do not+`width`, and `height` on the exported interactive component. Do notdeclare `style`, `width`, or `height` props on the inner component when usingthis layout; the wrapper owns them.@@ -66,7 +66,7 @@ export const Scene = Interactive.withSchema({export const MyVideo = () => {const {fps} = useVideoConfig();- return <Scene name="Opening scene" from={fps} durationInFrames={3 * fps} premountFor={fps} title="A new perspective" style={{backgroundColor: '#111111'}} />;+ return <Scene name="Opening scene" from={fps} durationInFrames={3 * fps} title="A new perspective" style={{backgroundColor: '#111111'}} />;};```diff --git a/packages/skills/skills/remotion-captions/display-captions.md b/packages/skills/skills/remotion-captions/display-captions.mdindex 2ecdbe14da..f698d42ad2 100644--- a/packages/skills/skills/remotion-captions/display-captions.md+++ b/packages/skills/skills/remotion-captions/display-captions.md@@ -65,18 +65,15 @@ export const MyComposition: React.FC = () => {name="Opening"trimBefore={4 * fps}durationInFrames={20 * fps}- premountFor={fps}><Videoname="Opening footage"src={staticFile("opening.mp4")}- premountFor={fps}objectFit="cover"style={{ width: "100%", height: "100%" }}/><BasicCaptionsname="Opening captions"- premountFor={fps}width={900}style={{position: "absolute",@@ -105,18 +102,15 @@ export const MyComposition: React.FC = () => {name="Next clip"trimBefore={1 * fps}durationInFrames={5 * fps}- premountFor={fps}><Videoname="Next footage"src={staticFile("next.mp4")}- premountFor={fps}objectFit="cover"style={{ width: "100%", height: "100%" }}/><BasicCaptionsname="Next captions"- premountFor={fps}width={900}style={{position: "absolute",diff --git a/packages/skills/skills/remotion-interactivity/SKILL.md b/packages/skills/skills/remotion-interactivity/SKILL.mdindex df8e3a8c5e..ad312daf9c 100644--- a/packages/skills/skills/remotion-interactivity/SKILL.md+++ b/packages/skills/skills/remotion-interactivity/SKILL.md@@ -15,28 +15,25 @@ If the markup is too complex for the Studio to make it interactive, then the val## Prefer interactive components with their own timelines-Use `Interactive.withSchema({wrapInSequence: true, layout: 'absolute-fill'})` for components that fill their parent. The wrapper provides their visual root and timeline item, and clips overflow by default, so the inner component can return a fragment. Put timing, premounting, dimensions, and per-instance styles on the exported component.+Use `Interactive.withSchema({wrapInSequence: true, layout: 'absolute-fill'})` for components that fill their parent. The wrapper provides their visual root and timeline item, and clips overflow by default, so the inner component can return a fragment. Put timing, dimensions, and per-instance styles on the exported component.Keep visuals that belong together in the same component, so they move and trim together. An inner layout container can still provide alignment, clipping within a smaller area, or an animated group; a container that only fills the scene is usually unnecessary. Cards, text boxes, and SVGs with their own bounds can keep the default `layout: 'none'` and forward `style` to their visual root.```tsx title="Scene.tsx"import {Video} from '@remotion/media';import type React from 'react';-import {Interactive, useVideoConfig, type InteractivitySchema} from 'remotion';+import {Interactive, type InteractivitySchema} from 'remotion';type SceneProps = {readonly title: string;};const SceneInner: React.FC<SceneProps> = ({title}) => {- const {fps} = useVideoConfig();-return (<><Videoname="Background footage"src="https://remotion.media/video.mp4"- premountFor={fps}objectFit="cover"style={{width: '100%', height: '100%'}}/>@@ -165,14 +162,13 @@ registration and extraction details.Avoid a separate `<Sequence>` around one component that already accepts timingprops. Built-in interactive components and custom components made with`wrapInSequence: true` can receive `name`, `from`, `durationInFrames`,-`trimBefore`, `playbackRate`, and `premountFor` directly.+`trimBefore`, and `playbackRate` directly.```tsx<Scenename="Opening scene"from={30}durationInFrames={90}- premountFor={fps}style={{opacity: 0.9}}title="A new perspective"/>diff --git a/packages/skills/skills/remotion-markup/SKILL.md b/packages/skills/skills/remotion-markup/SKILL.mdindex ac7b244317..005ef40e8a 100644--- a/packages/skills/skills/remotion-markup/SKILL.md+++ b/packages/skills/skills/remotion-markup/SKILL.md@@ -17,7 +17,7 @@ If you detect a surprising change made in the meanwhile, don't overwrite it, assInside a composition or scene component, get `fps` from `useVideoConfig()` forall seconds-to-frames calculations, including timing props such as `from`,-`trimBefore`, `durationInFrames`, and `premountFor`. Keeping the expression on+`trimBefore` and `durationInFrames`. Keeping the expression onthe JSX node, such as `trimBefore={4 * fps}`, lets Studio edit the timing andkeeps it correct if the composition frame rate changes.@@ -34,12 +34,6 @@ wrapper handles layout and instance styles. Sized elements such as lower thirdscan keep the default layout and forward `style` to their own root. Registerreusable scenes as connected compositions.Put timing directly on components that support it; avoid redundant `<Sequence>` wrappers.-Give every timed component that supports `premountFor` one second of premounting:-`premountFor={fps}`, where `fps` comes from `useVideoConfig()`. Apply this to-media, interactive components, `<Sequence>`, `<TransitionSeries.Sequence>`,-and `<TransitionSeries.Overlay>`, including timed components nested inside scenes. Premount the parent timeline item too-when a nested item needs to mount before the parent starts. A component without-`premountFor`, such as `<TransitionSeries.Transition>`, needs no substitute.The Studio edits the JSX source node that created an item. Author every composition registration, clip, scene, layer and sequence that should be editable independently as its own JSX node, with its editable props inline.Programmatic loops are suitable when the generated instances are intentionally controlled as one source template, not when users need to edit the instances@@ -55,7 +49,6 @@ export const FadeIn = () => {return (<Interactive.Divname="Title"- premountFor={fps}style={{opacity: interpolate(frame, [0, 2 * fps], [0, 1], {extrapolateRight: "clamp",@@ -116,22 +109,19 @@ Use `staticFile()` for files in `public/` or pass a remote URL directly:```tsximport { Audio, Video } from "@remotion/media";-import { staticFile, CanvasImage, AnimatedImage, useVideoConfig } from "remotion";+import { staticFile, CanvasImage, AnimatedImage } from "remotion";export const MyComposition = () => {- const {fps} = useVideoConfig();-return (<>- <Video src={staticFile("video.mp4")} premountFor={fps} style={{ opacity: 0.5 }} />- <Audio src={staticFile("audio.mp3")} premountFor={fps} />+ <Video src={staticFile("video.mp4")} style={{ opacity: 0.5 }} />+ <Audio src={staticFile("audio.mp3")} /><CanvasImagesrc={staticFile("logo.png")}- premountFor={fps}style={{ width: 100, height: 100 }}/>- <Video src="https://remotion.media/video.mp4" premountFor={fps} />- <AnimatedImage src={staticFile('nyancat.gif')} premountFor={fps} />+ <Video src="https://remotion.media/video.mp4" />+ <AnimatedImage src={staticFile('nyancat.gif')} /></>);};@@ -162,7 +152,6 @@ export const MyScene = () => {<Videoname="Background"src="https://remotion.media/video.mp4"- premountFor={fps}objectFit="cover"style={{position: "absolute",@@ -173,7 +162,6 @@ export const MyScene = () => {<LowerThirdname="Lower third"from={1 * fps}- premountFor={fps}accentColor="#0b84f3"style={{opacity: interpolate(frame, [1 * fps, 2 * fps], [0, 1], {diff --git a/packages/skills/skills/remotion-markup/audio.md b/packages/skills/skills/remotion-markup/audio.mdindex 8cc4eedfc7..4ec871f142 100644--- a/packages/skills/skills/remotion-markup/audio.md+++ b/packages/skills/skills/remotion-markup/audio.md@@ -149,10 +149,10 @@ Use `loop` to loop the audio indefinitely:```tsximport { Audio } from "@remotion/media";-<Audio src={staticFile("audio.mp3")} loop premountFor={fps} />+<Audio src={staticFile("audio.mp3")} loop />```-Put `name`, `from`, `loop`, `volume`, and `premountFor` directly on `<Audio>`.+Put `name`, `from`, `loop`, and `volume` directly on `<Audio>`.```tsximport { Audio } from "@remotion/media";diff --git a/packages/skills/skills/remotion-markup/multi-scene-video.md b/packages/skills/skills/remotion-markup/multi-scene-video.mdindex 26681cbf09..79ab9e9b09 100644--- a/packages/skills/skills/remotion-markup/multi-scene-video.md+++ b/packages/skills/skills/remotion-markup/multi-scene-video.md@@ -19,26 +19,21 @@ Example:```tsx// MyVideo.tsximport {TransitionSeries} from '@remotion/transitions';-import {useVideoConfig} from 'remotion';import {OpeningScene} from './OpeningScene';import {FeatureScene} from './FeatureScene';export const MyVideo = () => {- const {fps} = useVideoConfig();-return (<TransitionSeries><TransitionSeries.Sequencename="Opening"durationInFrames={90}- premountFor={fps}><OpeningScene /></TransitionSeries.Sequence><TransitionSeries.Sequencename="Feature"durationInFrames={120}- premountFor={fps}><FeatureScene /></TransitionSeries.Sequence>diff --git a/packages/skills/skills/remotion-markup/sequencing.md b/packages/skills/skills/remotion-markup/sequencing.mdindex da556121ea..d052cbf5be 100644--- a/packages/skills/skills/remotion-markup/sequencing.md+++ b/packages/skills/skills/remotion-markup/sequencing.md@@ -8,7 +8,7 @@ metadata:Prefer timing props directly on built-in interactive components and customcomponents made with `Interactive.withSchema({wrapInSequence: true})`.Avoid wrapping a single timing-capable component in a redundant `<Sequence>`.-Put `name`, `from`, `durationInFrames`, `loop`, `volume`, and `premountFor`+Put `name`, `from`, `durationInFrames`, `loop`, and `volume`directly on `<Audio>` from `@remotion/media` whenever their combination gives the intended timing.See [Remotion Interactivity](../remotion-interactivity/SKILL.md) for creating@@ -18,8 +18,8 @@ for registering them with their own Studio timelines.```tsx// Title and Subtitle are exported with Interactive.withSchema({wrapInSequence: true}).<>- <Title name="Title" from={30} durationInFrames={60} premountFor={fps} />- <Subtitle name="Subtitle" from={60} durationInFrames={60} premountFor={fps} />+ <Title name="Title" from={30} durationInFrames={60} />+ <Subtitle name="Subtitle" from={60} durationInFrames={60} /></>```@@ -28,22 +28,6 @@ when overriding dimensions for descendants, or when the child does not accepttiming props. Its default layout adds an absolutely positioned fill element;use `layout="none"` when no layout wrapper is needed.-## Premounting--Set `premountFor={fps}` on every timed component that supports the prop, using-`fps` from `useVideoConfig()`. This mounts it one second before its start in-Studio, allowing media and other content to prepare. Put the prop directly on-the timed component, including `<Audio>`, `<Video>`, interactive components,-`<Sequence>`, `<TransitionSeries.Sequence>`, and-`<TransitionSeries.Overlay>`:--```tsx-<Title from={60} durationInFrames={90} premountFor={fps} />-```--Premount parent timeline items as well when a nested item must mount before the-parent starts. The composition cannot premount before frame 0.-## TransitionSeriesUse `<TransitionSeries>` for consecutive scenes, with or without transitions. Without a transition, the scenes play without overlap.@@ -52,13 +36,13 @@ Use `<TransitionSeries>` for consecutive scenes, with or without transitions. Wiimport { TransitionSeries } from "@remotion/transitions";<TransitionSeries>- <TransitionSeries.Sequence durationInFrames={45} premountFor={fps}>+ <TransitionSeries.Sequence durationInFrames={45}><Intro /></TransitionSeries.Sequence>- <TransitionSeries.Sequence durationInFrames={60} premountFor={fps}>+ <TransitionSeries.Sequence durationInFrames={60}><MainContent /></TransitionSeries.Sequence>- <TransitionSeries.Sequence durationInFrames={30} premountFor={fps}>+ <TransitionSeries.Sequence durationInFrames={30}><Outro /></TransitionSeries.Sequence></TransitionSeries>;diff --git a/packages/skills/skills/remotion-markup/timing-props.md b/packages/skills/skills/remotion-markup/timing-props.mdindex a1f039764e..c6e4407c48 100644--- a/packages/skills/skills/remotion-markup/timing-props.md+++ b/packages/skills/skills/remotion-markup/timing-props.md@@ -6,10 +6,6 @@ a fixed FPS constant.The following timing props are supported by built-in components (`<AbsoluteFill>`, `<Interactive.*>`, `<Img>`, `<AnimatedImage>`, `<CanvasImage>`, `<HtmlInCanvas>`, `<Solid>`, `<Sequence>`, `<Track>` from `remotion`, `<Video>` and `<Audio>` from `@remotion/media`, `<Gif>`, and more).Custom components made with `Interactive.withSchema({wrapInSequence: true})` accept them too, see [Prefer interactive components with their own timelines](../remotion-interactivity/SKILL.md#prefer-interactive-components-with-their-own-timelines).-Set `premountFor={fps}` on these timed items when they support it, including-items starting at frame 0. At frame 0, the composition has no earlier frames-to premount into; the prop still keeps the same one-second default if the item-is moved later.### `from`diff --git a/packages/skills/skills/remotion-markup/transitions.md b/packages/skills/skills/remotion-markup/transitions.mdindex 0e33e59541..17c52ebbfa 100644--- a/packages/skills/skills/remotion-markup/transitions.md+++ b/packages/skills/skills/remotion-markup/transitions.md@@ -12,11 +12,6 @@ metadata:- **Transitions** (`<TransitionSeries.Transition>`) β crossfade, slide, wipe, etc. between two scenes. Shortens the timeline because both scenes play simultaneously during the transition.- **Overlays** (`<TransitionSeries.Overlay>`) β render an effect (e.g. a light leak) on top of the cut point without shortening the timeline.-Set `premountFor={fps}` on every `<TransitionSeries.Sequence>` and-`<TransitionSeries.Overlay>`, using `fps` from `useVideoConfig()`. Premount-timed children inside those items as well. `<TransitionSeries.Transition>`-does not accept `premountFor`.-For a multi-scene timeline, keep the outer `<TransitionSeries>` visible in thetimeline. Studio favors the active scene sequence when the two have the samefull-frame canvas outline.@@ -36,14 +31,14 @@ import { TransitionSeries, linearTiming } from "@remotion/transitions";import { fade } from "@remotion/transitions/fade";<TransitionSeries>- <TransitionSeries.Sequence durationInFrames={60} premountFor={fps}>+ <TransitionSeries.Sequence durationInFrames={60}><SceneA /></TransitionSeries.Sequence><TransitionSeries.Transitionpresentation={fade()}timing={linearTiming({ durationInFrames: 15 })}/>- <TransitionSeries.Sequence durationInFrames={60} premountFor={fps}>+ <TransitionSeries.Sequence durationInFrames={60}><SceneB /></TransitionSeries.Sequence></TransitionSeries>;@@ -60,13 +55,12 @@ import {interpolate, Solid, useCurrentFrame, useVideoConfig} from 'remotion';const LightLeakOverlay: React.FC = () => {const frame = useCurrentFrame();- const {durationInFrames, fps, height, width} = useVideoConfig();+ const {durationInFrames, height, width} = useVideoConfig();return (<Solidwidth={width}height={height}- premountFor={fps}effects={[lightLeak({progress: interpolate(frame, [0, durationInFrames - 1], [0, 1], {@@ -80,13 +74,13 @@ const LightLeakOverlay: React.FC = () => {};<TransitionSeries>- <TransitionSeries.Sequence durationInFrames={60} premountFor={fps}>+ <TransitionSeries.Sequence durationInFrames={60}><SceneA /></TransitionSeries.Sequence>- <TransitionSeries.Overlay durationInFrames={20} premountFor={fps}>+ <TransitionSeries.Overlay durationInFrames={20}><LightLeakOverlay /></TransitionSeries.Overlay>- <TransitionSeries.Sequence durationInFrames={60} premountFor={fps}>+ <TransitionSeries.Sequence durationInFrames={60}><SceneB /></TransitionSeries.Sequence></TransitionSeries>;@@ -104,13 +98,12 @@ import {interpolate, Solid, useCurrentFrame, useVideoConfig} from 'remotion';const LightLeakOverlay: React.FC = () => {const frame = useCurrentFrame();- const {durationInFrames, fps, height, width} = useVideoConfig();+ const {durationInFrames, height, width} = useVideoConfig();return (<Solidwidth={width}height={height}- premountFor={fps}effects={[lightLeak({progress: interpolate(frame, [0, durationInFrames - 1], [0, 1], {@@ -124,20 +117,20 @@ const LightLeakOverlay: React.FC = () => {};<TransitionSeries>- <TransitionSeries.Sequence durationInFrames={60} premountFor={fps}>+ <TransitionSeries.Sequence durationInFrames={60}><SceneA /></TransitionSeries.Sequence>- <TransitionSeries.Overlay durationInFrames={30} premountFor={fps}>+ <TransitionSeries.Overlay durationInFrames={30}><LightLeakOverlay /></TransitionSeries.Overlay>- <TransitionSeries.Sequence durationInFrames={60} premountFor={fps}>+ <TransitionSeries.Sequence durationInFrames={60}><SceneB /></TransitionSeries.Sequence><TransitionSeries.Transitionpresentation={fade()}timing={linearTiming({ durationInFrames: 15 })}/>- <TransitionSeries.Sequence durationInFrames={60} premountFor={fps}>+ <TransitionSeries.Sequence durationInFrames={60}><SceneC /></TransitionSeries.Sequence></TransitionSeries>;@@ -156,7 +149,6 @@ const LightLeakOverlay: React.FC = () => {- `durationInFrames` β how long the overlay is visible (positive integer).- `offset?` β shifts the overlay relative to the cut point center. Positive = later, negative = earlier. Default: `0`.-- `premountFor` β set to `fps` for one second of premounting.## Available transition typesdiff --git a/packages/skills/skills/remotion-markup/video-editing.md b/packages/skills/skills/remotion-markup/video-editing.mdindex b88ba94e2c..69183ed23c 100644--- a/packages/skills/skills/remotion-markup/video-editing.md+++ b/packages/skills/skills/remotion-markup/video-editing.md@@ -19,10 +19,8 @@ Choose the timeline structure based on the editing behavior:duration should reposition every later clip. It also supports transitionsand overlays.-Use `const {fps} = useVideoConfig()` in the enclosing composition and set-`premountFor={fps}` on each timed clip, sequence, and overlay that supports it.-When a clip is inside a series sequence, premount both the sequence and clip.-For trims and other timing props expressed in seconds, use that same `fps`+Use `const {fps} = useVideoConfig()` in the enclosing composition.+For trims and other timing props expressed in seconds, use that `fps`directly in each clip's JSX, for example `trimBefore={4 * fps}`. Do not use aseparate fixed `FPS` constant: Studio must be able to update each clip's sourceexpression when the user trims or splits it.@@ -60,7 +58,6 @@ Use literal frame counts when they are already known;src="https://remotion.media/video.mp4"trimBefore={0}durationInFrames={78}- premountFor={fps}/><Videoname="Interview"@@ -68,7 +65,6 @@ Use literal frame counts when they are already known;trimBefore={12}from={78}durationInFrames={66}- premountFor={fps}/><Videoname="Closing"@@ -76,7 +72,6 @@ Use literal frame counts when they are already known;trimBefore={72}from={144}durationInFrames={90}- premountFor={fps}/>```@@ -100,25 +95,22 @@ sequence and move the video's trim to that shared sequence as described above:import { TransitionSeries } from "@remotion/transitions";<TransitionSeries>- <TransitionSeries.Sequence name="Opening" durationInFrames={78} premountFor={fps}>+ <TransitionSeries.Sequence name="Opening" durationInFrames={78}><Videosrc="https://remotion.media/video.mp4"trimBefore={0}- premountFor={fps}/></TransitionSeries.Sequence>- <TransitionSeries.Sequence name="Interview" durationInFrames={66} premountFor={fps}>+ <TransitionSeries.Sequence name="Interview" durationInFrames={66}><Videosrc="https://remotion.media/video.webm"trimBefore={12}- premountFor={fps}/></TransitionSeries.Sequence>- <TransitionSeries.Sequence name="Closing" durationInFrames={90} premountFor={fps}>+ <TransitionSeries.Sequence name="Closing" durationInFrames={90}><Videosrc="https://remotion.media/video.mp4"trimBefore={72}- premountFor={fps}/></TransitionSeries.Sequence></TransitionSeries>@@ -132,7 +124,7 @@ Keep every sequence as a separate JSX node with a hardcoded `name` and`durationInFrames`. The child may also be a custom clip or scene component:```tsx-<TransitionSeries.Sequence name="Product demo" durationInFrames={150} premountFor={fps}>+<TransitionSeries.Sequence name="Product demo" durationInFrames={150}><ProductDemo /></TransitionSeries.Sequence>```@@ -145,22 +137,20 @@ captions inside its sequence and apply shared timing to that parent:```tsx<TransitionSeries name="Video timeline">- <TransitionSeries.Sequence name="Opening" durationInFrames={78} premountFor={fps}>+ <TransitionSeries.Sequence name="Opening" durationInFrames={78}><Videosrc="https://remotion.media/video.mp4"trimBefore={0}- premountFor={fps}/></TransitionSeries.Sequence><TransitionSeries.Transitionpresentation={fade()}timing={linearTiming({durationInFrames: 12})}/>- <TransitionSeries.Sequence name="Interview" durationInFrames={66} premountFor={fps}>+ <TransitionSeries.Sequence name="Interview" durationInFrames={66}><Videosrc="https://remotion.media/video.webm"trimBefore={12}- premountFor={fps}/></TransitionSeries.Sequence></TransitionSeries>