🎥 Make videos programmatically with React
Skills: Limit volume guidance changes to examples
Jonny Burger7f1ca4987fba
diff --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 04093597bd..14e9949e86 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@@ -87,8 +87,6 @@ import { Audio } from "@remotion/media";<Audio src={staticFile("audio.mp3")} volume={0.5} />```-Animate volume with `useCurrentFrame()` and pass the result of `interpolate()` directly to `volume`. Keep the keyframes inline so Studio can edit them:-```tsximport { Audio } from "@remotion/media";import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";@@ -107,32 +105,6 @@ return ();```-With Studio interactivity enabled, these keyframes can be edited and are shown as a volume curve in the timeline.--`frame` is relative to the component that calls `useCurrentFrame()`: the composition frame at the root, or the local frame inside a `<Sequence>`. Setting `from` on `<Audio>` does not reset this frame. Offset the keyframes to match when the audio starts:--```tsx-import { Audio } from "@remotion/media";-import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";--const frame = useCurrentFrame();-const { fps } = useVideoConfig();--return (- <Audio- src={staticFile("audio.mp3")}- from={1 * fps}- premountFor={fps}- volume={interpolate(frame, [1 * fps, 2 * fps], [0, 1], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- })}- />-);-```--This fades in during the first second of playback. `trimBefore` and `playbackRate` on the audio change the source playback, but do not shift or scale these parent-timeline keyframes. When migrating a volume callback, start the keyframes at the media's first visible frame, where the callback frame started at 0. See [Timing and trimming](https://www.remotion.dev/docs/timing) for how enclosing timing affects `useCurrentFrame()`.-## MutingUse `muted` to silence the audio. It can be set dynamically:@@ -173,35 +145,25 @@ 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>`.--Volume keyframes based on the parent component's `frame` continue across media loops. A fade over multiple loops needs no `loopVolumeCurveBehavior`:-```tsximport { Audio } from "@remotion/media";-import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";+import { interpolate, staticFile, useCurrentFrame } from "remotion";const frame = useCurrentFrame();-const { fps } = useVideoConfig();-return (- <Audio- src={staticFile("audio.mp3")}- loop- premountFor={fps}- volume={interpolate(frame, [0, 10 * fps], [1, 0], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- })}- />-);+<Audio+ src={staticFile("audio.mp3")}+ loop+ volume={interpolate(frame, [0, 300], [1, 0], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ })}+/>```-To repeat the volume envelope each loop, put the component that calls `useCurrentFrame()` inside a looping `<Sequence>` or `<Loop>`. Match its loop duration to the media's played duration, accounting for trimming and playback speed. The media's own `loop` prop does not reset the parent's `frame`.-## PitchUse `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2: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 c3d8deab8b..cf28b7da4c 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@@ -95,8 +95,6 @@ Set a static volume (0 to 1):<Video src={staticFile("video.mp4")} volume={0.5} />```-Animate volume with `useCurrentFrame()` and pass the result of `interpolate()` directly to `volume`. Keep the keyframes inline so Studio can edit them:-```tsximport { Video } from "@remotion/media";import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";@@ -115,12 +113,6 @@ return ();```-With Studio interactivity enabled, these keyframes can be edited and are shown as a volume curve in the timeline.--`frame` is relative to the component that calls `useCurrentFrame()`: the composition frame at the root, or the local frame inside a `<Sequence>`. Setting `from` on `<Video>` does not reset this frame. For a video starting at `from={1 * fps}`, fade in with `interpolate(frame, [1 * fps, 2 * fps], [0, 1], {...})`.--`trimBefore` and `playbackRate` on the video change the source playback, but do not shift or scale these parent-timeline keyframes. When migrating a volume callback, start the keyframes at the media's first visible frame, where the callback frame started at 0. See [Timing and trimming](https://www.remotion.dev/docs/timing) for how enclosing timing affects `useCurrentFrame()`.-Use `muted` to silence the video entirely:```tsx@@ -148,30 +140,22 @@ Use `loop` to loop the video indefinitely:<Video src={staticFile("video.mp4")} loop />```-Volume keyframes based on the parent component's `frame` continue across media loops. A fade over multiple loops needs no `loopVolumeCurveBehavior`:-```tsximport { Video } from "@remotion/media";-import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";+import { interpolate, staticFile, useCurrentFrame } from "remotion";const frame = useCurrentFrame();-const { fps } = useVideoConfig();-return (- <Video- src={staticFile("video.mp4")}- loop- premountFor={fps}- volume={interpolate(frame, [0, 10 * fps], [1, 0], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- })}- />-);+<Video+ src={staticFile("video.mp4")}+ loop+ volume={interpolate(frame, [0, 300], [1, 0], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ })}+/>```-To repeat the volume envelope each loop, put the component that calls `useCurrentFrame()` inside a looping `<Sequence>` or `<Loop>`. Match its loop duration to the media's played duration, accounting for trimming and playback speed. The media's own `loop` prop does not reset the parent's `frame`.-## PitchUse `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2:diff --git a/packages/codex-plugin/skills/remotion-markup/audio.md b/packages/codex-plugin/skills/remotion-markup/audio.mdindex 04093597bd..14e9949e86 100644--- a/packages/codex-plugin/skills/remotion-markup/audio.md+++ b/packages/codex-plugin/skills/remotion-markup/audio.md@@ -87,8 +87,6 @@ import { Audio } from "@remotion/media";<Audio src={staticFile("audio.mp3")} volume={0.5} />```-Animate volume with `useCurrentFrame()` and pass the result of `interpolate()` directly to `volume`. Keep the keyframes inline so Studio can edit them:-```tsximport { Audio } from "@remotion/media";import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";@@ -107,32 +105,6 @@ return ();```-With Studio interactivity enabled, these keyframes can be edited and are shown as a volume curve in the timeline.--`frame` is relative to the component that calls `useCurrentFrame()`: the composition frame at the root, or the local frame inside a `<Sequence>`. Setting `from` on `<Audio>` does not reset this frame. Offset the keyframes to match when the audio starts:--```tsx-import { Audio } from "@remotion/media";-import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";--const frame = useCurrentFrame();-const { fps } = useVideoConfig();--return (- <Audio- src={staticFile("audio.mp3")}- from={1 * fps}- premountFor={fps}- volume={interpolate(frame, [1 * fps, 2 * fps], [0, 1], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- })}- />-);-```--This fades in during the first second of playback. `trimBefore` and `playbackRate` on the audio change the source playback, but do not shift or scale these parent-timeline keyframes. When migrating a volume callback, start the keyframes at the media's first visible frame, where the callback frame started at 0. See [Timing and trimming](https://www.remotion.dev/docs/timing) for how enclosing timing affects `useCurrentFrame()`.-## MutingUse `muted` to silence the audio. It can be set dynamically:@@ -173,35 +145,25 @@ 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>`.--Volume keyframes based on the parent component's `frame` continue across media loops. A fade over multiple loops needs no `loopVolumeCurveBehavior`:-```tsximport { Audio } from "@remotion/media";-import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";+import { interpolate, staticFile, useCurrentFrame } from "remotion";const frame = useCurrentFrame();-const { fps } = useVideoConfig();-return (- <Audio- src={staticFile("audio.mp3")}- loop- premountFor={fps}- volume={interpolate(frame, [0, 10 * fps], [1, 0], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- })}- />-);+<Audio+ src={staticFile("audio.mp3")}+ loop+ volume={interpolate(frame, [0, 300], [1, 0], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ })}+/>```-To repeat the volume envelope each loop, put the component that calls `useCurrentFrame()` inside a looping `<Sequence>` or `<Loop>`. Match its loop duration to the media's played duration, accounting for trimming and playback speed. The media's own `loop` prop does not reset the parent's `frame`.-## PitchUse `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2:diff --git a/packages/codex-plugin/skills/remotion-markup/embedding-videos.md b/packages/codex-plugin/skills/remotion-markup/embedding-videos.mdindex c3d8deab8b..cf28b7da4c 100644--- a/packages/codex-plugin/skills/remotion-markup/embedding-videos.md+++ b/packages/codex-plugin/skills/remotion-markup/embedding-videos.md@@ -95,8 +95,6 @@ Set a static volume (0 to 1):<Video src={staticFile("video.mp4")} volume={0.5} />```-Animate volume with `useCurrentFrame()` and pass the result of `interpolate()` directly to `volume`. Keep the keyframes inline so Studio can edit them:-```tsximport { Video } from "@remotion/media";import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";@@ -115,12 +113,6 @@ return ();```-With Studio interactivity enabled, these keyframes can be edited and are shown as a volume curve in the timeline.--`frame` is relative to the component that calls `useCurrentFrame()`: the composition frame at the root, or the local frame inside a `<Sequence>`. Setting `from` on `<Video>` does not reset this frame. For a video starting at `from={1 * fps}`, fade in with `interpolate(frame, [1 * fps, 2 * fps], [0, 1], {...})`.--`trimBefore` and `playbackRate` on the video change the source playback, but do not shift or scale these parent-timeline keyframes. When migrating a volume callback, start the keyframes at the media's first visible frame, where the callback frame started at 0. See [Timing and trimming](https://www.remotion.dev/docs/timing) for how enclosing timing affects `useCurrentFrame()`.-Use `muted` to silence the video entirely:```tsx@@ -148,30 +140,22 @@ Use `loop` to loop the video indefinitely:<Video src={staticFile("video.mp4")} loop />```-Volume keyframes based on the parent component's `frame` continue across media loops. A fade over multiple loops needs no `loopVolumeCurveBehavior`:-```tsximport { Video } from "@remotion/media";-import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";+import { interpolate, staticFile, useCurrentFrame } from "remotion";const frame = useCurrentFrame();-const { fps } = useVideoConfig();-return (- <Video- src={staticFile("video.mp4")}- loop- premountFor={fps}- volume={interpolate(frame, [0, 10 * fps], [1, 0], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- })}- />-);+<Video+ src={staticFile("video.mp4")}+ loop+ volume={interpolate(frame, [0, 300], [1, 0], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ })}+/>```-To repeat the volume envelope each loop, put the component that calls `useCurrentFrame()` inside a looping `<Sequence>` or `<Loop>`. Match its loop duration to the media's played duration, accounting for trimming and playback speed. The media's own `loop` prop does not reset the parent's `frame`.-## PitchUse `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2:diff --git a/packages/docs/docs/audio/volume.mdx b/packages/docs/docs/audio/volume.mdxindex 6a3eccc09c..5a49e24cbd 100644--- a/packages/docs/docs/audio/volume.mdx+++ b/packages/docs/docs/audio/volume.mdx@@ -26,7 +26,7 @@ export const MyComposition = () => {## Changing volume over time-To animate volume, use [`useCurrentFrame()`](/docs/use-current-frame) and pass the result of [`interpolate()`](/docs/interpolate) directly to `volume`. This is the recommended pattern for audio and video.+You can also change volume over time using [`useCurrentFrame()`](/docs/use-current-frame) and [`interpolate()`](/docs/interpolate).```tsx twoslash {6,11} title="MyComp.tsx"import {Audio} from '@remotion/media';@@ -49,42 +49,3 @@ With [Studio interactivity](/docs/studio/interactivity) enabled, the Studio recoSelect an audio or video timeline row and press <kbd>V</kbd> to select its `volume` property. <AvailableFrom v="4.0.530" inline />Note that because values below 0 are not allowed, we need to set the [`extrapolateLeft: 'clamp'`](/docs/interpolate#extrapolateleft) option to ensure no negative values.--## Timing volume keyframes--[`useCurrentFrame()`](/docs/use-current-frame) returns the frame in the component where it is called: the composition frame at the root, or the local frame inside a [`<Sequence>`](/docs/sequence). Setting `from` on the media does not reset the frame used to calculate its props.--For audio starting after 1 second, move the volume keyframes to `[1 * fps, 2 * fps]` to fade in during its first second of playback:--```tsx twoslash {11,14} title="MyComp.tsx"-import {Audio} from '@remotion/media';-import {interpolate, staticFile, useCurrentFrame, useVideoConfig} from 'remotion';--export const MyComposition = () => {- const frame = useCurrentFrame();- const {fps} = useVideoConfig();-- return (- <Audio- src={staticFile('audio.mp3')}- from={1 * fps}- trimBefore={2 * fps}- premountFor={fps}- volume={interpolate(frame, [1 * fps, 2 * fps], [0, 1], {- extrapolateLeft: 'clamp',- extrapolateRight: 'clamp',- })}- />- );-};-```--`trimBefore` changes which source frame plays first; it does not move the volume keyframes. Likewise, `playbackRate` on the media changes its playback speed without scaling keyframes evaluated in the parent. An enclosing sequence's [timing props](/docs/timing) affect `useCurrentFrame()` in its children.--When migrating an existing `volume` callback, its frame starts at `0` when the media first becomes visible. If the media's start is visible in the caller's timeline, offset the keyframes by `from`, as above, to preserve the fade timing. If the media has already started when the caller becomes visible, for example due to a negative `from` or an enclosing trim, start the fade at its first visible frame to preserve the callback's timing.--## Volume across loops--With `volume={interpolate(frame, ...)}`, the media's `loop` prop does not reset the caller's `frame`. The volume envelope continues across media loops. [`loopVolumeCurveBehavior`](/docs/media/audio#loopvolumecurvebehavior) only affects callbacks.--To repeat a volume envelope each loop, render the component that calls `useCurrentFrame()` inside a looping [`<Sequence>`](/docs/sequence#loop) or [`<Loop>`](/docs/loop). Match the loop duration to the media's played duration, accounting for trimming and playback speed. To fade across all iterations of an enclosing loop, calculate volume in a component outside that loop and pass the value down.diff --git a/packages/docs/docs/audiobuffertodataurl.mdx b/packages/docs/docs/audiobuffertodataurl.mdxindex 9630573294..d4eb3c38a2 100644--- a/packages/docs/docs/audiobuffertodataurl.mdx+++ b/packages/docs/docs/audiobuffertodataurl.mdx@@ -25,7 +25,7 @@ const str = audioBufferToDataUrl(audioBuffer);The following composition will render a sine tone with a C4 pitch.-```tsx twoslash title="OfflineAudioBufferExample.tsx"+```tsx twoslashimport {audioBufferToDataUrl} from '@remotion/media-utils';import {Audio} from '@remotion/media';import {useCallback, useEffect, useState} from 'react';diff --git a/packages/docs/docs/html5-audio.mdx b/packages/docs/docs/html5-audio.mdxindex 75ffb71b7c..a34c29c4be 100644--- a/packages/docs/docs/html5-audio.mdx+++ b/packages/docs/docs/html5-audio.mdx@@ -39,7 +39,7 @@ Selects this many source frames starting at `trimBefore`. The audio occupies `du### `volume?`-Allows you to control the volume of the audio in its entirety or frame by frame. Read the [volume guide](/docs/audio/volume) for keyframes and timing.+Allows you to control the volume of the audio in it's entirety or frame by frame. Read the page on [using audio](/docs/using-audio) to learn more.```tsx twoslash title="Setting a static volume"import {Html5Audio, staticFile} from 'remotion';@@ -75,8 +75,6 @@ Controls the `frame` which is returned when using the [`volume`](#volume) callbaCan be either `"repeat"` (default, start from 0 on each iteration) or `"extend"` (keep increasing frames).-This prop only affects callbacks. For the recommended `volume={interpolate(frame, ...)}` pattern, the caller's frame controls the envelope. See [volume across loops](/docs/audio/volume#volume-across-loops).-### `trimBefore?`<AvailableFrom v="4.0.319"/>Removes a portion of the audio at the beginning (left side).diff --git a/packages/docs/docs/html5-video.mdx b/packages/docs/docs/html5-video.mdxindex a6e7fca26d..194ca383b9 100644--- a/packages/docs/docs/html5-video.mdx+++ b/packages/docs/docs/html5-video.mdx@@ -124,7 +124,7 @@ export const MyComposition = () => {### `volume?`-Allows you to control the volume for the whole track or change it on a per-frame basis. Refer to the [volume guide](/docs/audio/volume) for keyframes and timing.+Allows you to control the volume for the whole track or change it on a per-frame basis. Refer to the [using audio](/docs/audio/volume) guide to learn how to use it.```tsx twoslash title="Example using static volume"import {staticFile, Html5Video} from 'remotion';@@ -162,8 +162,6 @@ Controls the `frame` which is returned when using the [`volume`](#volume) callbaCan be either `"repeat"` (default, start from 0 on each iteration) or `"extend"` (keep increasing frames).-This prop only affects callbacks. For the recommended `volume={interpolate(frame, ...)}` pattern, the caller's frame controls the envelope. See [volume across loops](/docs/audio/volume#volume-across-loops).-### `name?`<AvailableFrom v="4.0.71"/>A name and that will be shown as the label of the sequence in the timeline of the Remotion Studio. This property is purely for helping you keep track of items in the timeline.diff --git a/packages/docs/docs/media/audio.mdx b/packages/docs/docs/media/audio.mdxindex eacef88833..5b64700a32 100644--- a/packages/docs/docs/media/audio.mdx+++ b/packages/docs/docs/media/audio.mdx@@ -113,8 +113,8 @@ Removes a portion of the audio at the end (right side). If `durationInFrames` en### `volume?`-Allows you to control the volume of the audio in its entirety or frame by frame.-Read the [volume guide](/docs/audio/volume) for keyframes and timing.+Allows you to control the volume of the audio in it's entirety or frame by frame.+Read the page on [using audio](/docs/using-audio) to learn more.```tsx twoslash title="Setting a static volume"import {staticFile} from 'remotion';@@ -222,8 +222,6 @@ Controls the `frame` which is returned when using the [`volume`](#volume) callbaCan be either `"repeat"` (default, start from 0 on each iteration) or `"extend"` (keep increasing frames).-This prop only affects callbacks. For the recommended `volume={interpolate(frame, ...)}` pattern, the caller's frame controls the envelope. See [volume across loops](/docs/audio/volume#volume-across-loops).-### `muted?`The `muted` prop will be respected. It will lead to no audio being played while still keeping the audio tag mounted. It's value may change over time, for example to only mute a certain section of the audio.diff --git a/packages/docs/docs/media/video.mdx b/packages/docs/docs/media/video.mdxindex b1cf17c8e5..712da35ee1 100644--- a/packages/docs/docs/media/video.mdx+++ b/packages/docs/docs/media/video.mdx@@ -161,8 +161,8 @@ Removes a portion of the video at the end (right side). If `durationInFrames` en### `volume?`-Allows you to control the volume of the audio in its entirety or frame by frame.-Read the [volume guide](/docs/audio/volume) for keyframes and timing.+Allows you to control the volume of the audio in it's entirety or frame by frame.+Read the page on [using audio](/docs/using-audio) to learn more.```tsx twoslash title="Setting a static volume"import {staticFile} from 'remotion';@@ -372,8 +372,6 @@ Controls the `frame` which is returned when using the [`volume`](#volume) callbaCan be either `"repeat"` (default, start from 0 on each iteration) or `"extend"` (keep increasing frames).-This prop only affects callbacks. For the recommended `volume={interpolate(frame, ...)}` pattern, the caller's frame controls the envelope. See [volume across loops](/docs/audio/volume#volume-across-loops).-### `showInTimeline?`If set to `false`, no layer will be shown in the timeline of the Remotion Studio. The default is `true`.diff --git a/packages/docs/docs/offthreadvideo.mdx b/packages/docs/docs/offthreadvideo.mdxindex 7cc6680875..c00a686ff6 100644--- a/packages/docs/docs/offthreadvideo.mdx+++ b/packages/docs/docs/offthreadvideo.mdx@@ -109,7 +109,7 @@ If set to `false` (_default_), frames will be extracted as bitmap (BMP), which i### `volume?`-Allows you to control the volume for the whole track or change it on a per-frame basis. Refer to the [volume guide](/docs/audio/volume) for keyframes and timing.+Allows you to control the volume for the whole track or change it on a per-frame basis. Refer to the [using audio](/docs/audio/volume) guide to learn how to use it.```tsx twoslash title="Example using static volume"import {OffthreadVideo, staticFile} from 'remotion';@@ -147,8 +147,6 @@ Controls the `frame` which is returned when using the [`volume`](#volume) callbaCan be either `"repeat"` (default, start from 0 on each iteration) or `"extend"` (keep increasing frames).-This prop only affects callbacks. For the recommended `volume={interpolate(frame, ...)}` pattern, the caller's frame controls the envelope. See [volume across loops](/docs/audio/volume#volume-across-loops).-### `style?`You can pass any style you can pass to a native HTML element. Keep in mind that during rendering, `<OffthreadVideo>` renders an [`<Img>`](/docs/img) tag, but a `<video>` tag is used during preview.diff --git a/packages/example/.agents/skills/remotion-markup/audio.md b/packages/example/.agents/skills/remotion-markup/audio.mdindex 04093597bd..14e9949e86 100644--- a/packages/example/.agents/skills/remotion-markup/audio.md+++ b/packages/example/.agents/skills/remotion-markup/audio.md@@ -87,8 +87,6 @@ import { Audio } from "@remotion/media";<Audio src={staticFile("audio.mp3")} volume={0.5} />```-Animate volume with `useCurrentFrame()` and pass the result of `interpolate()` directly to `volume`. Keep the keyframes inline so Studio can edit them:-```tsximport { Audio } from "@remotion/media";import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";@@ -107,32 +105,6 @@ return ();```-With Studio interactivity enabled, these keyframes can be edited and are shown as a volume curve in the timeline.--`frame` is relative to the component that calls `useCurrentFrame()`: the composition frame at the root, or the local frame inside a `<Sequence>`. Setting `from` on `<Audio>` does not reset this frame. Offset the keyframes to match when the audio starts:--```tsx-import { Audio } from "@remotion/media";-import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";--const frame = useCurrentFrame();-const { fps } = useVideoConfig();--return (- <Audio- src={staticFile("audio.mp3")}- from={1 * fps}- premountFor={fps}- volume={interpolate(frame, [1 * fps, 2 * fps], [0, 1], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- })}- />-);-```--This fades in during the first second of playback. `trimBefore` and `playbackRate` on the audio change the source playback, but do not shift or scale these parent-timeline keyframes. When migrating a volume callback, start the keyframes at the media's first visible frame, where the callback frame started at 0. See [Timing and trimming](https://www.remotion.dev/docs/timing) for how enclosing timing affects `useCurrentFrame()`.-## MutingUse `muted` to silence the audio. It can be set dynamically:@@ -173,35 +145,25 @@ 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>`.--Volume keyframes based on the parent component's `frame` continue across media loops. A fade over multiple loops needs no `loopVolumeCurveBehavior`:-```tsximport { Audio } from "@remotion/media";-import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";+import { interpolate, staticFile, useCurrentFrame } from "remotion";const frame = useCurrentFrame();-const { fps } = useVideoConfig();-return (- <Audio- src={staticFile("audio.mp3")}- loop- premountFor={fps}- volume={interpolate(frame, [0, 10 * fps], [1, 0], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- })}- />-);+<Audio+ src={staticFile("audio.mp3")}+ loop+ volume={interpolate(frame, [0, 300], [1, 0], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ })}+/>```-To repeat the volume envelope each loop, put the component that calls `useCurrentFrame()` inside a looping `<Sequence>` or `<Loop>`. Match its loop duration to the media's played duration, accounting for trimming and playback speed. The media's own `loop` prop does not reset the parent's `frame`.-## PitchUse `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2:diff --git a/packages/example/.agents/skills/remotion-markup/embedding-videos.md b/packages/example/.agents/skills/remotion-markup/embedding-videos.mdindex c3d8deab8b..cf28b7da4c 100644--- a/packages/example/.agents/skills/remotion-markup/embedding-videos.md+++ b/packages/example/.agents/skills/remotion-markup/embedding-videos.md@@ -95,8 +95,6 @@ Set a static volume (0 to 1):<Video src={staticFile("video.mp4")} volume={0.5} />```-Animate volume with `useCurrentFrame()` and pass the result of `interpolate()` directly to `volume`. Keep the keyframes inline so Studio can edit them:-```tsximport { Video } from "@remotion/media";import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";@@ -115,12 +113,6 @@ return ();```-With Studio interactivity enabled, these keyframes can be edited and are shown as a volume curve in the timeline.--`frame` is relative to the component that calls `useCurrentFrame()`: the composition frame at the root, or the local frame inside a `<Sequence>`. Setting `from` on `<Video>` does not reset this frame. For a video starting at `from={1 * fps}`, fade in with `interpolate(frame, [1 * fps, 2 * fps], [0, 1], {...})`.--`trimBefore` and `playbackRate` on the video change the source playback, but do not shift or scale these parent-timeline keyframes. When migrating a volume callback, start the keyframes at the media's first visible frame, where the callback frame started at 0. See [Timing and trimming](https://www.remotion.dev/docs/timing) for how enclosing timing affects `useCurrentFrame()`.-Use `muted` to silence the video entirely:```tsx@@ -148,30 +140,22 @@ Use `loop` to loop the video indefinitely:<Video src={staticFile("video.mp4")} loop />```-Volume keyframes based on the parent component's `frame` continue across media loops. A fade over multiple loops needs no `loopVolumeCurveBehavior`:-```tsximport { Video } from "@remotion/media";-import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";+import { interpolate, staticFile, useCurrentFrame } from "remotion";const frame = useCurrentFrame();-const { fps } = useVideoConfig();-return (- <Video- src={staticFile("video.mp4")}- loop- premountFor={fps}- volume={interpolate(frame, [0, 10 * fps], [1, 0], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- })}- />-);+<Video+ src={staticFile("video.mp4")}+ loop+ volume={interpolate(frame, [0, 300], [1, 0], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ })}+/>```-To repeat the volume envelope each loop, put the component that calls `useCurrentFrame()` inside a looping `<Sequence>` or `<Loop>`. Match its loop duration to the media's played duration, accounting for trimming and playback speed. The media's own `loop` prop does not reset the parent's `frame`.-## PitchUse `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2:diff --git a/packages/skills/skills/remotion-markup/audio.md b/packages/skills/skills/remotion-markup/audio.mdindex 8499acb29a..8cc4eedfc7 100644--- a/packages/skills/skills/remotion-markup/audio.md+++ b/packages/skills/skills/remotion-markup/audio.md@@ -87,7 +87,7 @@ import { Audio } from "@remotion/media";<Audio src={staticFile("audio.mp3")} volume={0.5} />```-Animate volume with `useCurrentFrame()` and pass the result of `interpolate()` directly to `volume`. Keep the keyframes inline so Studio can edit them:+Use `useCurrentFrame()` and `interpolate()` for keyframed volume:```tsximport { Audio } from "@remotion/media";@@ -109,30 +109,6 @@ return (With Studio interactivity enabled, these keyframes can be edited and are shown as a volume curve in the timeline.-`frame` is relative to the component that calls `useCurrentFrame()`: the composition frame at the root, or the local frame inside a `<Sequence>`. Setting `from` on `<Audio>` does not reset this frame. Offset the keyframes to match when the audio starts:--```tsx-import { Audio } from "@remotion/media";-import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";--const frame = useCurrentFrame();-const { fps } = useVideoConfig();--return (- <Audio- src={staticFile("audio.mp3")}- from={1 * fps}- premountFor={fps}- volume={interpolate(frame, [1 * fps, 2 * fps], [0, 1], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- })}- />-);-```--This fades in during the first second of playback. `trimBefore` and `playbackRate` on the audio change the source playback, but do not shift or scale these parent-timeline keyframes. When migrating a volume callback, start the keyframes at the media's first visible frame, where the callback frame started at 0. See [Timing and trimming](https://www.remotion.dev/docs/timing) for how enclosing timing affects `useCurrentFrame()`.-## MutingUse `muted` to silence the audio. It can be set dynamically:@@ -178,30 +154,22 @@ import { Audio } from "@remotion/media";Put `name`, `from`, `loop`, `volume`, and `premountFor` directly on `<Audio>`.-Volume keyframes based on the parent component's `frame` continue across media loops. A fade over multiple loops needs no `loopVolumeCurveBehavior`:-```tsximport { Audio } from "@remotion/media";-import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";+import { interpolate, staticFile, useCurrentFrame } from "remotion";const frame = useCurrentFrame();-const { fps } = useVideoConfig();-return (- <Audio- src={staticFile("audio.mp3")}- loop- premountFor={fps}- volume={interpolate(frame, [0, 10 * fps], [1, 0], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- })}- />-);+<Audio+ src={staticFile("audio.mp3")}+ loop+ volume={interpolate(frame, [0, 300], [1, 0], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ })}+/>```-To repeat the volume envelope each loop, put the component that calls `useCurrentFrame()` inside a looping `<Sequence>` or `<Loop>`. Match its loop duration to the media's played duration, accounting for trimming and playback speed. The media's own `loop` prop does not reset the parent's `frame`.-## PitchUse `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2:diff --git a/packages/skills/skills/remotion-markup/embedding-videos.md b/packages/skills/skills/remotion-markup/embedding-videos.mdindex 1c957b3e93..5263d6f1c2 100644--- a/packages/skills/skills/remotion-markup/embedding-videos.md+++ b/packages/skills/skills/remotion-markup/embedding-videos.md@@ -95,7 +95,7 @@ Set a static volume (0 to 1):<Video src={staticFile("video.mp4")} volume={0.5} />```-Animate volume with `useCurrentFrame()` and pass the result of `interpolate()` directly to `volume`. Keep the keyframes inline so Studio can edit them:+Use `useCurrentFrame()` and `interpolate()` for keyframed volume:```tsximport { Video } from "@remotion/media";@@ -117,10 +117,6 @@ return (With Studio interactivity enabled, these keyframes can be edited and are shown as a volume curve in the timeline.-`frame` is relative to the component that calls `useCurrentFrame()`: the composition frame at the root, or the local frame inside a `<Sequence>`. Setting `from` on `<Video>` does not reset this frame. For a video starting at `from={1 * fps}`, fade in with `interpolate(frame, [1 * fps, 2 * fps], [0, 1], {...})`.--`trimBefore` and `playbackRate` on the video change the source playback, but do not shift or scale these parent-timeline keyframes. When migrating a volume callback, start the keyframes at the media's first visible frame, where the callback frame started at 0. See [Timing and trimming](https://www.remotion.dev/docs/timing) for how enclosing timing affects `useCurrentFrame()`.-Use `muted` to silence the video entirely:```tsx@@ -148,30 +144,22 @@ Use `loop` to loop the video indefinitely:<Video src={staticFile("video.mp4")} loop />```-Volume keyframes based on the parent component's `frame` continue across media loops. A fade over multiple loops needs no `loopVolumeCurveBehavior`:-```tsximport { Video } from "@remotion/media";-import { interpolate, staticFile, useCurrentFrame, useVideoConfig } from "remotion";+import { interpolate, staticFile, useCurrentFrame } from "remotion";const frame = useCurrentFrame();-const { fps } = useVideoConfig();-return (- <Video- src={staticFile("video.mp4")}- loop- premountFor={fps}- volume={interpolate(frame, [0, 10 * fps], [1, 0], {- extrapolateLeft: "clamp",- extrapolateRight: "clamp",- })}- />-);+<Video+ src={staticFile("video.mp4")}+ loop+ volume={interpolate(frame, [0, 300], [1, 0], {+ extrapolateLeft: "clamp",+ extrapolateRight: "clamp",+ })}+/>```-To repeat the volume envelope each loop, put the component that calls `useCurrentFrame()` inside a looping `<Sequence>` or `<Loop>`. Match its loop duration to the media's played duration, accounting for trimming and playback speed. The media's own `loop` prop does not reset the parent's `frame`.-## PitchUse `toneFrequency` to adjust the pitch without affecting speed. Values range from 0.01 to 2: