Skip to content

🎥 Make videos programmatically with React

fix staticfile non serializable values

Jonny Burger5fd2ac13b8ed
diff --git a/packages/cli/src/benchmark.ts b/packages/cli/src/benchmark.ts
index c137f03a74..b717058b40 100644
--- a/packages/cli/src/benchmark.ts
+++ b/packages/cli/src/benchmark.ts
@@ -213,7 +213,7 @@ export const benchmarkCommand = async (
const comps = await RenderInternals.internalGetCompositions({
serveUrlOrWebpackUrl: bundleLocation,
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
envVariables,
chromiumOptions,
timeoutInMilliseconds: puppeteerTimeout,
@@ -298,7 +298,7 @@ export const benchmarkCommand = async (
codec,
uiImageFormat: null,
}),
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
overwrite,
pixelFormat,
proResProfile,
diff --git a/packages/cli/src/compositions.ts b/packages/cli/src/compositions.ts
index 2e6bb3c9d4..d51eb16cce 100644
--- a/packages/cli/src/compositions.ts
+++ b/packages/cli/src/compositions.ts
@@ -65,7 +65,7 @@ export const listCompositionsCommand = async (
browserExecutable,
chromiumOptions,
envVariables,
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
timeoutInMilliseconds: puppeteerTimeout,
port,
indent: false,
diff --git a/packages/cli/src/editor/components/RenderModal/SchemaEditor/input-props-serialization.ts b/packages/cli/src/editor/components/RenderModal/SchemaEditor/input-props-serialization.ts
index 5226c76c40..89de0a0a15 100644
--- a/packages/cli/src/editor/components/RenderModal/SchemaEditor/input-props-serialization.ts
+++ b/packages/cli/src/editor/components/RenderModal/SchemaEditor/input-props-serialization.ts
@@ -51,6 +51,7 @@ export const serializeJSONWithDate = ({
},
indent
);
+
return {serializedString, customDateUsed, customFileUsed, mapUsed, setUsed};
};
diff --git a/packages/cli/src/editor/components/RenderQueue/actions.ts b/packages/cli/src/editor/components/RenderQueue/actions.ts
index 7a10a23afa..c2e924127f 100644
--- a/packages/cli/src/editor/components/RenderQueue/actions.ts
+++ b/packages/cli/src/editor/components/RenderQueue/actions.ts
@@ -86,7 +86,11 @@ export const addStillRenderJob = ({
chromiumOptions,
delayRenderTimeout,
envVariables,
- inputProps,
+ serializedInputPropsWithCustomSchema: serializeJSONWithDate({
+ data: inputProps,
+ staticBase: window.remotion_staticBase,
+ indent: undefined,
+ }).serializedString,
});
};
@@ -169,7 +173,11 @@ export const addVideoRenderJob = ({
disallowParallelEncoding,
chromiumOptions,
envVariables,
- inputProps,
+ serializedInputPropsWithCustomSchema: serializeJSONWithDate({
+ data: inputProps,
+ staticBase: window.remotion_staticBase,
+ indent: undefined,
+ }).serializedString,
});
};
diff --git a/packages/cli/src/get-composition-id.ts b/packages/cli/src/get-composition-id.ts
index 0df402063c..dae41f43d8 100644
--- a/packages/cli/src/get-composition-id.ts
+++ b/packages/cli/src/get-composition-id.ts
@@ -38,7 +38,7 @@ const getCompName = ({
export const getCompositionId = async ({
args,
compositionIdFromUi,
- inputProps,
+ serializedInputPropsWithCustomSchema,
puppeteerInstance,
envVariables,
timeoutInMilliseconds,
@@ -52,7 +52,7 @@ export const getCompositionId = async ({
}: {
args: string[];
compositionIdFromUi: string | null;
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
puppeteerInstance: HeadlessBrowser | undefined;
envVariables: Record<string, string>;
timeoutInMilliseconds: number;
@@ -81,7 +81,7 @@ export const getCompositionId = async ({
const {metadata: config, propsSize} =
await RenderInternals.internalSelectComposition({
id: compName,
- inputProps,
+ serializedInputPropsWithCustomSchema,
puppeteerInstance,
envVariables,
timeoutInMilliseconds,
@@ -117,7 +117,6 @@ export const getCompositionId = async ({
if (!process.env.CI) {
const comps = await RenderInternals.internalGetCompositions({
- inputProps,
puppeteerInstance,
envVariables,
timeoutInMilliseconds,
@@ -129,6 +128,7 @@ export const getCompositionId = async ({
server,
serveUrlOrWebpackUrl,
onBrowserLog: null,
+ serializedInputPropsWithCustomSchema,
});
const {compositionId, reason} = await showSingleCompositionsPicker(comps);
if (compositionId && typeof compositionId === 'string') {
diff --git a/packages/cli/src/get-composition-with-dimension-override.ts b/packages/cli/src/get-composition-with-dimension-override.ts
index 75f0c82e2b..b83bdc015c 100644
--- a/packages/cli/src/get-composition-with-dimension-override.ts
+++ b/packages/cli/src/get-composition-with-dimension-override.ts
@@ -21,7 +21,7 @@ export const getCompositionWithDimensionOverride = async ({
browserExecutable,
serveUrlOrWebpackUrl,
indent,
- inputProps,
+ serializedInputPropsWithCustomSchema,
logLevel,
server,
}: {
@@ -38,7 +38,7 @@ export const getCompositionWithDimensionOverride = async ({
serveUrlOrWebpackUrl: string;
indent: boolean;
logLevel: LogLevel;
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
server: RemotionServer;
}): Promise<{
compositionId: string;
@@ -55,7 +55,7 @@ export const getCompositionWithDimensionOverride = async ({
browserExecutable,
chromiumOptions,
envVariables,
- inputProps,
+ serializedInputPropsWithCustomSchema,
port,
puppeteerInstance,
timeoutInMilliseconds,
diff --git a/packages/cli/src/preview-server/render-queue/job.ts b/packages/cli/src/preview-server/render-queue/job.ts
index 5c6e0da3d6..b2aa66dabc 100644
--- a/packages/cli/src/preview-server/render-queue/job.ts
+++ b/packages/cli/src/preview-server/render-queue/job.ts
@@ -82,7 +82,7 @@ export type RenderJob = {
cancelToken: ReturnType<typeof makeCancelSignal>;
chromiumOptions: RequiredChromiumOptions;
envVariables: Record<string, string>;
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
} & RenderJobDynamicFields;
export type RenderJobWithCleanup = RenderJob & {
@@ -132,7 +132,7 @@ export type AddRenderRequest = {
chromiumOptions: RequiredChromiumOptions;
delayRenderTimeout: number;
envVariables: Record<string, string>;
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
} & AddRenderRequestDynamicFields;
export type RemoveRenderRequest = {
diff --git a/packages/cli/src/preview-server/render-queue/make-retry-payload.ts b/packages/cli/src/preview-server/render-queue/make-retry-payload.ts
index 8e1fa73a21..bfdc709f9c 100644
--- a/packages/cli/src/preview-server/render-queue/make-retry-payload.ts
+++ b/packages/cli/src/preview-server/render-queue/make-retry-payload.ts
@@ -7,6 +7,7 @@ import type {
import type {RenderModalState} from '../../editor/state/modals';
import {getDefaultCodecs} from './get-default-video-contexts';
import type {RenderJob} from './job';
+import {deserializeJSONWithCustomFields} from '../../editor/components/RenderModal/SchemaEditor/input-props-serialization';
export const makeRetryPayload = (job: RenderJob): RenderModalState => {
const defaults = window.remotion_renderDefaults;
@@ -52,7 +53,9 @@ export const makeRetryPayload = (job: RenderJob): RenderModalState => {
initialHeadless: job.chromiumOptions.headless,
initialIgnoreCertificateErrors:
job.chromiumOptions.ignoreCertificateErrors,
- defaultProps: job.inputProps,
+ defaultProps: deserializeJSONWithCustomFields(
+ job.serializedInputPropsWithCustomSchema
+ ),
inFrameMark: null,
outFrameMark: null,
};
@@ -97,7 +100,9 @@ export const makeRetryPayload = (job: RenderJob): RenderModalState => {
initialHeadless: job.chromiumOptions.headless,
initialIgnoreCertificateErrors:
job.chromiumOptions.ignoreCertificateErrors,
- defaultProps: job.inputProps,
+ defaultProps: deserializeJSONWithCustomFields(
+ job.serializedInputPropsWithCustomSchema
+ ),
inFrameMark: job.startFrame,
outFrameMark: job.endFrame,
};
diff --git a/packages/cli/src/preview-server/render-queue/process-still.ts b/packages/cli/src/preview-server/render-queue/process-still.ts
index 275b448ad4..e2d153fc1e 100644
--- a/packages/cli/src/preview-server/render-queue/process-still.ts
+++ b/packages/cli/src/preview-server/render-queue/process-still.ts
@@ -38,7 +38,8 @@ export const processStill = async ({
envVariables: job.envVariables,
height: null,
fullEntryPoint,
- inputProps: job.inputProps,
+ serializedInputPropsWithCustomSchema:
+ job.serializedInputPropsWithCustomSchema,
overwrite: true,
port,
publicDir,
diff --git a/packages/cli/src/preview-server/render-queue/process-video.ts b/packages/cli/src/preview-server/render-queue/process-video.ts
index fc4badb6a6..44ec99d603 100644
--- a/packages/cli/src/preview-server/render-queue/process-video.ts
+++ b/packages/cli/src/preview-server/render-queue/process-video.ts
@@ -37,7 +37,8 @@ export const processVideoJob = async ({
envVariables: job.envVariables,
height: null,
fullEntryPoint,
- inputProps: job.inputProps,
+ serializedInputPropsWithCustomSchema:
+ job.serializedInputPropsWithCustomSchema,
overwrite: true,
port,
publicDir,
diff --git a/packages/cli/src/preview-server/routes/add-render.ts b/packages/cli/src/preview-server/routes/add-render.ts
index 715890b0d8..42397f8105 100644
--- a/packages/cli/src/preview-server/routes/add-render.ts
+++ b/packages/cli/src/preview-server/routes/add-render.ts
@@ -46,7 +46,8 @@ export const handleAddRender: ApiHandler<AddRenderRequest, undefined> = ({
disallowParallelEncoding: input.disallowParallelEncoding,
chromiumOptions: input.chromiumOptions,
envVariables: input.envVariables,
- inputProps: input.inputProps,
+ serializedInputPropsWithCustomSchema:
+ input.serializedInputPropsWithCustomSchema,
},
});
}
@@ -71,7 +72,8 @@ export const handleAddRender: ApiHandler<AddRenderRequest, undefined> = ({
chromiumOptions: input.chromiumOptions,
delayRenderTimeout: input.delayRenderTimeout,
envVariables: input.envVariables,
- inputProps: input.inputProps,
+ serializedInputPropsWithCustomSchema:
+ input.serializedInputPropsWithCustomSchema,
},
entryPoint,
remotionRoot,
diff --git a/packages/cli/src/render-flows/render.ts b/packages/cli/src/render-flows/render.ts
index bddac450fb..8bec411ddf 100644
--- a/packages/cli/src/render-flows/render.ts
+++ b/packages/cli/src/render-flows/render.ts
@@ -57,7 +57,6 @@ export const renderVideoFlow = async ({
scale,
shouldOutputImageSequence,
publicDir,
- inputProps,
envVariables,
puppeteerTimeout,
port,
@@ -88,6 +87,7 @@ export const renderVideoFlow = async ({
videoBitrate,
numberOfGifLoops,
audioCodec,
+ serializedInputPropsWithCustomSchema,
disallowParallelEncoding,
}: {
remotionRoot: string;
@@ -101,7 +101,7 @@ export const renderVideoFlow = async ({
indent: boolean;
shouldOutputImageSequence: boolean;
publicDir: string | null;
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
envVariables: Record<string, string>;
puppeteerTimeout: number;
port: number | null;
@@ -267,7 +267,7 @@ export const renderVideoFlow = async ({
chromiumOptions,
envVariables,
indent,
- inputProps,
+ serializedInputPropsWithCustomSchema,
port,
puppeteerInstance,
serveUrlOrWebpackUrl: urlOrBundle,
@@ -366,7 +366,7 @@ export const renderVideoFlow = async ({
await RenderInternals.internalRenderFrames({
imageFormat,
- inputProps,
+ serializedInputPropsWithCustomSchema,
onFrameUpdate: (rendered) => {
(renderingProgress as RenderingProgressInput).frames = rendered;
updateRenderProgress(false);
@@ -419,7 +419,7 @@ export const renderVideoFlow = async ({
crf: crf ?? null,
envVariables,
frameRange,
- inputProps,
+ serializedInputPropsWithCustomSchema,
overwrite,
pixelFormat,
proResProfile,
diff --git a/packages/cli/src/render-flows/still.ts b/packages/cli/src/render-flows/still.ts
index df522d9c70..df74585e6b 100644
--- a/packages/cli/src/render-flows/still.ts
+++ b/packages/cli/src/render-flows/still.ts
@@ -50,7 +50,7 @@ export const renderStillFlow = async ({
chromiumOptions,
envVariables,
height,
- inputProps,
+ serializedInputPropsWithCustomSchema,
overwrite,
port,
publicDir,
@@ -72,7 +72,7 @@ export const renderStillFlow = async ({
fullEntryPoint: string;
entryPointReason: string;
remainingArgs: string[];
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
envVariables: Record<string, string>;
jpegQuality: number;
browser: Browser;
@@ -189,7 +189,7 @@ export const renderStillFlow = async ({
chromiumOptions,
envVariables,
indent: indentOutput,
- inputProps,
+ serializedInputPropsWithCustomSchema,
port,
puppeteerInstance,
serveUrlOrWebpackUrl: urlOrBundle,
@@ -284,7 +284,7 @@ export const renderStillFlow = async ({
jpegQuality,
envVariables,
imageFormat,
- inputProps,
+ serializedInputPropsWithCustomSchema,
chromiumOptions,
timeoutInMilliseconds: puppeteerTimeout,
scale,
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index 2fa8a1423c..ee05ace871 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -81,7 +81,7 @@ export const render = async (remotionRoot: string, args: string[]) => {
shouldOutputImageSequence,
publicDir,
envVariables,
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
puppeteerTimeout,
port,
height,
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.ts
index 92018d1d21..6e2948cebb 100644
--- a/packages/cli/src/still.ts
+++ b/packages/cli/src/still.ts
@@ -63,7 +63,7 @@ export const still = async (remotionRoot: string, args: string[]) => {
chromiumOptions,
envVariables,
height,
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
overwrite,
port,
publicDir,
diff --git a/packages/compositor-darwin-arm64/compositor b/packages/compositor-darwin-arm64/compositor
index 2f4de54bfa..7c6369b4fa 100755
Binary files a/packages/compositor-darwin-arm64/compositor and b/packages/compositor-darwin-arm64/compositor differ
diff --git a/packages/lambda/src/api/get-compositions-on-lambda.ts b/packages/lambda/src/api/get-compositions-on-lambda.ts
index ec2b237180..42d4c07ad1 100644
--- a/packages/lambda/src/api/get-compositions-on-lambda.ts
+++ b/packages/lambda/src/api/get-compositions-on-lambda.ts
@@ -6,9 +6,9 @@ import {LambdaRoutines} from '../defaults';
import {callLambda} from '../shared/call-lambda';
import {
getNeedsToUpload,
- serializeInputProps,
+ compressInputProps,
serializeOrThrow,
-} from '../shared/serialize-props';
+} from '../shared/compress-props';
export type GetCompositionsOnLambdaInput = {
chromiumOptions?: ChromiumOptions;
@@ -55,7 +55,7 @@ export const getCompositionsOnLambda = async ({
}: GetCompositionsOnLambdaInput): Promise<GetCompositionsOnLambdaOutput> => {
const stringifiedInputProps = serializeOrThrow(inputProps, 'input-props');
- const serializedInputProps = await serializeInputProps({
+ const serializedInputProps = await compressInputProps({
stringifiedInputProps,
region,
userSpecifiedBucketName: bucketName ?? null,
diff --git a/packages/lambda/src/api/make-lambda-payload.ts b/packages/lambda/src/api/make-lambda-payload.ts
index 791a1c81f6..2edad4f5a9 100644
--- a/packages/lambda/src/api/make-lambda-payload.ts
+++ b/packages/lambda/src/api/make-lambda-payload.ts
@@ -3,9 +3,9 @@ import type {LambdaStartPayload, LambdaStatusPayload} from '../defaults';
import {LambdaRoutines} from '../defaults';
import {
getNeedsToUpload,
- serializeInputProps,
+ compressInputProps,
serializeOrThrow,
-} from '../shared/serialize-props';
+} from '../shared/compress-props';
import {validateDownloadBehavior} from '../shared/validate-download-behavior';
import {validateFramesPerLambda} from '../shared/validate-frames-per-lambda';
import {validateLambdaCodec} from '../shared/validate-lambda-codec';
@@ -70,7 +70,7 @@ export const makeLambdaRenderMediaPayload = async ({
'input-props'
);
- const serialized = await serializeInputProps({
+ const serialized = await compressInputProps({
stringifiedInputProps,
region,
needsToUpload: getNeedsToUpload('video-or-audio', stringifiedInputProps),
diff --git a/packages/lambda/src/api/render-still-on-lambda.ts b/packages/lambda/src/api/render-still-on-lambda.ts
index fbb0c0578d..9e67488b27 100644
--- a/packages/lambda/src/api/render-still-on-lambda.ts
+++ b/packages/lambda/src/api/render-still-on-lambda.ts
@@ -12,9 +12,9 @@ import type {DownloadBehavior} from '../shared/content-disposition-header';
import {getCloudwatchStreamUrl} from '../shared/get-aws-urls';
import {
getNeedsToUpload,
- serializeInputProps,
+ compressInputProps,
serializeOrThrow,
-} from '../shared/serialize-props';
+} from '../shared/compress-props';
export type RenderStillOnLambdaInput = {
region: AwsRegion;
@@ -105,7 +105,7 @@ export const renderStillOnLambda = async ({
const stringifiedInputProps = serializeOrThrow(inputProps, 'input-props');
- const serializedInputProps = await serializeInputProps({
+ const serializedInputProps = await compressInputProps({
stringifiedInputProps,
region,
needsToUpload: getNeedsToUpload('still', stringifiedInputProps),
diff --git a/packages/lambda/src/cli/commands/render/render.ts b/packages/lambda/src/cli/commands/render/render.ts
index 0d32cd2e86..a2578854ad 100644
--- a/packages/lambda/src/cli/commands/render/render.ts
+++ b/packages/lambda/src/cli/commands/render/render.ts
@@ -94,7 +94,7 @@ export const renderCommand = async (args: string[], remotionRoot: string) => {
envVariables,
height,
indent: false,
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
port,
puppeteerInstance: undefined,
serveUrlOrWebpackUrl: serveUrl,
diff --git a/packages/lambda/src/cli/commands/still.ts b/packages/lambda/src/cli/commands/still.ts
index 7ccf526136..aa8a5b1aa6 100644
--- a/packages/lambda/src/cli/commands/still.ts
+++ b/packages/lambda/src/cli/commands/still.ts
@@ -78,7 +78,7 @@ export const stillCommand = async (args: string[], remotionRoot: string) => {
browserExecutable,
chromiumOptions,
envVariables,
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
port,
puppeteerInstance: undefined,
timeoutInMilliseconds: puppeteerTimeout,
diff --git a/packages/lambda/src/functions/compositions.ts b/packages/lambda/src/functions/compositions.ts
index 4d255a7b8e..7ebb029bcb 100644
--- a/packages/lambda/src/functions/compositions.ts
+++ b/packages/lambda/src/functions/compositions.ts
@@ -6,7 +6,7 @@ import {LambdaRoutines} from '../defaults';
import {convertToServeUrl} from '../shared/convert-to-serve-url';
import {getBrowserInstance} from './helpers/get-browser-instance';
import {getCurrentRegionInFunction} from './helpers/get-current-region';
-import {deserializeInputProps} from '../shared/serialize-props';
+import {decompressInputProps} from '../shared/compress-props';
type Options = {
expectedBucketOwner: string;
@@ -46,7 +46,7 @@ export const compositionsHandler = async (
),
]);
- const inputProps = await deserializeInputProps({
+ const inputProps = await decompressInputProps({
bucketName,
expectedBucketOwner: options.expectedBucketOwner,
region: getCurrentRegionInFunction(),
@@ -63,7 +63,7 @@ export const compositionsHandler = async (
const compositions = await RenderInternals.internalGetCompositions({
serveUrlOrWebpackUrl: realServeUrl,
puppeteerInstance: browserInstance,
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
envVariables: lambdaParams.envVariables ?? {},
timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
chromiumOptions: lambdaParams.chromiumOptions,
diff --git a/packages/lambda/src/functions/helpers/validate-composition.ts b/packages/lambda/src/functions/helpers/validate-composition.ts
index 1c9a2972c6..aa81120662 100644
--- a/packages/lambda/src/functions/helpers/validate-composition.ts
+++ b/packages/lambda/src/functions/helpers/validate-composition.ts
@@ -13,7 +13,7 @@ type ValidateCompositionOptions = {
serveUrl: string;
composition: string;
browserInstance: Await<ReturnType<typeof openBrowser>>;
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
envVariables: Record<string, string>;
timeoutInMilliseconds: number;
chromiumOptions: ChromiumOptions;
@@ -28,7 +28,7 @@ export const validateComposition = async ({
serveUrl,
composition,
browserInstance,
- inputProps,
+ serializedInputPropsWithCustomSchema,
envVariables,
timeoutInMilliseconds,
chromiumOptions,
@@ -41,7 +41,7 @@ export const validateComposition = async ({
const {metadata: comp} = await RenderInternals.internalSelectComposition({
id: composition,
puppeteerInstance: browserInstance,
- inputProps,
+ serializedInputPropsWithCustomSchema,
envVariables,
timeoutInMilliseconds,
chromiumOptions,
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index 808c25cee5..2301240676 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -45,11 +45,11 @@ import {
} from './helpers/write-lambda-error';
import {writePostRenderData} from './helpers/write-post-render-data';
import {
- deserializeInputProps,
+ decompressInputProps,
getNeedsToUpload,
- serializeInputProps,
+ compressInputProps,
serializeOrThrow,
-} from '../shared/serialize-props';
+} from '../shared/compress-props';
type Options = {
expectedBucketOwner: string;
@@ -166,7 +166,7 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
params.chromiumOptions
);
- const inputPropsPromise = deserializeInputProps({
+ const inputPropsPromise = decompressInputProps({
bucketName: params.bucketName,
expectedBucketOwner: options.expectedBucketOwner,
region: getCurrentRegionInFunction(),
@@ -180,7 +180,7 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
serveUrl: params.serveUrl,
composition: params.composition,
browserInstance,
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
envVariables: params.envVariables ?? {},
timeoutInMilliseconds: params.timeoutInMilliseconds,
chromiumOptions: params.chromiumOptions,
@@ -264,14 +264,14 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
);
const [serializedResolvedProps, serializedDefaultProps] = await Promise.all([
- serializeInputProps({
+ compressInputProps({
propsType: 'resolved-props',
region: getCurrentRegionInFunction(),
stringifiedInputProps: serializedResolved,
userSpecifiedBucketName: params.bucketName,
needsToUpload,
}),
- serializeInputProps({
+ compressInputProps({
propsType: 'default-props',
region: getCurrentRegionInFunction(),
stringifiedInputProps: serializedDefault,
diff --git a/packages/lambda/src/functions/renderer.ts b/packages/lambda/src/functions/renderer.ts
index faf8ed0deb..af908bbe19 100644
--- a/packages/lambda/src/functions/renderer.ts
+++ b/packages/lambda/src/functions/renderer.ts
@@ -25,7 +25,7 @@ import {
getTmpDirStateIfENoSp,
writeLambdaError,
} from './helpers/write-lambda-error';
-import {deserializeInputProps} from '../shared/serialize-props';
+import {decompressInputProps} from '../shared/compress-props';
type Options = {
expectedBucketOwner: string;
@@ -47,7 +47,7 @@ const renderHandler = async (
);
}
- const inputPropsPromise = deserializeInputProps({
+ const inputPropsPromise = decompressInputProps({
bucketName: params.bucketName,
expectedBucketOwner: options.expectedBucketOwner,
region: getCurrentRegionInFunction(),
@@ -55,7 +55,7 @@ const renderHandler = async (
propsType: 'input-props',
});
- const resolvedPropsPromise = deserializeInputProps({
+ const resolvedPropsPromise = decompressInputProps({
bucketName: params.bucketName,
expectedBucketOwner: options.expectedBucketOwner,
region: getCurrentRegionInFunction(),
@@ -63,7 +63,7 @@ const renderHandler = async (
propsType: 'resolved-props',
});
- const defaultPropsPromise = deserializeInputProps({
+ const defaultPropsPromise = decompressInputProps({
bucketName: params.bucketName,
expectedBucketOwner: options.expectedBucketOwner,
region: getCurrentRegionInFunction(),
@@ -134,7 +134,7 @@ const renderHandler = async (
defaultProps,
},
imageFormat: params.imageFormat,
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
frameRange: params.frameRange,
onProgress: ({renderedFrames, encodedFrames, stitchStage}) => {
if (
diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.ts
index 6f6fbfd90e..8445019903 100644
--- a/packages/lambda/src/functions/still.ts
+++ b/packages/lambda/src/functions/still.ts
@@ -39,7 +39,7 @@ import {
getTmpDirStateIfENoSp,
writeLambdaError,
} from './helpers/write-lambda-error';
-import {deserializeInputProps} from '../shared/serialize-props';
+import {decompressInputProps} from '../shared/compress-props';
type Options = {
expectedBucketOwner: string;
@@ -89,7 +89,7 @@ const innerStillHandler = async (
const outputPath = path.join(outputDir, 'output');
const region = getCurrentRegionInFunction();
- const inputProps = await deserializeInputProps({
+ const inputProps = await decompressInputProps({
bucketName,
expectedBucketOwner: options.expectedBucketOwner,
region,
@@ -116,7 +116,7 @@ const innerStillHandler = async (
serveUrl,
browserInstance,
composition: lambdaParams.composition,
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
envVariables: lambdaParams.envVariables ?? {},
chromiumOptions: lambdaParams.chromiumOptions,
timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
@@ -171,7 +171,9 @@ const innerStillHandler = async (
durationInFrames: composition.durationInFrames,
}),
imageFormat: lambdaParams.imageFormat as StillImageFormat,
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(
+ lambdaParams.inputProps
+ ),
overwrite: false,
puppeteerInstance: browserInstance,
jpegQuality:
diff --git a/packages/lambda/src/shared/serialize-props.ts b/packages/lambda/src/shared/compress-props.ts
similarity index 97%
rename from packages/lambda/src/shared/serialize-props.ts
rename to packages/lambda/src/shared/compress-props.ts
index 32d498ea8b..fee004e3aa 100644
--- a/packages/lambda/src/shared/serialize-props.ts
+++ b/packages/lambda/src/shared/compress-props.ts
@@ -41,7 +41,7 @@ export const getNeedsToUpload = (
return false;
};
-export const serializeInputProps = async ({
+export const compressInputProps = async ({
stringifiedInputProps,
region,
userSpecifiedBucketName,
@@ -88,7 +88,7 @@ export const serializeInputProps = async ({
};
};
-export const deserializeInputProps = async ({
+export const decompressInputProps = async ({
serialized,
region,
bucketName,
diff --git a/packages/renderer/src/get-compositions.ts b/packages/renderer/src/get-compositions.ts
index 40c158d2a6..d6f00d86b0 100644
--- a/packages/renderer/src/get-compositions.ts
+++ b/packages/renderer/src/get-compositions.ts
@@ -18,7 +18,7 @@ import {type LogLevel} from './log-level';
import {getLogLevel} from './logger';
type InternalGetCompositionsOptions = {
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
envVariables: Record<string, string>;
puppeteerInstance: HeadlessBrowser | undefined;
onBrowserLog: null | ((log: BrowserLog) => void);
@@ -45,7 +45,7 @@ export type GetCompositionsOptions = {
};
type InnerGetCompositionsParams = {
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
envVariables: Record<string, string>;
onBrowserLog: null | ((log: BrowserLog) => void);
timeoutInMilliseconds: number;
@@ -56,7 +56,7 @@ type InnerGetCompositionsParams = {
const innerGetCompositions = async ({
envVariables,
- inputProps,
+ serializedInputPropsWithCustomSchema,
onBrowserLog,
page,
proxyPort,
@@ -76,7 +76,7 @@ const innerGetCompositions = async ({
validatePuppeteerTimeout(timeoutInMilliseconds);
await setPropsAndEnv({
- inputProps,
+ serializedInputPropsWithCustomSchema,
envVariables,
page,
serveUrl,
@@ -119,7 +119,7 @@ export const internalGetCompositions = async ({
chromiumOptions,
envVariables,
indent,
- inputProps,
+ serializedInputPropsWithCustomSchema,
onBrowserLog,
port,
puppeteerInstance,
@@ -173,7 +173,7 @@ export const internalGetCompositions = async ({
return innerGetCompositions({
envVariables,
- inputProps,
+ serializedInputPropsWithCustomSchema,
onBrowserLog,
page,
proxyPort: offthreadPort,
@@ -219,7 +219,7 @@ export const getCompositions = (
browserExecutable: browserExecutable ?? null,
chromiumOptions: chromiumOptions ?? {},
envVariables: envVariables ?? {},
- inputProps: inputProps ?? {},
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps ?? {}),
indent: false,
onBrowserLog: onBrowserLog ?? null,
port: port ?? null,
diff --git a/packages/renderer/src/render-frames.ts b/packages/renderer/src/render-frames.ts
index dbc871490b..0154ed769b 100644
--- a/packages/renderer/src/render-frames.ts
+++ b/packages/renderer/src/render-frames.ts
@@ -63,7 +63,6 @@ export type InternalRenderFramesOptions = {
timeToRenderInMilliseconds: number
) => void);
outputDir: string | null;
- inputProps: Record<string, unknown>;
envVariables: Record<string, string>;
imageFormat: VideoImageFormat;
jpegQuality: number;
@@ -86,6 +85,7 @@ export type InternalRenderFramesOptions = {
concurrency: number | string | null;
webpackBundleOrServeUrl: string;
logLevel: LogLevel;
+ serializedInputPropsWithCustomSchema: string;
};
type InnerRenderFramesOptions = {
@@ -98,7 +98,6 @@ type InnerRenderFramesOptions = {
timeToRenderInMilliseconds: number
) => void);
outputDir: string | null;
- inputProps: Record<string, unknown>;
envVariables: Record<string, string>;
imageFormat: VideoImageFormat;
jpegQuality: number;
@@ -124,6 +123,7 @@ type InnerRenderFramesOptions = {
serveUrl: string;
logLevel: LogLevel;
indent: boolean;
+ serializedInputPropsWithCustomSchema: string;
};
export type RenderFramesOptions = {
@@ -134,7 +134,7 @@ export type RenderFramesOptions = {
timeToRenderInMilliseconds: number
) => void;
outputDir: string | null;
- inputProps: Record<string, unknown>;
+ inputProps?: Record<string, unknown>;
envVariables?: Record<string, string>;
imageFormat?: VideoImageFormat;
/**
@@ -173,7 +173,7 @@ const innerRenderFrames = async ({
onFrameUpdate,
outputDir,
onStart,
- inputProps,
+ serializedInputPropsWithCustomSchema,
jpegQuality,
imageFormat,
frameRange,
@@ -244,7 +244,7 @@ const innerRenderFrames = async ({
const initialFrame = realFrameRange[0];
await setPropsAndEnv({
- inputProps,
+ serializedInputPropsWithCustomSchema,
envVariables,
page,
serveUrl,
@@ -565,7 +565,6 @@ export const internalRenderFrames = ({
frameRange,
imageFormat,
indent,
- inputProps,
jpegQuality,
muted,
onBrowserLog,
@@ -581,6 +580,7 @@ export const internalRenderFrames = ({
timeoutInMilliseconds,
logLevel,
webpackBundleOrServeUrl,
+ serializedInputPropsWithCustomSchema,
}: InternalRenderFramesOptions): Promise<RenderFramesOutput> => {
Internals.validateDimension(
composition.height,
@@ -700,7 +700,6 @@ export const internalRenderFrames = ({
everyNthFrame,
frameRange,
imageFormat,
- inputProps,
jpegQuality,
muted,
onBrowserLog,
@@ -712,6 +711,7 @@ export const internalRenderFrames = ({
timeoutInMilliseconds,
logLevel,
indent,
+ serializedInputPropsWithCustomSchema,
});
}
),
@@ -823,7 +823,7 @@ export const renderFrames = (
indent: false,
jpegQuality: jpegQuality ?? DEFAULT_JPEG_QUALITY,
onDownload: onDownload ?? null,
- inputProps,
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps ?? {}),
puppeteerInstance,
muted: muted ?? false,
onBrowserLog: onBrowserLog ?? null,
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index 497cc2af9d..60c0af1953 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -80,7 +80,7 @@ export type InternalRenderMediaOptions = {
outputLocation: string | null;
codec: Codec;
composition: VideoConfig;
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
crf: number | null;
imageFormat: VideoImageFormat;
pixelFormat: PixelFormat;
@@ -180,7 +180,7 @@ export const internalRenderMedia = ({
proResProfile,
crf,
composition,
- inputProps,
+ serializedInputPropsWithCustomSchema,
pixelFormat,
codec,
envVariables,
@@ -498,7 +498,7 @@ export const internalRenderMedia = ({
callUpdate();
onStart?.(data);
},
- inputProps,
+ serializedInputPropsWithCustomSchema,
envVariables,
imageFormat,
jpegQuality,
@@ -734,7 +734,7 @@ export const renderMedia = ({
ffmpegOverride: ffmpegOverride ?? undefined,
frameRange: frameRange ?? null,
imageFormat: imageFormat ?? DEFAULT_VIDEO_IMAGE_FORMAT,
- inputProps: inputProps ?? {},
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps ?? {}),
jpegQuality: jpegQuality ?? quality ?? DEFAULT_JPEG_QUALITY,
muted: muted ?? false,
numberOfGifLoops: numberOfGifLoops ?? null,
diff --git a/packages/renderer/src/render-still.ts b/packages/renderer/src/render-still.ts
index 70ff8b7a9e..8621d3ffbc 100644
--- a/packages/renderer/src/render-still.ts
+++ b/packages/renderer/src/render-still.ts
@@ -42,7 +42,7 @@ type InternalRenderStillOptions = {
composition: VideoConfig;
output: string | null;
frame: number;
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
imageFormat: StillImageFormat;
jpegQuality: number;
puppeteerInstance: HeadlessBrowser | null;
@@ -104,7 +104,7 @@ const innerRenderStill = async ({
serveUrl,
puppeteerInstance,
onError,
- inputProps,
+ serializedInputPropsWithCustomSchema,
envVariables,
output,
frame = 0,
@@ -250,7 +250,7 @@ const innerRenderStill = async ({
}
await setPropsAndEnv({
- inputProps,
+ serializedInputPropsWithCustomSchema,
envVariables,
page,
serveUrl,
@@ -425,7 +425,7 @@ export const renderStill = (
frame: frame ?? 0,
imageFormat: imageFormat ?? DEFAULT_STILL_IMAGE_FORMAT,
indent: false,
- inputProps: inputProps ?? {},
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps ?? {}),
jpegQuality: jpegQuality ?? quality ?? DEFAULT_JPEG_QUALITY,
onBrowserLog: onBrowserLog ?? null,
onDownload: onDownload ?? null,
diff --git a/packages/renderer/src/select-composition.ts b/packages/renderer/src/select-composition.ts
index 11569682b8..eece7c238c 100644
--- a/packages/renderer/src/select-composition.ts
+++ b/packages/renderer/src/select-composition.ts
@@ -18,7 +18,7 @@ import {validatePuppeteerTimeout} from './validate-puppeteer-timeout';
import {type LogLevel} from './log-level';
type InternalSelectCompositionsConfig = {
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
envVariables: Record<string, string>;
puppeteerInstance: HeadlessBrowser | undefined;
onBrowserLog: null | ((log: BrowserLog) => void);
@@ -60,7 +60,7 @@ type InnerSelectCompositionConfig = Omit<
const innerSelectComposition = async ({
page,
onBrowserLog,
- inputProps,
+ serializedInputPropsWithCustomSchema,
envVariables,
serveUrl,
timeoutInMilliseconds,
@@ -82,7 +82,7 @@ const innerSelectComposition = async ({
validatePuppeteerTimeout(timeoutInMilliseconds);
await setPropsAndEnv({
- inputProps,
+ serializedInputPropsWithCustomSchema,
envVariables,
page,
serveUrl,
@@ -152,7 +152,7 @@ export const internalSelectComposition = async (
port,
envVariables,
id,
- inputProps,
+ serializedInputPropsWithCustomSchema,
onBrowserLog,
server,
timeoutInMilliseconds,
@@ -207,7 +207,7 @@ export const internalSelectComposition = async (
chromiumOptions,
envVariables,
id,
- inputProps,
+ serializedInputPropsWithCustomSchema,
onBrowserLog,
timeoutInMilliseconds,
logLevel,
@@ -257,7 +257,7 @@ export const selectComposition = async (
browserExecutable: browserExecutable ?? null,
chromiumOptions: chromiumOptions ?? {},
envVariables: envVariables ?? {},
- inputProps: inputProps ?? {},
+ serializedInputPropsWithCustomSchema: JSON.stringify(inputProps ?? {}),
onBrowserLog: onBrowserLog ?? null,
port: port ?? null,
puppeteerInstance,
diff --git a/packages/renderer/src/set-props-and-env.ts b/packages/renderer/src/set-props-and-env.ts
index 72fa497a7d..1f43cd37da 100644
--- a/packages/renderer/src/set-props-and-env.ts
+++ b/packages/renderer/src/set-props-and-env.ts
@@ -8,7 +8,7 @@ import {validatePuppeteerTimeout} from './validate-puppeteer-timeout';
import {Log} from './logger';
type SetPropsAndEnv = {
- inputProps: Record<string, unknown>;
+ serializedInputPropsWithCustomSchema: string;
envVariables: Record<string, string> | undefined;
page: Page;
serveUrl: string;
@@ -21,7 +21,7 @@ type SetPropsAndEnv = {
};
const innerSetPropsAndEnv = async ({
- inputProps,
+ serializedInputPropsWithCustomSchema,
envVariables,
page,
serveUrl,
@@ -43,15 +43,9 @@ const innerSetPropsAndEnv = async ({
window.remotion_puppeteerTimeout = timeout;
}, actualTimeout);
- if (typeof inputProps === 'string') {
- throw new Error('Input props should be an object, not a string.');
- }
-
- if (inputProps) {
- await page.evaluateOnNewDocument((input: string) => {
- window.remotion_inputProps = input;
- }, JSON.stringify(inputProps));
- }
+ await page.evaluateOnNewDocument((input: string) => {
+ window.remotion_inputProps = input;
+ }, serializedInputPropsWithCustomSchema);
if (envVariables) {
await page.evaluateOnNewDocument((input: string) => {
@@ -95,7 +89,7 @@ const innerSetPropsAndEnv = async ({
return innerSetPropsAndEnv({
envVariables,
initialFrame,
- inputProps,
+ serializedInputPropsWithCustomSchema,
page,
proxyPort,
retriesRemaining: retriesRemaining - 1,
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index aec2785a5c..bcb41502aa 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1,9 +1,5 @@
lockfileVersion: '6.0'
-settings:
- autoInstallPeers: true
- excludeLinksFromLockfile: false
-
importers:
.:
@@ -89,7 +85,7 @@ importers:
version: 0.9.0
webpack:
specifier: 5.83.1
- version: 5.83.1
+ version: 5.83.1(@swc/[email protected])
devDependencies:
'@jonny/eslint-config':
specifier: 3.0.266
@@ -385,7 +381,7 @@ importers:
version: 0.31.1([email protected])
webpack:
specifier: 5.83.1
- version: 5.83.1
+ version: 5.83.1(@swc/[email protected])
zod:
specifier: 3.21.4
version: 3.21.4
@@ -1109,12 +1105,6 @@ importers:
specifier: workspace:*
version: link:../core
- packages/lambda-php-example/vendor/remotion/lambda:
- devDependencies:
- remotion:
- specifier: workspace:*
- version: link:../../../../core
-
packages/lottie:
dependencies:
lottie-web:
@@ -1361,7 +1351,7 @@ importers:
version: 0.31.1([email protected])
webpack:
specifier: 5.83.1
- version: 5.83.1
+ version: 5.83.1(@swc/[email protected])
zod:
specifier: ^3.21.4
version: 3.21.4
@@ -9926,7 +9916,7 @@ packages:
react-error-overlay: 7.0.0-next.117
react-refresh: 0.9.0
sockjs-client: 1.5.2
- webpack: 5.83.1
+ webpack: 5.83.1(@swc/[email protected])
transitivePeerDependencies:
- eslint
- supports-color
@@ -10406,7 +10396,7 @@ packages:
loader-utils: 1.4.0
make-dir: 3.1.0
schema-utils: 2.7.1
- webpack: 5.83.1
+ webpack: 5.83.1(@swc/[email protected])
dev: false
@@ -13378,7 +13368,7 @@ packages:
semver: 5.7.1
tapable: 1.1.3
typescript: 4.9.5
- webpack: 5.83.1
+ webpack: 5.83.1(@swc/[email protected])
worker-rpc: 0.1.1
transitivePeerDependencies:
- supports-color
@@ -17169,7 +17159,7 @@ packages:
klona: 2.0.6
postcss: 8.4.21
semver: 7.5.3
- webpack: 5.83.1
+ webpack: 5.83.1(@swc/[email protected])
dev: false
@@ -18300,7 +18290,7 @@ packages:
strip-ansi: 6.0.0
text-table: 0.2.0
typescript: 4.9.5
- webpack: 5.83.1
+ webpack: 5.83.1(@swc/[email protected])
transitivePeerDependencies:
- eslint
- supports-color
@@ -20228,29 +20218,6 @@ packages:
terser: 5.17.5
webpack: 5.83.1([email protected])
- resolution: {integrity: sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==}
- engines: {node: '>= 10.13.0'}
- peerDependencies:
- '@swc/core': '*'
- esbuild: '*'
- uglify-js: '*'
- webpack: ^5.1.0
- peerDependenciesMeta:
- '@swc/core':
- optional: true
- esbuild:
- optional: true
- uglify-js:
- optional: true
- dependencies:
- '@jridgewell/trace-mapping': 0.3.18
- jest-worker: 27.5.1
- schema-utils: 3.1.2
- serialize-javascript: 6.0.1
- terser: 5.17.5
- webpack: 5.83.1
-
resolution: {integrity: sha512-NqFkzBX34WExkCbk3K5urmNCpEWqMPZnwGI1pMHwqvJ/zDlXC75u3NI7BrzoR8/pryy8Abx2e1i8ChrWkhH1Hg==}
engines: {node: '>=10'}
@@ -21774,45 +21741,6 @@ packages:
resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==}
engines: {node: '>=10.13.0'}
- resolution: {integrity: sha512-TNsG9jDScbNuB+Lb/3+vYolPplCS3bbEaJf+Bj0Gw4DhP3ioAflBb1flcRt9zsWITyvOhM96wMQNRWlSX52DgA==}
- engines: {node: '>=10.13.0'}
- hasBin: true
- peerDependencies:
- webpack-cli: '*'
- peerDependenciesMeta:
- webpack-cli:
- optional: true
- dependencies:
- '@types/eslint-scope': 3.7.3
- '@types/estree': 1.0.0
- '@webassemblyjs/ast': 1.11.6
- '@webassemblyjs/wasm-edit': 1.11.6
- '@webassemblyjs/wasm-parser': 1.11.6
- acorn: 8.8.2
- acorn-import-assertions: 1.8.0([email protected])
- browserslist: 4.21.5
- chrome-trace-event: 1.0.3
- enhanced-resolve: 5.14.0
- es-module-lexer: 1.2.1
- eslint-scope: 5.1.1
- events: 3.3.0
- glob-to-regexp: 0.4.1
- graceful-fs: 4.2.10
- json-parse-even-better-errors: 2.3.1
- loader-runner: 4.2.0
- mime-types: 2.1.34
- neo-async: 2.6.2
- schema-utils: 3.1.2
- tapable: 2.2.1
- terser-webpack-plugin: 5.3.9([email protected])
- watchpack: 2.4.0
- webpack-sources: 3.2.3
- transitivePeerDependencies:
- - '@swc/core'
- - esbuild
- - uglify-js
-
resolution: {integrity: sha512-TNsG9jDScbNuB+Lb/3+vYolPplCS3bbEaJf+Bj0Gw4DhP3ioAflBb1flcRt9zsWITyvOhM96wMQNRWlSX52DgA==}
engines: {node: '>=10.13.0'}
@@ -22245,3 +22173,7 @@ packages:
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
dev: false
+
+settings:
+ autoInstallPeers: true
+ excludeLinksFromLockfile: false