@remotion/renderer 4.0.1 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/BrowserPage.js +11 -0
- package/dist/browser/should-log-message.js +6 -0
- package/dist/format-logs.js +6 -0
- package/dist/get-compositions.d.ts +3 -3
- package/dist/get-compositions.js +10 -5
- package/dist/index.d.ts +7 -6
- package/dist/logger.js +7 -7
- package/dist/offthread-video-server.js +8 -0
- package/dist/render-frames.d.ts +4 -3
- package/dist/render-frames.js +22 -7
- package/dist/render-media.d.ts +4 -3
- package/dist/render-media.js +20 -8
- package/dist/render-still.d.ts +2 -1
- package/dist/render-still.js +15 -6
- package/dist/select-composition.d.ts +3 -3
- package/dist/select-composition.js +24 -6
- package/dist/serialize-props.d.ts +6 -0
- package/dist/serialize-props.js +36 -0
- package/dist/set-props-and-env.d.ts +1 -1
- package/dist/set-props-and-env.js +9 -13
- package/package.json +9 -9
|
@@ -40,6 +40,14 @@ const TaskQueue_1 = require("./TaskQueue");
|
|
|
40
40
|
const TimeoutSettings_1 = require("./TimeoutSettings");
|
|
41
41
|
const util_1 = require("./util");
|
|
42
42
|
const format_logs_1 = require("../format-logs");
|
|
43
|
+
const shouldHideWarning = (log) => {
|
|
44
|
+
// Mixed Content warnings caused by localhost should not be displayed
|
|
45
|
+
if (log.text.includes('Mixed Content:') &&
|
|
46
|
+
log.text.includes('http://localhost:')) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
};
|
|
43
51
|
class Page extends EventEmitter_1.EventEmitter {
|
|
44
52
|
static async _create({ client, target, defaultViewport, browser, sourcemapContext, logLevel, indent, }) {
|
|
45
53
|
const page = new Page({
|
|
@@ -106,6 +114,9 @@ class Page extends EventEmitter_1.EventEmitter {
|
|
|
106
114
|
this.on('console', (log) => {
|
|
107
115
|
var _a;
|
|
108
116
|
const { url, columnNumber, lineNumber } = log.location();
|
|
117
|
+
if (shouldHideWarning(log)) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
109
120
|
if ((url === null || url === void 0 ? void 0 : url.endsWith(remotion_1.Internals.bundleName)) &&
|
|
110
121
|
lineNumber &&
|
|
111
122
|
this.sourcemapContext) {
|
|
@@ -18,6 +18,12 @@ const shouldLogBrowserMessage = (message) => {
|
|
|
18
18
|
if (message.includes('Failed to send GpuControl.CreateCommandBuffer')) {
|
|
19
19
|
return false;
|
|
20
20
|
}
|
|
21
|
+
if (message.includes('CreatePlatformSocket() failed: Address family not supported by protocol')) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (message.includes('Fontconfig error: No writable cache directories')) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
21
27
|
return true;
|
|
22
28
|
};
|
|
23
29
|
exports.shouldLogBrowserMessage = shouldLogBrowserMessage;
|
package/dist/format-logs.js
CHANGED
|
@@ -48,6 +48,9 @@ const formatObjectPreview = (preview) => {
|
|
|
48
48
|
return chalk_1.chalk.reset(`${property.name}: ${formatProperty(property)}`);
|
|
49
49
|
});
|
|
50
50
|
if (preview.subtype === 'array') {
|
|
51
|
+
if (preview.overflow) {
|
|
52
|
+
return chalk_1.chalk.reset(`[ ${preview.properties.map((p) => formatProperty(p)).join(', ')}, …]`);
|
|
53
|
+
}
|
|
51
54
|
return chalk_1.chalk.reset(`[ ${preview.properties.map((p) => formatProperty(p)).join(', ')} ]`);
|
|
52
55
|
}
|
|
53
56
|
if (preview.subtype === 'arraybuffer') {
|
|
@@ -104,6 +107,9 @@ const formatObjectPreview = (preview) => {
|
|
|
104
107
|
if (properties.length === 0) {
|
|
105
108
|
return chalk_1.chalk.reset('{}');
|
|
106
109
|
}
|
|
110
|
+
if (preview.overflow) {
|
|
111
|
+
return chalk_1.chalk.reset(`{ ${properties.join(', ')}, …}`);
|
|
112
|
+
}
|
|
107
113
|
return chalk_1.chalk.reset(`{ ${properties.join(', ')} }`);
|
|
108
114
|
}
|
|
109
115
|
return '';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type VideoConfig } from 'remotion';
|
|
2
2
|
import type { BrowserExecutable } from './browser-executable';
|
|
3
3
|
import type { BrowserLog } from './browser-log';
|
|
4
4
|
import type { HeadlessBrowser } from './browser/Browser';
|
|
@@ -6,7 +6,7 @@ import type { ChromiumOptions } from './open-browser';
|
|
|
6
6
|
import type { RemotionServer } from './prepare-server';
|
|
7
7
|
import { type LogLevel } from './log-level';
|
|
8
8
|
type InternalGetCompositionsOptions = {
|
|
9
|
-
|
|
9
|
+
serializedInputPropsWithCustomSchema: string;
|
|
10
10
|
envVariables: Record<string, string>;
|
|
11
11
|
puppeteerInstance: HeadlessBrowser | undefined;
|
|
12
12
|
onBrowserLog: null | ((log: BrowserLog) => void);
|
|
@@ -30,7 +30,7 @@ export type GetCompositionsOptions = {
|
|
|
30
30
|
port?: number | null;
|
|
31
31
|
logLevel?: LogLevel;
|
|
32
32
|
};
|
|
33
|
-
export declare const internalGetCompositions: ({ browserExecutable, chromiumOptions, envVariables, indent,
|
|
33
|
+
export declare const internalGetCompositions: ({ browserExecutable, chromiumOptions, envVariables, indent, serializedInputPropsWithCustomSchema, onBrowserLog, port, puppeteerInstance, serveUrlOrWebpackUrl, server, timeoutInMilliseconds, logLevel, }: InternalGetCompositionsOptions) => Promise<VideoConfig[]>;
|
|
34
34
|
/**
|
|
35
35
|
* @description Gets the compositions defined in a Remotion project based on a Webpack bundle.
|
|
36
36
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/get-compositions)
|
package/dist/get-compositions.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCompositions = exports.internalGetCompositions = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
4
5
|
const TimeoutSettings_1 = require("./browser/TimeoutSettings");
|
|
5
6
|
const handle_javascript_exception_1 = require("./error-handling/handle-javascript-exception");
|
|
6
7
|
const find_closest_package_json_1 = require("./find-closest-package-json");
|
|
@@ -11,7 +12,7 @@ const seek_to_frame_1 = require("./seek-to-frame");
|
|
|
11
12
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
12
13
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
13
14
|
const logger_1 = require("./logger");
|
|
14
|
-
const innerGetCompositions = async ({ envVariables,
|
|
15
|
+
const innerGetCompositions = async ({ envVariables, serializedInputPropsWithCustomSchema, onBrowserLog, page, proxyPort, serveUrl, timeoutInMilliseconds, }) => {
|
|
15
16
|
if (onBrowserLog) {
|
|
16
17
|
page.on('console', (log) => {
|
|
17
18
|
onBrowserLog({
|
|
@@ -23,7 +24,7 @@ const innerGetCompositions = async ({ envVariables, inputProps, onBrowserLog, pa
|
|
|
23
24
|
}
|
|
24
25
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
25
26
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
26
|
-
|
|
27
|
+
serializedInputPropsWithCustomSchema,
|
|
27
28
|
envVariables,
|
|
28
29
|
page,
|
|
29
30
|
serveUrl,
|
|
@@ -55,7 +56,7 @@ const innerGetCompositions = async ({ envVariables, inputProps, onBrowserLog, pa
|
|
|
55
56
|
});
|
|
56
57
|
return result;
|
|
57
58
|
};
|
|
58
|
-
const internalGetCompositions = async ({ browserExecutable, chromiumOptions, envVariables, indent,
|
|
59
|
+
const internalGetCompositions = async ({ browserExecutable, chromiumOptions, envVariables, indent, serializedInputPropsWithCustomSchema, onBrowserLog, port, puppeteerInstance, serveUrlOrWebpackUrl, server, timeoutInMilliseconds, logLevel, }) => {
|
|
59
60
|
const { page, cleanup: cleanupPage } = await (0, get_browser_instance_1.getPageAndCleanupFn)({
|
|
60
61
|
passedInInstance: puppeteerInstance,
|
|
61
62
|
browserExecutable,
|
|
@@ -89,7 +90,7 @@ const internalGetCompositions = async ({ browserExecutable, chromiumOptions, env
|
|
|
89
90
|
cleanup.push(() => cleanupServer(true));
|
|
90
91
|
return innerGetCompositions({
|
|
91
92
|
envVariables,
|
|
92
|
-
|
|
93
|
+
serializedInputPropsWithCustomSchema,
|
|
93
94
|
onBrowserLog,
|
|
94
95
|
page,
|
|
95
96
|
proxyPort: offthreadPort,
|
|
@@ -121,7 +122,11 @@ const getCompositions = (serveUrlOrWebpackUrl, config) => {
|
|
|
121
122
|
browserExecutable: browserExecutable !== null && browserExecutable !== void 0 ? browserExecutable : null,
|
|
122
123
|
chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
|
|
123
124
|
envVariables: envVariables !== null && envVariables !== void 0 ? envVariables : {},
|
|
124
|
-
|
|
125
|
+
serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
126
|
+
data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
127
|
+
indent: undefined,
|
|
128
|
+
staticBase: null,
|
|
129
|
+
}).serializedString,
|
|
125
130
|
indent: false,
|
|
126
131
|
onBrowserLog: onBrowserLog !== null && onBrowserLog !== void 0 ? onBrowserLog : null,
|
|
127
132
|
port: port !== null && port !== void 0 ? port : null,
|
package/dist/index.d.ts
CHANGED
|
@@ -404,7 +404,8 @@ export declare const RenderInternals: {
|
|
|
404
404
|
composition: import("remotion").VideoConfig;
|
|
405
405
|
output: string | null;
|
|
406
406
|
frame: number;
|
|
407
|
-
|
|
407
|
+
serializedInputPropsWithCustomSchema: string;
|
|
408
|
+
serializedResolvedPropsWithCustomSchema: string;
|
|
408
409
|
imageFormat: "jpeg" | "png" | "webp" | "pdf";
|
|
409
410
|
jpegQuality: number;
|
|
410
411
|
puppeteerInstance: HeadlessBrowser | null;
|
|
@@ -435,7 +436,7 @@ export declare const RenderInternals: {
|
|
|
435
436
|
logLevel: "error" | "verbose" | "info" | "warn";
|
|
436
437
|
}) => Promise<HeadlessBrowser>;
|
|
437
438
|
internalSelectComposition: (options: {
|
|
438
|
-
|
|
439
|
+
serializedInputPropsWithCustomSchema: string;
|
|
439
440
|
envVariables: Record<string, string>;
|
|
440
441
|
puppeteerInstance: HeadlessBrowser | undefined;
|
|
441
442
|
onBrowserLog: ((log: import("./browser-log").BrowserLog) => void) | null;
|
|
@@ -452,8 +453,8 @@ export declare const RenderInternals: {
|
|
|
452
453
|
metadata: import("remotion").VideoConfig;
|
|
453
454
|
propsSize: number;
|
|
454
455
|
}>;
|
|
455
|
-
internalGetCompositions: ({ browserExecutable, chromiumOptions, envVariables, indent,
|
|
456
|
-
|
|
456
|
+
internalGetCompositions: ({ browserExecutable, chromiumOptions, envVariables, indent, serializedInputPropsWithCustomSchema, onBrowserLog, port, puppeteerInstance, serveUrlOrWebpackUrl, server, timeoutInMilliseconds, logLevel, }: {
|
|
457
|
+
serializedInputPropsWithCustomSchema: string;
|
|
457
458
|
envVariables: Record<string, string>;
|
|
458
459
|
puppeteerInstance: HeadlessBrowser | undefined;
|
|
459
460
|
onBrowserLog: ((log: import("./browser-log").BrowserLog) => void) | null;
|
|
@@ -466,8 +467,8 @@ export declare const RenderInternals: {
|
|
|
466
467
|
logLevel: "error" | "verbose" | "info" | "warn";
|
|
467
468
|
serveUrlOrWebpackUrl: string;
|
|
468
469
|
}) => Promise<import("remotion").VideoConfig[]>;
|
|
469
|
-
internalRenderFrames: ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent,
|
|
470
|
-
internalRenderMedia: ({ proResProfile, crf, composition,
|
|
470
|
+
internalRenderFrames: ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, }: import("./render-frames").InternalRenderFramesOptions) => Promise<import("./types").RenderFramesOutput>;
|
|
471
|
+
internalRenderMedia: ({ proResProfile, crf, composition, serializedInputPropsWithCustomSchema, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, audioCodec, concurrency, disallowParallelEncoding, everyNthFrame, imageFormat: provisionalImageFormat, indent, jpegQuality, numberOfGifLoops, onCtrlCExit, preferLossless, serveUrl, server: reusedServer, logLevel, serializedResolvedPropsWithCustomSchema, }: import("./render-media").InternalRenderMediaOptions) => Promise<{
|
|
471
472
|
buffer: Buffer | null;
|
|
472
473
|
slowestFrames: import("./render-media").SlowFrame[];
|
|
473
474
|
}>;
|
package/dist/logger.js
CHANGED
|
@@ -23,15 +23,16 @@ exports.Log = {
|
|
|
23
23
|
return console.log(...[
|
|
24
24
|
options.indent ? exports.INDENT_TOKEN : null,
|
|
25
25
|
options.tag ? (0, exports.verboseTag)(options.tag) : null,
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
]
|
|
27
|
+
.filter(truthy_1.truthy)
|
|
28
|
+
.concat(args.map((a) => chalk_1.chalk.gray(a))));
|
|
28
29
|
}
|
|
29
30
|
},
|
|
30
31
|
info: (...args) => {
|
|
31
32
|
exports.Log.infoAdvanced({ indent: false, logLevel: (0, exports.getLogLevel)() }, ...args);
|
|
32
33
|
},
|
|
33
34
|
infoAdvanced: (options, ...args) => {
|
|
34
|
-
return console.log(...[options.indent ? exports.INDENT_TOKEN : null
|
|
35
|
+
return console.log(...[options.indent ? exports.INDENT_TOKEN : null].filter(truthy_1.truthy).concat(args));
|
|
35
36
|
},
|
|
36
37
|
warn: (...args) => {
|
|
37
38
|
if ((0, log_level_1.isEqualOrBelowLogLevel)((0, exports.getLogLevel)(), 'warn')) {
|
|
@@ -40,10 +41,9 @@ exports.Log = {
|
|
|
40
41
|
},
|
|
41
42
|
warnAdvanced: (options, ...args) => {
|
|
42
43
|
if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'warn')) {
|
|
43
|
-
return console.warn(...[
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
].filter(truthy_1.truthy));
|
|
44
|
+
return console.warn(...[options.indent ? chalk_1.chalk.yellow(exports.INDENT_TOKEN) : null]
|
|
45
|
+
.filter(truthy_1.truthy)
|
|
46
|
+
.concat(args.map((a) => chalk_1.chalk.yellow(a))));
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
error: (...args) => {
|
|
@@ -5,6 +5,7 @@ const node_url_1 = require("node:url");
|
|
|
5
5
|
const download_and_map_assets_to_file_1 = require("./assets/download-and-map-assets-to-file");
|
|
6
6
|
const compositor_1 = require("./compositor/compositor");
|
|
7
7
|
const log_level_1 = require("./log-level");
|
|
8
|
+
const logger_1 = require("./logger");
|
|
8
9
|
const extractUrlAndSourceFromUrl = (url) => {
|
|
9
10
|
const parsed = new URL(url, 'http://localhost');
|
|
10
11
|
const query = parsed.search;
|
|
@@ -68,8 +69,10 @@ const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent,
|
|
|
68
69
|
res.end();
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
72
|
+
let extractStart = Date.now();
|
|
71
73
|
(0, download_and_map_assets_to_file_1.downloadAsset)({ src, emitter: events, downloadMap })
|
|
72
74
|
.then((to) => {
|
|
75
|
+
extractStart = Date.now();
|
|
73
76
|
return compositor.executeCommand('ExtractFrame', {
|
|
74
77
|
input: to,
|
|
75
78
|
time,
|
|
@@ -77,6 +80,11 @@ const startOffthreadVideoServer = ({ downloadMap, concurrency, logLevel, indent,
|
|
|
77
80
|
});
|
|
78
81
|
})
|
|
79
82
|
.then((readable) => {
|
|
83
|
+
const extractEnd = Date.now();
|
|
84
|
+
const timeToExtract = extractEnd - extractStart;
|
|
85
|
+
if (timeToExtract > 1000) {
|
|
86
|
+
logger_1.Log.verbose(`Took ${timeToExtract}ms to extract frame from ${src} at ${time}`);
|
|
87
|
+
}
|
|
80
88
|
if (!readable) {
|
|
81
89
|
throw new Error('no readable from ffmpeg');
|
|
82
90
|
}
|
package/dist/render-frames.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export type InternalRenderFramesOptions = {
|
|
|
15
15
|
onStart: null | ((data: OnStartData) => void);
|
|
16
16
|
onFrameUpdate: null | ((framesRendered: number, frameIndex: number, timeToRenderInMilliseconds: number) => void);
|
|
17
17
|
outputDir: string | null;
|
|
18
|
-
inputProps: Record<string, unknown>;
|
|
19
18
|
envVariables: Record<string, string>;
|
|
20
19
|
imageFormat: VideoImageFormat;
|
|
21
20
|
jpegQuality: number;
|
|
@@ -31,13 +30,15 @@ export type InternalRenderFramesOptions = {
|
|
|
31
30
|
scale: number;
|
|
32
31
|
port: number | null;
|
|
33
32
|
cancelSignal: CancelSignal | undefined;
|
|
34
|
-
composition: VideoConfig
|
|
33
|
+
composition: Omit<VideoConfig, 'props' | 'defaultProps'>;
|
|
35
34
|
indent: boolean;
|
|
36
35
|
server: RemotionServer | undefined;
|
|
37
36
|
muted: boolean;
|
|
38
37
|
concurrency: number | string | null;
|
|
39
38
|
webpackBundleOrServeUrl: string;
|
|
40
39
|
logLevel: LogLevel;
|
|
40
|
+
serializedInputPropsWithCustomSchema: string;
|
|
41
|
+
serializedResolvedPropsWithCustomSchema: string;
|
|
41
42
|
};
|
|
42
43
|
export type RenderFramesOptions = {
|
|
43
44
|
onStart: (data: OnStartData) => void;
|
|
@@ -77,7 +78,7 @@ export type RenderFramesOptions = {
|
|
|
77
78
|
concurrency?: number | string | null;
|
|
78
79
|
serveUrl: string;
|
|
79
80
|
};
|
|
80
|
-
export declare const internalRenderFrames: ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent,
|
|
81
|
+
export declare const internalRenderFrames: ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, }: InternalRenderFramesOptions) => Promise<RenderFramesOutput>;
|
|
81
82
|
/**
|
|
82
83
|
* @description Renders a series of images using Puppeteer and computes information for mixing audio.
|
|
83
84
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/render-frames)
|
package/dist/render-frames.js
CHANGED
|
@@ -35,7 +35,7 @@ const truthy_1 = require("./truthy");
|
|
|
35
35
|
const validate_scale_1 = require("./validate-scale");
|
|
36
36
|
const logger_1 = require("./logger");
|
|
37
37
|
const MAX_RETRIES_PER_FRAME = 1;
|
|
38
|
-
const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart,
|
|
38
|
+
const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, jpegQuality, imageFormat, frameRange, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale, actualConcurrency, everyNthFrame, proxyPort, cancelSignal, downloadMap, muted, makeBrowser, browserReplacer, compositor, sourcemapContext, logLevel, indent, }) => {
|
|
39
39
|
if (outputDir) {
|
|
40
40
|
if (!node_fs_1.default.existsSync(outputDir)) {
|
|
41
41
|
node_fs_1.default.mkdirSync(outputDir, {
|
|
@@ -69,7 +69,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, inputProps
|
|
|
69
69
|
}
|
|
70
70
|
const initialFrame = realFrameRange[0];
|
|
71
71
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
72
|
-
|
|
72
|
+
serializedInputPropsWithCustomSchema,
|
|
73
73
|
envVariables,
|
|
74
74
|
page,
|
|
75
75
|
serveUrl,
|
|
@@ -86,7 +86,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, inputProps
|
|
|
86
86
|
window.remotion_setBundleMode({
|
|
87
87
|
type: 'composition',
|
|
88
88
|
compositionName: id,
|
|
89
|
-
props,
|
|
89
|
+
serializedResolvedPropsWithSchema: props,
|
|
90
90
|
compositionDurationInFrames: durationInFrames,
|
|
91
91
|
compositionFps: fps,
|
|
92
92
|
compositionHeight: height,
|
|
@@ -95,7 +95,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, inputProps
|
|
|
95
95
|
},
|
|
96
96
|
args: [
|
|
97
97
|
composition.id,
|
|
98
|
-
|
|
98
|
+
serializedResolvedPropsWithCustomSchema,
|
|
99
99
|
composition.durationInFrames,
|
|
100
100
|
composition.fps,
|
|
101
101
|
composition.height,
|
|
@@ -149,7 +149,12 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, inputProps
|
|
|
149
149
|
frame,
|
|
150
150
|
});
|
|
151
151
|
freePage.on('error', errorCallbackOnFrame);
|
|
152
|
+
const startSeeking = Date.now();
|
|
152
153
|
await (0, seek_to_frame_1.seekToFrame)({ frame, page: freePage, composition: compId });
|
|
154
|
+
const timeToSeek = Date.now() - startSeeking;
|
|
155
|
+
if (timeToSeek > 1000) {
|
|
156
|
+
logger_1.Log.verbose(`Seeking to frame ${frame} took ${timeToSeek}ms`);
|
|
157
|
+
}
|
|
153
158
|
if (!outputDir && !onFrameBuffer && imageFormat !== 'none') {
|
|
154
159
|
throw new Error('Called renderFrames() without specifying either `outputDir` or `onFrameBuffer`');
|
|
155
160
|
}
|
|
@@ -287,7 +292,7 @@ const innerRenderFrames = async ({ onFrameUpdate, outputDir, onStart, inputProps
|
|
|
287
292
|
await Promise.all(downloadPromises);
|
|
288
293
|
return result;
|
|
289
294
|
};
|
|
290
|
-
const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent,
|
|
295
|
+
const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions, composition, concurrency, envVariables, everyNthFrame, frameRange, imageFormat, indent, jpegQuality, muted, onBrowserLog, onDownload, onFrameBuffer, onFrameUpdate, onStart, outputDir, port, puppeteerInstance, scale, server, timeoutInMilliseconds, logLevel, webpackBundleOrServeUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema, }) => {
|
|
291
296
|
remotion_1.Internals.validateDimension(composition.height, 'height', 'in the `config` object passed to `renderFrames()`');
|
|
292
297
|
remotion_1.Internals.validateDimension(composition.width, 'width', 'in the `config` object passed to `renderFrames()`');
|
|
293
298
|
remotion_1.Internals.validateFps(composition.fps, 'in the `config` object of `renderFrames()`', false);
|
|
@@ -355,7 +360,6 @@ const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions
|
|
|
355
360
|
everyNthFrame,
|
|
356
361
|
frameRange,
|
|
357
362
|
imageFormat,
|
|
358
|
-
inputProps,
|
|
359
363
|
jpegQuality,
|
|
360
364
|
muted,
|
|
361
365
|
onBrowserLog,
|
|
@@ -367,6 +371,8 @@ const internalRenderFrames = ({ browserExecutable, cancelSignal, chromiumOptions
|
|
|
367
371
|
timeoutInMilliseconds,
|
|
368
372
|
logLevel,
|
|
369
373
|
indent,
|
|
374
|
+
serializedInputPropsWithCustomSchema,
|
|
375
|
+
serializedResolvedPropsWithCustomSchema,
|
|
370
376
|
});
|
|
371
377
|
}),
|
|
372
378
|
])
|
|
@@ -433,7 +439,16 @@ const renderFrames = (options) => {
|
|
|
433
439
|
indent: false,
|
|
434
440
|
jpegQuality: jpegQuality !== null && jpegQuality !== void 0 ? jpegQuality : jpeg_quality_1.DEFAULT_JPEG_QUALITY,
|
|
435
441
|
onDownload: onDownload !== null && onDownload !== void 0 ? onDownload : null,
|
|
436
|
-
|
|
442
|
+
serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
443
|
+
indent: undefined,
|
|
444
|
+
staticBase: null,
|
|
445
|
+
data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
446
|
+
}).serializedString,
|
|
447
|
+
serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
448
|
+
indent: undefined,
|
|
449
|
+
staticBase: null,
|
|
450
|
+
data: composition.props,
|
|
451
|
+
}).serializedString,
|
|
437
452
|
puppeteerInstance,
|
|
438
453
|
muted: muted !== null && muted !== void 0 ? muted : false,
|
|
439
454
|
onBrowserLog: onBrowserLog !== null && onBrowserLog !== void 0 ? onBrowserLog : null,
|
package/dist/render-media.d.ts
CHANGED
|
@@ -32,8 +32,9 @@ export type RenderMediaOnProgress = (progress: {
|
|
|
32
32
|
export type InternalRenderMediaOptions = {
|
|
33
33
|
outputLocation: string | null;
|
|
34
34
|
codec: Codec;
|
|
35
|
-
composition: VideoConfig
|
|
36
|
-
|
|
35
|
+
composition: Omit<VideoConfig, 'props' | 'defaultProps'>;
|
|
36
|
+
serializedInputPropsWithCustomSchema: string;
|
|
37
|
+
serializedResolvedPropsWithCustomSchema: string;
|
|
37
38
|
crf: number | null;
|
|
38
39
|
imageFormat: VideoImageFormat;
|
|
39
40
|
pixelFormat: PixelFormat;
|
|
@@ -124,7 +125,7 @@ type RenderMediaResult = {
|
|
|
124
125
|
buffer: Buffer | null;
|
|
125
126
|
slowestFrames: SlowFrame[];
|
|
126
127
|
};
|
|
127
|
-
export declare const internalRenderMedia: ({ proResProfile, crf, composition,
|
|
128
|
+
export declare const internalRenderMedia: ({ proResProfile, crf, composition, serializedInputPropsWithCustomSchema, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, audioCodec, concurrency, disallowParallelEncoding, everyNthFrame, imageFormat: provisionalImageFormat, indent, jpegQuality, numberOfGifLoops, onCtrlCExit, preferLossless, serveUrl, server: reusedServer, logLevel, serializedResolvedPropsWithCustomSchema, }: InternalRenderMediaOptions) => Promise<RenderMediaResult>;
|
|
128
129
|
/**
|
|
129
130
|
*
|
|
130
131
|
* @description Render a video from a composition
|
package/dist/render-media.js
CHANGED
|
@@ -43,7 +43,7 @@ const validate_output_filename_1 = require("./validate-output-filename");
|
|
|
43
43
|
const validate_scale_1 = require("./validate-scale");
|
|
44
44
|
const validate_videobitrate_1 = require("./validate-videobitrate");
|
|
45
45
|
const SLOWEST_FRAME_COUNT = 10;
|
|
46
|
-
const internalRenderMedia = ({ proResProfile, crf, composition,
|
|
46
|
+
const internalRenderMedia = ({ proResProfile, crf, composition, serializedInputPropsWithCustomSchema, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, audioCodec, concurrency, disallowParallelEncoding, everyNthFrame, imageFormat: provisionalImageFormat, indent, jpegQuality, numberOfGifLoops, onCtrlCExit, preferLossless, serveUrl, server: reusedServer, logLevel, serializedResolvedPropsWithCustomSchema, }) => {
|
|
47
47
|
(0, jpeg_quality_1.validateJpegQuality)(jpegQuality);
|
|
48
48
|
(0, crf_1.validateQualitySettings)({ crf, codec, videoBitrate });
|
|
49
49
|
(0, validate_videobitrate_1.validateBitrate)(audioBitrate, 'audioBitrate');
|
|
@@ -94,11 +94,13 @@ const internalRenderMedia = ({ proResProfile, crf, composition, inputProps, pixe
|
|
|
94
94
|
logLevel,
|
|
95
95
|
tag: 'renderMedia()',
|
|
96
96
|
}, 'Codec supports parallel rendering:', (0, can_use_parallel_encoding_1.canUseParallelEncoding)(codec));
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
if (disallowParallelEncoding) {
|
|
98
|
+
logger_1.Log.verboseAdvanced({
|
|
99
|
+
indent,
|
|
100
|
+
logLevel,
|
|
101
|
+
tag: 'renderMedia()',
|
|
102
|
+
}, 'User disallowed parallel encoding.');
|
|
103
|
+
}
|
|
102
104
|
if (parallelEncoding) {
|
|
103
105
|
logger_1.Log.verboseAdvanced({
|
|
104
106
|
indent,
|
|
@@ -248,7 +250,7 @@ const internalRenderMedia = ({ proResProfile, crf, composition, inputProps, pixe
|
|
|
248
250
|
callUpdate();
|
|
249
251
|
onStart === null || onStart === void 0 ? void 0 : onStart(data);
|
|
250
252
|
},
|
|
251
|
-
|
|
253
|
+
serializedInputPropsWithCustomSchema,
|
|
252
254
|
envVariables,
|
|
253
255
|
imageFormat,
|
|
254
256
|
jpegQuality,
|
|
@@ -288,6 +290,7 @@ const internalRenderMedia = ({ proResProfile, crf, composition, inputProps, pixe
|
|
|
288
290
|
logLevel,
|
|
289
291
|
indent,
|
|
290
292
|
server,
|
|
293
|
+
serializedResolvedPropsWithCustomSchema,
|
|
291
294
|
});
|
|
292
295
|
return renderFramesProc;
|
|
293
296
|
})
|
|
@@ -424,7 +427,11 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
424
427
|
ffmpegOverride: ffmpegOverride !== null && ffmpegOverride !== void 0 ? ffmpegOverride : undefined,
|
|
425
428
|
frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : null,
|
|
426
429
|
imageFormat: imageFormat !== null && imageFormat !== void 0 ? imageFormat : image_format_1.DEFAULT_VIDEO_IMAGE_FORMAT,
|
|
427
|
-
|
|
430
|
+
serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
431
|
+
indent: undefined,
|
|
432
|
+
staticBase: null,
|
|
433
|
+
data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
434
|
+
}).serializedString,
|
|
428
435
|
jpegQuality: (_a = jpegQuality !== null && jpegQuality !== void 0 ? jpegQuality : quality) !== null && _a !== void 0 ? _a : jpeg_quality_1.DEFAULT_JPEG_QUALITY,
|
|
429
436
|
muted: muted !== null && muted !== void 0 ? muted : false,
|
|
430
437
|
numberOfGifLoops: numberOfGifLoops !== null && numberOfGifLoops !== void 0 ? numberOfGifLoops : null,
|
|
@@ -445,6 +452,11 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
445
452
|
indent: false,
|
|
446
453
|
onCtrlCExit: () => undefined,
|
|
447
454
|
server: undefined,
|
|
455
|
+
serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
456
|
+
indent: undefined,
|
|
457
|
+
staticBase: null,
|
|
458
|
+
data: composition.props,
|
|
459
|
+
}).serializedString,
|
|
448
460
|
});
|
|
449
461
|
};
|
|
450
462
|
exports.renderMedia = renderMedia;
|
package/dist/render-still.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ type InternalRenderStillOptions = {
|
|
|
13
13
|
composition: VideoConfig;
|
|
14
14
|
output: string | null;
|
|
15
15
|
frame: number;
|
|
16
|
-
|
|
16
|
+
serializedInputPropsWithCustomSchema: string;
|
|
17
|
+
serializedResolvedPropsWithCustomSchema: string;
|
|
17
18
|
imageFormat: StillImageFormat;
|
|
18
19
|
jpegQuality: number;
|
|
19
20
|
puppeteerInstance: HeadlessBrowser | null;
|
package/dist/render-still.js
CHANGED
|
@@ -49,7 +49,7 @@ const take_frame_and_compose_1 = require("./take-frame-and-compose");
|
|
|
49
49
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
50
50
|
const validate_scale_1 = require("./validate-scale");
|
|
51
51
|
const logger_1 = require("./logger");
|
|
52
|
-
const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFAULT_STILL_IMAGE_FORMAT, serveUrl, puppeteerInstance, onError,
|
|
52
|
+
const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFAULT_STILL_IMAGE_FORMAT, serveUrl, puppeteerInstance, onError, serializedInputPropsWithCustomSchema, envVariables, output, frame = 0, overwrite, browserExecutable, timeoutInMilliseconds, chromiumOptions, scale, proxyPort, cancelSignal, jpegQuality, onBrowserLog, compositor, sourceMapContext, downloadMap, logLevel, indent, serializedResolvedPropsWithCustomSchema, }) => {
|
|
53
53
|
remotion_1.Internals.validateDimension(composition.height, 'height', 'in the `config` object passed to `renderStill()`');
|
|
54
54
|
remotion_1.Internals.validateDimension(composition.width, 'width', 'in the `config` object passed to `renderStill()`');
|
|
55
55
|
remotion_1.Internals.validateFps(composition.fps, 'in the `config` object of `renderStill()`', false);
|
|
@@ -134,7 +134,7 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
|
|
|
134
134
|
page.on('console', logCallback);
|
|
135
135
|
}
|
|
136
136
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
137
|
-
|
|
137
|
+
serializedInputPropsWithCustomSchema,
|
|
138
138
|
envVariables,
|
|
139
139
|
page,
|
|
140
140
|
serveUrl,
|
|
@@ -151,7 +151,7 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
|
|
|
151
151
|
window.remotion_setBundleMode({
|
|
152
152
|
type: 'composition',
|
|
153
153
|
compositionName: id,
|
|
154
|
-
props,
|
|
154
|
+
serializedResolvedPropsWithSchema: props,
|
|
155
155
|
compositionDurationInFrames: durationInFrames,
|
|
156
156
|
compositionFps: fps,
|
|
157
157
|
compositionHeight: height,
|
|
@@ -160,7 +160,7 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
|
|
|
160
160
|
},
|
|
161
161
|
args: [
|
|
162
162
|
composition.id,
|
|
163
|
-
|
|
163
|
+
serializedResolvedPropsWithCustomSchema,
|
|
164
164
|
composition.durationInFrames,
|
|
165
165
|
composition.fps,
|
|
166
166
|
composition.height,
|
|
@@ -239,7 +239,7 @@ exports.internalRenderStill = internalRenderStill;
|
|
|
239
239
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/render-still)
|
|
240
240
|
*/
|
|
241
241
|
const renderStill = (options) => {
|
|
242
|
-
var _a;
|
|
242
|
+
var _a, _b;
|
|
243
243
|
const { composition, serveUrl, browserExecutable, cancelSignal, chromiumOptions, dumpBrowserLogs, envVariables, frame, imageFormat, inputProps, jpegQuality, onBrowserLog, onDownload, output, overwrite, port, puppeteerInstance, scale, timeoutInMilliseconds, verbose, quality, } = options;
|
|
244
244
|
if (typeof jpegQuality !== 'undefined' && imageFormat !== 'jpeg') {
|
|
245
245
|
throw new Error("You can only pass the `quality` option if `imageFormat` is 'jpeg'.");
|
|
@@ -256,7 +256,11 @@ const renderStill = (options) => {
|
|
|
256
256
|
frame: frame !== null && frame !== void 0 ? frame : 0,
|
|
257
257
|
imageFormat: imageFormat !== null && imageFormat !== void 0 ? imageFormat : image_format_1.DEFAULT_STILL_IMAGE_FORMAT,
|
|
258
258
|
indent: false,
|
|
259
|
-
|
|
259
|
+
serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
260
|
+
staticBase: null,
|
|
261
|
+
indent: undefined,
|
|
262
|
+
data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
263
|
+
}).serializedString,
|
|
260
264
|
jpegQuality: (_a = jpegQuality !== null && jpegQuality !== void 0 ? jpegQuality : quality) !== null && _a !== void 0 ? _a : jpeg_quality_1.DEFAULT_JPEG_QUALITY,
|
|
261
265
|
onBrowserLog: onBrowserLog !== null && onBrowserLog !== void 0 ? onBrowserLog : null,
|
|
262
266
|
onDownload: onDownload !== null && onDownload !== void 0 ? onDownload : null,
|
|
@@ -269,6 +273,11 @@ const renderStill = (options) => {
|
|
|
269
273
|
serveUrl,
|
|
270
274
|
timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : TimeoutSettings_1.DEFAULT_TIMEOUT,
|
|
271
275
|
logLevel: verbose || dumpBrowserLogs ? 'verbose' : (0, logger_1.getLogLevel)(),
|
|
276
|
+
serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
277
|
+
indent: undefined,
|
|
278
|
+
staticBase: null,
|
|
279
|
+
data: (_b = composition.props) !== null && _b !== void 0 ? _b : {},
|
|
280
|
+
}).serializedString,
|
|
272
281
|
});
|
|
273
282
|
};
|
|
274
283
|
exports.renderStill = renderStill;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type VideoConfig } from 'remotion';
|
|
2
2
|
import type { BrowserExecutable } from './browser-executable';
|
|
3
3
|
import type { BrowserLog } from './browser-log';
|
|
4
4
|
import type { HeadlessBrowser } from './browser/Browser';
|
|
@@ -6,7 +6,7 @@ import type { ChromiumOptions } from './open-browser';
|
|
|
6
6
|
import type { RemotionServer } from './prepare-server';
|
|
7
7
|
import { type LogLevel } from './log-level';
|
|
8
8
|
type InternalSelectCompositionsConfig = {
|
|
9
|
-
|
|
9
|
+
serializedInputPropsWithCustomSchema: string;
|
|
10
10
|
envVariables: Record<string, string>;
|
|
11
11
|
puppeteerInstance: HeadlessBrowser | undefined;
|
|
12
12
|
onBrowserLog: null | ((log: BrowserLog) => void);
|
|
@@ -42,5 +42,5 @@ export declare const internalSelectComposition: (options: InternalSelectComposit
|
|
|
42
42
|
* @description Gets a composition defined in a Remotion project based on a Webpack bundle.
|
|
43
43
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/select-composition)
|
|
44
44
|
*/
|
|
45
|
-
export declare const selectComposition: (options: SelectCompositionOptions) => Promise<VideoConfig
|
|
45
|
+
export declare const selectComposition: (options: SelectCompositionOptions) => Promise<Omit<VideoConfig, 'defaultProps'>>;
|
|
46
46
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.selectComposition = exports.internalSelectComposition = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
4
5
|
const TimeoutSettings_1 = require("./browser/TimeoutSettings");
|
|
5
6
|
const handle_javascript_exception_1 = require("./error-handling/handle-javascript-exception");
|
|
6
7
|
const find_closest_package_json_1 = require("./find-closest-package-json");
|
|
@@ -11,7 +12,7 @@ const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
|
11
12
|
const seek_to_frame_1 = require("./seek-to-frame");
|
|
12
13
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
13
14
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
14
|
-
const innerSelectComposition = async ({ page, onBrowserLog,
|
|
15
|
+
const innerSelectComposition = async ({ page, onBrowserLog, serializedInputPropsWithCustomSchema, envVariables, serveUrl, timeoutInMilliseconds, port, id, indent, logLevel, }) => {
|
|
15
16
|
if (onBrowserLog) {
|
|
16
17
|
page.on('console', (log) => {
|
|
17
18
|
onBrowserLog({
|
|
@@ -23,7 +24,7 @@ const innerSelectComposition = async ({ page, onBrowserLog, inputProps, envVaria
|
|
|
23
24
|
}
|
|
24
25
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
25
26
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
26
|
-
|
|
27
|
+
serializedInputPropsWithCustomSchema,
|
|
27
28
|
envVariables,
|
|
28
29
|
page,
|
|
29
30
|
serveUrl,
|
|
@@ -64,11 +65,24 @@ const innerSelectComposition = async ({ page, onBrowserLog, inputProps, envVaria
|
|
|
64
65
|
tag: 'selectComposition()',
|
|
65
66
|
logLevel,
|
|
66
67
|
}, `calculateMetadata() took ${Date.now() - time}ms`);
|
|
67
|
-
|
|
68
|
+
const res = result;
|
|
69
|
+
const { width, durationInFrames, fps, height } = res;
|
|
70
|
+
return {
|
|
71
|
+
metadata: {
|
|
72
|
+
id,
|
|
73
|
+
width,
|
|
74
|
+
height,
|
|
75
|
+
fps,
|
|
76
|
+
durationInFrames,
|
|
77
|
+
props: remotion_1.Internals.deserializeJSONWithCustomFields(res.serializedResolvedPropsWithCustomSchema),
|
|
78
|
+
defaultProps: remotion_1.Internals.deserializeJSONWithCustomFields(res.serializedDefaultPropsWithCustomSchema),
|
|
79
|
+
},
|
|
80
|
+
propsSize: size,
|
|
81
|
+
};
|
|
68
82
|
};
|
|
69
83
|
const internalSelectComposition = async (options) => {
|
|
70
84
|
const cleanup = [];
|
|
71
|
-
const { puppeteerInstance, browserExecutable, chromiumOptions, serveUrl: serveUrlOrWebpackUrl, logLevel, indent, port, envVariables, id,
|
|
85
|
+
const { puppeteerInstance, browserExecutable, chromiumOptions, serveUrl: serveUrlOrWebpackUrl, logLevel, indent, port, envVariables, id, serializedInputPropsWithCustomSchema, onBrowserLog, server, timeoutInMilliseconds, } = options;
|
|
72
86
|
const { page, cleanup: cleanupPage } = await (0, get_browser_instance_1.getPageAndCleanupFn)({
|
|
73
87
|
passedInInstance: puppeteerInstance,
|
|
74
88
|
browserExecutable,
|
|
@@ -108,7 +122,7 @@ const internalSelectComposition = async (options) => {
|
|
|
108
122
|
chromiumOptions,
|
|
109
123
|
envVariables,
|
|
110
124
|
id,
|
|
111
|
-
|
|
125
|
+
serializedInputPropsWithCustomSchema,
|
|
112
126
|
onBrowserLog,
|
|
113
127
|
timeoutInMilliseconds,
|
|
114
128
|
logLevel,
|
|
@@ -143,7 +157,11 @@ const selectComposition = async (options) => {
|
|
|
143
157
|
browserExecutable: browserExecutable !== null && browserExecutable !== void 0 ? browserExecutable : null,
|
|
144
158
|
chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
|
|
145
159
|
envVariables: envVariables !== null && envVariables !== void 0 ? envVariables : {},
|
|
146
|
-
|
|
160
|
+
serializedInputPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
|
|
161
|
+
indent: undefined,
|
|
162
|
+
staticBase: null,
|
|
163
|
+
data: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
164
|
+
}).serializedString,
|
|
147
165
|
onBrowserLog: onBrowserLog !== null && onBrowserLog !== void 0 ? onBrowserLog : null,
|
|
148
166
|
port: port !== null && port !== void 0 ? port : null,
|
|
149
167
|
puppeteerInstance,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SerializedJSONWithCustomFields } from 'remotion';
|
|
2
|
+
export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
|
|
3
|
+
data: Record<string, unknown>;
|
|
4
|
+
indent: number | undefined;
|
|
5
|
+
staticBase: string | null;
|
|
6
|
+
}) => SerializedJSONWithCustomFields;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeJSONWithDate = void 0;
|
|
4
|
+
// Keep in sync with /packages/core/src/input-props-serialization.ts
|
|
5
|
+
const DATE_TOKEN = 'remotion-date:';
|
|
6
|
+
const FILE_TOKEN = 'remotion-file:';
|
|
7
|
+
const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
|
|
8
|
+
let customDateUsed = false;
|
|
9
|
+
let customFileUsed = false;
|
|
10
|
+
let mapUsed = false;
|
|
11
|
+
let setUsed = false;
|
|
12
|
+
const serializedString = JSON.stringify(data, function (key, value) {
|
|
13
|
+
const item = this[key];
|
|
14
|
+
if (item instanceof Date) {
|
|
15
|
+
customDateUsed = true;
|
|
16
|
+
return `${DATE_TOKEN}${item.toISOString()}`;
|
|
17
|
+
}
|
|
18
|
+
if (item instanceof Map) {
|
|
19
|
+
mapUsed = true;
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
if (item instanceof Set) {
|
|
23
|
+
setUsed = true;
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
if (typeof item === 'string' &&
|
|
27
|
+
staticBase !== null &&
|
|
28
|
+
item.startsWith(staticBase)) {
|
|
29
|
+
customFileUsed = true;
|
|
30
|
+
return `${FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}, indent);
|
|
34
|
+
return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
|
|
35
|
+
};
|
|
36
|
+
exports.serializeJSONWithDate = serializeJSONWithDate;
|
|
@@ -7,7 +7,8 @@ const normalize_serve_url_1 = require("./normalize-serve-url");
|
|
|
7
7
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
8
8
|
const redirect_status_codes_1 = require("./redirect-status-codes");
|
|
9
9
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
10
|
-
const
|
|
10
|
+
const logger_1 = require("./logger");
|
|
11
|
+
const innerSetPropsAndEnv = async ({ serializedInputPropsWithCustomSchema, envVariables, page, serveUrl, initialFrame, timeoutInMilliseconds, proxyPort, retriesRemaining, audioEnabled, videoEnabled, }) => {
|
|
11
12
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
12
13
|
const actualTimeout = timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : TimeoutSettings_1.DEFAULT_TIMEOUT;
|
|
13
14
|
page.setDefaultTimeout(actualTimeout);
|
|
@@ -16,14 +17,9 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
|
|
|
16
17
|
await page.evaluateOnNewDocument((timeout) => {
|
|
17
18
|
window.remotion_puppeteerTimeout = timeout;
|
|
18
19
|
}, actualTimeout);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
if (inputProps) {
|
|
23
|
-
await page.evaluateOnNewDocument((input) => {
|
|
24
|
-
window.remotion_inputProps = input;
|
|
25
|
-
}, JSON.stringify(inputProps));
|
|
26
|
-
}
|
|
20
|
+
await page.evaluateOnNewDocument((input) => {
|
|
21
|
+
window.remotion_inputProps = input;
|
|
22
|
+
}, serializedInputPropsWithCustomSchema);
|
|
27
23
|
if (envVariables) {
|
|
28
24
|
await page.evaluateOnNewDocument((input) => {
|
|
29
25
|
window.remotion_envVariables = input;
|
|
@@ -57,7 +53,7 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
|
|
|
57
53
|
return innerSetPropsAndEnv({
|
|
58
54
|
envVariables,
|
|
59
55
|
initialFrame,
|
|
60
|
-
|
|
56
|
+
serializedInputPropsWithCustomSchema,
|
|
61
57
|
page,
|
|
62
58
|
proxyPort,
|
|
63
59
|
retriesRemaining: retriesRemaining - 1,
|
|
@@ -97,16 +93,16 @@ const innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, i
|
|
|
97
93
|
frame: null,
|
|
98
94
|
page,
|
|
99
95
|
});
|
|
100
|
-
const requiredVersion = '
|
|
96
|
+
const requiredVersion = '8';
|
|
101
97
|
if (siteVersion !== requiredVersion) {
|
|
102
98
|
throw new Error(`Incompatible site: When visiting ${urlToVisit}, a bundle was found, but one that is not compatible with this version of Remotion. Found version: ${siteVersion} - Required version: ${requiredVersion}. To resolve this error, please bundle and deploy again.`);
|
|
103
99
|
}
|
|
104
100
|
if (remotionVersion !== version_1.VERSION && process.env.NODE_ENV !== 'test') {
|
|
105
101
|
if (remotionVersion) {
|
|
106
|
-
|
|
102
|
+
logger_1.Log.warn(`The site was bundled with version ${remotionVersion} of @remotion/bundler, while @remotion/renderer is on version ${version_1.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`);
|
|
107
103
|
}
|
|
108
104
|
else {
|
|
109
|
-
|
|
105
|
+
logger_1.Log.warn(`The site was bundled with an old version of Remotion, while @remotion/renderer is on version ${version_1.VERSION}. You may not have the newest bugfixes and features. Re-bundle the site to fix this issue.`);
|
|
110
106
|
}
|
|
111
107
|
}
|
|
112
108
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"extract-zip": "2.0.1",
|
|
19
19
|
"source-map": "^0.8.0-beta.0",
|
|
20
20
|
"ws": "8.7.0",
|
|
21
|
-
"remotion": "4.0.
|
|
21
|
+
"remotion": "4.0.3"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": ">=16.8.0",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"zod": "^3.21.4"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"@remotion/compositor-
|
|
46
|
-
"@remotion/compositor-darwin-
|
|
47
|
-
"@remotion/compositor-
|
|
48
|
-
"@remotion/compositor-linux-x64-gnu": "4.0.
|
|
49
|
-
"@remotion/compositor-linux-
|
|
50
|
-
"@remotion/compositor-linux-
|
|
51
|
-
"@remotion/compositor-win32-x64-msvc": "4.0.
|
|
45
|
+
"@remotion/compositor-darwin-x64": "4.0.3",
|
|
46
|
+
"@remotion/compositor-darwin-arm64": "4.0.3",
|
|
47
|
+
"@remotion/compositor-linux-arm64-musl": "4.0.3",
|
|
48
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.3",
|
|
49
|
+
"@remotion/compositor-linux-x64-musl": "4.0.3",
|
|
50
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.3",
|
|
51
|
+
"@remotion/compositor-win32-x64-msvc": "4.0.3"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|
|
54
54
|
"remotion",
|