🎥 Make videos programmatically with React
rename it to media cache size
Jonny Burgerc02fda030f22
diff --git a/packages/cli/src/benchmark.ts b/packages/cli/src/benchmark.tsindex edd2334ab5..7743b2ebf7 100644--- a/packages/cli/src/benchmark.ts+++ b/packages/cli/src/benchmark.ts@@ -55,7 +55,7 @@ const {hardwareAccelerationOption,chromeModeOption,offthreadVideoThreadsOption,- videoCacheSizeInBytesOption,+ mediaCacheSizeInBytesOption,} = BrowserSafeApis.options;const getValidConcurrency = (cliConcurrency: number | string | null) => {@@ -332,7 +332,7 @@ export const benchmarkCommand = async (}).value,onBrowserDownload,chromeMode,- videoCacheSizeInBytes: videoCacheSizeInBytesOption.getValue({+ mediaCacheSizeInBytes: mediaCacheSizeInBytesOption.getValue({commandLine: parsedCli,}).value,});@@ -521,7 +521,7 @@ export const benchmarkCommand = async (commandLine: parsedCli,}).value,chromeMode,- videoCacheSizeInBytes: videoCacheSizeInBytesOption.getValue({+ mediaCacheSizeInBytes: mediaCacheSizeInBytesOption.getValue({commandLine: parsedCli,}).value,},diff --git a/packages/cli/src/compositions.ts b/packages/cli/src/compositions.tsindex d36ed2a9f1..f17ff3d985 100644--- a/packages/cli/src/compositions.ts+++ b/packages/cli/src/compositions.ts@@ -24,7 +24,7 @@ const {publicDirOption,chromeModeOption,audioLatencyHintOption,- videoCacheSizeInBytesOption,+ mediaCacheSizeInBytesOption,} = BrowserSafeApis.options;export const listCompositionsCommand = async (@@ -110,7 +110,7 @@ export const listCompositionsCommand = async (const audioLatencyHint = audioLatencyHintOption.getValue({commandLine: parsedCli,}).value;- const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({+ const mediaCacheSizeInBytes = mediaCacheSizeInBytesOption.getValue({commandLine: parsedCli,}).value;@@ -167,7 +167,7 @@ export const listCompositionsCommand = async (quiet: quietFlagProvided(),}),chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});printCompositions(compositions, logLevel);diff --git a/packages/cli/src/get-composition-id.ts b/packages/cli/src/get-composition-id.tsindex e9c3cc6d33..08c02269ad 100644--- a/packages/cli/src/get-composition-id.ts+++ b/packages/cli/src/get-composition-id.ts@@ -64,7 +64,7 @@ export const getCompositionId = async ({binariesDirectory,onBrowserDownload,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: {args: (string | number)[];compositionIdFromUi: string | null;@@ -84,7 +84,7 @@ export const getCompositionId = async ({binariesDirectory: string | null;onBrowserDownload: OnBrowserDownload;chromeMode: ChromeMode;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;}): Promise<{compositionId: string;reason: string;@@ -118,7 +118,7 @@ export const getCompositionId = async ({onBrowserDownload,onServeUrlVisited: () => undefined,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});if (propsSize > 10_000_000) {@@ -165,7 +165,7 @@ export const getCompositionId = async ({binariesDirectory,onBrowserDownload,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});if (comps.length === 1) {diff --git a/packages/cli/src/get-composition-with-dimension-override.ts b/packages/cli/src/get-composition-with-dimension-override.tsindex 11200a6b46..89ed103933 100644--- a/packages/cli/src/get-composition-with-dimension-override.ts+++ b/packages/cli/src/get-composition-with-dimension-override.ts@@ -31,7 +31,7 @@ export const getCompositionWithDimensionOverride = async ({binariesDirectory,onBrowserDownload,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: {height: number | null;width: number | null;@@ -53,7 +53,7 @@ export const getCompositionWithDimensionOverride = async ({binariesDirectory: string | null;onBrowserDownload: OnBrowserDownload;chromeMode: ChromeMode;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;}): Promise<{compositionId: string;reason: string;@@ -79,7 +79,7 @@ export const getCompositionWithDimensionOverride = async ({onBrowserDownload,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});return {diff --git a/packages/cli/src/get-render-defaults.ts b/packages/cli/src/get-render-defaults.tsindex bbc85e68bb..3800055be6 100644--- a/packages/cli/src/get-render-defaults.ts+++ b/packages/cli/src/get-render-defaults.ts@@ -29,7 +29,7 @@ const {audioCodecOption,hardwareAccelerationOption,chromeModeOption,- videoCacheSizeInBytesOption,+ mediaCacheSizeInBytesOption,} = BrowserSafeApis.options;export const getRenderDefaults = (): RenderDefaults => {@@ -112,7 +112,7 @@ export const getRenderDefaults = (): RenderDefaults => {const chromeMode = chromeModeOption.getValue({commandLine: parsedCli,}).value;- const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({+ const mediaCacheSizeInBytes = mediaCacheSizeInBytesOption.getValue({commandLine: parsedCli,}).value;@@ -167,6 +167,6 @@ export const getRenderDefaults = (): RenderDefaults => {metadata,hardwareAcceleration,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,};};diff --git a/packages/cli/src/render-flows/render.ts b/packages/cli/src/render-flows/render.tsindex e64a6cfa1f..4b7723e1f6 100644--- a/packages/cli/src/render-flows/render.ts+++ b/packages/cli/src/render-flows/render.ts@@ -117,7 +117,7 @@ export const renderVideoFlow = async ({chromeMode,audioLatencyHint,imageSequencePattern,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: {remotionRoot: string;fullEntryPoint: string;@@ -177,7 +177,7 @@ export const renderVideoFlow = async ({chromeMode: ChromeMode;audioLatencyHint: AudioContextLatencyCategory | null;imageSequencePattern: string | null;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;}) => {const isVerbose = RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose');@@ -352,7 +352,7 @@ export const renderVideoFlow = async ({binariesDirectory,onBrowserDownload,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});const {onArtifact} = handleOnArtifact({@@ -541,7 +541,7 @@ export const renderVideoFlow = async ({onArtifact,chromeMode,imageSequencePattern,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});Log.info({indent, logLevel}, chalk.blue(`\nâ–¶ ${absoluteOutputFile}`));@@ -636,7 +636,7 @@ export const renderVideoFlow = async ({metadata: metadata ?? null,hardwareAcceleration,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});if (!updatesDontOverwrite) {updateRenderProgress({newline: true, printToConsole: true});diff --git a/packages/cli/src/render-flows/still.ts b/packages/cli/src/render-flows/still.tsindex dc8c098d6e..d1ae74e28d 100644--- a/packages/cli/src/render-flows/still.ts+++ b/packages/cli/src/render-flows/still.ts@@ -79,7 +79,7 @@ export const renderStillFlow = async ({chromeMode,offthreadVideoThreads,audioLatencyHint,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: {remotionRoot: string;fullEntryPoint: string;@@ -113,7 +113,7 @@ export const renderStillFlow = async ({publicPath: string | null;chromeMode: ChromeMode;audioLatencyHint: AudioContextLatencyCategory | null;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;}) => {const isVerbose = RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose');Log.verbose(@@ -252,7 +252,7 @@ export const renderStillFlow = async ({binariesDirectory,onBrowserDownload,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});const {format: imageFormat, source} = determineFinalStillImageFormat({@@ -385,7 +385,7 @@ export const renderStillFlow = async ({onArtifact,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});aggregate.rendering = {diff --git a/packages/cli/src/render-queue/process-still.ts b/packages/cli/src/render-queue/process-still.tsindex b8b45002f0..265e33eeb3 100644--- a/packages/cli/src/render-queue/process-still.ts+++ b/packages/cli/src/render-queue/process-still.ts@@ -71,6 +71,6 @@ export const processStill = async ({publicPath: null,chromeMode: job.chromeMode,audioLatencyHint: null,- videoCacheSizeInBytes: job.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: job.mediaCacheSizeInBytes,});};diff --git a/packages/cli/src/render-queue/process-video.ts b/packages/cli/src/render-queue/process-video.tsindex 10d17f93de..36b8516721 100644--- a/packages/cli/src/render-queue/process-video.ts+++ b/packages/cli/src/render-queue/process-video.ts@@ -100,7 +100,7 @@ export const processVideoJob = async ({job.type === 'video' ? job.hardwareAcceleration : 'disable',chromeMode: job.chromeMode,offthreadVideoThreads: job.offthreadVideoThreads,- videoCacheSizeInBytes: job.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: job.mediaCacheSizeInBytes,audioLatencyHint: null,imageSequencePattern: null,});diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsxindex 174fb6991f..94e3555311 100644--- a/packages/cli/src/render.tsx+++ b/packages/cli/src/render.tsx@@ -43,7 +43,7 @@ const {offthreadVideoThreadsOption,audioLatencyHintOption,imageSequencePatternOption,- videoCacheSizeInBytesOption,+ mediaCacheSizeInBytesOption,} = BrowserSafeApis.options;export const render = async (@@ -198,7 +198,7 @@ export const render = async (const imageSequencePattern = imageSequencePatternOption.getValue({commandLine: parsedCli,}).value;- const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({+ const mediaCacheSizeInBytes = mediaCacheSizeInBytesOption.getValue({commandLine: parsedCli,}).value;@@ -256,7 +256,7 @@ export const render = async (audioCodec,disallowParallelEncoding,offthreadVideoCacheSizeInBytes,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,colorSpace,repro,binariesDirectory,diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.tsindex 8b445c7f83..a6896826cb 100644--- a/packages/cli/src/still.ts+++ b/packages/cli/src/still.ts@@ -25,7 +25,7 @@ const {chromeModeOption,offthreadVideoThreadsOption,audioLatencyHintOption,- videoCacheSizeInBytesOption,+ mediaCacheSizeInBytesOption,} = BrowserSafeApis.options;export const still = async (@@ -93,7 +93,7 @@ export const still = async (offthreadVideoCacheSizeInBytesOption.getValue({commandLine: parsedCli,}).value;- const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({+ const mediaCacheSizeInBytes = mediaCacheSizeInBytesOption.getValue({commandLine: parsedCli,}).value;const offthreadVideoThreads = offthreadVideoThreadsOption.getValue({@@ -176,6 +176,6 @@ export const still = async (publicPath,chromeMode,audioLatencyHint,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});};diff --git a/packages/cloudrun/src/api/render-media-on-cloudrun.ts b/packages/cloudrun/src/api/render-media-on-cloudrun.tsindex fd07faa623..fc6bda9c12 100644--- a/packages/cloudrun/src/api/render-media-on-cloudrun.ts+++ b/packages/cloudrun/src/api/render-media-on-cloudrun.ts@@ -145,7 +145,7 @@ const internalRenderMediaOnCloudrunRaw = async ({colorSpace,downloadBehavior,metadata,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: InternalRenderMediaOnCloudrun): Promise<RenderMediaOnCloudrunOutput | CloudRunCrashResponse> => {@@ -209,7 +209,7 @@ const internalRenderMediaOnCloudrunRaw = async ({metadata: metadata ?? null,renderIdOverride,renderStatusWebhook,- videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,};const client = await getAuthClientForUrl(cloudRunEndpoint);@@ -346,7 +346,7 @@ export const renderMediaOnCloudrun = ({renderIdOverride,renderStatusWebhook,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: RenderMediaOnCloudrunInput): Promise<RenderMediaOnCloudrunOutput | CloudRunCrashResponse> => {@@ -398,6 +398,6 @@ export const renderMediaOnCloudrun = ({renderIdOverride: renderIdOverride ?? undefined,renderStatusWebhook: renderStatusWebhook ?? undefined,offthreadVideoThreads: offthreadVideoThreads ?? null,- videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,});};diff --git a/packages/cloudrun/src/api/render-still-on-cloudrun.ts b/packages/cloudrun/src/api/render-still-on-cloudrun.tsindex 870e4c418e..80cc3be6de 100644--- a/packages/cloudrun/src/api/render-still-on-cloudrun.ts+++ b/packages/cloudrun/src/api/render-still-on-cloudrun.ts@@ -103,7 +103,7 @@ const internalRenderStillOnCloudRun = async ({downloadBehavior,renderIdOverride,renderStatusWebhook,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: OptionalParameters & MandatoryParameters): Promise<RenderStillOnCloudrunOutput | ErrorResponsePayload | CloudRunCrashResponse> => {@@ -148,7 +148,7 @@ const internalRenderStillOnCloudRun = async ({downloadBehavior,renderIdOverride,renderStatusWebhook,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,};const client = await getAuthClientForUrl(cloudRunEndpoint);@@ -257,6 +257,6 @@ export const renderStillOnCloudrun = (options: RenderStillOnCloudrunInput) => {downloadBehavior: options.downloadBehavior ?? {type: 'play-in-browser'},renderIdOverride: options.renderIdOverride ?? undefined,renderStatusWebhook: options.renderStatusWebhook ?? undefined,- videoCacheSizeInBytes: options.videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: options.mediaCacheSizeInBytes ?? null,});};diff --git a/packages/cloudrun/src/api/test/payloads.test.ts b/packages/cloudrun/src/api/test/payloads.test.tsindex 20ae739c3b..a511715710 100644--- a/packages/cloudrun/src/api/test/payloads.test.ts+++ b/packages/cloudrun/src/api/test/payloads.test.ts@@ -20,7 +20,7 @@ test('CloudRunPayload should work with and without optional webhook fields', ()outName: null,offthreadVideoCacheSizeInBytes: null,offthreadVideoThreads: null,- videoCacheSizeInBytes: null,+ mediaCacheSizeInBytes: null,serializedInputPropsWithCustomSchema: JSON.stringify({}),};diff --git a/packages/cloudrun/src/cli/commands/render/index.ts b/packages/cloudrun/src/cli/commands/render/index.tsindex 81a5a3809d..aba54b780b 100644--- a/packages/cloudrun/src/cli/commands/render/index.ts+++ b/packages/cloudrun/src/cli/commands/render/index.ts@@ -36,7 +36,7 @@ const {delayRenderTimeoutInMillisecondsOption,binariesDirectoryOption,metadataOption,- videoCacheSizeInBytesOption,+ mediaCacheSizeInBytesOption,} = BrowserSafeApis.options;export const renderCommand = async (@@ -111,7 +111,7 @@ export const renderCommand = async (const binariesDirectory = binariesDirectoryOption.getValue({commandLine: CliInternals.parsedCli,}).value;- const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({+ const mediaCacheSizeInBytes = mediaCacheSizeInBytesOption.getValue({commandLine: CliInternals.parsedCli,}).value;let composition: string = args[1];@@ -184,7 +184,7 @@ export const renderCommand = async (quiet: CliInternals.quietFlagProvided(),}),chromeMode: 'headless-shell',- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});composition = compositionId;}@@ -346,7 +346,7 @@ ${downloadName ? ` Downloaded File = ${downloadName}` : ''}}: null,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});if (res.type === 'crash') {diff --git a/packages/cloudrun/src/cli/commands/still.ts b/packages/cloudrun/src/cli/commands/still.tsindex 809f52e710..3963065cab 100644--- a/packages/cloudrun/src/cli/commands/still.ts+++ b/packages/cloudrun/src/cli/commands/still.ts@@ -22,7 +22,7 @@ const {delayRenderTimeoutInMillisecondsOption,headlessOption,binariesDirectoryOption,- videoCacheSizeInBytesOption,+ mediaCacheSizeInBytesOption,} = BrowserSafeApis.options;export const stillCommand = async (@@ -84,7 +84,7 @@ export const stillCommand = async (const binariesDirectory = binariesDirectoryOption.getValue({commandLine: CliInternals.parsedCli,}).value;- const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({+ const mediaCacheSizeInBytes = mediaCacheSizeInBytesOption.getValue({commandLine: CliInternals.parsedCli,}).value;@@ -147,7 +147,7 @@ export const stillCommand = async (}),chromeMode: 'headless-shell',offthreadVideoThreads: 1,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});composition = compositionId;}diff --git a/packages/cloudrun/src/functions/helpers/get-composition-from-body.ts b/packages/cloudrun/src/functions/helpers/get-composition-from-body.tsindex 6a03ec6ea2..eb2addc6f8 100644--- a/packages/cloudrun/src/functions/helpers/get-composition-from-body.ts+++ b/packages/cloudrun/src/functions/helpers/get-composition-from-body.ts@@ -31,7 +31,7 @@ export const getCompositionFromBody = async (body: CloudRunPayloadType) => {},onServeUrlVisited: () => undefined,chromeMode: 'headless-shell',- videoCacheSizeInBytes: body.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: body.mediaCacheSizeInBytes,},);diff --git a/packages/cloudrun/src/functions/helpers/payloads.ts b/packages/cloudrun/src/functions/helpers/payloads.tsindex d50aa10c8f..729e0943f2 100644--- a/packages/cloudrun/src/functions/helpers/payloads.ts+++ b/packages/cloudrun/src/functions/helpers/payloads.ts@@ -65,7 +65,7 @@ export const CloudRunPayload = z.discriminatedUnion('type', [enforceAudioTrack: z.boolean(),preferLossless: z.boolean(),offthreadVideoCacheSizeInBytes: z.number().nullable(),- videoCacheSizeInBytes: z.number().nullable(),+ mediaCacheSizeInBytes: z.number().nullable(),offthreadVideoThreads: z.number().nullable(),colorSpace: z.enum(BrowserSafeApis.validColorSpaces).nullable(),clientVersion: z.string(),@@ -100,7 +100,7 @@ export const CloudRunPayload = z.discriminatedUnion('type', [frame: z.number(),delayRenderTimeoutInMilliseconds: z.number(),logLevel,- videoCacheSizeInBytes: z.number().nullable(),+ mediaCacheSizeInBytes: z.number().nullable(),offthreadVideoCacheSizeInBytes: z.number().nullable(),offthreadVideoThreads: z.number().nullable(),clientVersion: z.string(),diff --git a/packages/cloudrun/src/functions/render-media-single-thread.ts b/packages/cloudrun/src/functions/render-media-single-thread.tsindex 364ad6572d..eab22d3310 100644--- a/packages/cloudrun/src/functions/render-media-single-thread.ts+++ b/packages/cloudrun/src/functions/render-media-single-thread.ts@@ -186,7 +186,7 @@ export const renderMediaSingleThread = async (puppeteerInstance: undefined,server: undefined,offthreadVideoCacheSizeInBytes: body.offthreadVideoCacheSizeInBytes,- videoCacheSizeInBytes: body.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: body.mediaCacheSizeInBytes,offthreadVideoThreads: body.offthreadVideoThreads,colorSpace: body.colorSpace,repro: false,diff --git a/packages/cloudrun/src/functions/render-still-single-thread.ts b/packages/cloudrun/src/functions/render-still-single-thread.tsindex a4407d4720..de1d34b975 100644--- a/packages/cloudrun/src/functions/render-still-single-thread.ts+++ b/packages/cloudrun/src/functions/render-still-single-thread.ts@@ -103,7 +103,7 @@ export const renderStillSingleThread = async (throw new Error('Emitting artifacts is not supported in Cloud Run');},chromeMode: 'headless-shell',- videoCacheSizeInBytes: body.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: body.mediaCacheSizeInBytes,});Log.info({indent: false, logLevel: body.logLevel}, 'Still rendered');diff --git a/packages/core/src/index.ts b/packages/core/src/index.tsindex 3234d3d00d..dd2ab1b5ea 100644--- a/packages/core/src/index.ts+++ b/packages/core/src/index.ts@@ -70,7 +70,7 @@ declare global {remotion_inputProps: string;remotion_envVariables: string;remotion_isMainTab: boolean;- remotion_videoCacheSizeInBytes: number | null;+ remotion_mediaCacheSizeInBytes: number | null;remotion_initialMemoryAvailable: number | null;remotion_collectAssets: () => TRenderAsset[];remotion_isPlayer: boolean;diff --git a/packages/docs/docs/media/audio.mdx b/packages/docs/docs/media/audio.mdxindex 922944c9a5..555639639f 100644--- a/packages/docs/docs/media/audio.mdx+++ b/packages/docs/docs/media/audio.mdx@@ -189,6 +189,15 @@ Customize the [number of retries](/docs/delay-render#retrying) of the [`delayRen**Pending removal**: Future iterations will also have client-side playback and not support this prop which was designed for the `<audio>` tag.+## Setting the cache size++`@remotion/media` keeps a cache of video and audio frames.++By default, the cache may grow to up to 50% of the available system memory.+The rendering APIs allow you to customize this limit on a per-render basis.++See in [`renderMedia()`](/docs/renderer/render-media) for example: [`mediaCacheSizeInBytes`](/docs/renderer/select-composition#mediacachesizeinbytes).+## See also- [Source code for this component](https://github.com/remotion-dev/remotion/blob/main/packages/media/src/audio/audio.tsx)diff --git a/packages/docs/docs/media/video.mdx b/packages/docs/docs/media/video.mdxindex 7601136c48..1280509afe 100644--- a/packages/docs/docs/media/video.mdx+++ b/packages/docs/docs/media/video.mdx@@ -225,6 +225,15 @@ The callback is called with a [`CanvasImageSource`](https://developer.mozilla.or**Pending removal**: Future iterations will also have client-side playback and not support this prop which was designed for the `<video>` tag.+## Setting the cache size++`@remotion/media` keeps a cache of video and audio frames.++By default, the cache may grow to up to 50% of the available system memory.+The rendering APIs allow you to customize this limit on a per-render basis.++See in [`renderMedia()`](/docs/renderer/render-media) for example: [`mediaCacheSizeInBytes`](/docs/renderer/select-composition#mediacachesizeinbytes).+## See also- [Source code for this component](https://github.com/remotion-dev/remotion/blob/main/packages/media/src/video/video.tsx)diff --git a/packages/docs/docs/renderer/get-compositions.mdx b/packages/docs/docs/renderer/get-compositions.mdxindex 5224b1e5b9..2cb37d5a50 100644--- a/packages/docs/docs/renderer/get-compositions.mdx+++ b/packages/docs/docs/renderer/get-compositions.mdx@@ -120,6 +120,10 @@ Allows you to set certain Chromium / Google Chrome flags. See: [Chromium flags](<Options id="offthreadvideo-cache-size-in-bytes" />+### `mediaCacheSizeInBytes?`<AvailableFrom v="4.0.352"/>++<Options id="media-cache-size-in-bytes" />+### `offthreadVideoThreads?`<AvailableFrom v="4.0.261"/><Options id="offthreadvideo-video-threads" />diff --git a/packages/docs/docs/renderer/render-frames.mdx b/packages/docs/docs/renderer/render-frames.mdxindex b3d651b21d..37f03ff4fa 100644--- a/packages/docs/docs/renderer/render-frames.mdx+++ b/packages/docs/docs/renderer/render-frames.mdx@@ -297,6 +297,10 @@ Lets you set a custom user agent that the headless Chrome browser assumes.<Options id="offthreadvideo-cache-size-in-bytes" />+### `mediaCacheSizeInBytes?`<AvailableFrom v="4.0.352"/>++<Options id="media-cache-size-in-bytes" />+### `offthreadVideoThreads?`<AvailableFrom v="4.0.261"/><Options id="offthreadvideo-video-threads" />diff --git a/packages/docs/docs/renderer/render-media.mdx b/packages/docs/docs/renderer/render-media.mdxindex b5bf8daa28..fc46e74607 100644--- a/packages/docs/docs/renderer/render-media.mdx+++ b/packages/docs/docs/renderer/render-media.mdx@@ -441,6 +441,10 @@ Before you use this hack, reach out to the Remotion team on [Discord](https://reDisallows the renderer from doing rendering frames and encoding at the same time. This makes the rendering process more memory-efficient, but possibly slower.+### `mediaCacheSizeInBytes?`<AvailableFrom v="4.0.352"/>++<Options id="media-cache-size-in-bytes" />+### `offthreadVideoCacheSizeInBytes?`<AvailableFrom v="4.0.23"/><Options id="offthreadvideo-cache-size-in-bytes" />diff --git a/packages/docs/docs/renderer/render-still.mdx b/packages/docs/docs/renderer/render-still.mdxindex 06a25c88cc..b7e77994d5 100644--- a/packages/docs/docs/renderer/render-still.mdx+++ b/packages/docs/docs/renderer/render-still.mdx@@ -195,6 +195,10 @@ Results in invalid SSL certificates, such as self-signed ones, being ignored.Lets you set a custom user agent that the headless Chrome browser assumes.+### `mediaCacheSizeInBytes?`<AvailableFrom v="4.0.352"/>++<Options id="media-cache-size-in-bytes" />+### `offthreadVideoCacheSizeInBytes?`<AvailableFrom v="4.0.23"/><Options id="offthreadvideo-cache-size-in-bytes" />diff --git a/packages/docs/docs/video.mdx b/packages/docs/docs/video.mdxindex 040d3dd736..6b702a7ce6 100644--- a/packages/docs/docs/video.mdx+++ b/packages/docs/docs/video.mdx@@ -299,15 +299,18 @@ Remotion will download the whole video during render in order to mix its audio.See: [Which video formats does Remotion support?](/docs/miscellaneous/video-formats)-## Alternative: `<OffthreadVideo>`+## Alternatives: `<OffthreadVideo>` and `@remotion/media`-[`<OffthreadVideo>`](/docs/offthreadvideo) is a drop-in alternative to `<Video>`. To decide which tag to use, see: [Comparison of video tags](/docs/video-tags)+[`<OffthreadVideo>`](/docs/offthreadvideo) is a Rust-based alternative to `<Video>`.+[`@remotion/media`](/docs/media/video) is an experimental component that will replace `<Video>` at some point.++To decide which tag to use, see: [Comparison of video tags](/docs/video-tags)## See also- [Source code for this function](https://github.com/remotion-dev/remotion/blob/main/packages/core/src/video/Video.tsx)- [`<Audio />`](/docs/audio)- [`<OffthreadVideo />`](/docs/offthreadvideo)-- [Comparison of video tags](/docs/video-tags)- [`<Video />` (from `@remotion/media`)](/docs/media/video)+- [Comparison of video tags](/docs/video-tags)- [`Change the speed of a video over time`](/docs/miscellaneous/snippets/accelerated-video)diff --git a/packages/it-tests/src/monorepo/go-package.test.ts b/packages/it-tests/src/monorepo/go-package.test.tsindex b1c76035d8..66669fd92e 100644--- a/packages/it-tests/src/monorepo/go-package.test.ts+++ b/packages/it-tests/src/monorepo/go-package.test.ts@@ -84,7 +84,7 @@ test(apiKey: null,storageClass: null,requestHandler: null,- videoCacheSizeInBytes: null,+ mediaCacheSizeInBytes: null,});expect(removeUndefined(parsed)).toEqual(removeUndefined(nativeVersion));diff --git a/packages/it-tests/src/monorepo/php-package.test.ts b/packages/it-tests/src/monorepo/php-package.test.tsindex e96466f1c2..1c196e78ea 100644--- a/packages/it-tests/src/monorepo/php-package.test.ts+++ b/packages/it-tests/src/monorepo/php-package.test.ts@@ -129,7 +129,7 @@ class SemanticapiKey: null,storageClass: null,requestHandler: null,- videoCacheSizeInBytes: null,+ mediaCacheSizeInBytes: null,});const jsonOutput = toParse.substring(0, toParse.lastIndexOf('}') + 1);const parsedJson = JSON.parse(jsonOutput);diff --git a/packages/it-tests/src/monorepo/python-package.test.ts b/packages/it-tests/src/monorepo/python-package.test.tsindex 671cfade5e..b6b0ebd0dd 100644--- a/packages/it-tests/src/monorepo/python-package.test.ts+++ b/packages/it-tests/src/monorepo/python-package.test.ts@@ -112,7 +112,7 @@ test('Python package should create the same renderMedia payload as normal Lambda},apiKey: null,storageClass: null,- videoCacheSizeInBytes: null,+ mediaCacheSizeInBytes: null,});const jsonOutput = toParse.substring(0, toParse.lastIndexOf('}') + 1);const parsedJson = JSON.parse(jsonOutput);@@ -197,7 +197,7 @@ test('Python package should create the same renderStill payload as normal LambdaapiKey: null,storageClass: null,requestHandler: null,- videoCacheSizeInBytes: null,+ mediaCacheSizeInBytes: null,});const jsonOutput = toParse.substring(0, toParse.lastIndexOf('}') + 1);const {streamed: _, ...parsedJson} = JSON.parse(jsonOutput);diff --git a/packages/it-tests/src/monorepo/ruby-package.test.ts b/packages/it-tests/src/monorepo/ruby-package.test.tsindex 8ee0800c95..fddbfb7c2f 100644--- a/packages/it-tests/src/monorepo/ruby-package.test.ts+++ b/packages/it-tests/src/monorepo/ruby-package.test.ts@@ -138,7 +138,7 @@ test('Render Media payload', async () => {apiKey: null,storageClass: null,requestHandler: null,- videoCacheSizeInBytes: null,+ mediaCacheSizeInBytes: null,});expect(JSON.parse(output)).toEqual(nativeVersion);@@ -184,7 +184,7 @@ test('Render Still payload', async () => {offthreadVideoThreads: null,storageClass: null,requestHandler: null,- videoCacheSizeInBytes: null,+ mediaCacheSizeInBytes: null,});expect(JSON.parse(output)).toEqual({...nativeVersion, streamed: false});diff --git a/packages/lambda-client/src/get-compositions-on-lambda.ts b/packages/lambda-client/src/get-compositions-on-lambda.tsindex bd6b82f2a5..ac6f1e50f6 100644--- a/packages/lambda-client/src/get-compositions-on-lambda.ts+++ b/packages/lambda-client/src/get-compositions-on-lambda.ts@@ -53,7 +53,7 @@ export const getCompositionsOnLambda = async ({offthreadVideoCacheSizeInBytes,forcePathStyle,requestHandler,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: GetCompositionsOnLambdaInput): Promise<GetCompositionsOnLambdaOutput> => {const stringifiedInputProps = serializeOrThrow(inputProps, 'input-props');@@ -92,7 +92,7 @@ export const getCompositionsOnLambda = async ({bucketName: bucketName ?? null,offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes ?? null,forcePathStyle: forcePathStyle ?? false,- videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,},region,timeoutInTest: 120000,diff --git a/packages/lambda-client/src/make-lambda-payload.ts b/packages/lambda-client/src/make-lambda-payload.tsindex d4a9ce9717..1e90b94aed 100644--- a/packages/lambda-client/src/make-lambda-payload.ts+++ b/packages/lambda-client/src/make-lambda-payload.ts@@ -130,7 +130,7 @@ export const makeLambdaRenderMediaPayload = async ({overwrite,jpegQuality,offthreadVideoCacheSizeInBytes,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,deleteAfter,colorSpace,preferLossless,@@ -219,7 +219,7 @@ export const makeLambdaRenderMediaPayload = async ({metadata: metadata ?? null,apiKey: apiKey ?? null,offthreadVideoThreads: offthreadVideoThreads ?? null,- videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,storageClass: storageClass ?? null,};};@@ -269,7 +269,7 @@ export const makeLambdaRenderStillPayload = async ({storageClass,requestHandler,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: RenderStillOnLambdaNonNullInput): Promise<ServerlessPayloads<AwsProvider>[ServerlessRoutines.still]> => {@@ -322,7 +322,7 @@ export const makeLambdaRenderStillPayload = async ({forcePathStyle,apiKey: apiKey ?? null,offthreadVideoThreads: offthreadVideoThreads ?? null,- videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,storageClass: storageClass ?? null,};};diff --git a/packages/lambda-client/src/render-media-on-lambda.ts b/packages/lambda-client/src/render-media-on-lambda.tsindex 3d955f840c..c13fcb8e21 100644--- a/packages/lambda-client/src/render-media-on-lambda.ts+++ b/packages/lambda-client/src/render-media-on-lambda.ts@@ -199,7 +199,7 @@ export const renderMediaOnLambdaOptionalToRequired = (apiKey: options.apiKey ?? null,storageClass: options.storageClass ?? null,requestHandler: options.requestHandler ?? null,- videoCacheSizeInBytes: options.videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: options.mediaCacheSizeInBytes ?? null,};};diff --git a/packages/lambda-client/src/render-still-on-lambda.ts b/packages/lambda-client/src/render-still-on-lambda.tsindex 6be1d8ef10..8bf3f7b423 100644--- a/packages/lambda-client/src/render-still-on-lambda.ts+++ b/packages/lambda-client/src/render-still-on-lambda.ts@@ -204,6 +204,6 @@ export const renderStillOnLambda = (offthreadVideoThreads: input.offthreadVideoThreads ?? null,storageClass: input.storageClass ?? null,requestHandler: input.requestHandler ?? null,- videoCacheSizeInBytes: input.videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: input.mediaCacheSizeInBytes ?? null,});};diff --git a/packages/lambda-client/src/test/concurrency-payload.test.ts b/packages/lambda-client/src/test/concurrency-payload.test.tsindex 81a46f3732..ed01f24091 100644--- a/packages/lambda-client/src/test/concurrency-payload.test.ts+++ b/packages/lambda-client/src/test/concurrency-payload.test.ts@@ -50,7 +50,7 @@ test('Should include concurrency field in payload', async () => {metadata: null,apiKey: null,offthreadVideoCacheSizeInBytes: null,- videoCacheSizeInBytes: null,+ mediaCacheSizeInBytes: null,offthreadVideoThreads: null,storageClass: null,requestHandler: null,@@ -109,7 +109,7 @@ test('Should handle null concurrency', async () => {metadata: null,apiKey: null,offthreadVideoCacheSizeInBytes: null,- videoCacheSizeInBytes: null,+ mediaCacheSizeInBytes: null,offthreadVideoThreads: null,storageClass: null,requestHandler: null,diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.tsindex 6990feb8b8..e3e7e6d87c 100644--- a/packages/lambda/src/cli/commands/render/render.ts+++ b/packages/lambda/src/cli/commands/render/render.ts@@ -54,7 +54,7 @@ const {binariesDirectoryOption,preferLosslessOption,metadataOption,- videoCacheSizeInBytesOption,+ mediaCacheSizeInBytesOption,} = BrowserSafeApis.options;export const renderCommand = async ({@@ -114,7 +114,7 @@ export const renderCommand = async ({offthreadVideoCacheSizeInBytesOption.getValue({commandLine: CliInternals.parsedCli,}).value;- const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({+ const mediaCacheSizeInBytes = mediaCacheSizeInBytesOption.getValue({commandLine: CliInternals.parsedCli,}).value;const offthreadVideoThreads = offthreadVideoThreadsOption.getValue({@@ -250,7 +250,7 @@ export const renderCommand = async ({quiet: CliInternals.quietFlagProvided(),}),chromeMode: 'headless-shell',- videoCacheSizeInBytes,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes,});composition = compositionId;}@@ -339,7 +339,7 @@ export const renderCommand = async ({colorSpace,downloadBehavior: {type: 'play-in-browser'},offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes ?? null,- videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,offthreadVideoThreads: offthreadVideoThreads ?? null,x264Preset: x264Preset ?? null,preferLossless,diff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.tsindex 2c3cdb8554..0e713601cc 100644--- a/packages/lambda/src/cli/commands/still.ts+++ b/packages/lambda/src/cli/commands/still.ts@@ -33,7 +33,7 @@ const {headlessOption,delayRenderTimeoutInMillisecondsOption,binariesDirectoryOption,- videoCacheSizeInBytesOption,+ mediaCacheSizeInBytesOption,} = BrowserSafeApis.options;const {@@ -124,7 +124,7 @@ export const stillCommand = async ({const binariesDirectory = binariesDirectoryOption.getValue({commandLine: parsedCli,}).value;- const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({+ const mediaCacheSizeInBytes = mediaCacheSizeInBytesOption.getValue({commandLine: parsedCli,}).value;@@ -186,7 +186,7 @@ export const stillCommand = async ({quiet: CliInternals.quietFlagProvided(),}),chromeMode: 'headless-shell',- videoCacheSizeInBytes,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes,});composition = compositionId;}@@ -283,7 +283,7 @@ export const stillCommand = async ({offthreadVideoCacheSizeInBytes,offthreadVideoThreads: null,requestHandler: null,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});Log.info({indent: false, logLevel},diff --git a/packages/lambda/src/test/integration/renders/old-version.test.ts b/packages/lambda/src/test/integration/renders/old-version.test.tsindex 488e0e3d95..05f2f42c00 100644--- a/packages/lambda/src/test/integration/renders/old-version.test.ts+++ b/packages/lambda/src/test/integration/renders/old-version.test.ts@@ -60,7 +60,7 @@ test('Should fail when using an incompatible version', async () => {metadata: {Author: 'Lunar'},apiKey: null,storageClass: null,- videoCacheSizeInBytes: null,+ mediaCacheSizeInBytes: null,},functionName: 'remotion-dev-render',region: 'us-east-1',diff --git a/packages/lambda/src/test/integration/webhooks.test.ts b/packages/lambda/src/test/integration/webhooks.test.tsindex f52898320e..9f96540ee9 100644--- a/packages/lambda/src/test/integration/webhooks.test.ts+++ b/packages/lambda/src/test/integration/webhooks.test.ts@@ -96,7 +96,7 @@ test(metadata: {Author: 'Lunar'},apiKey: null,storageClass: null,- videoCacheSizeInBytes: null,+ mediaCacheSizeInBytes: null,},functionName: 'remotion-dev-lambda',region: 'us-east-1',@@ -161,7 +161,7 @@ test(type: ServerlessRoutines.launch,payload: {type: ServerlessRoutines.launch,- videoCacheSizeInBytes: null,+ mediaCacheSizeInBytes: null,offthreadVideoCacheSizeInBytes: null,offthreadVideoThreads: null,serveUrl: `http://localhost:${port}`,diff --git a/packages/media/src/caches.ts b/packages/media/src/caches.tsindex 90c4775b95..7203e47159 100644--- a/packages/media/src/caches.ts+++ b/packages/media/src/caches.ts@@ -22,30 +22,30 @@ export const getTotalCacheStats = async () => {const getUncachedMaxCacheSize = (logLevel: LogLevel) => {if (- window.remotion_videoCacheSizeInBytes !== undefined &&- window.remotion_videoCacheSizeInBytes !== null+ window.remotion_mediaCacheSizeInBytes !== undefined &&+ window.remotion_mediaCacheSizeInBytes !== null) {- if (window.remotion_videoCacheSizeInBytes < 240 * 1024 * 1024) {+ if (window.remotion_mediaCacheSizeInBytes < 240 * 1024 * 1024) {cancelRender(new Error(- `The minimum value for the "videoCacheSizeInBytes" prop is 240MB (${240 * 1024 * 1024}), got: ${window.remotion_videoCacheSizeInBytes}`,+ `The minimum value for the "mediaCacheSizeInBytes" prop is 240MB (${240 * 1024 * 1024}), got: ${window.remotion_mediaCacheSizeInBytes}`,),);}- if (window.remotion_videoCacheSizeInBytes > 20_000 * 1024 * 1024) {+ if (window.remotion_mediaCacheSizeInBytes > 20_000 * 1024 * 1024) {cancelRender(new Error(- `The maximum value for the "videoCacheSizeInBytes" prop is 20GB (${20000 * 1024 * 1024}), got: ${window.remotion_videoCacheSizeInBytes}`,+ `The maximum value for the "mediaCacheSizeInBytes" prop is 20GB (${20000 * 1024 * 1024}), got: ${window.remotion_mediaCacheSizeInBytes}`,),);}Log.verbose(logLevel,- `Using @remotion/media cache size set using "videoCacheSizeInBytes": ${(window.remotion_videoCacheSizeInBytes / 1024 / 1024).toFixed(1)} MB`,+ `Using @remotion/media cache size set using "mediaCacheSizeInBytes": ${(window.remotion_mediaCacheSizeInBytes / 1024 / 1024).toFixed(1)} MB`,);- return window.remotion_videoCacheSizeInBytes;+ return window.remotion_mediaCacheSizeInBytes;}if (diff --git a/packages/renderer/src/get-compositions.ts b/packages/renderer/src/get-compositions.tsindex 945ebbea50..7a11b129a8 100644--- a/packages/renderer/src/get-compositions.ts+++ b/packages/renderer/src/get-compositions.ts@@ -63,7 +63,7 @@ const innerGetCompositions = async ({timeoutInMilliseconds,indent,logLevel,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: InnerGetCompositionsParams): Promise<VideoConfig[]> => {validatePuppeteerTimeout(timeoutInMilliseconds);@@ -82,7 +82,7 @@ const innerGetCompositions = async ({logLevel,onServeUrlVisited: () => undefined,isMainTab: true,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,initialMemoryAvailable: getAvailableMemory(logLevel),});@@ -172,7 +172,7 @@ const internalGetCompositionsRaw = async ({onBrowserDownload,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: InternalGetCompositionsOptions) => {const {page, cleanupPage} = await getPageAndCleanupFn({passedInInstance: puppeteerInstance,@@ -240,7 +240,7 @@ const internalGetCompositionsRaw = async ({onBrowserDownload,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});})@@ -291,7 +291,7 @@ export const getCompositions = (offthreadVideoCacheSizeInBytes,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,} = config ?? {};const indent = false;@@ -326,6 +326,6 @@ export const getCompositions = (}),chromeMode: chromeMode ?? 'headless-shell',offthreadVideoThreads: offthreadVideoThreads ?? null,- videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,});};diff --git a/packages/renderer/src/make-page.ts b/packages/renderer/src/make-page.tsindex a47acbc643..3d0912821f 100644--- a/packages/renderer/src/make-page.ts+++ b/packages/renderer/src/make-page.ts@@ -31,7 +31,7 @@ export const makePage = async ({serializedResolvedPropsWithCustomSchema,pageIndex,isMainTab,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: {context: SourceMapGetter;initialFrame: number;@@ -52,7 +52,7 @@ export const makePage = async ({imageFormat: VideoImageFormat;pageIndex: number;isMainTab: boolean;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;}) => {const page = await browserReplacer.getBrowser()@@ -79,7 +79,7 @@ export const makePage = async ({logLevel,onServeUrlVisited: () => undefined,isMainTab,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,initialMemoryAvailable: getAvailableMemory(logLevel),});diff --git a/packages/renderer/src/options/index.tsx b/packages/renderer/src/options/index.tsxindex a4c3cca4f0..0d1341a392 100644--- a/packages/renderer/src/options/index.tsx+++ b/packages/renderer/src/options/index.tsx@@ -41,7 +41,7 @@ import {separateAudioOption} from './separate-audio';import {throwIfSiteExistsOption} from './throw-if-site-exists';import {delayRenderTimeoutInMillisecondsOption} from './timeout';import {videoBitrateOption} from './video-bitrate';-import {videoCacheSizeInBytesOption} from './video-cache-size';+import {mediaCacheSizeInBytesOption} from './video-cache-size';import {videoCodecOption} from './video-codec';import {webhookCustomDataOption} from './webhook-custom-data';import {x264Option} from './x264-preset';@@ -92,7 +92,7 @@ export const allOptions = {audioLatencyHintOption,enableCrossSiteIsolationOption,imageSequencePatternOption,- videoCacheSizeInBytesOption,+ mediaCacheSizeInBytesOption,};export type AvailableOptions = keyof typeof allOptions;diff --git a/packages/renderer/src/options/options-map.ts b/packages/renderer/src/options/options-map.tsindex fe0bcef9d9..ec492b85d8 100644--- a/packages/renderer/src/options/options-map.ts+++ b/packages/renderer/src/options/options-map.ts@@ -27,13 +27,13 @@ import {separateAudioOption} from './separate-audio';import {throwIfSiteExistsOption} from './throw-if-site-exists';import {delayRenderTimeoutInMillisecondsOption} from './timeout';import {videoBitrateOption} from './video-bitrate';-import {videoCacheSizeInBytesOption} from './video-cache-size';+import {mediaCacheSizeInBytesOption} from './video-cache-size';import {videoCodecOption} from './video-codec';import {x264Option} from './x264-preset';export const optionsMap = {renderMedia: {- videoCacheSizeInBytes: videoCacheSizeInBytesOption,+ mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,offthreadVideoThreads: offthreadVideoThreadsOption,videoBitrate: videoBitrateOption,@@ -63,7 +63,7 @@ export const optionsMap = {hardwareAcceleration: hardwareAccelerationOption,},renderStill: {- videoCacheSizeInBytes: videoCacheSizeInBytesOption,+ mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,offthreadVideoThreads: offthreadVideoThreadsOption,jpegQuality: jpegQualityOption,@@ -74,7 +74,7 @@ export const optionsMap = {chromeMode: chromeModeOption,},getCompositions: {- videoCacheSizeInBytes: videoCacheSizeInBytesOption,+ mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,offthreadVideoThreads: offthreadVideoThreadsOption,logLevel: logLevelOption,@@ -84,7 +84,7 @@ export const optionsMap = {chromeMode: chromeModeOption,},selectComposition: {- videoCacheSizeInBytes: videoCacheSizeInBytesOption,+ mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,offthreadVideoThreads: offthreadVideoThreadsOption,logLevel: logLevelOption,@@ -94,7 +94,7 @@ export const optionsMap = {chromeMode: chromeModeOption,},renderFrames: {- videoCacheSizeInBytes: videoCacheSizeInBytesOption,+ mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,forSeamlessAacConcatenation: forSeamlessAacConcatenationOption,offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,offthreadVideoThreads: offthreadVideoThreadsOption,@@ -107,7 +107,7 @@ export const optionsMap = {imageSequencePattern: imageSequencePatternOption,},renderMediaOnLambda: {- videoCacheSizeInBytes: videoCacheSizeInBytesOption,+ mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,offthreadVideoThreads: offthreadVideoThreadsOption,videoBitrate: videoBitrateOption,@@ -125,7 +125,7 @@ export const optionsMap = {apiKey: apiKeyOption,},renderStillOnLambda: {- videoCacheSizeInBytes: videoCacheSizeInBytesOption,+ mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,offthreadVideoThreads: offthreadVideoThreadsOption,jpegQuality: jpegQualityOption,@@ -136,13 +136,13 @@ export const optionsMap = {apiKey: apiKeyOption,},getCompositionsOnLambda: {- videoCacheSizeInBytes: videoCacheSizeInBytesOption,+ mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,logLevel: logLevelOption,timeoutInMilliseconds: delayRenderTimeoutInMillisecondsOption,},renderMediaOnCloudRun: {- videoCacheSizeInBytes: videoCacheSizeInBytesOption,+ mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,offthreadVideoThreads: offthreadVideoThreadsOption,numberOfGifLoops: numberOfGifLoopsOption,@@ -162,7 +162,7 @@ export const optionsMap = {jpegQuality: jpegQualityOption,},renderStillOnCloudRun: {- videoCacheSizeInBytes: videoCacheSizeInBytesOption,+ mediaCacheSizeInBytes: mediaCacheSizeInBytesOption,offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,offthreadVideoThreads: offthreadVideoThreadsOption,logLevel: logLevelOption,diff --git a/packages/renderer/src/options/video-cache-size.tsx b/packages/renderer/src/options/video-cache-size.tsxindex 75fbd8846d..ab55614280 100644--- a/packages/renderer/src/options/video-cache-size.tsx+++ b/packages/renderer/src/options/video-cache-size.tsx@@ -1,25 +1,26 @@import type {AnyRemotionOption} from './option';-let videoCacheSizeInBytes: number | null = null;+let mediaCacheSizeInBytes: number | null = null;-export const getVideoCacheSizeInBytes = () => {- return videoCacheSizeInBytes;+export const getMediaCacheSizeInBytes = () => {+ return mediaCacheSizeInBytes;};-const cliFlag = 'video-cache-size-in-bytes' as const;+const cliFlag = 'media-cache-size-in-bytes' as const;-export const videoCacheSizeInBytesOption = {- name: '<Video> cache size',+export const mediaCacheSizeInBytesOption = {+ name: '@remotion/media cache size',cliFlag,description: () => (<>- Specify the maximum size of the cache for <code><Video></code> (from{' '}- <code>@remotion/media</code>) frames, in bytes. <br />- Default: <code>1_000_000</code>+ Specify the maximum size of the cache that <code><Video></code> and{' '}+ <code><Audio></code> from <code>@remotion/media</code> may use+ combined, in bytes. <br />+ The default is half of the available system memory when the render starts.</>),- ssrName: 'videoCacheSizeInBytes' as const,- docLink: 'https://www.remotion.dev/docs/media/video',+ ssrName: 'mediaCacheSizeInBytes' as const,+ docLink: 'https://www.remotion.dev/docs/media/video#setting-the-cache-size',type: 0 as number | null,getValue: ({commandLine}) => {if (commandLine[cliFlag] !== undefined) {@@ -29,10 +30,10 @@ export const videoCacheSizeInBytesOption = {};}- if (videoCacheSizeInBytes !== null) {+ if (mediaCacheSizeInBytes !== null) {return {source: 'config',- value: videoCacheSizeInBytes,+ value: mediaCacheSizeInBytes,};}@@ -42,11 +43,11 @@ export const videoCacheSizeInBytesOption = {};},setConfig: (size: number | null) => {- videoCacheSizeInBytes = size ?? null;+ mediaCacheSizeInBytes = size ?? null;},} satisfies AnyRemotionOption<number | null>;-export const validateVideoCacheSizeInBytes = (option: unknown) => {+export const validateMediaCacheSizeInBytes = (option: unknown) => {if (option === undefined || option === null) {return;}diff --git a/packages/renderer/src/render-frames.ts b/packages/renderer/src/render-frames.tsindex 6d32418523..cd7a217efe 100644--- a/packages/renderer/src/render-frames.ts+++ b/packages/renderer/src/render-frames.ts@@ -231,7 +231,7 @@ const innerRenderFrames = async ({onArtifact,binariesDirectory,imageSequencePattern,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: Omit<InnerRenderFramesOptions,'offthreadVideoCacheSizeInBytes'@@ -293,7 +293,7 @@ const innerRenderFrames = async ({timeoutInMilliseconds,pageIndex,isMainTab: pageIndex === 0,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});};@@ -476,7 +476,7 @@ const internalRenderFramesRaw = ({chromeMode,offthreadVideoThreads,imageSequencePattern,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: InternalRenderFramesOptions): Promise<RenderFramesOutput> => {validateDimension(composition.height,@@ -610,7 +610,7 @@ const internalRenderFramesRaw = ({chromeMode,offthreadVideoThreads,imageSequencePattern,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});}),])@@ -710,7 +710,7 @@ export const renderFrames = (chromeMode,offthreadVideoThreads,imageSequencePattern,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,} = options;if (!composition) {@@ -786,6 +786,6 @@ export const renderFrames = (chromeMode: chromeMode ?? 'headless-shell',offthreadVideoThreads: offthreadVideoThreads ?? null,imageSequencePattern: imageSequencePattern ?? null,- videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,});};diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.tsindex 2c51edf5b7..18f15ee520 100644--- a/packages/renderer/src/render-media.ts+++ b/packages/renderer/src/render-media.ts@@ -254,7 +254,7 @@ const internalRenderMediaRaw = ({hardwareAcceleration,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: InternalRenderMediaOptions): Promise<RenderMediaResult> => {const pixelFormat =userPixelFormat ??@@ -717,7 +717,7 @@ const internalRenderMediaRaw = ({onArtifact,chromeMode,imageSequencePattern: null,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});return renderFramesProc;@@ -947,7 +947,7 @@ export const renderMedia = ({chromeMode,offthreadVideoThreads,compositionStart,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: RenderMediaOptions): Promise<RenderMediaResult> => {const indent = false;const logLevel =@@ -1033,6 +1033,6 @@ export const renderMedia = ({compositionStart: compositionStart ?? 0,hardwareAcceleration: hardwareAcceleration ?? 'disable',chromeMode: chromeMode ?? 'headless-shell',- videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,});};diff --git a/packages/renderer/src/render-still.ts b/packages/renderer/src/render-still.tsindex 27556befc6..68e81dcd38 100644--- a/packages/renderer/src/render-still.ts+++ b/packages/renderer/src/render-still.ts@@ -134,7 +134,7 @@ const innerRenderStill = async ({onBrowserDownload,onArtifact,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: InternalRenderStillOptions & {serveUrl: string;onError: (err: Error) => void;@@ -267,7 +267,7 @@ const innerRenderStill = async ({logLevel,onServeUrlVisited: () => undefined,isMainTab: true,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,initialMemoryAvailable: getAvailableMemory(logLevel),});@@ -468,7 +468,7 @@ export const renderStill = (onArtifact,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,} = options;if (typeof jpegQuality !== 'undefined' && imageFormat !== 'jpeg') {@@ -534,6 +534,6 @@ export const renderStill = (onArtifact: onArtifact ?? null,chromeMode: chromeMode ?? 'headless-shell',offthreadVideoThreads: offthreadVideoThreads ?? null,- videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,});};diff --git a/packages/renderer/src/select-composition.ts b/packages/renderer/src/select-composition.tsindex 2cc40f72f8..0c72313df2 100644--- a/packages/renderer/src/select-composition.ts+++ b/packages/renderer/src/select-composition.ts@@ -74,7 +74,7 @@ const innerSelectComposition = async ({indent,logLevel,onServeUrlVisited,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: InnerSelectCompositionConfig): Promise<InternalReturnType> => {validatePuppeteerTimeout(timeoutInMilliseconds);@@ -93,7 +93,7 @@ const innerSelectComposition = async ({logLevel,onServeUrlVisited,isMainTab: true,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,initialMemoryAvailable: getAvailableMemory(logLevel),});@@ -208,7 +208,7 @@ export const internalSelectCompositionRaw = async (onBrowserDownload,onServeUrlVisited,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,} = options;const [{page, cleanupPage}, serverUsed] = await Promise.all([@@ -278,7 +278,7 @@ export const internalSelectCompositionRaw = async (onBrowserDownload,onServeUrlVisited,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}).then((data) => {return resolve(data);@@ -327,7 +327,7 @@ export const selectComposition = async (onBrowserDownload,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,} = options;const indent = false;@@ -364,7 +364,7 @@ export const selectComposition = async (onServeUrlVisited: () => undefined,chromeMode: chromeMode ?? 'headless-shell',offthreadVideoThreads: offthreadVideoThreads ?? null,- videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,});return data.metadata;};diff --git a/packages/renderer/src/set-props-and-env.ts b/packages/renderer/src/set-props-and-env.tsindex 2a36c912d1..d68de10556 100644--- a/packages/renderer/src/set-props-and-env.ts+++ b/packages/renderer/src/set-props-and-env.ts@@ -25,7 +25,7 @@ type SetPropsAndEnv = {logLevel: LogLevel;onServeUrlVisited: () => void;isMainTab: boolean;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;initialMemoryAvailable: number | null;};@@ -44,7 +44,7 @@ const innerSetPropsAndEnv = async ({logLevel,onServeUrlVisited,isMainTab,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,initialMemoryAvailable,}: SetPropsAndEnv): Promise<void> => {validatePuppeteerTimeout(timeoutInMilliseconds);@@ -63,7 +63,7 @@ const innerSetPropsAndEnv = async ({) => {window.remotion_puppeteerTimeout = timeout;window.remotion_isMainTab = mainTab;- window.remotion_videoCacheSizeInBytes = cacheSizeInBytes;+ window.remotion_mediaCacheSizeInBytes = cacheSizeInBytes;window.remotion_initialMemoryAvailable = initMemoryAvailable;// To make useRemotionEnvironment() workif (window.process === undefined) {@@ -79,7 +79,7 @@ const innerSetPropsAndEnv = async ({},actualTimeout,isMainTab,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,initialMemoryAvailable,);@@ -167,7 +167,7 @@ const innerSetPropsAndEnv = async ({logLevel,onServeUrlVisited,isMainTab,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,initialMemoryAvailable,});};diff --git a/packages/serverless-client/src/constants.ts b/packages/serverless-client/src/constants.tsindex c499dee01c..2a3ab87fd1 100644--- a/packages/serverless-client/src/constants.ts+++ b/packages/serverless-client/src/constants.ts@@ -153,7 +153,7 @@ export type ServerlessStartPayload<Provider extends CloudProvider> = {bucketName: string | null;offthreadVideoCacheSizeInBytes: number | null;offthreadVideoThreads: number | null;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;deleteAfter: DeleteAfter | null;colorSpace: ColorSpace | null;preferLossless: boolean;@@ -211,7 +211,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {forceWidth: number | null;offthreadVideoCacheSizeInBytes: number | null;offthreadVideoThreads: number | null;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;deleteAfter: DeleteAfter | null;colorSpace: ColorSpace | null;preferLossless: boolean;@@ -263,7 +263,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {preferLossless: boolean;offthreadVideoCacheSizeInBytes: number | null;offthreadVideoThreads: number | null;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;deleteAfter: DeleteAfter | null;colorSpace: ColorSpace | null;compositionStart: number;@@ -296,7 +296,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {bucketName: string | null;offthreadVideoCacheSizeInBytes: number | null;offthreadVideoThreads: number | null;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;deleteAfter: DeleteAfter | null;streamed: boolean;forcePathStyle: boolean;@@ -314,7 +314,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {serveUrl: string;bucketName: string | null;offthreadVideoCacheSizeInBytes: number | null;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;forcePathStyle: boolean;};};diff --git a/packages/serverless/src/handlers/compositions.ts b/packages/serverless/src/handlers/compositions.tsindex 1ca1b65997..75d13ffd75 100644--- a/packages/serverless/src/handlers/compositions.ts+++ b/packages/serverless/src/handlers/compositions.ts@@ -100,7 +100,7 @@ export const compositionsHandler = async <Provider extends CloudProvider>({},chromeMode: 'headless-shell',offthreadVideoThreads: 1,- videoCacheSizeInBytes: params.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: params.mediaCacheSizeInBytes,});return Promise.resolve({diff --git a/packages/serverless/src/handlers/launch.ts b/packages/serverless/src/handlers/launch.tsindex 7f0cf44aca..670b5f830e 100644--- a/packages/serverless/src/handlers/launch.ts+++ b/packages/serverless/src/handlers/launch.ts@@ -134,7 +134,7 @@ const innerLaunchHandler = async <Provider extends CloudProvider>({},providerSpecifics,offthreadVideoThreads: params.offthreadVideoThreads,- videoCacheSizeInBytes: params.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: params.mediaCacheSizeInBytes,});overallProgress.setCompositionValidated(Date.now());RenderInternals.Log.info(@@ -288,7 +288,7 @@ const innerLaunchHandler = async <Provider extends CloudProvider>({forcePathStyle: params.forcePathStyle,metadata: params.metadata,offthreadVideoThreads: params.offthreadVideoThreads,- videoCacheSizeInBytes: params.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: params.mediaCacheSizeInBytes,};return payload;});diff --git a/packages/serverless/src/handlers/renderer.ts b/packages/serverless/src/handlers/renderer.tsindex 9999d978cb..b6f5bc047a 100644--- a/packages/serverless/src/handlers/renderer.ts+++ b/packages/serverless/src/handlers/renderer.ts@@ -343,7 +343,7 @@ const renderHandler = async <Provider extends CloudProvider>({hardwareAcceleration: 'disable',chromeMode: 'headless-shell',offthreadVideoThreads: params.offthreadVideoThreads,- videoCacheSizeInBytes: params.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: params.mediaCacheSizeInBytes,}).then(({slowestFrames}) => {RenderInternals.Log.verbose(diff --git a/packages/serverless/src/handlers/start.ts b/packages/serverless/src/handlers/start.tsindex 3f4fba4471..6712f7fad7 100644--- a/packages/serverless/src/handlers/start.ts+++ b/packages/serverless/src/handlers/start.ts@@ -128,7 +128,7 @@ export const startHandler = async <Provider extends CloudProvider>({apiKey: params.apiKey,offthreadVideoThreads: params.offthreadVideoThreads,storageClass: params.storageClass,- videoCacheSizeInBytes: params.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: params.mediaCacheSizeInBytes,};await providerSpecifics.callFunctionAsync({diff --git a/packages/serverless/src/handlers/still.ts b/packages/serverless/src/handlers/still.tsindex 2867d60a7b..33819d5e0e 100644--- a/packages/serverless/src/handlers/still.ts+++ b/packages/serverless/src/handlers/still.ts@@ -179,7 +179,7 @@ const innerStillHandler = async <Provider extends CloudProvider>(onServeUrlVisited: () => undefined,providerSpecifics,offthreadVideoThreads: params.offthreadVideoThreads,- videoCacheSizeInBytes: params.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: params.mediaCacheSizeInBytes,});const renderMetadata: RenderMetadata<Provider> = {@@ -327,7 +327,7 @@ const innerStillHandler = async <Provider extends CloudProvider>(data: composition.props,}).serializedString,offthreadVideoCacheSizeInBytes: params.offthreadVideoCacheSizeInBytes,- videoCacheSizeInBytes: params.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: params.mediaCacheSizeInBytes,binariesDirectory: null,onBrowserDownload,onArtifact,diff --git a/packages/serverless/src/validate-composition.ts b/packages/serverless/src/validate-composition.tsindex 054e17aee5..0553cfeff2 100644--- a/packages/serverless/src/validate-composition.ts+++ b/packages/serverless/src/validate-composition.ts@@ -32,7 +32,7 @@ type ValidateCompositionOptions<Provider extends CloudProvider> = {logLevel: LogLevel;server: RemotionServer | undefined;offthreadVideoCacheSizeInBytes: number | null;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;offthreadVideoThreads: number | null;onBrowserDownload: OnBrowserDownload;onServeUrlVisited: () => void;@@ -57,7 +57,7 @@ export const validateComposition = async <Provider extends CloudProvider>({onServeUrlVisited,providerSpecifics,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: ValidateCompositionOptions<Provider>): Promise<VideoConfig> => {const {metadata: comp} = await RenderInternals.internalSelectComposition({id: composition,@@ -79,7 +79,7 @@ export const validateComposition = async <Provider extends CloudProvider>({onBrowserDownload,onServeUrlVisited,chromeMode: 'headless-shell',- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});const videoConfig: VideoConfig = {diff --git a/packages/studio-server/src/preview-server/routes/add-render.ts b/packages/studio-server/src/preview-server/routes/add-render.tsindex 918d9d5be3..461d5ffbca 100644--- a/packages/studio-server/src/preview-server/routes/add-render.ts+++ b/packages/studio-server/src/preview-server/routes/add-render.ts@@ -64,7 +64,7 @@ export const handleAddRender: ApiHandler<AddRenderRequest, undefined> = ({hardwareAcceleration: input.hardwareAcceleration,chromeMode: input.chromeMode,offthreadVideoThreads: input.offthreadVideoThreads,- videoCacheSizeInBytes: input.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: input.mediaCacheSizeInBytes,},logLevel,});@@ -104,7 +104,7 @@ export const handleAddRender: ApiHandler<AddRenderRequest, undefined> = ({metadata: input.metadata,chromeMode: input.chromeMode,offthreadVideoThreads: input.offthreadVideoThreads,- videoCacheSizeInBytes: input.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: input.mediaCacheSizeInBytes,},logLevel,});@@ -140,7 +140,7 @@ export const handleAddRender: ApiHandler<AddRenderRequest, undefined> = ({metadata: input.metadata,chromeMode: input.chromeMode,offthreadVideoThreads: input.offthreadVideoThreads,- videoCacheSizeInBytes: input.videoCacheSizeInBytes,+ mediaCacheSizeInBytes: input.mediaCacheSizeInBytes,},entryPoint,remotionRoot,diff --git a/packages/studio-shared/src/api-requests.ts b/packages/studio-shared/src/api-requests.tsindex e53057ee73..f8c481fc73 100644--- a/packages/studio-shared/src/api-requests.ts+++ b/packages/studio-shared/src/api-requests.ts@@ -100,7 +100,7 @@ export type AddRenderRequest = {serializedInputPropsWithCustomSchema: string;offthreadVideoCacheSizeInBytes: number | null;offthreadVideoThreads: number | null;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;multiProcessOnLinux: boolean;beepOnFinish: boolean;metadata: Record<string, string> | null;diff --git a/packages/studio-shared/src/render-defaults.ts b/packages/studio-shared/src/render-defaults.tsindex 6ec04af1e3..b51b536583 100644--- a/packages/studio-shared/src/render-defaults.ts+++ b/packages/studio-shared/src/render-defaults.ts@@ -42,7 +42,7 @@ export type RenderDefaults = {disableWebSecurity: boolean;openGlRenderer: OpenGlRenderer | null;ignoreCertificateErrors: boolean;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;offthreadVideoCacheSizeInBytes: number | null;offthreadVideoThreads: number | null;headless: boolean;diff --git a/packages/studio-shared/src/render-job.ts b/packages/studio-shared/src/render-job.tsindex 1dba85736b..b6aad0f4b7 100644--- a/packages/studio-shared/src/render-job.ts+++ b/packages/studio-shared/src/render-job.ts@@ -104,7 +104,7 @@ type RenderJobDynamicFields =frame: number;scale: number;offthreadVideoCacheSizeInBytes: number | null;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;offthreadVideoThreads: number | null;} & RenderJobDynamicStatus)| ({@@ -116,7 +116,7 @@ type RenderJobDynamicFields =startFrame: number;endFrame: number;offthreadVideoCacheSizeInBytes: number | null;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;offthreadVideoThreads: number | null;} & RenderJobDynamicStatus)| ({@@ -143,7 +143,7 @@ type RenderJobDynamicFields =numberOfGifLoops: number | null;disallowParallelEncoding: boolean;offthreadVideoCacheSizeInBytes: number | null;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;offthreadVideoThreads: number | null;colorSpace: ColorSpace;forSeamlessAacConcatenation: boolean;diff --git a/packages/studio/src/components/Modals.tsx b/packages/studio/src/components/Modals.tsxindex f4adcf24ce..d75ac173e8 100644--- a/packages/studio/src/components/Modals.tsx+++ b/packages/studio/src/components/Modals.tsx@@ -48,8 +48,8 @@ export const Modals: React.FC<{initialOffthreadVideoThreads={modalContextType.initialOffthreadVideoThreads}- initialVideoCacheSizeInBytes={- modalContextType.initialVideoCacheSizeInBytes+ initialMediaCacheSizeInBytes={+ modalContextType.initialMediaCacheSizeInBytes}initialConcurrency={modalContextType.initialConcurrency}maxConcurrency={modalContextType.maxConcurrency}diff --git a/packages/studio/src/components/RenderButton.tsx b/packages/studio/src/components/RenderButton.tsxindex d03a14bcde..dc279ef4b6 100644--- a/packages/studio/src/components/RenderButton.tsx+++ b/packages/studio/src/components/RenderButton.tsx@@ -115,7 +115,7 @@ export const RenderButton: React.FC = () => {defaulMetadata: defaults.metadata,initialHardwareAcceleration: defaults.hardwareAcceleration,initialChromeMode: defaults.chromeMode,- initialVideoCacheSizeInBytes: defaults.videoCacheSizeInBytes,+ initialMediaCacheSizeInBytes: defaults.mediaCacheSizeInBytes,});}, [video, setSelectedModal, getCurrentFrame, props, inFrame, outFrame]);diff --git a/packages/studio/src/components/RenderModal/RenderModal.tsx b/packages/studio/src/components/RenderModal/RenderModal.tsxindex 4c8a12c15d..63225aa6b7 100644--- a/packages/studio/src/components/RenderModal/RenderModal.tsx+++ b/packages/studio/src/components/RenderModal/RenderModal.tsx@@ -222,7 +222,7 @@ type RenderModalProps = {readonly initialGl: OpenGlRenderer | null;readonly initialIgnoreCertificateErrors: boolean;readonly initialOffthreadVideoCacheSizeInBytes: number | null;- readonly initialVideoCacheSizeInBytes: number | null;+ readonly initialMediaCacheSizeInBytes: number | null;readonly initialHeadless: boolean;readonly initialColorSpace: ColorSpace;readonly initialEncodingMaxRate: string | null;@@ -277,7 +277,7 @@ const RenderModal: React.FC<initialEncodingBufferSize,initialEncodingMaxRate,initialOffthreadVideoThreads,- initialVideoCacheSizeInBytes,+ initialMediaCacheSizeInBytes,initialUserAgent,defaultProps,inFrameMark,@@ -492,9 +492,9 @@ const RenderModal: React.FC<const [offthreadVideoCacheSizeInBytes, setOffthreadVideoCacheSizeInBytes] =useState<number | null>(initialOffthreadVideoCacheSizeInBytes);- const [videoCacheSizeInBytes, setVideoCacheSizeInBytes] = useState<+ const [mediaCacheSizeInBytes, setMediaCacheSizeInBytes] = useState<number | null- >(initialVideoCacheSizeInBytes);+ >(initialMediaCacheSizeInBytes);const [offthreadVideoThreads, setOffthreadVideoThreads] = useState<number | null@@ -767,7 +767,7 @@ const RenderModal: React.FC<metadata,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}).then(() => {dispatchIfMounted({type: 'succeed'});@@ -797,7 +797,7 @@ const RenderModal: React.FC<metadata,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,]);const [everyNthFrameSetting, setEveryNthFrameSetting] = useState(@@ -873,7 +873,7 @@ const RenderModal: React.FC<hardwareAcceleration,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}).then(() => {dispatchIfMounted({type: 'succeed'});@@ -927,7 +927,7 @@ const RenderModal: React.FC<hardwareAcceleration,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,]);const onClickSequence = useCallback(() => {@@ -957,7 +957,7 @@ const RenderModal: React.FC<metadata,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}).then(() => {dispatchIfMounted({type: 'succeed'});@@ -991,7 +991,7 @@ const RenderModal: React.FC<metadata,chromeMode,offthreadVideoThreads,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,]);useEffect(() => {@@ -1445,8 +1445,8 @@ const RenderModal: React.FC<setEnvVariables={setEnvVariables}envVariables={envVariables}offthreadVideoCacheSizeInBytes={offthreadVideoCacheSizeInBytes}- setVideoCacheSizeInBytes={setVideoCacheSizeInBytes}- videoCacheSizeInBytes={videoCacheSizeInBytes}+ setMediaCacheSizeInBytes={setMediaCacheSizeInBytes}+ mediaCacheSizeInBytes={mediaCacheSizeInBytes}setOffthreadVideoCacheSizeInBytes={setOffthreadVideoCacheSizeInBytes}diff --git a/packages/studio/src/components/RenderModal/RenderModalAdvanced.tsx b/packages/studio/src/components/RenderModal/RenderModalAdvanced.tsxindex c04c38c987..98436d9490 100644--- a/packages/studio/src/components/RenderModal/RenderModalAdvanced.tsx+++ b/packages/studio/src/components/RenderModal/RenderModalAdvanced.tsx@@ -67,8 +67,8 @@ export const RenderModalAdvanced: React.FC<{readonly setOffthreadVideoCacheSizeInBytes: React.Dispatch<React.SetStateAction<number | null>>;- readonly videoCacheSizeInBytes: number | null;- readonly setVideoCacheSizeInBytes: React.Dispatch<+ readonly mediaCacheSizeInBytes: number | null;+ readonly setMediaCacheSizeInBytes: React.Dispatch<React.SetStateAction<number | null>>;readonly offthreadVideoThreads: number | null;@@ -109,8 +109,8 @@ export const RenderModalAdvanced: React.FC<{setx264Preset,x264Preset,codec,- setVideoCacheSizeInBytes,- videoCacheSizeInBytes,+ setMediaCacheSizeInBytes,+ mediaCacheSizeInBytes,offthreadVideoCacheSizeInBytes,setOffthreadVideoCacheSizeInBytes,offthreadVideoThreads,@@ -140,15 +140,15 @@ export const RenderModalAdvanced: React.FC<{];}, []);- const toggleCustomVideoCacheSizeInBytes = useCallback(() => {- setVideoCacheSizeInBytes((previous) => {+ const toggleCustomMediaCacheSizeInBytes = useCallback(() => {+ setMediaCacheSizeInBytes((previous) => {if (previous === null) {return 1000 * 1000 * 1000;}return null;});- }, [setVideoCacheSizeInBytes]);+ }, [setMediaCacheSizeInBytes]);const toggleCustomOffthreadVideoCacheSizeInBytes = useCallback(() => {setOffthreadVideoCacheSizeInBytes((previous) => {@@ -306,11 +306,11 @@ export const RenderModalAdvanced: React.FC<{);}, [hardwareAcceleration, setHardwareAcceleration]);- const changeVideoCacheSizeInBytes: React.Dispatch<+ const changeMediaCacheSizeInBytes: React.Dispatch<React.SetStateAction<number>> = useCallback((cb) => {- setVideoCacheSizeInBytes((prev) => {+ setMediaCacheSizeInBytes((prev) => {if (prev === null) {throw new TypeError('Expected previous value');}@@ -322,7 +322,7 @@ export const RenderModalAdvanced: React.FC<{return cb;});},- [setVideoCacheSizeInBytes],+ [setMediaCacheSizeInBytes],);const changeOffthreadVideoCacheSizeInBytes: React.Dispatch<@@ -434,25 +434,25 @@ export const RenderModalAdvanced: React.FC<{<div style={optionRow}><div style={label}>Custom Video cache</div><Spacing x={0.5} />- <OptionExplainerBubble id="videoCacheSizeInBytesOption" />+ <OptionExplainerBubble id="mediaCacheSizeInBytesOption" /><div style={rightRow}><Checkbox- checked={videoCacheSizeInBytes !== null}- onChange={toggleCustomVideoCacheSizeInBytes}- name="video-cache-size"+ checked={mediaCacheSizeInBytes !== null}+ onChange={toggleCustomMediaCacheSizeInBytes}+ name="media-cache-size"/></div></div>)}- {renderMode === 'audio' || videoCacheSizeInBytes === null ? null : (+ {renderMode === 'audio' || mediaCacheSizeInBytes === null ? null : (<NumberSettingmin={0}max={2000 * 1024 * 1024}step={1024}- name="Video cache size"+ name="@remotion/media cache size"formatter={(w) => `${w} bytes`}- onValueChanged={changeVideoCacheSizeInBytes}- value={videoCacheSizeInBytes}+ onValueChanged={changeMediaCacheSizeInBytes}+ value={mediaCacheSizeInBytes}/>)}{renderMode === 'audio' ? null : (diff --git a/packages/studio/src/components/RenderQueue/actions.ts b/packages/studio/src/components/RenderQueue/actions.tsindex b1e35acbdd..fe53d58ab5 100644--- a/packages/studio/src/components/RenderQueue/actions.ts+++ b/packages/studio/src/components/RenderQueue/actions.ts@@ -42,7 +42,7 @@ export const addStillRenderJob = ({beepOnFinish,metadata,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: {compositionId: string;outName: string;@@ -61,7 +61,7 @@ export const addStillRenderJob = ({beepOnFinish: boolean;metadata: Record<string, string> | null;chromeMode: ChromeMode;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;}) => {return callApi('/api/render', {compositionId,@@ -87,7 +87,7 @@ export const addStillRenderJob = ({beepOnFinish,metadata,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});};@@ -113,7 +113,7 @@ export const addSequenceRenderJob = ({repro,metadata,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: {compositionId: string;outName: string;@@ -136,7 +136,7 @@ export const addSequenceRenderJob = ({repro: boolean;metadata: Record<string, string> | null;chromeMode: ChromeMode;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;}) => {return callApi('/api/render', {compositionId,@@ -166,7 +166,7 @@ export const addSequenceRenderJob = ({repro,metadata,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});};@@ -210,7 +210,7 @@ export const addVideoRenderJob = ({metadata,hardwareAcceleration,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,}: {compositionId: string;outName: string;@@ -251,7 +251,7 @@ export const addVideoRenderJob = ({metadata: Record<string, string> | null;hardwareAcceleration: HardwareAccelerationOption;chromeMode: ChromeMode;- videoCacheSizeInBytes: number | null;+ mediaCacheSizeInBytes: number | null;}) => {return callApi('/api/render', {compositionId,@@ -299,7 +299,7 @@ export const addVideoRenderJob = ({metadata,hardwareAcceleration,chromeMode,- videoCacheSizeInBytes,+ mediaCacheSizeInBytes,});};diff --git a/packages/studio/src/components/SidebarRenderButton.tsx b/packages/studio/src/components/SidebarRenderButton.tsxindex 8d439a7451..caf650abc5 100644--- a/packages/studio/src/components/SidebarRenderButton.tsx+++ b/packages/studio/src/components/SidebarRenderButton.tsx@@ -96,7 +96,7 @@ export const SidebarRenderButton: React.FC<{defaulMetadata: defaults.metadata,initialHardwareAcceleration: defaults.hardwareAcceleration,initialChromeMode: defaults.chromeMode,- initialVideoCacheSizeInBytes: defaults.videoCacheSizeInBytes,+ initialMediaCacheSizeInBytes: defaults.mediaCacheSizeInBytes,});if (isMobileLayout) {diff --git a/packages/studio/src/helpers/retry-payload.ts b/packages/studio/src/helpers/retry-payload.tsindex 410e5fc5bd..4a3da95074 100644--- a/packages/studio/src/helpers/retry-payload.ts+++ b/packages/studio/src/helpers/retry-payload.ts@@ -66,7 +66,7 @@ export const makeRetryPayload = (job: RenderJob): RenderModalState => {renderTypeOfLastRender: 'still',initialHardwareAcceleration: defaults.hardwareAcceleration,initialChromeMode: job.chromeMode,- initialVideoCacheSizeInBytes: job.videoCacheSizeInBytes,+ initialMediaCacheSizeInBytes: job.mediaCacheSizeInBytes,};}@@ -120,7 +120,7 @@ export const makeRetryPayload = (job: RenderJob): RenderModalState => {renderTypeOfLastRender: 'sequence',initialHardwareAcceleration: defaults.hardwareAcceleration,initialChromeMode: job.chromeMode,- initialVideoCacheSizeInBytes: job.videoCacheSizeInBytes,+ initialMediaCacheSizeInBytes: job.mediaCacheSizeInBytes,};}@@ -175,7 +175,7 @@ export const makeRetryPayload = (job: RenderJob): RenderModalState => {renderTypeOfLastRender: 'video',initialHardwareAcceleration: job.hardwareAcceleration,initialChromeMode: job.chromeMode,- initialVideoCacheSizeInBytes: job.videoCacheSizeInBytes,+ initialMediaCacheSizeInBytes: job.mediaCacheSizeInBytes,};}diff --git a/packages/studio/src/state/modals.ts b/packages/studio/src/state/modals.tsindex b89eee108f..752f2606fe 100644--- a/packages/studio/src/state/modals.ts+++ b/packages/studio/src/state/modals.ts@@ -45,7 +45,7 @@ export type RenderModalState = {initialOpenGlRenderer: OpenGlRenderer | null;initialIgnoreCertificateErrors: boolean;initialHeadless: boolean;- initialVideoCacheSizeInBytes: number | null;+ initialMediaCacheSizeInBytes: number | null;initialOffthreadVideoCacheSizeInBytes: number | null;initialOffthreadVideoThreads: number | null;initialColorSpace: ColorSpace;