Skip to content

🎥 Make videos programmatically with React

Initiate `videoCacheSizeInBytes` prop

Jonny Burgerdc6cf5ae053f
diff --git a/packages/cli/src/benchmark.ts b/packages/cli/src/benchmark.ts
index 5fc2c14821..edd2334ab5 100644
--- a/packages/cli/src/benchmark.ts
+++ b/packages/cli/src/benchmark.ts
@@ -55,6 +55,7 @@ const {
hardwareAccelerationOption,
chromeModeOption,
offthreadVideoThreadsOption,
+ videoCacheSizeInBytesOption,
} = BrowserSafeApis.options;
const getValidConcurrency = (cliConcurrency: number | string | null) => {
@@ -331,6 +332,9 @@ export const benchmarkCommand = async (
}).value,
onBrowserDownload,
chromeMode,
+ videoCacheSizeInBytes: videoCacheSizeInBytesOption.getValue({
+ commandLine: parsedCli,
+ }).value,
});
const ids = (
@@ -517,6 +521,9 @@ export const benchmarkCommand = async (
commandLine: parsedCli,
}).value,
chromeMode,
+ videoCacheSizeInBytes: videoCacheSizeInBytesOption.getValue({
+ commandLine: parsedCli,
+ }).value,
},
(run, progress) => {
benchmarkProgress.update(
diff --git a/packages/cli/src/compositions.ts b/packages/cli/src/compositions.ts
index dd57713519..d36ed2a9f1 100644
--- a/packages/cli/src/compositions.ts
+++ b/packages/cli/src/compositions.ts
@@ -24,6 +24,7 @@ const {
publicDirOption,
chromeModeOption,
audioLatencyHintOption,
+ videoCacheSizeInBytesOption,
} = BrowserSafeApis.options;
export const listCompositionsCommand = async (
@@ -109,6 +110,9 @@ export const listCompositionsCommand = async (
const audioLatencyHint = audioLatencyHintOption.getValue({
commandLine: parsedCli,
}).value;
+ const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const {urlOrBundle: bundled, cleanup: cleanupBundle} =
await bundleOnCliOrTakeServeUrl({
@@ -163,6 +167,7 @@ export const listCompositionsCommand = async (
quiet: quietFlagProvided(),
}),
chromeMode,
+ videoCacheSizeInBytes,
});
printCompositions(compositions, logLevel);
diff --git a/packages/cli/src/get-composition-id.ts b/packages/cli/src/get-composition-id.ts
index 34046c5b48..e9c3cc6d33 100644
--- a/packages/cli/src/get-composition-id.ts
+++ b/packages/cli/src/get-composition-id.ts
@@ -64,6 +64,7 @@ export const getCompositionId = async ({
binariesDirectory,
onBrowserDownload,
chromeMode,
+ videoCacheSizeInBytes,
}: {
args: (string | number)[];
compositionIdFromUi: string | null;
@@ -83,6 +84,7 @@ export const getCompositionId = async ({
binariesDirectory: string | null;
onBrowserDownload: OnBrowserDownload;
chromeMode: ChromeMode;
+ videoCacheSizeInBytes: number | null;
}): Promise<{
compositionId: string;
reason: string;
@@ -116,6 +118,7 @@ export const getCompositionId = async ({
onBrowserDownload,
onServeUrlVisited: () => undefined,
chromeMode,
+ videoCacheSizeInBytes,
});
if (propsSize > 10_000_000) {
@@ -162,6 +165,7 @@ export const getCompositionId = async ({
binariesDirectory,
onBrowserDownload,
chromeMode,
+ videoCacheSizeInBytes,
});
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.ts
index be6cd0bca4..11200a6b46 100644
--- a/packages/cli/src/get-composition-with-dimension-override.ts
+++ b/packages/cli/src/get-composition-with-dimension-override.ts
@@ -31,6 +31,7 @@ export const getCompositionWithDimensionOverride = async ({
binariesDirectory,
onBrowserDownload,
chromeMode,
+ videoCacheSizeInBytes,
}: {
height: number | null;
width: number | null;
@@ -52,6 +53,7 @@ export const getCompositionWithDimensionOverride = async ({
binariesDirectory: string | null;
onBrowserDownload: OnBrowserDownload;
chromeMode: ChromeMode;
+ videoCacheSizeInBytes: number | null;
}): Promise<{
compositionId: string;
reason: string;
@@ -77,6 +79,7 @@ export const getCompositionWithDimensionOverride = async ({
onBrowserDownload,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
});
return {
diff --git a/packages/cli/src/get-render-defaults.ts b/packages/cli/src/get-render-defaults.ts
index 37188a1db3..bbc85e68bb 100644
--- a/packages/cli/src/get-render-defaults.ts
+++ b/packages/cli/src/get-render-defaults.ts
@@ -29,6 +29,7 @@ const {
audioCodecOption,
hardwareAccelerationOption,
chromeModeOption,
+ videoCacheSizeInBytesOption,
} = BrowserSafeApis.options;
export const getRenderDefaults = (): RenderDefaults => {
@@ -111,6 +112,9 @@ export const getRenderDefaults = (): RenderDefaults => {
const chromeMode = chromeModeOption.getValue({
commandLine: parsedCli,
}).value;
+ const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const everyNthFrame = ConfigInternals.getEveryNthFrame();
const stillImageFormat = ConfigInternals.getUserPreferredStillImageFormat();
@@ -163,5 +167,6 @@ export const getRenderDefaults = (): RenderDefaults => {
metadata,
hardwareAcceleration,
chromeMode,
+ videoCacheSizeInBytes,
};
};
diff --git a/packages/cli/src/render-flows/render.ts b/packages/cli/src/render-flows/render.ts
index 12171613f8..e64a6cfa1f 100644
--- a/packages/cli/src/render-flows/render.ts
+++ b/packages/cli/src/render-flows/render.ts
@@ -117,6 +117,7 @@ export const renderVideoFlow = async ({
chromeMode,
audioLatencyHint,
imageSequencePattern,
+ videoCacheSizeInBytes,
}: {
remotionRoot: string;
fullEntryPoint: string;
@@ -176,6 +177,7 @@ export const renderVideoFlow = async ({
chromeMode: ChromeMode;
audioLatencyHint: AudioContextLatencyCategory | null;
imageSequencePattern: string | null;
+ videoCacheSizeInBytes: number | null;
}) => {
const isVerbose = RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose');
@@ -350,6 +352,7 @@ export const renderVideoFlow = async ({
binariesDirectory,
onBrowserDownload,
chromeMode,
+ videoCacheSizeInBytes,
});
const {onArtifact} = handleOnArtifact({
@@ -538,6 +541,7 @@ export const renderVideoFlow = async ({
onArtifact,
chromeMode,
imageSequencePattern,
+ videoCacheSizeInBytes,
});
Log.info({indent, logLevel}, chalk.blue(`\nâ–¶ ${absoluteOutputFile}`));
@@ -632,6 +636,7 @@ export const renderVideoFlow = async ({
metadata: metadata ?? null,
hardwareAcceleration,
chromeMode,
+ videoCacheSizeInBytes,
});
if (!updatesDontOverwrite) {
updateRenderProgress({newline: true, printToConsole: true});
diff --git a/packages/cli/src/render-flows/still.ts b/packages/cli/src/render-flows/still.ts
index 1c98cc31ea..dc8c098d6e 100644
--- a/packages/cli/src/render-flows/still.ts
+++ b/packages/cli/src/render-flows/still.ts
@@ -79,6 +79,7 @@ export const renderStillFlow = async ({
chromeMode,
offthreadVideoThreads,
audioLatencyHint,
+ videoCacheSizeInBytes,
}: {
remotionRoot: string;
fullEntryPoint: string;
@@ -112,6 +113,7 @@ export const renderStillFlow = async ({
publicPath: string | null;
chromeMode: ChromeMode;
audioLatencyHint: AudioContextLatencyCategory | null;
+ videoCacheSizeInBytes: number | null;
}) => {
const isVerbose = RenderInternals.isEqualOrBelowLogLevel(logLevel, 'verbose');
Log.verbose(
@@ -250,6 +252,7 @@ export const renderStillFlow = async ({
binariesDirectory,
onBrowserDownload,
chromeMode,
+ videoCacheSizeInBytes,
});
const {format: imageFormat, source} = determineFinalStillImageFormat({
@@ -382,6 +385,7 @@ export const renderStillFlow = async ({
onArtifact,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
});
aggregate.rendering = {
diff --git a/packages/cli/src/render-queue/process-still.ts b/packages/cli/src/render-queue/process-still.ts
index bcb006f0a9..b8b45002f0 100644
--- a/packages/cli/src/render-queue/process-still.ts
+++ b/packages/cli/src/render-queue/process-still.ts
@@ -71,5 +71,6 @@ export const processStill = async ({
publicPath: null,
chromeMode: job.chromeMode,
audioLatencyHint: null,
+ videoCacheSizeInBytes: job.videoCacheSizeInBytes,
});
};
diff --git a/packages/cli/src/render-queue/process-video.ts b/packages/cli/src/render-queue/process-video.ts
index d9fc0da622..10d17f93de 100644
--- a/packages/cli/src/render-queue/process-video.ts
+++ b/packages/cli/src/render-queue/process-video.ts
@@ -100,6 +100,7 @@ export const processVideoJob = async ({
job.type === 'video' ? job.hardwareAcceleration : 'disable',
chromeMode: job.chromeMode,
offthreadVideoThreads: job.offthreadVideoThreads,
+ videoCacheSizeInBytes: job.videoCacheSizeInBytes,
audioLatencyHint: null,
imageSequencePattern: null,
});
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index 36a55b4ab9..174fb6991f 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -43,6 +43,7 @@ const {
offthreadVideoThreadsOption,
audioLatencyHintOption,
imageSequencePatternOption,
+ videoCacheSizeInBytesOption,
} = BrowserSafeApis.options;
export const render = async (
@@ -197,6 +198,9 @@ export const render = async (
const imageSequencePattern = imageSequencePatternOption.getValue({
commandLine: parsedCli,
}).value;
+ const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({
+ commandLine: parsedCli,
+ }).value;
await renderVideoFlow({
fullEntryPoint,
@@ -252,6 +256,7 @@ export const render = async (
audioCodec,
disallowParallelEncoding,
offthreadVideoCacheSizeInBytes,
+ videoCacheSizeInBytes,
colorSpace,
repro,
binariesDirectory,
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.ts
index db48a34397..8b445c7f83 100644
--- a/packages/cli/src/still.ts
+++ b/packages/cli/src/still.ts
@@ -25,6 +25,7 @@ const {
chromeModeOption,
offthreadVideoThreadsOption,
audioLatencyHintOption,
+ videoCacheSizeInBytesOption,
} = BrowserSafeApis.options;
export const still = async (
@@ -92,6 +93,9 @@ export const still = async (
offthreadVideoCacheSizeInBytesOption.getValue({
commandLine: parsedCli,
}).value;
+ const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({
+ commandLine: parsedCli,
+ }).value;
const offthreadVideoThreads = offthreadVideoThreadsOption.getValue({
commandLine: parsedCli,
}).value;
@@ -172,5 +176,6 @@ export const still = async (
publicPath,
chromeMode,
audioLatencyHint,
+ videoCacheSizeInBytes,
});
};
diff --git a/packages/cloudrun/src/api/render-media-on-cloudrun.ts b/packages/cloudrun/src/api/render-media-on-cloudrun.ts
index 6aa7d3d8e7..fd07faa623 100644
--- a/packages/cloudrun/src/api/render-media-on-cloudrun.ts
+++ b/packages/cloudrun/src/api/render-media-on-cloudrun.ts
@@ -145,6 +145,7 @@ const internalRenderMediaOnCloudrunRaw = async ({
colorSpace,
downloadBehavior,
metadata,
+ videoCacheSizeInBytes,
}: InternalRenderMediaOnCloudrun): Promise<
RenderMediaOnCloudrunOutput | CloudRunCrashResponse
> => {
@@ -208,6 +209,7 @@ const internalRenderMediaOnCloudrunRaw = async ({
metadata: metadata ?? null,
renderIdOverride,
renderStatusWebhook,
+ videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,
};
const client = await getAuthClientForUrl(cloudRunEndpoint);
@@ -344,6 +346,7 @@ export const renderMediaOnCloudrun = ({
renderIdOverride,
renderStatusWebhook,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
}: RenderMediaOnCloudrunInput): Promise<
RenderMediaOnCloudrunOutput | CloudRunCrashResponse
> => {
@@ -395,5 +398,6 @@ export const renderMediaOnCloudrun = ({
renderIdOverride: renderIdOverride ?? undefined,
renderStatusWebhook: renderStatusWebhook ?? undefined,
offthreadVideoThreads: offthreadVideoThreads ?? null,
+ videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,
});
};
diff --git a/packages/cloudrun/src/api/render-still-on-cloudrun.ts b/packages/cloudrun/src/api/render-still-on-cloudrun.ts
index da31e3366b..870e4c418e 100644
--- a/packages/cloudrun/src/api/render-still-on-cloudrun.ts
+++ b/packages/cloudrun/src/api/render-still-on-cloudrun.ts
@@ -103,6 +103,7 @@ const internalRenderStillOnCloudRun = async ({
downloadBehavior,
renderIdOverride,
renderStatusWebhook,
+ videoCacheSizeInBytes,
}: OptionalParameters & MandatoryParameters): Promise<
RenderStillOnCloudrunOutput | ErrorResponsePayload | CloudRunCrashResponse
> => {
@@ -147,6 +148,7 @@ const internalRenderStillOnCloudRun = async ({
downloadBehavior,
renderIdOverride,
renderStatusWebhook,
+ videoCacheSizeInBytes,
};
const client = await getAuthClientForUrl(cloudRunEndpoint);
@@ -255,5 +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,
});
};
diff --git a/packages/cloudrun/src/api/test/payloads.test.ts b/packages/cloudrun/src/api/test/payloads.test.ts
index 1e1772b723..20ae739c3b 100644
--- a/packages/cloudrun/src/api/test/payloads.test.ts
+++ b/packages/cloudrun/src/api/test/payloads.test.ts
@@ -20,6 +20,7 @@ test('CloudRunPayload should work with and without optional webhook fields', ()
outName: null,
offthreadVideoCacheSizeInBytes: null,
offthreadVideoThreads: null,
+ videoCacheSizeInBytes: null,
serializedInputPropsWithCustomSchema: JSON.stringify({}),
};
diff --git a/packages/cloudrun/src/cli/commands/render/index.ts b/packages/cloudrun/src/cli/commands/render/index.ts
index 1351a53d41..81a5a3809d 100644
--- a/packages/cloudrun/src/cli/commands/render/index.ts
+++ b/packages/cloudrun/src/cli/commands/render/index.ts
@@ -36,6 +36,7 @@ const {
delayRenderTimeoutInMillisecondsOption,
binariesDirectoryOption,
metadataOption,
+ videoCacheSizeInBytesOption,
} = BrowserSafeApis.options;
export const renderCommand = async (
@@ -110,6 +111,9 @@ export const renderCommand = async (
const binariesDirectory = binariesDirectoryOption.getValue({
commandLine: CliInternals.parsedCli,
}).value;
+ const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
let composition: string = args[1];
const chromiumOptions: ChromiumOptions = {
@@ -180,6 +184,7 @@ export const renderCommand = async (
quiet: CliInternals.quietFlagProvided(),
}),
chromeMode: 'headless-shell',
+ videoCacheSizeInBytes,
});
composition = compositionId;
}
@@ -341,6 +346,7 @@ ${downloadName ? ` Downloaded File = ${downloadName}` : ''}
}
: null,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
});
if (res.type === 'crash') {
diff --git a/packages/cloudrun/src/cli/commands/still.ts b/packages/cloudrun/src/cli/commands/still.ts
index 1cd12bdf13..809f52e710 100644
--- a/packages/cloudrun/src/cli/commands/still.ts
+++ b/packages/cloudrun/src/cli/commands/still.ts
@@ -22,6 +22,7 @@ const {
delayRenderTimeoutInMillisecondsOption,
headlessOption,
binariesDirectoryOption,
+ videoCacheSizeInBytesOption,
} = BrowserSafeApis.options;
export const stillCommand = async (
@@ -83,6 +84,9 @@ export const stillCommand = async (
const binariesDirectory = binariesDirectoryOption.getValue({
commandLine: CliInternals.parsedCli,
}).value;
+ const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
if (!composition) {
Log.info(
@@ -143,6 +147,7 @@ export const stillCommand = async (
}),
chromeMode: 'headless-shell',
offthreadVideoThreads: 1,
+ videoCacheSizeInBytes,
});
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.ts
index 2cb550647f..6a03ec6ea2 100644
--- a/packages/cloudrun/src/functions/helpers/get-composition-from-body.ts
+++ b/packages/cloudrun/src/functions/helpers/get-composition-from-body.ts
@@ -31,6 +31,7 @@ export const getCompositionFromBody = async (body: CloudRunPayloadType) => {
},
onServeUrlVisited: () => undefined,
chromeMode: 'headless-shell',
+ videoCacheSizeInBytes: body.videoCacheSizeInBytes,
},
);
diff --git a/packages/cloudrun/src/functions/helpers/payloads.ts b/packages/cloudrun/src/functions/helpers/payloads.ts
index 3829a5dce5..d50aa10c8f 100644
--- a/packages/cloudrun/src/functions/helpers/payloads.ts
+++ b/packages/cloudrun/src/functions/helpers/payloads.ts
@@ -65,6 +65,7 @@ export const CloudRunPayload = z.discriminatedUnion('type', [
enforceAudioTrack: z.boolean(),
preferLossless: z.boolean(),
offthreadVideoCacheSizeInBytes: z.number().nullable(),
+ videoCacheSizeInBytes: z.number().nullable(),
offthreadVideoThreads: z.number().nullable(),
colorSpace: z.enum(BrowserSafeApis.validColorSpaces).nullable(),
clientVersion: z.string(),
@@ -99,6 +100,7 @@ export const CloudRunPayload = z.discriminatedUnion('type', [
frame: z.number(),
delayRenderTimeoutInMilliseconds: z.number(),
logLevel,
+ videoCacheSizeInBytes: 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.ts
index 132bed3a48..364ad6572d 100644
--- a/packages/cloudrun/src/functions/render-media-single-thread.ts
+++ b/packages/cloudrun/src/functions/render-media-single-thread.ts
@@ -186,6 +186,7 @@ export const renderMediaSingleThread = async (
puppeteerInstance: undefined,
server: undefined,
offthreadVideoCacheSizeInBytes: body.offthreadVideoCacheSizeInBytes,
+ videoCacheSizeInBytes: body.videoCacheSizeInBytes,
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.ts
index a24ec2513d..a4407d4720 100644
--- a/packages/cloudrun/src/functions/render-still-single-thread.ts
+++ b/packages/cloudrun/src/functions/render-still-single-thread.ts
@@ -103,6 +103,7 @@ export const renderStillSingleThread = async (
throw new Error('Emitting artifacts is not supported in Cloud Run');
},
chromeMode: 'headless-shell',
+ videoCacheSizeInBytes: body.videoCacheSizeInBytes,
});
Log.info({indent: false, logLevel: body.logLevel}, 'Still rendered');
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 931d4cdc74..2eb6bc29f9 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -70,6 +70,7 @@ declare global {
remotion_inputProps: string;
remotion_envVariables: string;
remotion_isMainTab: boolean;
+ remotion_videoCacheSizeInBytes: number | null;
remotion_collectAssets: () => TRenderAsset[];
remotion_isPlayer: boolean;
remotion_isStudio: boolean;
diff --git a/packages/it-tests/src/monorepo/go-package.test.ts b/packages/it-tests/src/monorepo/go-package.test.ts
index 4eae9bec96..b1c76035d8 100644
--- a/packages/it-tests/src/monorepo/go-package.test.ts
+++ b/packages/it-tests/src/monorepo/go-package.test.ts
@@ -84,6 +84,7 @@ test(
apiKey: null,
storageClass: null,
requestHandler: null,
+ videoCacheSizeInBytes: 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.ts
index af69515182..e96466f1c2 100644
--- a/packages/it-tests/src/monorepo/php-package.test.ts
+++ b/packages/it-tests/src/monorepo/php-package.test.ts
@@ -129,6 +129,7 @@ class Semantic
apiKey: null,
storageClass: null,
requestHandler: null,
+ videoCacheSizeInBytes: 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.ts
index db4d5e811d..671cfade5e 100644
--- a/packages/it-tests/src/monorepo/python-package.test.ts
+++ b/packages/it-tests/src/monorepo/python-package.test.ts
@@ -112,6 +112,7 @@ test('Python package should create the same renderMedia payload as normal Lambda
},
apiKey: null,
storageClass: null,
+ videoCacheSizeInBytes: null,
});
const jsonOutput = toParse.substring(0, toParse.lastIndexOf('}') + 1);
const parsedJson = JSON.parse(jsonOutput);
@@ -196,6 +197,7 @@ test('Python package should create the same renderStill payload as normal Lambda
apiKey: null,
storageClass: null,
requestHandler: null,
+ videoCacheSizeInBytes: 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.ts
index 8c08065c2e..8ee0800c95 100644
--- a/packages/it-tests/src/monorepo/ruby-package.test.ts
+++ b/packages/it-tests/src/monorepo/ruby-package.test.ts
@@ -138,6 +138,7 @@ test('Render Media payload', async () => {
apiKey: null,
storageClass: null,
requestHandler: null,
+ videoCacheSizeInBytes: null,
});
expect(JSON.parse(output)).toEqual(nativeVersion);
@@ -183,6 +184,7 @@ test('Render Still payload', async () => {
offthreadVideoThreads: null,
storageClass: null,
requestHandler: null,
+ videoCacheSizeInBytes: 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.ts
index 4ae745265f..bd6b82f2a5 100644
--- a/packages/lambda-client/src/get-compositions-on-lambda.ts
+++ b/packages/lambda-client/src/get-compositions-on-lambda.ts
@@ -53,6 +53,7 @@ export const getCompositionsOnLambda = async ({
offthreadVideoCacheSizeInBytes,
forcePathStyle,
requestHandler,
+ videoCacheSizeInBytes,
}: GetCompositionsOnLambdaInput): Promise<GetCompositionsOnLambdaOutput> => {
const stringifiedInputProps = serializeOrThrow(inputProps, 'input-props');
@@ -91,6 +92,7 @@ export const getCompositionsOnLambda = async ({
bucketName: bucketName ?? null,
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes ?? null,
forcePathStyle: forcePathStyle ?? false,
+ videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,
},
region,
timeoutInTest: 120000,
diff --git a/packages/lambda-client/src/make-lambda-payload.ts b/packages/lambda-client/src/make-lambda-payload.ts
index fef98f6bed..d4a9ce9717 100644
--- a/packages/lambda-client/src/make-lambda-payload.ts
+++ b/packages/lambda-client/src/make-lambda-payload.ts
@@ -130,6 +130,7 @@ export const makeLambdaRenderMediaPayload = async ({
overwrite,
jpegQuality,
offthreadVideoCacheSizeInBytes,
+ videoCacheSizeInBytes,
deleteAfter,
colorSpace,
preferLossless,
@@ -218,6 +219,7 @@ export const makeLambdaRenderMediaPayload = async ({
metadata: metadata ?? null,
apiKey: apiKey ?? null,
offthreadVideoThreads: offthreadVideoThreads ?? null,
+ videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,
storageClass: storageClass ?? null,
};
};
@@ -266,6 +268,8 @@ export const makeLambdaRenderStillPayload = async ({
apiKey,
storageClass,
requestHandler,
+ offthreadVideoThreads,
+ videoCacheSizeInBytes,
}: RenderStillOnLambdaNonNullInput): Promise<
ServerlessPayloads<AwsProvider>[ServerlessRoutines.still]
> => {
@@ -317,7 +321,8 @@ export const makeLambdaRenderStillPayload = async ({
streamed: true,
forcePathStyle,
apiKey: apiKey ?? null,
- offthreadVideoThreads: null,
+ offthreadVideoThreads: offthreadVideoThreads ?? null,
+ videoCacheSizeInBytes: videoCacheSizeInBytes ?? 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.ts
index 670786f0a8..3d955f840c 100644
--- a/packages/lambda-client/src/render-media-on-lambda.ts
+++ b/packages/lambda-client/src/render-media-on-lambda.ts
@@ -199,6 +199,7 @@ export const renderMediaOnLambdaOptionalToRequired = (
apiKey: options.apiKey ?? null,
storageClass: options.storageClass ?? null,
requestHandler: options.requestHandler ?? null,
+ videoCacheSizeInBytes: options.videoCacheSizeInBytes ?? null,
};
};
diff --git a/packages/lambda-client/src/render-still-on-lambda.ts b/packages/lambda-client/src/render-still-on-lambda.ts
index 1c083c3a97..6be1d8ef10 100644
--- a/packages/lambda-client/src/render-still-on-lambda.ts
+++ b/packages/lambda-client/src/render-still-on-lambda.ts
@@ -204,5 +204,6 @@ export const renderStillOnLambda = (
offthreadVideoThreads: input.offthreadVideoThreads ?? null,
storageClass: input.storageClass ?? null,
requestHandler: input.requestHandler ?? null,
+ videoCacheSizeInBytes: input.videoCacheSizeInBytes ?? null,
});
};
diff --git a/packages/lambda-client/src/test/concurrency-payload.test.ts b/packages/lambda-client/src/test/concurrency-payload.test.ts
index aefa65b2a4..81a46f3732 100644
--- a/packages/lambda-client/src/test/concurrency-payload.test.ts
+++ b/packages/lambda-client/src/test/concurrency-payload.test.ts
@@ -50,6 +50,7 @@ test('Should include concurrency field in payload', async () => {
metadata: null,
apiKey: null,
offthreadVideoCacheSizeInBytes: null,
+ videoCacheSizeInBytes: null,
offthreadVideoThreads: null,
storageClass: null,
requestHandler: null,
@@ -108,6 +109,7 @@ test('Should handle null concurrency', async () => {
metadata: null,
apiKey: null,
offthreadVideoCacheSizeInBytes: null,
+ videoCacheSizeInBytes: null,
offthreadVideoThreads: null,
storageClass: null,
requestHandler: null,
diff --git a/packages/lambda-client/tsconfig.json b/packages/lambda-client/tsconfig.json
index b54936718a..f6ebe36774 100644
--- a/packages/lambda-client/tsconfig.json
+++ b/packages/lambda-client/tsconfig.json
@@ -5,5 +5,5 @@
"outDir": "dist"
},
"include": ["src"],
- "references": [{"path": "../serverless-client"}]
+ "references": [{"path": "../serverless-client"}, {"path": "../renderer"}]
}
diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.ts
index 4adeb06fc0..6990feb8b8 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -54,6 +54,7 @@ const {
binariesDirectoryOption,
preferLosslessOption,
metadataOption,
+ videoCacheSizeInBytesOption,
} = BrowserSafeApis.options;
export const renderCommand = async ({
@@ -113,6 +114,9 @@ export const renderCommand = async ({
offthreadVideoCacheSizeInBytesOption.getValue({
commandLine: CliInternals.parsedCli,
}).value;
+ const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({
+ commandLine: CliInternals.parsedCli,
+ }).value;
const offthreadVideoThreads = offthreadVideoThreadsOption.getValue({
commandLine: CliInternals.parsedCli,
}).value;
@@ -246,6 +250,7 @@ export const renderCommand = async ({
quiet: CliInternals.quietFlagProvided(),
}),
chromeMode: 'headless-shell',
+ videoCacheSizeInBytes,
});
composition = compositionId;
}
@@ -334,6 +339,7 @@ export const renderCommand = async ({
colorSpace,
downloadBehavior: {type: 'play-in-browser'},
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes ?? null,
+ videoCacheSizeInBytes: videoCacheSizeInBytes ?? 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.ts
index 7a6f6986a4..2c3cdb8554 100644
--- a/packages/lambda/src/cli/commands/still.ts
+++ b/packages/lambda/src/cli/commands/still.ts
@@ -33,6 +33,7 @@ const {
headlessOption,
delayRenderTimeoutInMillisecondsOption,
binariesDirectoryOption,
+ videoCacheSizeInBytesOption,
} = BrowserSafeApis.options;
const {
@@ -123,6 +124,9 @@ export const stillCommand = async ({
const binariesDirectory = binariesDirectoryOption.getValue({
commandLine: parsedCli,
}).value;
+ const videoCacheSizeInBytes = videoCacheSizeInBytesOption.getValue({
+ commandLine: parsedCli,
+ }).value;
if (!composition) {
Log.info(
@@ -182,6 +186,7 @@ export const stillCommand = async ({
quiet: CliInternals.quietFlagProvided(),
}),
chromeMode: 'headless-shell',
+ videoCacheSizeInBytes,
});
composition = compositionId;
}
@@ -278,6 +283,7 @@ export const stillCommand = async ({
offthreadVideoCacheSizeInBytes,
offthreadVideoThreads: null,
requestHandler: null,
+ videoCacheSizeInBytes,
});
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.ts
index 80dcf526ea..488e0e3d95 100644
--- a/packages/lambda/src/test/integration/renders/old-version.test.ts
+++ b/packages/lambda/src/test/integration/renders/old-version.test.ts
@@ -60,6 +60,7 @@ test('Should fail when using an incompatible version', async () => {
metadata: {Author: 'Lunar'},
apiKey: null,
storageClass: null,
+ videoCacheSizeInBytes: 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.ts
index 106c0c50ed..f52898320e 100644
--- a/packages/lambda/src/test/integration/webhooks.test.ts
+++ b/packages/lambda/src/test/integration/webhooks.test.ts
@@ -96,6 +96,7 @@ test(
metadata: {Author: 'Lunar'},
apiKey: null,
storageClass: null,
+ videoCacheSizeInBytes: null,
},
functionName: 'remotion-dev-lambda',
region: 'us-east-1',
@@ -160,6 +161,7 @@ test(
type: ServerlessRoutines.launch,
payload: {
type: ServerlessRoutines.launch,
+ videoCacheSizeInBytes: null,
offthreadVideoCacheSizeInBytes: null,
offthreadVideoThreads: null,
serveUrl: `http://localhost:${port}`,
diff --git a/packages/renderer/src/get-compositions.ts b/packages/renderer/src/get-compositions.ts
index 7ad5bcd9fd..ff5670f137 100644
--- a/packages/renderer/src/get-compositions.ts
+++ b/packages/renderer/src/get-compositions.ts
@@ -62,6 +62,7 @@ const innerGetCompositions = async ({
timeoutInMilliseconds,
indent,
logLevel,
+ videoCacheSizeInBytes,
}: InnerGetCompositionsParams): Promise<VideoConfig[]> => {
validatePuppeteerTimeout(timeoutInMilliseconds);
@@ -80,6 +81,7 @@ const innerGetCompositions = async ({
logLevel,
onServeUrlVisited: () => undefined,
isMainTab: true,
+ videoCacheSizeInBytes,
});
await puppeteerEvaluateWithCatch({
@@ -168,6 +170,7 @@ const internalGetCompositionsRaw = async ({
onBrowserDownload,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
}: InternalGetCompositionsOptions) => {
const {page, cleanupPage} = await getPageAndCleanupFn({
passedInInstance: puppeteerInstance,
@@ -235,6 +238,7 @@ const internalGetCompositionsRaw = async ({
onBrowserDownload,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
});
})
@@ -285,6 +289,7 @@ export const getCompositions = (
offthreadVideoCacheSizeInBytes,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
} = config ?? {};
const indent = false;
@@ -319,5 +324,6 @@ export const getCompositions = (
}),
chromeMode: chromeMode ?? 'headless-shell',
offthreadVideoThreads: offthreadVideoThreads ?? null,
+ videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,
});
};
diff --git a/packages/renderer/src/make-page.ts b/packages/renderer/src/make-page.ts
index 6b7c3f8544..0eae7080f9 100644
--- a/packages/renderer/src/make-page.ts
+++ b/packages/renderer/src/make-page.ts
@@ -30,6 +30,7 @@ export const makePage = async ({
serializedResolvedPropsWithCustomSchema,
pageIndex,
isMainTab,
+ videoCacheSizeInBytes,
}: {
context: SourceMapGetter;
initialFrame: number;
@@ -50,6 +51,7 @@ export const makePage = async ({
imageFormat: VideoImageFormat;
pageIndex: number;
isMainTab: boolean;
+ videoCacheSizeInBytes: number | null;
}) => {
const page = await browserReplacer
.getBrowser()
@@ -76,6 +78,7 @@ export const makePage = async ({
logLevel,
onServeUrlVisited: () => undefined,
isMainTab,
+ videoCacheSizeInBytes,
});
await puppeteerEvaluateWithCatch({
diff --git a/packages/renderer/src/options/index.tsx b/packages/renderer/src/options/index.tsx
index c9f76daf0d..a4c3cca4f0 100644
--- a/packages/renderer/src/options/index.tsx
+++ b/packages/renderer/src/options/index.tsx
@@ -41,6 +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 {videoCodecOption} from './video-codec';
import {webhookCustomDataOption} from './webhook-custom-data';
import {x264Option} from './x264-preset';
@@ -91,6 +92,7 @@ export const allOptions = {
audioLatencyHintOption,
enableCrossSiteIsolationOption,
imageSequencePatternOption,
+ videoCacheSizeInBytesOption,
};
export type AvailableOptions = keyof typeof allOptions;
diff --git a/packages/renderer/src/options/options-map.ts b/packages/renderer/src/options/options-map.ts
index ef06785fbc..fe0bcef9d9 100644
--- a/packages/renderer/src/options/options-map.ts
+++ b/packages/renderer/src/options/options-map.ts
@@ -27,11 +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 {videoCodecOption} from './video-codec';
import {x264Option} from './x264-preset';
export const optionsMap = {
renderMedia: {
+ videoCacheSizeInBytes: videoCacheSizeInBytesOption,
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,
offthreadVideoThreads: offthreadVideoThreadsOption,
videoBitrate: videoBitrateOption,
@@ -61,6 +63,7 @@ export const optionsMap = {
hardwareAcceleration: hardwareAccelerationOption,
},
renderStill: {
+ videoCacheSizeInBytes: videoCacheSizeInBytesOption,
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,
offthreadVideoThreads: offthreadVideoThreadsOption,
jpegQuality: jpegQualityOption,
@@ -71,6 +74,7 @@ export const optionsMap = {
chromeMode: chromeModeOption,
},
getCompositions: {
+ videoCacheSizeInBytes: videoCacheSizeInBytesOption,
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,
offthreadVideoThreads: offthreadVideoThreadsOption,
logLevel: logLevelOption,
@@ -80,6 +84,7 @@ export const optionsMap = {
chromeMode: chromeModeOption,
},
selectComposition: {
+ videoCacheSizeInBytes: videoCacheSizeInBytesOption,
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,
offthreadVideoThreads: offthreadVideoThreadsOption,
logLevel: logLevelOption,
@@ -89,6 +94,7 @@ export const optionsMap = {
chromeMode: chromeModeOption,
},
renderFrames: {
+ videoCacheSizeInBytes: videoCacheSizeInBytesOption,
forSeamlessAacConcatenation: forSeamlessAacConcatenationOption,
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,
offthreadVideoThreads: offthreadVideoThreadsOption,
@@ -101,6 +107,7 @@ export const optionsMap = {
imageSequencePattern: imageSequencePatternOption,
},
renderMediaOnLambda: {
+ videoCacheSizeInBytes: videoCacheSizeInBytesOption,
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,
offthreadVideoThreads: offthreadVideoThreadsOption,
videoBitrate: videoBitrateOption,
@@ -118,6 +125,7 @@ export const optionsMap = {
apiKey: apiKeyOption,
},
renderStillOnLambda: {
+ videoCacheSizeInBytes: videoCacheSizeInBytesOption,
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,
offthreadVideoThreads: offthreadVideoThreadsOption,
jpegQuality: jpegQualityOption,
@@ -128,12 +136,13 @@ export const optionsMap = {
apiKey: apiKeyOption,
},
getCompositionsOnLambda: {
+ videoCacheSizeInBytes: videoCacheSizeInBytesOption,
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,
- offthreadVideoThreads: offthreadVideoThreadsOption,
logLevel: logLevelOption,
timeoutInMilliseconds: delayRenderTimeoutInMillisecondsOption,
},
renderMediaOnCloudRun: {
+ videoCacheSizeInBytes: videoCacheSizeInBytesOption,
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytesOption,
offthreadVideoThreads: offthreadVideoThreadsOption,
numberOfGifLoops: numberOfGifLoopsOption,
@@ -153,6 +162,7 @@ export const optionsMap = {
jpegQuality: jpegQualityOption,
},
renderStillOnCloudRun: {
+ videoCacheSizeInBytes: videoCacheSizeInBytesOption,
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.tsx
new file mode 100644
index 0000000000..75fbd8846d
--- /dev/null
+++ b/packages/renderer/src/options/video-cache-size.tsx
@@ -0,0 +1,73 @@
+import type {AnyRemotionOption} from './option';
+
+let videoCacheSizeInBytes: number | null = null;
+
+export const getVideoCacheSizeInBytes = () => {
+ return videoCacheSizeInBytes;
+};
+
+const cliFlag = 'video-cache-size-in-bytes' as const;
+
+export const videoCacheSizeInBytesOption = {
+ name: '<Video> cache size',
+ cliFlag,
+ description: () => (
+ <>
+ Specify the maximum size of the cache for <code>&lt;Video&gt;</code> (from{' '}
+ <code>@remotion/media</code>) frames, in bytes. <br />
+ Default: <code>1_000_000</code>
+ </>
+ ),
+ ssrName: 'videoCacheSizeInBytes' as const,
+ docLink: 'https://www.remotion.dev/docs/media/video',
+ type: 0 as number | null,
+ getValue: ({commandLine}) => {
+ if (commandLine[cliFlag] !== undefined) {
+ return {
+ source: 'cli',
+ value: commandLine[cliFlag] as number,
+ };
+ }
+
+ if (videoCacheSizeInBytes !== null) {
+ return {
+ source: 'config',
+ value: videoCacheSizeInBytes,
+ };
+ }
+
+ return {
+ source: 'default',
+ value: null,
+ };
+ },
+ setConfig: (size: number | null) => {
+ videoCacheSizeInBytes = size ?? null;
+ },
+} satisfies AnyRemotionOption<number | null>;
+
+export const validateVideoCacheSizeInBytes = (option: unknown) => {
+ if (option === undefined || option === null) {
+ return;
+ }
+
+ if (typeof option !== 'number') {
+ throw new Error('Expected a number');
+ }
+
+ if (option < 0 || option === 0) {
+ throw new Error('Expected a positive number');
+ }
+
+ if (Number.isNaN(option)) {
+ throw new Error('Expected a number');
+ }
+
+ if (!Number.isFinite(option)) {
+ throw new Error('Expected a finite number');
+ }
+
+ if (option % 1 !== 0) {
+ throw new Error('Expected a whole number');
+ }
+};
diff --git a/packages/renderer/src/render-frames.ts b/packages/renderer/src/render-frames.ts
index d6ec141d69..6d32418523 100644
--- a/packages/renderer/src/render-frames.ts
+++ b/packages/renderer/src/render-frames.ts
@@ -231,6 +231,7 @@ const innerRenderFrames = async ({
onArtifact,
binariesDirectory,
imageSequencePattern,
+ videoCacheSizeInBytes,
}: Omit<
InnerRenderFramesOptions,
'offthreadVideoCacheSizeInBytes'
@@ -292,6 +293,7 @@ const innerRenderFrames = async ({
timeoutInMilliseconds,
pageIndex,
isMainTab: pageIndex === 0,
+ videoCacheSizeInBytes,
});
};
@@ -474,6 +476,7 @@ const internalRenderFramesRaw = ({
chromeMode,
offthreadVideoThreads,
imageSequencePattern,
+ videoCacheSizeInBytes,
}: InternalRenderFramesOptions): Promise<RenderFramesOutput> => {
validateDimension(
composition.height,
@@ -607,6 +610,7 @@ const internalRenderFramesRaw = ({
chromeMode,
offthreadVideoThreads,
imageSequencePattern,
+ videoCacheSizeInBytes,
});
}),
])
@@ -706,6 +710,7 @@ export const renderFrames = (
chromeMode,
offthreadVideoThreads,
imageSequencePattern,
+ videoCacheSizeInBytes,
} = options;
if (!composition) {
@@ -781,5 +786,6 @@ export const renderFrames = (
chromeMode: chromeMode ?? 'headless-shell',
offthreadVideoThreads: offthreadVideoThreads ?? null,
imageSequencePattern: imageSequencePattern ?? null,
+ videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,
});
};
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index b6b1a24e7b..2c51edf5b7 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -254,6 +254,7 @@ const internalRenderMediaRaw = ({
hardwareAcceleration,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
}: InternalRenderMediaOptions): Promise<RenderMediaResult> => {
const pixelFormat =
userPixelFormat ??
@@ -716,6 +717,7 @@ const internalRenderMediaRaw = ({
onArtifact,
chromeMode,
imageSequencePattern: null,
+ videoCacheSizeInBytes,
});
return renderFramesProc;
@@ -945,6 +947,7 @@ export const renderMedia = ({
chromeMode,
offthreadVideoThreads,
compositionStart,
+ videoCacheSizeInBytes,
}: RenderMediaOptions): Promise<RenderMediaResult> => {
const indent = false;
const logLevel =
@@ -1030,5 +1033,6 @@ export const renderMedia = ({
compositionStart: compositionStart ?? 0,
hardwareAcceleration: hardwareAcceleration ?? 'disable',
chromeMode: chromeMode ?? 'headless-shell',
+ videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,
});
};
diff --git a/packages/renderer/src/render-still.ts b/packages/renderer/src/render-still.ts
index 7fadf33ae9..a77827e780 100644
--- a/packages/renderer/src/render-still.ts
+++ b/packages/renderer/src/render-still.ts
@@ -133,6 +133,7 @@ const innerRenderStill = async ({
onBrowserDownload,
onArtifact,
chromeMode,
+ videoCacheSizeInBytes,
}: InternalRenderStillOptions & {
serveUrl: string;
onError: (err: Error) => void;
@@ -265,6 +266,7 @@ const innerRenderStill = async ({
logLevel,
onServeUrlVisited: () => undefined,
isMainTab: true,
+ videoCacheSizeInBytes,
});
await puppeteerEvaluateWithCatch({
@@ -464,6 +466,7 @@ export const renderStill = (
onArtifact,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
} = options;
if (typeof jpegQuality !== 'undefined' && imageFormat !== 'jpeg') {
@@ -529,5 +532,6 @@ export const renderStill = (
onArtifact: onArtifact ?? null,
chromeMode: chromeMode ?? 'headless-shell',
offthreadVideoThreads: offthreadVideoThreads ?? null,
+ videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,
});
};
diff --git a/packages/renderer/src/select-composition.ts b/packages/renderer/src/select-composition.ts
index 29ea3b3c5d..669712575d 100644
--- a/packages/renderer/src/select-composition.ts
+++ b/packages/renderer/src/select-composition.ts
@@ -73,6 +73,7 @@ const innerSelectComposition = async ({
indent,
logLevel,
onServeUrlVisited,
+ videoCacheSizeInBytes,
}: InnerSelectCompositionConfig): Promise<InternalReturnType> => {
validatePuppeteerTimeout(timeoutInMilliseconds);
@@ -91,6 +92,7 @@ const innerSelectComposition = async ({
logLevel,
onServeUrlVisited,
isMainTab: true,
+ videoCacheSizeInBytes,
});
await puppeteerEvaluateWithCatch({
@@ -204,6 +206,7 @@ export const internalSelectCompositionRaw = async (
onBrowserDownload,
onServeUrlVisited,
chromeMode,
+ videoCacheSizeInBytes,
} = options;
const [{page, cleanupPage}, serverUsed] = await Promise.all([
@@ -273,6 +276,7 @@ export const internalSelectCompositionRaw = async (
onBrowserDownload,
onServeUrlVisited,
chromeMode,
+ videoCacheSizeInBytes,
})
.then((data) => {
return resolve(data);
@@ -321,6 +325,7 @@ export const selectComposition = async (
onBrowserDownload,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
} = options;
const indent = false;
@@ -357,6 +362,7 @@ export const selectComposition = async (
onServeUrlVisited: () => undefined,
chromeMode: chromeMode ?? 'headless-shell',
offthreadVideoThreads: offthreadVideoThreads ?? null,
+ videoCacheSizeInBytes: videoCacheSizeInBytes ?? null,
});
return data.metadata;
};
diff --git a/packages/renderer/src/set-props-and-env.ts b/packages/renderer/src/set-props-and-env.ts
index 34745480dc..eab6977a88 100644
--- a/packages/renderer/src/set-props-and-env.ts
+++ b/packages/renderer/src/set-props-and-env.ts
@@ -25,6 +25,7 @@ type SetPropsAndEnv = {
logLevel: LogLevel;
onServeUrlVisited: () => void;
isMainTab: boolean;
+ videoCacheSizeInBytes: number | null;
};
const innerSetPropsAndEnv = async ({
@@ -42,6 +43,7 @@ const innerSetPropsAndEnv = async ({
logLevel,
onServeUrlVisited,
isMainTab,
+ videoCacheSizeInBytes,
}: SetPropsAndEnv): Promise<void> => {
validatePuppeteerTimeout(timeoutInMilliseconds);
const actualTimeout = timeoutInMilliseconds ?? DEFAULT_TIMEOUT;
@@ -53,8 +55,8 @@ const innerSetPropsAndEnv = async ({
await page.evaluateOnNewDocument(
(timeout: number, mainTab: boolean) => {
window.remotion_puppeteerTimeout = timeout;
-
window.remotion_isMainTab = mainTab;
+ window.remotion_videoCacheSizeInBytes = videoCacheSizeInBytes;
// To make useRemotionEnvironment() work
if (window.process === undefined) {
// @ts-expect-error
@@ -69,6 +71,7 @@ const innerSetPropsAndEnv = async ({
},
actualTimeout,
isMainTab,
+ videoCacheSizeInBytes,
);
await page.evaluateOnNewDocument(
@@ -155,6 +158,7 @@ const innerSetPropsAndEnv = async ({
logLevel,
onServeUrlVisited,
isMainTab,
+ videoCacheSizeInBytes,
});
};
diff --git a/packages/serverless-client/src/constants.ts b/packages/serverless-client/src/constants.ts
index 3567241d36..c499dee01c 100644
--- a/packages/serverless-client/src/constants.ts
+++ b/packages/serverless-client/src/constants.ts
@@ -153,6 +153,7 @@ export type ServerlessStartPayload<Provider extends CloudProvider> = {
bucketName: string | null;
offthreadVideoCacheSizeInBytes: number | null;
offthreadVideoThreads: number | null;
+ videoCacheSizeInBytes: number | null;
deleteAfter: DeleteAfter | null;
colorSpace: ColorSpace | null;
preferLossless: boolean;
@@ -210,6 +211,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {
forceWidth: number | null;
offthreadVideoCacheSizeInBytes: number | null;
offthreadVideoThreads: number | null;
+ videoCacheSizeInBytes: number | null;
deleteAfter: DeleteAfter | null;
colorSpace: ColorSpace | null;
preferLossless: boolean;
@@ -261,6 +263,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {
preferLossless: boolean;
offthreadVideoCacheSizeInBytes: number | null;
offthreadVideoThreads: number | null;
+ videoCacheSizeInBytes: number | null;
deleteAfter: DeleteAfter | null;
colorSpace: ColorSpace | null;
compositionStart: number;
@@ -293,6 +296,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {
bucketName: string | null;
offthreadVideoCacheSizeInBytes: number | null;
offthreadVideoThreads: number | null;
+ videoCacheSizeInBytes: number | null;
deleteAfter: DeleteAfter | null;
streamed: boolean;
forcePathStyle: boolean;
@@ -310,6 +314,7 @@ export type ServerlessPayloads<Provider extends CloudProvider> = {
serveUrl: string;
bucketName: string | null;
offthreadVideoCacheSizeInBytes: number | null;
+ videoCacheSizeInBytes: number | null;
forcePathStyle: boolean;
};
};
diff --git a/packages/serverless/src/handlers/compositions.ts b/packages/serverless/src/handlers/compositions.ts
index 8275490233..1ca1b65997 100644
--- a/packages/serverless/src/handlers/compositions.ts
+++ b/packages/serverless/src/handlers/compositions.ts
@@ -100,6 +100,7 @@ export const compositionsHandler = async <Provider extends CloudProvider>({
},
chromeMode: 'headless-shell',
offthreadVideoThreads: 1,
+ videoCacheSizeInBytes: params.videoCacheSizeInBytes,
});
return Promise.resolve({
diff --git a/packages/serverless/src/handlers/launch.ts b/packages/serverless/src/handlers/launch.ts
index 53d15b3d6d..7f0cf44aca 100644
--- a/packages/serverless/src/handlers/launch.ts
+++ b/packages/serverless/src/handlers/launch.ts
@@ -134,6 +134,7 @@ const innerLaunchHandler = async <Provider extends CloudProvider>({
},
providerSpecifics,
offthreadVideoThreads: params.offthreadVideoThreads,
+ videoCacheSizeInBytes: params.videoCacheSizeInBytes,
});
overallProgress.setCompositionValidated(Date.now());
RenderInternals.Log.info(
@@ -287,6 +288,7 @@ const innerLaunchHandler = async <Provider extends CloudProvider>({
forcePathStyle: params.forcePathStyle,
metadata: params.metadata,
offthreadVideoThreads: params.offthreadVideoThreads,
+ videoCacheSizeInBytes: params.videoCacheSizeInBytes,
};
return payload;
});
diff --git a/packages/serverless/src/handlers/renderer.ts b/packages/serverless/src/handlers/renderer.ts
index 83271a898c..9999d978cb 100644
--- a/packages/serverless/src/handlers/renderer.ts
+++ b/packages/serverless/src/handlers/renderer.ts
@@ -343,6 +343,7 @@ const renderHandler = async <Provider extends CloudProvider>({
hardwareAcceleration: 'disable',
chromeMode: 'headless-shell',
offthreadVideoThreads: params.offthreadVideoThreads,
+ videoCacheSizeInBytes: params.videoCacheSizeInBytes,
})
.then(({slowestFrames}) => {
RenderInternals.Log.verbose(
diff --git a/packages/serverless/src/handlers/start.ts b/packages/serverless/src/handlers/start.ts
index 5e36e02aba..3f4fba4471 100644
--- a/packages/serverless/src/handlers/start.ts
+++ b/packages/serverless/src/handlers/start.ts
@@ -128,6 +128,7 @@ export const startHandler = async <Provider extends CloudProvider>({
apiKey: params.apiKey,
offthreadVideoThreads: params.offthreadVideoThreads,
storageClass: params.storageClass,
+ videoCacheSizeInBytes: params.videoCacheSizeInBytes,
};
await providerSpecifics.callFunctionAsync({
diff --git a/packages/serverless/src/handlers/still.ts b/packages/serverless/src/handlers/still.ts
index e40974f7d1..2867d60a7b 100644
--- a/packages/serverless/src/handlers/still.ts
+++ b/packages/serverless/src/handlers/still.ts
@@ -179,6 +179,7 @@ const innerStillHandler = async <Provider extends CloudProvider>(
onServeUrlVisited: () => undefined,
providerSpecifics,
offthreadVideoThreads: params.offthreadVideoThreads,
+ videoCacheSizeInBytes: params.videoCacheSizeInBytes,
});
const renderMetadata: RenderMetadata<Provider> = {
@@ -326,6 +327,7 @@ const innerStillHandler = async <Provider extends CloudProvider>(
data: composition.props,
}).serializedString,
offthreadVideoCacheSizeInBytes: params.offthreadVideoCacheSizeInBytes,
+ videoCacheSizeInBytes: params.videoCacheSizeInBytes,
binariesDirectory: null,
onBrowserDownload,
onArtifact,
diff --git a/packages/serverless/src/validate-composition.ts b/packages/serverless/src/validate-composition.ts
index 6490068e7c..054e17aee5 100644
--- a/packages/serverless/src/validate-composition.ts
+++ b/packages/serverless/src/validate-composition.ts
@@ -32,6 +32,7 @@ type ValidateCompositionOptions<Provider extends CloudProvider> = {
logLevel: LogLevel;
server: RemotionServer | undefined;
offthreadVideoCacheSizeInBytes: number | null;
+ videoCacheSizeInBytes: number | null;
offthreadVideoThreads: number | null;
onBrowserDownload: OnBrowserDownload;
onServeUrlVisited: () => void;
@@ -56,6 +57,7 @@ export const validateComposition = async <Provider extends CloudProvider>({
onServeUrlVisited,
providerSpecifics,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
}: ValidateCompositionOptions<Provider>): Promise<VideoConfig> => {
const {metadata: comp} = await RenderInternals.internalSelectComposition({
id: composition,
@@ -77,6 +79,7 @@ export const validateComposition = async <Provider extends CloudProvider>({
onBrowserDownload,
onServeUrlVisited,
chromeMode: 'headless-shell',
+ videoCacheSizeInBytes,
});
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.ts
index 3a7079ddd1..918d9d5be3 100644
--- a/packages/studio-server/src/preview-server/routes/add-render.ts
+++ b/packages/studio-server/src/preview-server/routes/add-render.ts
@@ -64,6 +64,7 @@ export const handleAddRender: ApiHandler<AddRenderRequest, undefined> = ({
hardwareAcceleration: input.hardwareAcceleration,
chromeMode: input.chromeMode,
offthreadVideoThreads: input.offthreadVideoThreads,
+ videoCacheSizeInBytes: input.videoCacheSizeInBytes,
},
logLevel,
});
@@ -103,6 +104,7 @@ export const handleAddRender: ApiHandler<AddRenderRequest, undefined> = ({
metadata: input.metadata,
chromeMode: input.chromeMode,
offthreadVideoThreads: input.offthreadVideoThreads,
+ videoCacheSizeInBytes: input.videoCacheSizeInBytes,
},
logLevel,
});
@@ -138,6 +140,7 @@ export const handleAddRender: ApiHandler<AddRenderRequest, undefined> = ({
metadata: input.metadata,
chromeMode: input.chromeMode,
offthreadVideoThreads: input.offthreadVideoThreads,
+ videoCacheSizeInBytes: input.videoCacheSizeInBytes,
},
entryPoint,
remotionRoot,
diff --git a/packages/studio-shared/src/api-requests.ts b/packages/studio-shared/src/api-requests.ts
index 6c78002850..e53057ee73 100644
--- a/packages/studio-shared/src/api-requests.ts
+++ b/packages/studio-shared/src/api-requests.ts
@@ -100,6 +100,7 @@ export type AddRenderRequest = {
serializedInputPropsWithCustomSchema: string;
offthreadVideoCacheSizeInBytes: number | null;
offthreadVideoThreads: number | null;
+ videoCacheSizeInBytes: 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.ts
index 0d4159cb92..6ec04af1e3 100644
--- a/packages/studio-shared/src/render-defaults.ts
+++ b/packages/studio-shared/src/render-defaults.ts
@@ -42,6 +42,7 @@ export type RenderDefaults = {
disableWebSecurity: boolean;
openGlRenderer: OpenGlRenderer | null;
ignoreCertificateErrors: boolean;
+ videoCacheSizeInBytes: 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.ts
index 645fd26c7b..1dba85736b 100644
--- a/packages/studio-shared/src/render-job.ts
+++ b/packages/studio-shared/src/render-job.ts
@@ -104,6 +104,7 @@ type RenderJobDynamicFields =
frame: number;
scale: number;
offthreadVideoCacheSizeInBytes: number | null;
+ videoCacheSizeInBytes: number | null;
offthreadVideoThreads: number | null;
} & RenderJobDynamicStatus)
| ({
@@ -115,6 +116,7 @@ type RenderJobDynamicFields =
startFrame: number;
endFrame: number;
offthreadVideoCacheSizeInBytes: number | null;
+ videoCacheSizeInBytes: number | null;
offthreadVideoThreads: number | null;
} & RenderJobDynamicStatus)
| ({
@@ -141,6 +143,7 @@ type RenderJobDynamicFields =
numberOfGifLoops: number | null;
disallowParallelEncoding: boolean;
offthreadVideoCacheSizeInBytes: number | null;
+ videoCacheSizeInBytes: number | null;
offthreadVideoThreads: number | null;
colorSpace: ColorSpace;
forSeamlessAacConcatenation: boolean;
diff --git a/packages/studio/src/components/Modals.tsx b/packages/studio/src/components/Modals.tsx
index b9fd331510..f4adcf24ce 100644
--- a/packages/studio/src/components/Modals.tsx
+++ b/packages/studio/src/components/Modals.tsx
@@ -48,6 +48,9 @@ export const Modals: React.FC<{
initialOffthreadVideoThreads={
modalContextType.initialOffthreadVideoThreads
}
+ initialVideoCacheSizeInBytes={
+ modalContextType.initialVideoCacheSizeInBytes
+ }
initialConcurrency={modalContextType.initialConcurrency}
maxConcurrency={modalContextType.maxConcurrency}
minConcurrency={modalContextType.minConcurrency}
diff --git a/packages/studio/src/components/RenderButton.tsx b/packages/studio/src/components/RenderButton.tsx
index 491544894f..d03a14bcde 100644
--- a/packages/studio/src/components/RenderButton.tsx
+++ b/packages/studio/src/components/RenderButton.tsx
@@ -115,6 +115,7 @@ export const RenderButton: React.FC = () => {
defaulMetadata: defaults.metadata,
initialHardwareAcceleration: defaults.hardwareAcceleration,
initialChromeMode: defaults.chromeMode,
+ initialVideoCacheSizeInBytes: defaults.videoCacheSizeInBytes,
});
}, [video, setSelectedModal, getCurrentFrame, props, inFrame, outFrame]);
diff --git a/packages/studio/src/components/RenderModal/RenderModal.tsx b/packages/studio/src/components/RenderModal/RenderModal.tsx
index c7030b9a68..4c8a12c15d 100644
--- a/packages/studio/src/components/RenderModal/RenderModal.tsx
+++ b/packages/studio/src/components/RenderModal/RenderModal.tsx
@@ -222,6 +222,7 @@ type RenderModalProps = {
readonly initialGl: OpenGlRenderer | null;
readonly initialIgnoreCertificateErrors: boolean;
readonly initialOffthreadVideoCacheSizeInBytes: number | null;
+ readonly initialVideoCacheSizeInBytes: number | null;
readonly initialHeadless: boolean;
readonly initialColorSpace: ColorSpace;
readonly initialEncodingMaxRate: string | null;
@@ -276,6 +277,7 @@ const RenderModal: React.FC<
initialEncodingBufferSize,
initialEncodingMaxRate,
initialOffthreadVideoThreads,
+ initialVideoCacheSizeInBytes,
initialUserAgent,
defaultProps,
inFrameMark,
@@ -490,6 +492,9 @@ const RenderModal: React.FC<
const [offthreadVideoCacheSizeInBytes, setOffthreadVideoCacheSizeInBytes] =
useState<number | null>(initialOffthreadVideoCacheSizeInBytes);
+ const [videoCacheSizeInBytes, setVideoCacheSizeInBytes] = useState<
+ number | null
+ >(initialVideoCacheSizeInBytes);
const [offthreadVideoThreads, setOffthreadVideoThreads] = useState<
number | null
@@ -762,6 +767,7 @@ const RenderModal: React.FC<
metadata,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
})
.then(() => {
dispatchIfMounted({type: 'succeed'});
@@ -791,6 +797,7 @@ const RenderModal: React.FC<
metadata,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
]);
const [everyNthFrameSetting, setEveryNthFrameSetting] = useState(
@@ -866,6 +873,7 @@ const RenderModal: React.FC<
hardwareAcceleration,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
})
.then(() => {
dispatchIfMounted({type: 'succeed'});
@@ -919,6 +927,7 @@ const RenderModal: React.FC<
hardwareAcceleration,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
]);
const onClickSequence = useCallback(() => {
@@ -948,6 +957,7 @@ const RenderModal: React.FC<
metadata,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
})
.then(() => {
dispatchIfMounted({type: 'succeed'});
@@ -981,6 +991,7 @@ const RenderModal: React.FC<
metadata,
chromeMode,
offthreadVideoThreads,
+ videoCacheSizeInBytes,
]);
useEffect(() => {
@@ -1434,6 +1445,8 @@ const RenderModal: React.FC<
setEnvVariables={setEnvVariables}
envVariables={envVariables}
offthreadVideoCacheSizeInBytes={offthreadVideoCacheSizeInBytes}
+ setVideoCacheSizeInBytes={setVideoCacheSizeInBytes}
+ videoCacheSizeInBytes={videoCacheSizeInBytes}
setOffthreadVideoCacheSizeInBytes={
setOffthreadVideoCacheSizeInBytes
}
diff --git a/packages/studio/src/components/RenderModal/RenderModalAdvanced.tsx b/packages/studio/src/components/RenderModal/RenderModalAdvanced.tsx
index 215064cba4..c04c38c987 100644
--- a/packages/studio/src/components/RenderModal/RenderModalAdvanced.tsx
+++ b/packages/studio/src/components/RenderModal/RenderModalAdvanced.tsx
@@ -67,6 +67,10 @@ export const RenderModalAdvanced: React.FC<{
readonly setOffthreadVideoCacheSizeInBytes: React.Dispatch<
React.SetStateAction<number | null>
>;
+ readonly videoCacheSizeInBytes: number | null;
+ readonly setVideoCacheSizeInBytes: React.Dispatch<
+ React.SetStateAction<number | null>
+ >;
readonly offthreadVideoThreads: number | null;
readonly setOffthreadVideoThreads: React.Dispatch<
React.SetStateAction<number | null>
@@ -105,6 +109,8 @@ export const RenderModalAdvanced: React.FC<{
setx264Preset,
x264Preset,
codec,
+ setVideoCacheSizeInBytes,
+ videoCacheSizeInBytes,
offthreadVideoCacheSizeInBytes,
setOffthreadVideoCacheSizeInBytes,
offthreadVideoThreads,
@@ -134,6 +140,16 @@ export const RenderModalAdvanced: React.FC<{
];
}, []);
+ const toggleCustomVideoCacheSizeInBytes = useCallback(() => {
+ setVideoCacheSizeInBytes((previous) => {
+ if (previous === null) {
+ return 1000 * 1000 * 1000;
+ }
+
+ return null;
+ });
+ }, [setVideoCacheSizeInBytes]);
+
const toggleCustomOffthreadVideoCacheSizeInBytes = useCallback(() => {
setOffthreadVideoCacheSizeInBytes((previous) => {
if (previous === null) {
@@ -290,6 +306,25 @@ export const RenderModalAdvanced: React.FC<{
);
}, [hardwareAcceleration, setHardwareAcceleration]);
+ const changeVideoCacheSizeInBytes: React.Dispatch<
+ React.SetStateAction<number>
+ > = useCallback(
+ (cb) => {
+ setVideoCacheSizeInBytes((prev) => {
+ if (prev === null) {
+ throw new TypeError('Expected previous value');
+ }
+
+ if (typeof cb === 'function') {
+ return cb(prev);
+ }
+
+ return cb;
+ });
+ },
+ [setVideoCacheSizeInBytes],
+ );
+
const changeOffthreadVideoCacheSizeInBytes: React.Dispatch<
React.SetStateAction<number>
> = useCallback(
@@ -395,6 +430,31 @@ export const RenderModalAdvanced: React.FC<{
/>
</div>
</div>
+ {renderMode === 'audio' ? null : (
+ <div style={optionRow}>
+ <div style={label}>Custom Video cache</div>
+ <Spacing x={0.5} />
+ <OptionExplainerBubble id="videoCacheSizeInBytesOption" />
+ <div style={rightRow}>
+ <Checkbox
+ checked={videoCacheSizeInBytes !== null}
+ onChange={toggleCustomVideoCacheSizeInBytes}
+ name="video-cache-size"
+ />
+ </div>
+ </div>
+ )}
+ {renderMode === 'audio' || videoCacheSizeInBytes === null ? null : (
+ <NumberSetting
+ min={0}
+ max={2000 * 1024 * 1024}
+ step={1024}
+ name="Video cache size"
+ formatter={(w) => `${w} bytes`}
+ onValueChanged={changeVideoCacheSizeInBytes}
+ value={videoCacheSizeInBytes}
+ />
+ )}
{renderMode === 'audio' ? null : (
<div style={optionRow}>
<div style={label}>Custom OffthreadVideo cache</div>
diff --git a/packages/studio/src/components/RenderQueue/actions.ts b/packages/studio/src/components/RenderQueue/actions.ts
index 121b154019..b1e35acbdd 100644
--- a/packages/studio/src/components/RenderQueue/actions.ts
+++ b/packages/studio/src/components/RenderQueue/actions.ts
@@ -42,6 +42,7 @@ export const addStillRenderJob = ({
beepOnFinish,
metadata,
chromeMode,
+ videoCacheSizeInBytes,
}: {
compositionId: string;
outName: string;
@@ -60,6 +61,7 @@ export const addStillRenderJob = ({
beepOnFinish: boolean;
metadata: Record<string, string> | null;
chromeMode: ChromeMode;
+ videoCacheSizeInBytes: number | null;
}) => {
return callApi('/api/render', {
compositionId,
@@ -85,6 +87,7 @@ export const addStillRenderJob = ({
beepOnFinish,
metadata,
chromeMode,
+ videoCacheSizeInBytes,
});
};
@@ -110,6 +113,7 @@ export const addSequenceRenderJob = ({
repro,
metadata,
chromeMode,
+ videoCacheSizeInBytes,
}: {
compositionId: string;
outName: string;
@@ -132,6 +136,7 @@ export const addSequenceRenderJob = ({
repro: boolean;
metadata: Record<string, string> | null;
chromeMode: ChromeMode;
+ videoCacheSizeInBytes: number | null;
}) => {
return callApi('/api/render', {
compositionId,
@@ -161,6 +166,7 @@ export const addSequenceRenderJob = ({
repro,
metadata,
chromeMode,
+ videoCacheSizeInBytes,
});
};
@@ -204,6 +210,7 @@ export const addVideoRenderJob = ({
metadata,
hardwareAcceleration,
chromeMode,
+ videoCacheSizeInBytes,
}: {
compositionId: string;
outName: string;
@@ -244,6 +251,7 @@ export const addVideoRenderJob = ({
metadata: Record<string, string> | null;
hardwareAcceleration: HardwareAccelerationOption;
chromeMode: ChromeMode;
+ videoCacheSizeInBytes: number | null;
}) => {
return callApi('/api/render', {
compositionId,
@@ -291,6 +299,7 @@ export const addVideoRenderJob = ({
metadata,
hardwareAcceleration,
chromeMode,
+ videoCacheSizeInBytes,
});
};
diff --git a/packages/studio/src/components/SidebarRenderButton.tsx b/packages/studio/src/components/SidebarRenderButton.tsx
index c905fdaeab..8d439a7451 100644
--- a/packages/studio/src/components/SidebarRenderButton.tsx
+++ b/packages/studio/src/components/SidebarRenderButton.tsx
@@ -96,6 +96,7 @@ export const SidebarRenderButton: React.FC<{
defaulMetadata: defaults.metadata,
initialHardwareAcceleration: defaults.hardwareAcceleration,
initialChromeMode: defaults.chromeMode,
+ initialVideoCacheSizeInBytes: defaults.videoCacheSizeInBytes,
});
if (isMobileLayout) {
diff --git a/packages/studio/src/helpers/retry-payload.ts b/packages/studio/src/helpers/retry-payload.ts
index d0b26d3f94..410e5fc5bd 100644
--- a/packages/studio/src/helpers/retry-payload.ts
+++ b/packages/studio/src/helpers/retry-payload.ts
@@ -66,6 +66,7 @@ export const makeRetryPayload = (job: RenderJob): RenderModalState => {
renderTypeOfLastRender: 'still',
initialHardwareAcceleration: defaults.hardwareAcceleration,
initialChromeMode: job.chromeMode,
+ initialVideoCacheSizeInBytes: job.videoCacheSizeInBytes,
};
}
@@ -119,6 +120,7 @@ export const makeRetryPayload = (job: RenderJob): RenderModalState => {
renderTypeOfLastRender: 'sequence',
initialHardwareAcceleration: defaults.hardwareAcceleration,
initialChromeMode: job.chromeMode,
+ initialVideoCacheSizeInBytes: job.videoCacheSizeInBytes,
};
}
@@ -173,6 +175,7 @@ export const makeRetryPayload = (job: RenderJob): RenderModalState => {
renderTypeOfLastRender: 'video',
initialHardwareAcceleration: job.hardwareAcceleration,
initialChromeMode: job.chromeMode,
+ initialVideoCacheSizeInBytes: job.videoCacheSizeInBytes,
};
}
diff --git a/packages/studio/src/state/modals.ts b/packages/studio/src/state/modals.ts
index 0bbc1e0c1c..b89eee108f 100644
--- a/packages/studio/src/state/modals.ts
+++ b/packages/studio/src/state/modals.ts
@@ -45,6 +45,7 @@ export type RenderModalState = {
initialOpenGlRenderer: OpenGlRenderer | null;
initialIgnoreCertificateErrors: boolean;
initialHeadless: boolean;
+ initialVideoCacheSizeInBytes: number | null;
initialOffthreadVideoCacheSizeInBytes: number | null;
initialOffthreadVideoThreads: number | null;
initialColorSpace: ColorSpace;
diff --git a/tsconfig.json b/tsconfig.json
index 6cf6589e2d..74090128bc 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -232,7 +232,7 @@
"path": "./packages/zod-types"
},
{
- "path": "./packages/video"
+ "path": "./packages/media"
},
{
"path": "./packages/web-renderer"