Skip to content

🎥 Make videos programmatically with React

use serialized string everywhere

Jonny Burger5c8c7493d950
diff --git a/packages/cli/src/compositions.ts b/packages/cli/src/compositions.ts
index d51eb16cce..9eed586a52 100644
--- a/packages/cli/src/compositions.ts
+++ b/packages/cli/src/compositions.ts
@@ -6,6 +6,7 @@ import {getCliOptions} from './get-cli-options';
import {Log} from './log';
import {printCompositions} from './print-compositions';
import {bundleOnCliOrTakeServeUrl} from './setup-cache';
+import {Internals} from 'remotion';
export const listCompositionsCommand = async (
remotionRoot: string,
@@ -65,7 +66,11 @@ export const listCompositionsCommand = async (
browserExecutable,
chromiumOptions,
envVariables,
- serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
+ serializedInputPropsWithCustomSchema: Internals.serializeJSONWithDate({
+ data: inputProps,
+ staticBase: null,
+ indent: undefined,
+ }).serializedString,
timeoutInMilliseconds: puppeteerTimeout,
port,
indent: false,
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index ee05ace871..a5824e0fcd 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -1,4 +1,5 @@
// eslint-disable-next-line no-restricted-imports
+import {Internals} from 'remotion';
import {registerCleanupJob} from './cleanup-before-quit';
import {ConfigInternals} from './config';
import {convertEntryPointToServeUrl} from './convert-entry-point-to-serve-url';
@@ -81,7 +82,11 @@ export const render = async (remotionRoot: string, args: string[]) => {
shouldOutputImageSequence,
publicDir,
envVariables,
- serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
+ serializedInputPropsWithCustomSchema: Internals.serializeJSONWithDate({
+ indent: undefined,
+ staticBase: null,
+ data: inputProps,
+ }).serializedString,
puppeteerTimeout,
port,
height,
diff --git a/packages/cli/src/still.ts b/packages/cli/src/still.ts
index 6e2948cebb..ac0853dede 100644
--- a/packages/cli/src/still.ts
+++ b/packages/cli/src/still.ts
@@ -1,3 +1,4 @@
+import {Internals} from 'remotion';
import {registerCleanupJob} from './cleanup-before-quit';
import {convertEntryPointToServeUrl} from './convert-entry-point-to-serve-url';
import {findEntryPoint} from './entry-point';
@@ -63,7 +64,11 @@ export const still = async (remotionRoot: string, args: string[]) => {
chromiumOptions,
envVariables,
height,
- serializedInputPropsWithCustomSchema: JSON.stringify(inputProps),
+ serializedInputPropsWithCustomSchema: Internals.serializeJSONWithDate({
+ data: inputProps,
+ indent: undefined,
+ staticBase: null,
+ }).serializedString,
overwrite,
port,
publicDir,
diff --git a/packages/lambda/src/functions/helpers/validate-composition.ts b/packages/lambda/src/functions/helpers/validate-composition.ts
index aa81120662..79003d4b8c 100644
--- a/packages/lambda/src/functions/helpers/validate-composition.ts
+++ b/packages/lambda/src/functions/helpers/validate-composition.ts
@@ -58,7 +58,5 @@ export const validateComposition = async ({
...comp,
height: forceHeight ?? comp.height,
width: forceWidth ?? comp.width,
- defaultProps: comp.defaultProps,
- props: comp.props,
};
};
diff --git a/packages/lambda/src/functions/still.ts b/packages/lambda/src/functions/still.ts
index c4bc0909e6..925ecb1eaa 100644
--- a/packages/lambda/src/functions/still.ts
+++ b/packages/lambda/src/functions/still.ts
@@ -40,6 +40,7 @@ import {
writeLambdaError,
} from './helpers/write-lambda-error';
import {decompressInputProps} from '../shared/compress-props';
+import {Internals} from 'remotion';
type Options = {
expectedBucketOwner: string;
@@ -171,9 +172,11 @@ const innerStillHandler = async (
durationInFrames: composition.durationInFrames,
}),
imageFormat: lambdaParams.imageFormat as StillImageFormat,
- serializedInputPropsWithCustomSchema: JSON.stringify(
- lambdaParams.inputProps
- ),
+ serializedInputPropsWithCustomSchema: Internals.serializeJSONWithDate({
+ data: lambdaParams.inputProps,
+ indent: undefined,
+ staticBase: null,
+ }).serializedString,
overwrite: false,
puppeteerInstance: browserInstance,
jpegQuality:
@@ -189,7 +192,11 @@ const innerStillHandler = async (
port: null,
server,
logLevel: lambdaParams.logLevel,
- serializedResolvedPropsWithCustomSchema: JSON.stringify(composition.props),
+ serializedResolvedPropsWithCustomSchema: Internals.serializeJSONWithDate({
+ indent: undefined,
+ staticBase: null,
+ data: composition.props,
+ }).serializedString,
});
const {key, renderBucketName, customCredentials} = getExpectedOutName(
diff --git a/packages/renderer/src/render-frames.ts b/packages/renderer/src/render-frames.ts
index 358cba87e5..9187806349 100644
--- a/packages/renderer/src/render-frames.ts
+++ b/packages/renderer/src/render-frames.ts
@@ -828,8 +828,16 @@ export const renderFrames = (
indent: false,
jpegQuality: jpegQuality ?? DEFAULT_JPEG_QUALITY,
onDownload: onDownload ?? null,
- serializedInputPropsWithCustomSchema: JSON.stringify(inputProps ?? {}),
- serializedResolvedPropsWithCustomSchema: JSON.stringify(composition.props),
+ serializedInputPropsWithCustomSchema: Internals.serializeJSONWithDate({
+ indent: undefined,
+ staticBase: null,
+ data: inputProps ?? {},
+ }).serializedString,
+ serializedResolvedPropsWithCustomSchema: Internals.serializeJSONWithDate({
+ indent: undefined,
+ staticBase: null,
+ data: composition.props,
+ }).serializedString,
puppeteerInstance,
muted: muted ?? false,
onBrowserLog: onBrowserLog ?? null,
diff --git a/packages/renderer/src/render-media.ts b/packages/renderer/src/render-media.ts
index 2288625401..e542e2e2a9 100644
--- a/packages/renderer/src/render-media.ts
+++ b/packages/renderer/src/render-media.ts
@@ -737,7 +737,11 @@ export const renderMedia = ({
ffmpegOverride: ffmpegOverride ?? undefined,
frameRange: frameRange ?? null,
imageFormat: imageFormat ?? DEFAULT_VIDEO_IMAGE_FORMAT,
- serializedInputPropsWithCustomSchema: JSON.stringify(inputProps ?? {}),
+ serializedInputPropsWithCustomSchema: Internals.serializeJSONWithDate({
+ indent: undefined,
+ staticBase: null,
+ data: inputProps ?? {},
+ }).serializedString,
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 88aabcfc2b..806391d251 100644
--- a/packages/renderer/src/render-still.ts
+++ b/packages/renderer/src/render-still.ts
@@ -427,7 +427,11 @@ export const renderStill = (
frame: frame ?? 0,
imageFormat: imageFormat ?? DEFAULT_STILL_IMAGE_FORMAT,
indent: false,
- serializedInputPropsWithCustomSchema: JSON.stringify(inputProps ?? {}),
+ serializedInputPropsWithCustomSchema: Internals.serializeJSONWithDate({
+ staticBase: null,
+ indent: undefined,
+ data: inputProps ?? {},
+ }).serializedString,
jpegQuality: jpegQuality ?? quality ?? DEFAULT_JPEG_QUALITY,
onBrowserLog: onBrowserLog ?? null,
onDownload: onDownload ?? null,