🎥 Make videos programmatically with React
upgraded to new props serialization
Jonny Burger5aa3e63cd511
diff --git a/packages/cloudrun/src/api/render-media-on-cloudrun.ts b/packages/cloudrun/src/api/render-media-on-cloudrun.tsindex 5eef448031..5a40c06092 100644--- a/packages/cloudrun/src/api/render-media-on-cloudrun.ts+++ b/packages/cloudrun/src/api/render-media-on-cloudrun.ts@@ -1,5 +1,6 @@import type {ChromiumOptions, FrameRange, LogLevel} from '@remotion/renderer';import {RenderInternals} from '@remotion/renderer';+import {Internals} from 'remotion';import type {CloudRunCrashResponse,CloudRunPayloadType,@@ -159,7 +160,11 @@ export const renderMediaOnCloudrun = async ({composition,serveUrl,codec: actualCodec,- inputProps: inputProps ?? {},+ serializedInputPropsWithCustomSchema: Internals.serializeJSONWithDate({+ indent: undefined,+ staticBase: null,+ data: inputProps ?? {},+ }).serializedString,jpegQuality: jpegQuality ?? RenderInternals.DEFAULT_JPEG_QUALITY,audioCodec: audioCodec ?? null,audioBitrate: audioBitrate ?? null,diff --git a/packages/cloudrun/src/api/render-still-on-cloudrun.ts b/packages/cloudrun/src/api/render-still-on-cloudrun.tsindex 781c99f50d..9814db20ed 100644--- a/packages/cloudrun/src/api/render-still-on-cloudrun.ts+++ b/packages/cloudrun/src/api/render-still-on-cloudrun.ts@@ -4,6 +4,7 @@ import type {StillImageFormat,} from '@remotion/renderer';import {RenderInternals} from '@remotion/renderer';+import {Internals} from 'remotion';import type {CloudRunPayloadType,RenderStillOnCloudrunOutput,@@ -98,7 +99,11 @@ export const renderStillOnCloudrun = async ({const data: CloudRunPayloadType = {composition,serveUrl,- inputProps: inputProps ?? {},+ serializedInputPropsWithCustomSchema: Internals.serializeJSONWithDate({+ indent: undefined,+ staticBase: null,+ data: inputProps ?? {},+ }).serializedString,outputBucket,outName,privacy: privacy ?? 'public',diff --git a/packages/cloudrun/src/cli/commands/render/index.ts b/packages/cloudrun/src/cli/commands/render/index.tsindex 69283f3729..28f18359dc 100644--- a/packages/cloudrun/src/cli/commands/render/index.ts+++ b/packages/cloudrun/src/cli/commands/render/index.ts@@ -4,6 +4,7 @@ import type {CloudrunCodec} from '../../../shared/validate-gcp-codec';// import {validateMaxRetries} from '../../../shared/validate-retries';import {ConfigInternals} from '@remotion/cli/config';import {RenderInternals} from '@remotion/renderer';+import {Internals} from 'remotion';import {downloadFile} from '../../../api/download-file';import {extractMemoryFromURL} from '../../../api/helpers/extract-mem-from-url';import {extractTimeoutFromURL} from '../../../api/helpers/extract-time-from-url';@@ -91,7 +92,6 @@ export const renderCommand = async (args: string[], remotionRoot: string) => {envVariables,height,indent: false,- inputProps,port,puppeteerInstance: undefined,serveUrlOrWebpackUrl: serveUrl,@@ -99,6 +99,11 @@ export const renderCommand = async (args: string[], remotionRoot: string) => {logLevel,width,server: await server,+ serializedInputPropsWithCustomSchema: Internals.serializeJSONWithDate({+ data: inputProps,+ indent: undefined,+ staticBase: null,+ }).serializedString,});composition = compositionId;}diff --git a/packages/cloudrun/src/cli/commands/still.ts b/packages/cloudrun/src/cli/commands/still.tsindex 17454b66d5..17b1e1bd29 100644--- a/packages/cloudrun/src/cli/commands/still.ts+++ b/packages/cloudrun/src/cli/commands/still.ts@@ -1,6 +1,7 @@import {CliInternals} from '@remotion/cli';import {ConfigInternals} from '@remotion/cli/config';import {RenderInternals} from '@remotion/renderer';+import {Internals} from 'remotion';import {downloadFile} from '../../api/download-file';import {renderStillOnCloudrun} from '../../api/render-still-on-cloudrun';import {validateServeUrl} from '../../shared/validate-serveurl';@@ -63,7 +64,11 @@ export const stillCommand = async (args: string[], remotionRoot: string) => {browserExecutable,chromiumOptions,envVariables,- inputProps,+ serializedInputPropsWithCustomSchema: Internals.serializeJSONWithDate({+ data: inputProps,+ indent: undefined,+ staticBase: null,+ }).serializedString,port,puppeteerInstance: undefined,timeoutInMilliseconds: puppeteerTimeout,diff --git a/packages/cloudrun/src/functions/helpers/get-composition-from-body.ts b/packages/cloudrun/src/functions/helpers/get-composition-from-body.tsindex cfd4ab6e7c..bf5065d4dd 100644--- a/packages/cloudrun/src/functions/helpers/get-composition-from-body.ts+++ b/packages/cloudrun/src/functions/helpers/get-composition-from-body.ts@@ -10,7 +10,8 @@ export const getCompositionFromBody = async (body: CloudRunPayloadType) => {envVariables: body.envVariables ?? {},id: body.composition,indent: false,- inputProps: body.inputProps ?? {},+ serializedInputPropsWithCustomSchema:+ body.serializedInputPropsWithCustomSchema,logLevel: body.logLevel,onBrowserLog: () => null,port: null,diff --git a/packages/cloudrun/src/functions/helpers/payloads.ts b/packages/cloudrun/src/functions/helpers/payloads.tsindex e44848fd72..61ee90fdfb 100644--- a/packages/cloudrun/src/functions/helpers/payloads.ts+++ b/packages/cloudrun/src/functions/helpers/payloads.ts@@ -25,7 +25,7 @@ export const CloudRunPayload = z.discriminatedUnion('type', [forceHeight: z.number().optional().nullable(),forceWidth: z.number().optional().nullable(),codec,- inputProps: z.record(z.string(), z.unknown()),+ serializedInputPropsWithCustomSchema: z.string(),jpegQuality: z.number(),audioCodec: audioCodec.nullable(),audioBitrate: z.string().nullable(),@@ -56,7 +56,7 @@ export const CloudRunPayload = z.discriminatedUnion('type', [composition: z.string(),forceHeight: z.number().optional().nullable(),forceWidth: z.number().optional().nullable(),- inputProps: z.record(z.string(), z.unknown()),+ serializedInputPropsWithCustomSchema: z.string(),jpegQuality: z.number().optional(),imageFormat: stillImageFormat,scale: z.number(),diff --git a/packages/cloudrun/src/functions/render-media-single-thread.ts b/packages/cloudrun/src/functions/render-media-single-thread.tsindex aba3e42122..aae4f27122 100644--- a/packages/cloudrun/src/functions/render-media-single-thread.ts+++ b/packages/cloudrun/src/functions/render-media-single-thread.ts@@ -2,6 +2,7 @@ import type * as ff from '@google-cloud/functions-framework';import {Storage} from '@google-cloud/storage';import type {ChromiumOptions, RenderMediaOnProgress} from '@remotion/renderer';import {RenderInternals} from '@remotion/renderer';+import {Internals} from 'remotion';import {randomHash} from '../shared/random-hash';import {getCompositionFromBody} from './helpers/get-composition-from-body';import type {@@ -46,7 +47,13 @@ export const renderMediaSingleThread = async (serveUrl: body.serveUrl,codec: body.codec,outputLocation: tempFilePath,- inputProps: body.inputProps,+ serializedInputPropsWithCustomSchema:+ body.serializedInputPropsWithCustomSchema,+ serializedResolvedPropsWithCustomSchema: Internals.serializeJSONWithDate({+ data: composition.props,+ indent: undefined,+ staticBase: null,+ }).serializedString,jpegQuality: body.jpegQuality,audioCodec: body.audioCodec,audioBitrate: body.audioBitrate,diff --git a/packages/cloudrun/src/functions/render-still-single-thread.ts b/packages/cloudrun/src/functions/render-still-single-thread.tsindex 1019b29c24..4075986a07 100644--- a/packages/cloudrun/src/functions/render-still-single-thread.ts+++ b/packages/cloudrun/src/functions/render-still-single-thread.ts@@ -2,6 +2,7 @@ import type * as ff from '@google-cloud/functions-framework';import {Storage} from '@google-cloud/storage';import type {ChromiumOptions} from '@remotion/renderer';import {RenderInternals} from '@remotion/renderer';+import {Internals} from 'remotion';import {Log} from '../cli/log';import {randomHash} from '../shared/random-hash';import {getCompositionFromBody} from './helpers/get-composition-from-body';@@ -41,7 +42,13 @@ export const renderStillSingleThread = async (},serveUrl: body.serveUrl,output: tempFilePath,- inputProps: body.inputProps,+ serializedInputPropsWithCustomSchema:+ body.serializedInputPropsWithCustomSchema,+ serializedResolvedPropsWithCustomSchema: Internals.serializeJSONWithDate({+ data: composition.props,+ indent: undefined,+ staticBase: null,+ }).serializedString,jpegQuality: body.jpegQuality ?? RenderInternals.DEFAULT_JPEG_QUALITY,imageFormat: body.imageFormat,scale: body.scale,