Skip to content

🎥 Make videos programmatically with React

yoyo

Jonny Burgerd93106088b01
diff --git a/packages/cli/src/benchmark.ts b/packages/cli/src/benchmark.ts
index 1d86a6b77b..255c010c60 100644
--- a/packages/cli/src/benchmark.ts
+++ b/packages/cli/src/benchmark.ts
@@ -337,9 +337,12 @@ export const benchmarkCommand = async (
onStart: () => undefined,
preferLossless: false,
server: undefined,
- serializedResolvedPropsWithCustomSchema: JSON.stringify(
- composition.props
- ),
+ serializedResolvedPropsWithCustomSchema:
+ Internals.serializeJSONWithDate({
+ data: composition.props,
+ indent: undefined,
+ staticBase: null,
+ }).serializedString,
},
(run, progress) => {
benchmarkProgress.update(
diff --git a/packages/cli/src/render-flows/render.ts b/packages/cli/src/render-flows/render.ts
index 42072020a8..96c2256a32 100644
--- a/packages/cli/src/render-flows/render.ts
+++ b/packages/cli/src/render-flows/render.ts
@@ -45,6 +45,7 @@ import {shouldUseNonOverlayingLogger} from '../should-use-non-overlaying-logger'
import type {RenderStep} from '../step';
import {truthy} from '../truthy';
import {getUserPassedOutputLocation} from '../user-passed-output-location';
+import {Internals} from 'remotion';
export const renderVideoFlow = async ({
remotionRoot,
@@ -394,7 +395,11 @@ export const renderVideoFlow = async ({
onBrowserLog: null,
onFrameBuffer: null,
logLevel,
- serializedResolvedPropsWithCustomSchema: JSON.stringify(config.props),
+ serializedResolvedPropsWithCustomSchema: Internals.serializeJSONWithDate({
+ indent: undefined,
+ staticBase: null,
+ data: config.props,
+ }).serializedString,
});
updateRenderProgress(true);
@@ -465,7 +470,11 @@ export const renderVideoFlow = async ({
disallowParallelEncoding,
onBrowserLog: null,
onStart: () => undefined,
- serializedResolvedPropsWithCustomSchema: JSON.stringify(config.props),
+ serializedResolvedPropsWithCustomSchema: Internals.serializeJSONWithDate({
+ data: config.props,
+ indent: undefined,
+ staticBase: null,
+ }).serializedString,
});
updateRenderProgress(true);
diff --git a/packages/cli/src/render-flows/still.ts b/packages/cli/src/render-flows/still.ts
index 9c8260130b..9a30d074f1 100644
--- a/packages/cli/src/render-flows/still.ts
+++ b/packages/cli/src/render-flows/still.ts
@@ -39,6 +39,7 @@ import {
getOutputLocation,
getUserPassedOutputLocation,
} from '../user-passed-output-location';
+import {Internals} from 'remotion';
export const renderStillFlow = async ({
remotionRoot,
@@ -298,7 +299,11 @@ export const renderStillFlow = async ({
indent: indentOutput,
onBrowserLog: null,
logLevel,
- serializedResolvedPropsWithCustomSchema: JSON.stringify(config.props),
+ serializedResolvedPropsWithCustomSchema: Internals.serializeJSONWithDate({
+ indent: undefined,
+ staticBase: null,
+ data: config.props,
+ }).serializedString,
});
aggregate.rendering = {
diff --git a/packages/cli/src/test/json-serialization.test.ts b/packages/core/src/test/json-serialization.test.ts
similarity index 62%
rename from packages/cli/src/test/json-serialization.test.ts
rename to packages/core/src/test/json-serialization.test.ts
index 09d37ce140..aa204a7406 100644
--- a/packages/cli/src/test/json-serialization.test.ts
+++ b/packages/core/src/test/json-serialization.test.ts
@@ -1,13 +1,14 @@
-import {Internals} from 'remotion';
import {expect, test} from 'vitest';
-
-// TODO: move this to core library
+import {
+ deserializeJSONWithCustomFields,
+ serializeJSONWithDate,
+} from '../input-props-serialization.js';
test('date serialization', () => {
const date = {data: new Date(), hi: 'there'};
const {serializedString, customDateUsed, customFileUsed} =
- Internals.serializeJSONWithDate({
+ serializeJSONWithDate({
data: date,
indent: 2,
staticBase: '/static',
@@ -15,26 +16,24 @@ test('date serialization', () => {
expect(customDateUsed).toEqual(true);
expect(customFileUsed).toEqual(false);
- const deserialized =
- Internals.deserializeJSONWithCustomFields(serializedString);
+ const deserialized = deserializeJSONWithCustomFields(serializedString);
expect(deserialized.data).toBeInstanceOf(Date);
});
test('No date used', () => {
- const {customDateUsed, customFileUsed, mapUsed} =
- Internals.serializeJSONWithDate({
- data: {a: 'hi'},
- indent: 2,
- staticBase: '/static',
- });
+ const {customDateUsed, customFileUsed, mapUsed} = serializeJSONWithDate({
+ data: {a: 'hi'},
+ indent: 2,
+ staticBase: '/static',
+ });
expect(customDateUsed).toEqual(false);
expect(customFileUsed).toEqual(false);
expect(mapUsed).toEqual(false);
});
test('Map used', () => {
- const {mapUsed} = Internals.serializeJSONWithDate({
+ const {mapUsed} = serializeJSONWithDate({
data: {a: 'hi', map: new Map()},
indent: 2,
staticBase: '/static',