@remotion/renderer 4.0.0-alpha8 → 4.0.0-alpha9
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/compositor/compose.d.ts +3 -1
- package/dist/compositor/compose.js +2 -3
- package/dist/compositor/compositor.d.ts +1 -2
- package/dist/get-compositions.d.ts +1 -1
- package/dist/get-compositions.js +2 -1
- package/dist/index.d.ts +1 -0
- package/dist/offthread-video-server.d.ts +2 -0
- package/dist/offthread-video-server.js +1 -0
- package/dist/prepare-server.d.ts +2 -0
- package/dist/prepare-server.js +4 -2
- package/dist/render-frames.d.ts +1 -1
- package/dist/render-frames.js +17 -5
- package/dist/render-media.d.ts +1 -1
- package/dist/render-media.js +1 -1
- package/dist/render-still.d.ts +1 -1
- package/dist/render-still.js +5 -3
- package/dist/serve-static.d.ts +2 -0
- package/dist/serve-static.js +2 -2
- package/dist/set-props-and-env.d.ts +5 -3
- package/dist/set-props-and-env.js +12 -2
- package/dist/take-frame-and-compose.d.ts +3 -1
- package/dist/take-frame-and-compose.js +2 -1
- package/package.json +13 -12
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DownloadMap } from '../assets/download-map';
|
|
2
|
+
import type { Compositor } from './compositor';
|
|
2
3
|
import type { CompositorCommand, CompositorCommandSerialized, CompositorImageFormat, Layer } from './payloads';
|
|
3
4
|
declare type CompositorInput = {
|
|
4
5
|
height: number;
|
|
@@ -7,9 +8,10 @@ declare type CompositorInput = {
|
|
|
7
8
|
imageFormat: CompositorImageFormat;
|
|
8
9
|
};
|
|
9
10
|
export declare const serializeCommand: <Type extends keyof CompositorCommand>(command: Type, params: CompositorCommand[Type]) => CompositorCommandSerialized<Type>;
|
|
10
|
-
export declare const compose: ({ height, width, layers, output, downloadMap, imageFormat, }: CompositorInput & {
|
|
11
|
+
export declare const compose: ({ height, width, layers, output, downloadMap, imageFormat, compositor, }: CompositorInput & {
|
|
11
12
|
downloadMap: DownloadMap;
|
|
12
13
|
output: string;
|
|
14
|
+
compositor: Compositor;
|
|
13
15
|
}) => Promise<void>;
|
|
14
16
|
export declare const callCompositor: (payload: string) => Promise<void>;
|
|
15
17
|
export {};
|
|
@@ -21,20 +21,19 @@ const serializeCommand = (command, params) => {
|
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
exports.serializeCommand = serializeCommand;
|
|
24
|
-
const compose = async ({ height, width, layers, output, downloadMap, imageFormat, }) => {
|
|
24
|
+
const compose = async ({ height, width, layers, output, downloadMap, imageFormat, compositor, }) => {
|
|
25
25
|
const hash = getCompositorHash({ height, width, layers, imageFormat });
|
|
26
26
|
if (downloadMap.compositorCache[hash]) {
|
|
27
27
|
await (0, promises_1.copyFile)(downloadMap.compositorCache[hash], output);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
await compositor.executeCommand('Compose', {
|
|
31
31
|
height,
|
|
32
32
|
width,
|
|
33
33
|
layers,
|
|
34
34
|
output,
|
|
35
35
|
output_format: imageFormat,
|
|
36
36
|
});
|
|
37
|
-
await (0, exports.callCompositor)(JSON.stringify(payload));
|
|
38
37
|
downloadMap.compositorCache[hash] = output;
|
|
39
38
|
};
|
|
40
39
|
exports.compose = compose;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { CompositorCommand } from './payloads';
|
|
3
|
-
declare type Compositor = {
|
|
3
|
+
export declare type Compositor = {
|
|
4
4
|
finishCommands: () => void;
|
|
5
5
|
executeCommand: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T]) => Promise<Buffer>;
|
|
6
6
|
waitForDone: () => Promise<void>;
|
|
@@ -9,4 +9,3 @@ declare type Compositor = {
|
|
|
9
9
|
export declare const getIdealMaximumFrameCacheItems: () => number;
|
|
10
10
|
export declare const startLongRunningCompositor: (maximumFrameCacheItems: number, verbose: boolean, indent: boolean) => Compositor;
|
|
11
11
|
export declare const startCompositor: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T], indent: boolean) => Compositor;
|
|
12
|
-
export {};
|
|
@@ -5,7 +5,7 @@ import type { BrowserLog } from './browser-log';
|
|
|
5
5
|
import type { Browser } from './browser/Browser';
|
|
6
6
|
import type { ChromiumOptions } from './open-browser';
|
|
7
7
|
declare type GetCompositionsConfig = {
|
|
8
|
-
inputProps?:
|
|
8
|
+
inputProps?: Record<string, unknown> | null;
|
|
9
9
|
envVariables?: Record<string, string>;
|
|
10
10
|
puppeteerInstance?: Browser;
|
|
11
11
|
onBrowserLog?: (log: BrowserLog) => void;
|
package/dist/get-compositions.js
CHANGED
|
@@ -11,6 +11,7 @@ const seek_to_frame_1 = require("./seek-to-frame");
|
|
|
11
11
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
12
12
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
13
13
|
const innerGetCompositions = async (serveUrl, page, config, proxyPort) => {
|
|
14
|
+
var _a;
|
|
14
15
|
if (config === null || config === void 0 ? void 0 : config.onBrowserLog) {
|
|
15
16
|
page.on('console', (log) => {
|
|
16
17
|
var _a;
|
|
@@ -23,7 +24,7 @@ const innerGetCompositions = async (serveUrl, page, config, proxyPort) => {
|
|
|
23
24
|
}
|
|
24
25
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(config === null || config === void 0 ? void 0 : config.timeoutInMilliseconds);
|
|
25
26
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
26
|
-
inputProps: config === null || config === void 0 ? void 0 : config.inputProps,
|
|
27
|
+
inputProps: (_a = config === null || config === void 0 ? void 0 : config.inputProps) !== null && _a !== void 0 ? _a : {},
|
|
27
28
|
envVariables: config === null || config === void 0 ? void 0 : config.envVariables,
|
|
28
29
|
page,
|
|
29
30
|
serveUrl,
|
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ export declare const RenderInternals: {
|
|
|
47
47
|
}) => Promise<{
|
|
48
48
|
port: number;
|
|
49
49
|
close: () => Promise<void>;
|
|
50
|
+
compositor: import("./compositor/compositor").Compositor;
|
|
50
51
|
}>;
|
|
51
52
|
validateEvenDimensionsWithCodec: ({ width, height, codec, scale, }: {
|
|
52
53
|
width: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RequestListener } from 'node:http';
|
|
2
2
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
3
3
|
import type { DownloadMap } from './assets/download-map';
|
|
4
|
+
import type { Compositor } from './compositor/compositor';
|
|
4
5
|
export declare const extractUrlAndSourceFromUrl: (url: string) => {
|
|
5
6
|
src: string;
|
|
6
7
|
time: number;
|
|
@@ -16,4 +17,5 @@ export declare const startOffthreadVideoServer: ({ onDownload, onError, download
|
|
|
16
17
|
}) => {
|
|
17
18
|
listener: RequestListener;
|
|
18
19
|
close: () => Promise<void>;
|
|
20
|
+
compositor: Compositor;
|
|
19
21
|
};
|
package/dist/prepare-server.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
2
2
|
import type { DownloadMap } from './assets/download-map';
|
|
3
|
+
import type { Compositor } from './compositor/compositor';
|
|
3
4
|
export declare const prepareServer: ({ onDownload, onError, webpackConfigOrServeUrl, port, downloadMap, remotionRoot, concurrency, verbose, indent, }: {
|
|
4
5
|
webpackConfigOrServeUrl: string;
|
|
5
6
|
onDownload: RenderMediaOnDownload;
|
|
@@ -14,4 +15,5 @@ export declare const prepareServer: ({ onDownload, onError, webpackConfigOrServe
|
|
|
14
15
|
serveUrl: string;
|
|
15
16
|
closeServer: (force: boolean) => Promise<unknown>;
|
|
16
17
|
offthreadPort: number;
|
|
18
|
+
compositor: Compositor;
|
|
17
19
|
}>;
|
package/dist/prepare-server.js
CHANGED
|
@@ -11,7 +11,7 @@ const serve_static_1 = require("./serve-static");
|
|
|
11
11
|
const wait_for_symbolication_error_to_be_done_1 = require("./wait-for-symbolication-error-to-be-done");
|
|
12
12
|
const prepareServer = async ({ onDownload, onError, webpackConfigOrServeUrl, port, downloadMap, remotionRoot, concurrency, verbose, indent, }) => {
|
|
13
13
|
if ((0, is_serve_url_1.isServeUrl)(webpackConfigOrServeUrl)) {
|
|
14
|
-
const { port: offthreadPort, close: closeProxy } = await (0, serve_static_1.serveStatic)(null, {
|
|
14
|
+
const { port: offthreadPort, close: closeProxy, compositor: comp, } = await (0, serve_static_1.serveStatic)(null, {
|
|
15
15
|
onDownload,
|
|
16
16
|
onError,
|
|
17
17
|
port,
|
|
@@ -27,6 +27,7 @@ const prepareServer = async ({ onDownload, onError, webpackConfigOrServeUrl, por
|
|
|
27
27
|
return closeProxy();
|
|
28
28
|
},
|
|
29
29
|
offthreadPort,
|
|
30
|
+
compositor: comp,
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
// Check if the path has a `index.html` file
|
|
@@ -35,7 +36,7 @@ const prepareServer = async ({ onDownload, onError, webpackConfigOrServeUrl, por
|
|
|
35
36
|
if (!exists) {
|
|
36
37
|
throw new Error(`Tried to serve the Webpack bundle on a HTTP server, but the file ${indexFile} does not exist. Is this a valid path to a Webpack bundle?`);
|
|
37
38
|
}
|
|
38
|
-
const { port: serverPort, close } = await (0, serve_static_1.serveStatic)(webpackConfigOrServeUrl, {
|
|
39
|
+
const { port: serverPort, close, compositor, } = await (0, serve_static_1.serveStatic)(webpackConfigOrServeUrl, {
|
|
39
40
|
onDownload,
|
|
40
41
|
onError,
|
|
41
42
|
port,
|
|
@@ -54,6 +55,7 @@ const prepareServer = async ({ onDownload, onError, webpackConfigOrServeUrl, por
|
|
|
54
55
|
},
|
|
55
56
|
serveUrl: `http://localhost:${serverPort}`,
|
|
56
57
|
offthreadPort: serverPort,
|
|
58
|
+
compositor,
|
|
57
59
|
});
|
|
58
60
|
};
|
|
59
61
|
exports.prepareServer = prepareServer;
|
package/dist/render-frames.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ declare type RenderFramesOptions = {
|
|
|
14
14
|
onStart: (data: OnStartData) => void;
|
|
15
15
|
onFrameUpdate: (framesRendered: number, frameIndex: number, timeToRenderInMilliseconds: number) => void;
|
|
16
16
|
outputDir: string | null;
|
|
17
|
-
inputProps: unknown
|
|
17
|
+
inputProps: Record<string, unknown>;
|
|
18
18
|
envVariables?: Record<string, string>;
|
|
19
19
|
imageFormat?: VideoImageFormat;
|
|
20
20
|
/**
|
package/dist/render-frames.js
CHANGED
|
@@ -35,7 +35,7 @@ const take_frame_and_compose_1 = require("./take-frame-and-compose");
|
|
|
35
35
|
const truthy_1 = require("./truthy");
|
|
36
36
|
const validate_scale_1 = require("./validate-scale");
|
|
37
37
|
const MAX_RETRIES_PER_FRAME = 1;
|
|
38
|
-
const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, jpegQuality, quality, imageFormat = image_format_1.DEFAULT_VIDEO_IMAGE_FORMAT, frameRange, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale = 1, actualConcurrency, everyNthFrame = 1, proxyPort, cancelSignal, downloadMap, muted, makeBrowser, browserReplacer, }) => {
|
|
38
|
+
const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, jpegQuality, quality, imageFormat = image_format_1.DEFAULT_VIDEO_IMAGE_FORMAT, frameRange, onError, envVariables, onBrowserLog, onFrameBuffer, onDownload, pagesArray, serveUrl, composition, timeoutInMilliseconds, scale = 1, actualConcurrency, everyNthFrame = 1, proxyPort, cancelSignal, downloadMap, muted, makeBrowser, browserReplacer, compositor, }) => {
|
|
39
39
|
if (outputDir) {
|
|
40
40
|
if (!node_fs_1.default.existsSync(outputDir)) {
|
|
41
41
|
node_fs_1.default.mkdirSync(outputDir, {
|
|
@@ -175,6 +175,7 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, jpeg
|
|
|
175
175
|
scale,
|
|
176
176
|
downloadMap,
|
|
177
177
|
wantsBuffer: Boolean(onFrameBuffer),
|
|
178
|
+
compositor,
|
|
178
179
|
});
|
|
179
180
|
if (onFrameBuffer) {
|
|
180
181
|
if (!buffer) {
|
|
@@ -217,7 +218,7 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, jpeg
|
|
|
217
218
|
});
|
|
218
219
|
});
|
|
219
220
|
};
|
|
220
|
-
const renderFrameAndRetryTargetClose = async (frame, index, retriesLeft, attempt) => {
|
|
221
|
+
const renderFrameAndRetryTargetClose = async ({ frame, index, retriesLeft, attempt, }) => {
|
|
221
222
|
try {
|
|
222
223
|
await Promise.race([
|
|
223
224
|
renderFrame(frame, index),
|
|
@@ -253,10 +254,20 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, jpeg
|
|
|
253
254
|
pool.release(newPage);
|
|
254
255
|
}
|
|
255
256
|
});
|
|
256
|
-
await renderFrameAndRetryTargetClose(
|
|
257
|
+
await renderFrameAndRetryTargetClose({
|
|
258
|
+
frame,
|
|
259
|
+
index,
|
|
260
|
+
retriesLeft: retriesLeft - 1,
|
|
261
|
+
attempt: attempt + 1,
|
|
262
|
+
});
|
|
257
263
|
}
|
|
258
264
|
};
|
|
259
|
-
const progress = Promise.all(framesToRender.map((frame, index) => renderFrameAndRetryTargetClose(
|
|
265
|
+
const progress = Promise.all(framesToRender.map((frame, index) => renderFrameAndRetryTargetClose({
|
|
266
|
+
frame,
|
|
267
|
+
index,
|
|
268
|
+
retriesLeft: MAX_RETRIES_PER_FRAME,
|
|
269
|
+
attempt: 1,
|
|
270
|
+
})));
|
|
260
271
|
const happyPath = progress.then(() => {
|
|
261
272
|
const firstFrameIndex = countType === 'from-zero' ? 0 : framesToRender[0];
|
|
262
273
|
const returnValue = {
|
|
@@ -343,7 +354,7 @@ const renderFrames = (options) => {
|
|
|
343
354
|
indent: (_c = options.indent) !== null && _c !== void 0 ? _c : false,
|
|
344
355
|
}),
|
|
345
356
|
browserInstance,
|
|
346
|
-
]).then(([{ serveUrl, closeServer, offthreadPort }, puppeteerInstance]) => {
|
|
357
|
+
]).then(([{ serveUrl, closeServer, offthreadPort, compositor }, puppeteerInstance,]) => {
|
|
347
358
|
const browserReplacer = (0, replace_browser_1.handleBrowserCrash)(puppeteerInstance);
|
|
348
359
|
const { stopCycling } = (0, cycle_browser_tabs_1.cycleBrowserTabs)(browserReplacer, actualConcurrency);
|
|
349
360
|
cleanup.push(stopCycling);
|
|
@@ -361,6 +372,7 @@ const renderFrames = (options) => {
|
|
|
361
372
|
downloadMap,
|
|
362
373
|
makeBrowser,
|
|
363
374
|
browserReplacer,
|
|
375
|
+
compositor,
|
|
364
376
|
});
|
|
365
377
|
}),
|
|
366
378
|
])
|
package/dist/render-media.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare type RenderMediaOptions = {
|
|
|
32
32
|
outputLocation?: string | null;
|
|
33
33
|
codec: Codec;
|
|
34
34
|
composition: AnySmallCompMetadata;
|
|
35
|
-
inputProps?: unknown
|
|
35
|
+
inputProps?: Record<string, unknown>;
|
|
36
36
|
crf?: number | null;
|
|
37
37
|
imageFormat?: VideoImageFormat;
|
|
38
38
|
pixelFormat?: PixelFormat;
|
package/dist/render-media.js
CHANGED
|
@@ -246,7 +246,7 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
246
246
|
callUpdate();
|
|
247
247
|
onStart === null || onStart === void 0 ? void 0 : onStart(data);
|
|
248
248
|
},
|
|
249
|
-
inputProps,
|
|
249
|
+
inputProps: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
250
250
|
envVariables,
|
|
251
251
|
imageFormat,
|
|
252
252
|
jpegQuality,
|
package/dist/render-still.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare type InnerStillOptions = {
|
|
|
12
12
|
composition: AnySmallCompMetadata;
|
|
13
13
|
output?: string | null;
|
|
14
14
|
frame?: number;
|
|
15
|
-
inputProps?: unknown
|
|
15
|
+
inputProps?: Record<string, unknown>;
|
|
16
16
|
imageFormat?: StillImageFormat;
|
|
17
17
|
/**
|
|
18
18
|
* @deprecated Renamed to `jpegQuality`
|
package/dist/render-still.js
CHANGED
|
@@ -47,7 +47,7 @@ const set_props_and_env_1 = require("./set-props-and-env");
|
|
|
47
47
|
const take_frame_and_compose_1 = require("./take-frame-and-compose");
|
|
48
48
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
49
49
|
const validate_scale_1 = require("./validate-scale");
|
|
50
|
-
const innerRenderStill = async ({ composition, quality, imageFormat = image_format_1.DEFAULT_STILL_IMAGE_FORMAT, serveUrl, puppeteerInstance, dumpBrowserLogs = false, onError, inputProps, envVariables, output, frame = 0, overwrite = true, browserExecutable, timeoutInMilliseconds, chromiumOptions, scale = 1, proxyPort, cancelSignal, downloadMap, jpegQuality, onBrowserLog, }) => {
|
|
50
|
+
const innerRenderStill = async ({ composition, quality, imageFormat = image_format_1.DEFAULT_STILL_IMAGE_FORMAT, serveUrl, puppeteerInstance, dumpBrowserLogs = false, onError, inputProps, envVariables, output, frame = 0, overwrite = true, browserExecutable, timeoutInMilliseconds, chromiumOptions, scale = 1, proxyPort, cancelSignal, downloadMap, jpegQuality, onBrowserLog, compositor, }) => {
|
|
51
51
|
if (quality) {
|
|
52
52
|
throw new Error('quality has been renamed to jpegQuality. Please rename the option.');
|
|
53
53
|
}
|
|
@@ -137,7 +137,7 @@ const innerRenderStill = async ({ composition, quality, imageFormat = image_form
|
|
|
137
137
|
page.on('console', logCallback);
|
|
138
138
|
}
|
|
139
139
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
140
|
-
inputProps,
|
|
140
|
+
inputProps: inputProps !== null && inputProps !== void 0 ? inputProps : {},
|
|
141
141
|
envVariables,
|
|
142
142
|
page,
|
|
143
143
|
serveUrl,
|
|
@@ -184,6 +184,7 @@ const innerRenderStill = async ({ composition, quality, imageFormat = image_form
|
|
|
184
184
|
output,
|
|
185
185
|
jpegQuality,
|
|
186
186
|
wantsBuffer: !output,
|
|
187
|
+
compositor,
|
|
187
188
|
});
|
|
188
189
|
await cleanup();
|
|
189
190
|
return { buffer: output ? null : buffer };
|
|
@@ -212,7 +213,7 @@ const renderStill = (options) => {
|
|
|
212
213
|
verbose: (_b = options.verbose) !== null && _b !== void 0 ? _b : false,
|
|
213
214
|
indent: (_c = options.indent) !== null && _c !== void 0 ? _c : false,
|
|
214
215
|
})
|
|
215
|
-
.then(({ serveUrl, closeServer, offthreadPort }) => {
|
|
216
|
+
.then(({ serveUrl, closeServer, offthreadPort, compositor }) => {
|
|
216
217
|
close = closeServer;
|
|
217
218
|
return innerRenderStill({
|
|
218
219
|
...options,
|
|
@@ -220,6 +221,7 @@ const renderStill = (options) => {
|
|
|
220
221
|
onError: (err) => reject(err),
|
|
221
222
|
proxyPort: offthreadPort,
|
|
222
223
|
downloadMap,
|
|
224
|
+
compositor,
|
|
223
225
|
});
|
|
224
226
|
})
|
|
225
227
|
.then((res) => resolve(res))
|
package/dist/serve-static.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
2
2
|
import type { DownloadMap } from './assets/download-map';
|
|
3
|
+
import type { Compositor } from './compositor/compositor';
|
|
3
4
|
export declare const serveStatic: (path: string | null, options: {
|
|
4
5
|
port: number | null;
|
|
5
6
|
onDownload: RenderMediaOnDownload;
|
|
@@ -12,4 +13,5 @@ export declare const serveStatic: (path: string | null, options: {
|
|
|
12
13
|
}) => Promise<{
|
|
13
14
|
port: number;
|
|
14
15
|
close: () => Promise<void>;
|
|
16
|
+
compositor: Compositor;
|
|
15
17
|
}>;
|
package/dist/serve-static.js
CHANGED
|
@@ -9,7 +9,7 @@ const get_port_1 = require("./get-port");
|
|
|
9
9
|
const offthread_video_server_1 = require("./offthread-video-server");
|
|
10
10
|
const serve_handler_1 = require("./serve-handler");
|
|
11
11
|
const serveStatic = async (path, options) => {
|
|
12
|
-
const { listener: offthreadRequest, close: closeCompositor } = (0, offthread_video_server_1.startOffthreadVideoServer)({
|
|
12
|
+
const { listener: offthreadRequest, close: closeCompositor, compositor, } = (0, offthread_video_server_1.startOffthreadVideoServer)({
|
|
13
13
|
onDownload: options.onDownload,
|
|
14
14
|
onError: options.onError,
|
|
15
15
|
downloadMap: options.downloadMap,
|
|
@@ -87,7 +87,7 @@ const serveStatic = async (path, options) => {
|
|
|
87
87
|
}),
|
|
88
88
|
]);
|
|
89
89
|
};
|
|
90
|
-
return { port: selectedPort, close };
|
|
90
|
+
return { port: selectedPort, close, compositor };
|
|
91
91
|
}
|
|
92
92
|
catch (err) {
|
|
93
93
|
if (!(err instanceof Error)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Page } from './browser/BrowserPage';
|
|
2
|
-
|
|
3
|
-
inputProps: unknown
|
|
2
|
+
declare type SetPropsAndEnv = {
|
|
3
|
+
inputProps: Record<string, unknown>;
|
|
4
4
|
envVariables: Record<string, string> | undefined;
|
|
5
5
|
page: Page;
|
|
6
6
|
serveUrl: string;
|
|
@@ -10,4 +10,6 @@ export declare const setPropsAndEnv: ({ inputProps, envVariables, page, serveUrl
|
|
|
10
10
|
retriesRemaining: number;
|
|
11
11
|
audioEnabled: boolean;
|
|
12
12
|
videoEnabled: boolean;
|
|
13
|
-
}
|
|
13
|
+
};
|
|
14
|
+
export declare const setPropsAndEnv: (params: SetPropsAndEnv) => Promise<unknown>;
|
|
15
|
+
export {};
|
|
@@ -7,7 +7,7 @@ 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 innerSetPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, initialFrame, timeoutInMilliseconds, proxyPort, retriesRemaining, audioEnabled, videoEnabled, }) => {
|
|
11
11
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
12
12
|
const actualTimeout = timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : TimeoutSettings_1.DEFAULT_TIMEOUT;
|
|
13
13
|
page.setDefaultTimeout(actualTimeout);
|
|
@@ -54,7 +54,7 @@ const setPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, initia
|
|
|
54
54
|
resolve();
|
|
55
55
|
}, 2000);
|
|
56
56
|
});
|
|
57
|
-
return (
|
|
57
|
+
return innerSetPropsAndEnv({
|
|
58
58
|
envVariables,
|
|
59
59
|
initialFrame,
|
|
60
60
|
inputProps,
|
|
@@ -110,4 +110,14 @@ const setPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, initia
|
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
|
+
const setPropsAndEnv = (params) => {
|
|
114
|
+
return Promise.race([
|
|
115
|
+
innerSetPropsAndEnv(params),
|
|
116
|
+
new Promise((_, reject) => {
|
|
117
|
+
setTimeout(() => {
|
|
118
|
+
reject(new Error('Timed out while setting up the headless browser - the browser seems to not respond. This error is thrown to trigger a retry.'));
|
|
119
|
+
}, 10000);
|
|
120
|
+
}),
|
|
121
|
+
]);
|
|
122
|
+
};
|
|
113
123
|
exports.setPropsAndEnv = setPropsAndEnv;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import type { TAsset } from 'remotion';
|
|
3
3
|
import type { DownloadMap } from './assets/download-map';
|
|
4
4
|
import type { Page } from './browser/BrowserPage';
|
|
5
|
+
import type { Compositor } from './compositor/compositor';
|
|
5
6
|
import type { StillImageFormat, VideoImageFormat } from './image-format';
|
|
6
|
-
export declare const takeFrameAndCompose: ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, downloadMap, wantsBuffer, }: {
|
|
7
|
+
export declare const takeFrameAndCompose: ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, downloadMap, wantsBuffer, compositor, }: {
|
|
7
8
|
freePage: Page;
|
|
8
9
|
imageFormat: VideoImageFormat | StillImageFormat;
|
|
9
10
|
jpegQuality: number | undefined;
|
|
@@ -14,6 +15,7 @@ export declare const takeFrameAndCompose: ({ freePage, imageFormat, jpegQuality,
|
|
|
14
15
|
scale: number;
|
|
15
16
|
downloadMap: DownloadMap;
|
|
16
17
|
wantsBuffer: boolean;
|
|
18
|
+
compositor: Compositor;
|
|
17
19
|
}) => Promise<{
|
|
18
20
|
buffer: Buffer | null;
|
|
19
21
|
collectedAssets: TAsset[];
|
|
@@ -10,7 +10,7 @@ const compose_1 = require("./compositor/compose");
|
|
|
10
10
|
const provide_screenshot_1 = require("./provide-screenshot");
|
|
11
11
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
12
12
|
const truthy_1 = require("./truthy");
|
|
13
|
-
const takeFrameAndCompose = async ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, downloadMap, wantsBuffer, }) => {
|
|
13
|
+
const takeFrameAndCompose = async ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, downloadMap, wantsBuffer, compositor, }) => {
|
|
14
14
|
var _a;
|
|
15
15
|
const [clipRegion, collectedAssets] = await Promise.all([
|
|
16
16
|
(0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
@@ -90,6 +90,7 @@ const takeFrameAndCompose = async ({ freePage, imageFormat, jpegQuality, frame,
|
|
|
90
90
|
output: needsComposing.finalOutFile,
|
|
91
91
|
downloadMap,
|
|
92
92
|
imageFormat: imageFormat === 'jpeg' ? 'Jpeg' : 'Png',
|
|
93
|
+
compositor,
|
|
93
94
|
});
|
|
94
95
|
if (wantsBuffer) {
|
|
95
96
|
const buffer = await node_fs_1.default.promises.readFile(needsComposing.finalOutFile);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-alpha9",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"execa": "5.1.1",
|
|
18
18
|
"extract-zip": "2.0.1",
|
|
19
|
-
"remotion": "4.0.0-alpha8",
|
|
20
19
|
"source-map": "^0.8.0-beta.0",
|
|
21
|
-
"ws": "8.7.0"
|
|
20
|
+
"ws": "8.7.0",
|
|
21
|
+
"remotion": "4.0.0-alpha9"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"react": ">=16.8.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@jonny/eslint-config": "3.0.266",
|
|
29
29
|
"@testing-library/dom": "^8.16.0",
|
|
30
30
|
"@testing-library/react": "13.3.0",
|
|
31
|
-
"@types/node": "
|
|
31
|
+
"@types/node": "18.14.6",
|
|
32
32
|
"@types/progress": "2.0.5",
|
|
33
33
|
"@types/react": "18.0.26",
|
|
34
34
|
"@types/react-dom": "18.0.10",
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
"react": "18.0.0",
|
|
39
39
|
"react-dom": "18.0.0",
|
|
40
40
|
"typescript": "^4.7.0",
|
|
41
|
-
"vitest": "0.
|
|
41
|
+
"vitest": "0.31.1",
|
|
42
42
|
"zod": "^3.21.4"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"@remotion/compositor-darwin-arm64": "4.0.0-
|
|
46
|
-
"@remotion/compositor-
|
|
47
|
-
"@remotion/compositor-
|
|
48
|
-
"@remotion/compositor-linux-arm64-musl": "4.0.0-
|
|
49
|
-
"@remotion/compositor-
|
|
50
|
-
"@remotion/compositor-linux-x64-
|
|
51
|
-
"@remotion/compositor-
|
|
45
|
+
"@remotion/compositor-darwin-arm64": "4.0.0-alpha9",
|
|
46
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.0-alpha9",
|
|
47
|
+
"@remotion/compositor-darwin-x64": "4.0.0-alpha9",
|
|
48
|
+
"@remotion/compositor-linux-arm64-musl": "4.0.0-alpha9",
|
|
49
|
+
"@remotion/compositor-win32-x64-msvc": "4.0.0-alpha9",
|
|
50
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.0-alpha9",
|
|
51
|
+
"@remotion/compositor-linux-x64-musl": "4.0.0-alpha9"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|
|
54
54
|
"remotion",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"access": "public"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
|
+
"formatting": "prettier src --check",
|
|
64
65
|
"lint": "eslint src --ext ts,tsx",
|
|
65
66
|
"test": "vitest --run",
|
|
66
67
|
"watch": "tsc -w",
|