Skip to content

🎥 Make videos programmatically with React

@remotion/media: Deprecate trimAfter

JonnyBurgerf6fa4c0896ce
diff --git a/packages/docs/docs/media/audio.mdx b/packages/docs/docs/media/audio.mdx
index 8862213669..d309430f0c 100644
--- a/packages/docs/docs/media/audio.mdx
+++ b/packages/docs/docs/media/audio.mdx
@@ -50,7 +50,7 @@ At which frame this clip should start relative to the parent timeline. Default i
### `durationInFrames?`<AvailableFrom v="4.0.446" />
-Selects this many source frames starting at `trimBefore`, unless `trimAfter` ends the range earlier. The clip occupies `durationInFrames / playbackRate` frames on the parent timeline, or uses this range as its loop when `loop` is enabled. Same meaning as [`durationInFrames`](/docs/sequence#durationinframes) on [`<Sequence>`](/docs/sequence).
+Selects this many source frames starting at `trimBefore`. The clip occupies `durationInFrames / playbackRate` frames on the parent timeline, or uses this range as its loop when `loop` is enabled. Same meaning as [`durationInFrames`](/docs/sequence#durationinframes) on [`<Sequence>`](/docs/sequence).
:::note
You can still wrap `<Audio>` in an outer [`<Sequence>`](/docs/sequence). Timing [cascades](/docs/sequence#cascading) like nested sequences.
@@ -104,7 +104,11 @@ export const MyComposition = () => {
};
```
-### `trimAfter?`
+### ~~`trimAfter?`~~
+
+:::info Deprecated
+Use [`durationInFrames`](#durationinframes) instead. See [PR #11685](https://github.com/remotion-dev/remotion/pull/11685).
+:::
Removes a portion of the audio at the end (right side). If `durationInFrames` ends the range earlier, the shorter range is used. See [`trimBefore`](#trimbefore) for an explanation.
diff --git a/packages/docs/docs/media/video.mdx b/packages/docs/docs/media/video.mdx
index 72b5ba450b..e23391531c 100644
--- a/packages/docs/docs/media/video.mdx
+++ b/packages/docs/docs/media/video.mdx
@@ -89,7 +89,7 @@ At which frame this clip should start relative to the parent timeline. Default i
### `durationInFrames?`<AvailableFrom v="4.0.446" />
-Selects this many source frames starting at `trimBefore`, unless `trimAfter` ends the range earlier. The clip occupies `durationInFrames / playbackRate` frames on the parent timeline, or uses this range as its loop when `loop` is enabled. Same meaning as [`durationInFrames`](/docs/sequence#durationinframes) on [`<Sequence>`](/docs/sequence).
+Selects this many source frames starting at `trimBefore`. The clip occupies `durationInFrames / playbackRate` frames on the parent timeline, or uses this range as its loop when `loop` is enabled. Same meaning as [`durationInFrames`](/docs/sequence#durationinframes) on [`<Sequence>`](/docs/sequence).
:::note
You can still wrap `<Video>` in an outer [`<Sequence>`](/docs/sequence). Timing [cascades](/docs/sequence#cascading) like nested sequences.
@@ -153,7 +153,11 @@ export const MyComposition = () => {
};
```
-### `trimAfter?`
+### ~~`trimAfter?`~~
+
+:::info Deprecated
+Use [`durationInFrames`](#durationinframes) instead. See [PR #11685](https://github.com/remotion-dev/remotion/pull/11685).
+:::
Removes a portion of the video at the end (right side). If `durationInFrames` ends the range earlier, the shorter range is used. See [`trimBefore`](#trimbefore) for an explanation.
diff --git a/packages/docs/docs/timing.mdx b/packages/docs/docs/timing.mdx
index ff16c0e280..364b841186 100644
--- a/packages/docs/docs/timing.mdx
+++ b/packages/docs/docs/timing.mdx
@@ -126,7 +126,7 @@ export const MyComposition = () => (
```
To set a finite total duration for a loop, wrap it in an outer item with `durationInFrames`.
-[`<Video>`](/docs/media/video) and [`<Audio>`](/docs/media/audio) may omit `durationInFrames` because they have an intrinsic duration. They also support `trimAfter` for trimming the source.
+[`<Video>`](/docs/media/video) and [`<Audio>`](/docs/media/audio) may omit `durationInFrames` because they have an intrinsic duration.
## Order of operations
diff --git a/packages/media/src/audio/props.ts b/packages/media/src/audio/props.ts
index c2c32f3907..a25424aa84 100644
--- a/packages/media/src/audio/props.ts
+++ b/packages/media/src/audio/props.ts
@@ -20,6 +20,9 @@ export type FallbackHtml5AudioProps = {
export type AudioProps = {
src: string;
trimBefore?: number;
+ /**
+ * @deprecated Use `durationInFrames` instead. See https://github.com/remotion-dev/remotion/pull/11685
+ */
trimAfter?: number;
volume?: VolumeProp;
loopVolumeCurveBehavior?: LoopVolumeCurveBehavior;
diff --git a/packages/media/src/video/props.ts b/packages/media/src/video/props.ts
index 2ce13c0ceb..a6bab99c55 100644
--- a/packages/media/src/video/props.ts
+++ b/packages/media/src/video/props.ts
@@ -42,6 +42,9 @@ type MandatoryVideoProps = {
type OuterVideoProps = {
trimBefore: number | undefined;
+ /**
+ * @deprecated Use `durationInFrames` instead. See https://github.com/remotion-dev/remotion/pull/11685
+ */
trimAfter: number | undefined;
};
@@ -60,6 +63,9 @@ type OptionalVideoProps = {
audioStreamIndex: number;
disallowFallbackToOffthreadVideo: boolean;
fallbackOffthreadVideoProps: FallbackOffthreadVideoProps;
+ /**
+ * @deprecated Use `durationInFrames` instead. See https://github.com/remotion-dev/remotion/pull/11685
+ */
trimAfter: number | undefined;
trimBefore: number | undefined;
toneFrequency: number;