🎥 Make videos programmatically with React
`@remotion/media`: Use Mediabunny retry defaults
Jonny Burger0cfb5bcc6a8b
diff --git a/packages/brand/src/LogoHorn/index.tsx b/packages/brand/src/LogoHorn/index.tsxindex b1d4227091..64eacd0376 100644--- a/packages/brand/src/LogoHorn/index.tsx+++ b/packages/brand/src/LogoHorn/index.tsx@@ -1,4 +1,5 @@import {chromaticAberration} from '@remotion/effects/chromatic-aberration';+import {pixelDissolve} from '@remotion/effects/pixel-dissolve';import {Audio} from '@remotion/media';import {useWindowedAudioData, visualizeAudio} from '@remotion/media-utils';import {ALL_FORMATS, Input, UrlSource} from 'mediabunny';@@ -13,8 +14,6 @@ import {useVideoConfig,} from 'remotion';-import {pixelDissolve} from '@remotion/effects/pixel-dissolve';-const AUDIO_FILE = staticFile('hoorn.wav');const LOGO_FILE = staticFile('logo/remotion/logo-on-white.svg');const LOGO_SIZE = 200;@@ -52,9 +51,7 @@ export const calculateLogoHornMetadata: CalculateMetadataFunction<const fps = 30;const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(AUDIO_FILE, {- getRetryDelay: () => null,- }),+ source: new UrlSource(AUDIO_FILE),});const durationInSeconds = await input.computeDuration();diff --git a/packages/docs/docs/dynamic-metadata.mdx b/packages/docs/docs/dynamic-metadata.mdxindex 96cfd95425..0785f0785d 100644--- a/packages/docs/docs/dynamic-metadata.mdx+++ b/packages/docs/docs/dynamic-metadata.mdx@@ -22,9 +22,7 @@ import {Input, ALL_FORMATS, UrlSource} from 'mediabunny';export const getMediaMetadata = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const durationInSeconds = await input.computeDuration();@@ -118,9 +116,7 @@ import {Input, ALL_FORMATS, UrlSource} from 'mediabunny';export const getMediaMetadata = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const durationInSeconds = await input.computeDuration();@@ -227,9 +223,7 @@ import {Input, ALL_FORMATS, UrlSource} from 'mediabunny';export const getMediaMetadata = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const durationInSeconds = await input.computeDuration();diff --git a/packages/docs/docs/lambda/cost-example.mdx b/packages/docs/docs/lambda/cost-example.mdxindex d1ede6c75c..6297eb1b1f 100644--- a/packages/docs/docs/lambda/cost-example.mdx+++ b/packages/docs/docs/lambda/cost-example.mdx@@ -36,9 +36,7 @@ import {Input, ALL_FORMATS, UrlSource} from 'mediabunny';export const getMediaMetadata = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const durationInSeconds = await input.computeDuration();@@ -114,9 +112,7 @@ import {Input, ALL_FORMATS, UrlSource} from 'mediabunny';export const getMediaMetadata = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const durationInSeconds = await input.computeDuration();@@ -188,9 +184,7 @@ import {Input, ALL_FORMATS, UrlSource} from 'mediabunny';export const getMediaMetadata = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const durationInSeconds = await input.computeDuration();diff --git a/packages/docs/docs/mediabunny/frame-rate.mdx b/packages/docs/docs/mediabunny/frame-rate.mdxindex bc1cc0b8c2..1f75725436 100644--- a/packages/docs/docs/mediabunny/frame-rate.mdx+++ b/packages/docs/docs/mediabunny/frame-rate.mdx@@ -84,9 +84,7 @@ export const calculateMetadata: CalculateMetadataFunction<Props> = async ({}) => {using input = new Input({formats: ALL_FORMATS,- source: new UrlSource(props.src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(props.src),});const videoTrack = await input.getPrimaryVideoTrack();diff --git a/packages/docs/docs/mediabunny/metadata.mdx b/packages/docs/docs/mediabunny/metadata.mdxindex 33b9c3a55a..45baab4b83 100644--- a/packages/docs/docs/mediabunny/metadata.mdx+++ b/packages/docs/docs/mediabunny/metadata.mdx@@ -23,9 +23,7 @@ import {Input, ALL_FORMATS, UrlSource} from 'mediabunny';export const getMediaMetadata = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const durationInSeconds = await input.computeDuration();@@ -56,7 +54,6 @@ export const getMediaMetadata = async (src: string) => {<summary>Explanation</summary><p>We load a URL (e.g. `https://remotion.media/video.mp4`) and parse it using Mediabunny.</p><p>We don't care which format, so we load all parsers using `ALL_FORMATS`.</p>- <p>By setting `getRetryDelay` to `() => null`, we prevent Mediabunny from infinitely retrying if the request fails.</p><p>We compute the duration, dimensions, and frame rate. If the media file is an audio file, we return `null` for the dimensions and frame rate.</p></details>diff --git a/packages/docs/docs/offthreadvideo.mdx b/packages/docs/docs/offthreadvideo.mdxindex b77284ee3b..e0d8e38bf5 100644--- a/packages/docs/docs/offthreadvideo.mdx+++ b/packages/docs/docs/offthreadvideo.mdx@@ -353,9 +353,7 @@ import {Input, ALL_FORMATS, UrlSource} from 'mediabunny';export const getMediaMetadata = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const durationInSeconds = await input.computeDuration();diff --git a/packages/docs/docs/sample-rate.mdx b/packages/docs/docs/sample-rate.mdxindex 48971fefec..027e7a6cbb 100644--- a/packages/docs/docs/sample-rate.mdx+++ b/packages/docs/docs/sample-rate.mdx@@ -113,9 +113,7 @@ const calculateMetadata: CalculateMetadataFunction<> = async ({props}) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(props.src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(props.src),});const audioTrack = await input.getPrimaryAudioTrack();diff --git a/packages/docs/docs/videos/align-duration.mdx b/packages/docs/docs/videos/align-duration.mdxindex b60e7b2f82..03b6645eaa 100644--- a/packages/docs/docs/videos/align-duration.mdx+++ b/packages/docs/docs/videos/align-duration.mdx@@ -48,9 +48,7 @@ import type {CalculateMetadataFunction} from 'remotion';export const calculateMetadata: CalculateMetadataFunction<MyCompProps> = async ({props}) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(props.src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(props.src),});const [durationInSeconds, videoTrack] = await Promise.all([diff --git a/packages/docs/docs/videos/sequence.mdx b/packages/docs/docs/videos/sequence.mdxindex 894786a314..0fffa80a50 100644--- a/packages/docs/docs/videos/sequence.mdx+++ b/packages/docs/docs/videos/sequence.mdx@@ -75,9 +75,7 @@ import type {VideosInSequenceProps} from './VideosInSequence';const getVideoDuration = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});return input.computeDuration();diff --git a/packages/example/src/get-media-metadata.ts b/packages/example/src/get-media-metadata.tsindex c46d25c9cd..7a8a362597 100644--- a/packages/example/src/get-media-metadata.ts+++ b/packages/example/src/get-media-metadata.ts@@ -20,9 +20,7 @@ const snapToCommonFps = (fps: number) => {export const getMediaMetadata = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const durationInSeconds = await input.computeDuration();diff --git a/packages/media/src/video-extraction/get-frames-since-keyframe.ts b/packages/media/src/video-extraction/get-frames-since-keyframe.tsindex 59460337c9..00d80af808 100644--- a/packages/media/src/video-extraction/get-frames-since-keyframe.ts+++ b/packages/media/src/video-extraction/get-frames-since-keyframe.ts@@ -1,4 +1,4 @@-import type {InputFormat, UrlSourceOptions} from 'mediabunny';+import type {InputFormat} from 'mediabunny';import {ALL_FORMATS,AudioSampleSink,@@ -43,10 +43,6 @@ export type VideoSinkResult =| 'unknown-container-format'| 'network-error';-const getRetryDelay = (() => {- return null;-}) satisfies UrlSourceOptions['getRetryDelay'];-const getFormatOrNullOrNetworkError = async (input: Input,): Promise<InputFormat | 'network-error' | null> => {@@ -71,7 +67,6 @@ export const makeSinks = (const input = new Input({formats: ALL_FORMATS,source: new UrlSource(src, {- getRetryDelay,maxCacheSize: getMaxSourceCacheSize(logLevel),...(resolvedRequestInit ? {requestInit: resolvedRequestInit} : undefined),}),diff --git a/packages/skills/skills/remotion-multimedia/get-audio-duration.md b/packages/skills/skills/remotion-multimedia/get-audio-duration.mdindex 35ef747174..e2336c7d00 100644--- a/packages/skills/skills/remotion-multimedia/get-audio-duration.md+++ b/packages/skills/skills/remotion-multimedia/get-audio-duration.md@@ -17,9 +17,7 @@ import { Input, ALL_FORMATS, UrlSource } from "mediabunny";export const getAudioDuration = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const durationInSeconds = await input.computeDuration();diff --git a/packages/skills/skills/remotion-multimedia/get-video-dimensions.md b/packages/skills/skills/remotion-multimedia/get-video-dimensions.mdindex 746c09fbec..e73014e72e 100644--- a/packages/skills/skills/remotion-multimedia/get-video-dimensions.md+++ b/packages/skills/skills/remotion-multimedia/get-video-dimensions.md@@ -17,9 +17,7 @@ import { Input, ALL_FORMATS, UrlSource } from "mediabunny";export const getVideoDimensions = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const videoTrack = await input.getPrimaryVideoTrack();diff --git a/packages/skills/skills/remotion-multimedia/get-video-duration.md b/packages/skills/skills/remotion-multimedia/get-video-duration.mdindex 10ab735d16..9fd125fb34 100644--- a/packages/skills/skills/remotion-multimedia/get-video-duration.md+++ b/packages/skills/skills/remotion-multimedia/get-video-duration.md@@ -17,9 +17,7 @@ import { Input, ALL_FORMATS, UrlSource } from "mediabunny";export const getVideoDuration = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const durationInSeconds = await input.computeDuration();diff --git a/packages/template-music-visualization/src/Root.tsx b/packages/template-music-visualization/src/Root.tsxindex a0c31ee366..273258f957 100644--- a/packages/template-music-visualization/src/Root.tsx+++ b/packages/template-music-visualization/src/Root.tsx@@ -36,9 +36,7 @@ export const RemotionRoot: React.FC = () => {// Determine the length of the video based on the duration of the audio filecalculateMetadata={async ({ props }) => {const input = new Input({- source: new UrlSource(props.audioFileUrl, {- getRetryDelay: () => null,- }),+ source: new UrlSource(props.audioFileUrl),formats: ALL_FORMATS,});diff --git a/packages/template-three/src/helpers/get-media-metadata.ts b/packages/template-three/src/helpers/get-media-metadata.tsindex e3dbb33393..13eef482b7 100644--- a/packages/template-three/src/helpers/get-media-metadata.ts+++ b/packages/template-three/src/helpers/get-media-metadata.ts@@ -3,9 +3,7 @@ import { ALL_FORMATS, Input, UrlSource } from "mediabunny";export const getMediaMetadata = async (src: string) => {const input = new Input({formats: ALL_FORMATS,- source: new UrlSource(src, {- getRetryDelay: () => null,- }),+ source: new UrlSource(src),});const durationInSeconds = await input.computeDuration();