@remotion/renderer 3.3.28 → 3.3.31
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/create-ffmpeg-complex-filter.d.ts +1 -4
- package/dist/determine-resize-params.d.ts +1 -4
- package/dist/extract-frame-from-video.d.ts +1 -0
- package/dist/get-compositions-from-bundle.d.ts +6 -1
- package/dist/get-compositions-from-bundle.js +2 -2
- package/dist/get-compositions.js +9 -2
- package/dist/get-concurrency.d.ts +1 -1
- package/dist/get-concurrency.js +8 -1
- package/dist/get-extension-from-codec.d.ts +1 -1
- package/dist/get-frame-of-video-slow.d.ts +2 -4
- package/dist/guess-extension-for-media.d.ts +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/last-frame-from-video-cache.d.ts +1 -0
- package/dist/make-comp-manager-context.d.ts +2 -0
- package/dist/make-comp-manager-context.js +45 -0
- package/dist/prepare-server.d.ts +1 -1
- package/dist/prepare-server.js +5 -2
- package/dist/provide-screenshot.d.ts +1 -0
- package/dist/puppeteer-screenshot.d.ts +1 -0
- package/dist/render-frames.d.ts +1 -1
- package/dist/render-frames.js +1 -1
- package/dist/render-media.d.ts +2 -1
- package/dist/render-on-server.js +3 -40
- package/dist/render-still.js +1 -1
- package/dist/render-svg.d.ts +8 -0
- package/dist/render-svg.js +28 -0
- package/dist/render-web-frame.d.ts +6 -2
- package/dist/render-web-frame.js +35 -43
- package/dist/screenshot-dom-element.d.ts +1 -0
- package/dist/screenshot-task.d.ts +1 -0
- package/dist/take-frame-and-compose.d.ts +1 -0
- package/dist/try-to-extract-frame-of-video-fast.d.ts +1 -0
- package/dist/validate-concurrency.js +14 -9
- package/package.json +10 -10
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import type { DownloadMap } from './assets/download-map';
|
|
2
2
|
export declare const createFfmpegComplexFilter: (filters: number, downloadMap: DownloadMap) => Promise<{
|
|
3
|
-
complexFilterFlag: [
|
|
4
|
-
string,
|
|
5
|
-
string
|
|
6
|
-
] | null;
|
|
3
|
+
complexFilterFlag: [string, string] | null;
|
|
7
4
|
cleanup: () => void;
|
|
8
5
|
}>;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { TCompMetadata } from 'remotion';
|
|
1
3
|
import type { GetCompositionsConfig } from './get-compositions';
|
|
2
|
-
export declare const getCompositionsFromBundle: (bundle: string, options: GetCompositionsConfig) =>
|
|
4
|
+
export declare const getCompositionsFromBundle: (bundle: string, options: GetCompositionsConfig) => {
|
|
5
|
+
compositions: TCompMetadata[];
|
|
6
|
+
root: ComponentType;
|
|
7
|
+
};
|
|
@@ -48,8 +48,8 @@ const getCompositionsFromBundle = (bundle, options) => {
|
|
|
48
48
|
throw new Error('Did not call getRoot() in the bundle. Delaying the calling of getRoot() is not supported in server-side-rendering.');
|
|
49
49
|
}
|
|
50
50
|
const Comp = theRoot;
|
|
51
|
-
console.log({ Comp1: Comp });
|
|
52
51
|
const comps = (0, remotion_1.getCompositionsFromMarkup)(Comp);
|
|
53
|
-
|
|
52
|
+
remotion_1.Internals.clearRoot();
|
|
53
|
+
return { compositions: comps, root: Comp };
|
|
54
54
|
};
|
|
55
55
|
exports.getCompositionsFromBundle = getCompositionsFromBundle;
|
package/dist/get-compositions.js
CHANGED
|
@@ -89,13 +89,20 @@ const getCompositions = async (serveUrlOrWebpackUrl, config) => {
|
|
|
89
89
|
close = closeServer;
|
|
90
90
|
return innerGetCompositions(serveUrl, page, config !== null && config !== void 0 ? config : {}, offthreadPort);
|
|
91
91
|
})
|
|
92
|
-
.then((comp) =>
|
|
92
|
+
.then((comp) => {
|
|
93
|
+
if (close) {
|
|
94
|
+
return Promise.all([comp, close(true)]);
|
|
95
|
+
}
|
|
96
|
+
return Promise.resolve([comp, null]);
|
|
97
|
+
})
|
|
98
|
+
.then(([comp]) => {
|
|
99
|
+
return resolve(comp);
|
|
100
|
+
})
|
|
93
101
|
.catch((err) => {
|
|
94
102
|
reject(err);
|
|
95
103
|
})
|
|
96
104
|
.finally(() => {
|
|
97
105
|
cleanup();
|
|
98
|
-
close === null || close === void 0 ? void 0 : close();
|
|
99
106
|
cleanupPageError();
|
|
100
107
|
// Clean download map if it was not passed in
|
|
101
108
|
if (!(config === null || config === void 0 ? void 0 : config.downloadMap)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getActualConcurrency: (userPreference: number | null) => number;
|
|
1
|
+
export declare const getActualConcurrency: (userPreference: number | string | null) => number;
|
package/dist/get-concurrency.js
CHANGED
|
@@ -9,9 +9,16 @@ const getActualConcurrency = (userPreference) => {
|
|
|
9
9
|
if (userPreference === null) {
|
|
10
10
|
return Math.round(Math.min(8, Math.max(1, os_1.default.cpus().length / 2)));
|
|
11
11
|
}
|
|
12
|
-
const rounded = Math.floor(userPreference);
|
|
13
12
|
const max = os_1.default.cpus().length;
|
|
14
13
|
const min = 1;
|
|
14
|
+
let rounded;
|
|
15
|
+
if (typeof userPreference === 'string') {
|
|
16
|
+
const percentage = parseInt(userPreference.slice(0, -1), 10);
|
|
17
|
+
rounded = Math.floor((percentage / 100) * max);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
rounded = Math.floor(userPreference);
|
|
21
|
+
}
|
|
15
22
|
if (rounded > max) {
|
|
16
23
|
throw new Error(`Maximum for --concurrency is ${max} (number of cores on this system)`);
|
|
17
24
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Codec } from './codec';
|
|
2
|
-
export declare const getFileExtensionFromCodec: (codec: Codec, type: 'chunk' | 'final') => "mp3" | "aac" | "wav" | "gif" | "
|
|
2
|
+
export declare const getFileExtensionFromCodec: (codec: Codec, type: 'chunk' | 'final') => "mp3" | "aac" | "wav" | "gif" | "webm" | "mp4" | "mov" | "mkv";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import type { OffthreadVideoImageFormat } from 'remotion';
|
|
2
3
|
import type { SpecialVCodecForTransparency } from './assets/download-map';
|
|
3
4
|
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
@@ -7,10 +8,7 @@ export declare const getFrameOfVideoSlow: ({ src, duration, ffmpegExecutable, im
|
|
|
7
8
|
duration: number;
|
|
8
9
|
imageFormat: OffthreadVideoImageFormat;
|
|
9
10
|
specialVCodecForTransparency: SpecialVCodecForTransparency;
|
|
10
|
-
needsResize: [
|
|
11
|
-
number,
|
|
12
|
-
number
|
|
13
|
-
] | null;
|
|
11
|
+
needsResize: [number, number] | null;
|
|
14
12
|
offset: number;
|
|
15
13
|
fps: number | null;
|
|
16
14
|
remotionRoot: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import execa from 'execa';
|
|
2
3
|
import { SymbolicateableError } from './error-handling/symbolicateable-error';
|
|
3
4
|
import { mimeContentType, mimeLookup } from './mime-types';
|
|
@@ -40,7 +41,7 @@ export declare const RenderInternals: {
|
|
|
40
41
|
feature: "enable-gpl" | "enable-libx265" | "enable-libvpx";
|
|
41
42
|
remotionRoot: string;
|
|
42
43
|
}) => Promise<boolean>;
|
|
43
|
-
getActualConcurrency: (userPreference: number | null) => number;
|
|
44
|
+
getActualConcurrency: (userPreference: string | number | null) => number;
|
|
44
45
|
validateFfmpeg: (customFfmpegBinary: string | null, remotionRoot: string, binary: "ffmpeg" | "ffprobe") => Promise<void>;
|
|
45
46
|
serveStatic: (path: string | null, options: {
|
|
46
47
|
port: number | null;
|
|
@@ -60,7 +61,7 @@ export declare const RenderInternals: {
|
|
|
60
61
|
scale: number;
|
|
61
62
|
codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
62
63
|
}) => void;
|
|
63
|
-
getFileExtensionFromCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", type: "chunk" | "final") => "mp3" | "aac" | "wav" | "gif" | "
|
|
64
|
+
getFileExtensionFromCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif", type: "chunk" | "final") => "mp3" | "aac" | "wav" | "gif" | "webm" | "mp4" | "mov" | "mkv";
|
|
64
65
|
tmpDir: (str: string) => string;
|
|
65
66
|
deleteDirectory: (directory: string) => Promise<void>;
|
|
66
67
|
isServeUrl: (potentialUrl: string) => boolean;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeCompManagerContext = void 0;
|
|
4
|
+
const makeCompManagerContext = (composition) => {
|
|
5
|
+
const memo = {
|
|
6
|
+
assets: [],
|
|
7
|
+
compositions: [composition],
|
|
8
|
+
currentComposition: composition.id,
|
|
9
|
+
currentCompositionMetadata: composition,
|
|
10
|
+
folders: [],
|
|
11
|
+
registerAsset: () => {
|
|
12
|
+
throw new Error('Not implemented');
|
|
13
|
+
},
|
|
14
|
+
registerComposition: () => {
|
|
15
|
+
throw new Error('Not implemented');
|
|
16
|
+
},
|
|
17
|
+
registerFolder: () => {
|
|
18
|
+
throw new Error('Not implemented');
|
|
19
|
+
},
|
|
20
|
+
setCurrentComposition: () => {
|
|
21
|
+
throw new Error('Not implemented');
|
|
22
|
+
},
|
|
23
|
+
registerSequence() {
|
|
24
|
+
throw new Error('Not implemented');
|
|
25
|
+
},
|
|
26
|
+
sequences: [],
|
|
27
|
+
setCurrentCompositionMetadata: () => {
|
|
28
|
+
throw new Error('Not implemented');
|
|
29
|
+
},
|
|
30
|
+
unregisterAsset: () => {
|
|
31
|
+
throw new Error('Not implemented');
|
|
32
|
+
},
|
|
33
|
+
unregisterComposition: () => {
|
|
34
|
+
throw new Error('Not implemented');
|
|
35
|
+
},
|
|
36
|
+
unregisterFolder: () => {
|
|
37
|
+
throw new Error('Not implemented');
|
|
38
|
+
},
|
|
39
|
+
unregisterSequence: () => {
|
|
40
|
+
throw new Error('Not implemented');
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
return memo;
|
|
44
|
+
};
|
|
45
|
+
exports.makeCompManagerContext = makeCompManagerContext;
|
package/dist/prepare-server.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ export declare const prepareServer: ({ ffmpegExecutable, ffprobeExecutable, onDo
|
|
|
12
12
|
remotionRoot: string;
|
|
13
13
|
}) => Promise<{
|
|
14
14
|
serveUrl: string;
|
|
15
|
-
closeServer: () => Promise<unknown>;
|
|
15
|
+
closeServer: (force: boolean) => Promise<unknown>;
|
|
16
16
|
offthreadPort: number;
|
|
17
17
|
}>;
|
package/dist/prepare-server.js
CHANGED
|
@@ -44,8 +44,11 @@ const prepareServer = async ({ ffmpegExecutable, ffprobeExecutable, onDownload,
|
|
|
44
44
|
remotionRoot,
|
|
45
45
|
});
|
|
46
46
|
return Promise.resolve({
|
|
47
|
-
closeServer: () => {
|
|
48
|
-
|
|
47
|
+
closeServer: async (force) => {
|
|
48
|
+
if (!force) {
|
|
49
|
+
await (0, wait_for_symbolication_error_to_be_done_1.waitForSymbolicationToBeDone)();
|
|
50
|
+
}
|
|
51
|
+
return close();
|
|
49
52
|
},
|
|
50
53
|
serveUrl: `http://localhost:${serverPort}`,
|
|
51
54
|
offthreadPort: serverPort,
|
package/dist/render-frames.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ declare type ConfigOrComposition = {
|
|
|
21
21
|
composition: SmallTCompMetadata;
|
|
22
22
|
};
|
|
23
23
|
declare type ConcurrencyOrParallelism = {
|
|
24
|
-
concurrency?: number | null;
|
|
24
|
+
concurrency?: number | string | null;
|
|
25
25
|
} | {
|
|
26
26
|
/**
|
|
27
27
|
* @deprecated This field has been renamed to `concurrency`
|
package/dist/render-frames.js
CHANGED
|
@@ -343,7 +343,7 @@ const renderFrames = (options) => {
|
|
|
343
343
|
const browserReplacer = (0, replace_browser_1.handleBrowserCrash)(puppeteerInstance);
|
|
344
344
|
const { stopCycling } = (0, cycle_browser_tabs_1.cycleBrowserTabs)(browserReplacer, actualConcurrency);
|
|
345
345
|
cleanup.push(stopCycling);
|
|
346
|
-
cleanup.push(closeServer);
|
|
346
|
+
cleanup.push(() => closeServer(false));
|
|
347
347
|
return innerRenderFrames({
|
|
348
348
|
...options,
|
|
349
349
|
puppeteerInstance,
|
package/dist/render-media.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import type { SmallTCompMetadata } from 'remotion';
|
|
2
3
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
3
4
|
import type { DownloadMap } from './assets/download-map';
|
|
@@ -71,7 +72,7 @@ export declare type RenderMediaOptions = {
|
|
|
71
72
|
disallowParallelEncoding?: boolean;
|
|
72
73
|
} & ServeUrlOrWebpackBundle & ConcurrencyOrParallelism;
|
|
73
74
|
declare type ConcurrencyOrParallelism = {
|
|
74
|
-
concurrency?: number | null;
|
|
75
|
+
concurrency?: number | string | null;
|
|
75
76
|
} | {
|
|
76
77
|
/**
|
|
77
78
|
* @deprecated This field has been renamed to `concurrency`
|
package/dist/render-on-server.js
CHANGED
|
@@ -13,51 +13,14 @@ const download_map_1 = require("./assets/download-map");
|
|
|
13
13
|
const compose_1 = require("./compositor/compose");
|
|
14
14
|
const compositor_1 = require("./compositor/compositor");
|
|
15
15
|
const get_frame_padded_index_1 = require("./get-frame-padded-index");
|
|
16
|
+
const make_comp_manager_context_1 = require("./make-comp-manager-context");
|
|
16
17
|
const pool_1 = require("./pool");
|
|
17
18
|
const renderOnServer = async (Comp, composition) => {
|
|
18
19
|
console.time('total');
|
|
19
20
|
console.time('frames');
|
|
20
21
|
process.env.REMOTION_SERVER_RENDERING = 'true';
|
|
21
|
-
process.env.SELECT_COMP_ID = composition.id;
|
|
22
22
|
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
|
23
|
-
const memo =
|
|
24
|
-
assets: [],
|
|
25
|
-
compositions: [composition],
|
|
26
|
-
currentComposition: composition.id,
|
|
27
|
-
currentCompositionMetadata: composition,
|
|
28
|
-
folders: [],
|
|
29
|
-
registerAsset: () => {
|
|
30
|
-
throw new Error('Not implemented');
|
|
31
|
-
},
|
|
32
|
-
registerComposition: () => {
|
|
33
|
-
throw new Error('Not implemented');
|
|
34
|
-
},
|
|
35
|
-
registerFolder: () => {
|
|
36
|
-
throw new Error('Not implemented');
|
|
37
|
-
},
|
|
38
|
-
setCurrentComposition: () => {
|
|
39
|
-
throw new Error('Not implemented');
|
|
40
|
-
},
|
|
41
|
-
registerSequence() {
|
|
42
|
-
throw new Error('Not implemented');
|
|
43
|
-
},
|
|
44
|
-
sequences: [],
|
|
45
|
-
setCurrentCompositionMetadata: () => {
|
|
46
|
-
throw new Error('Not implemented');
|
|
47
|
-
},
|
|
48
|
-
unregisterAsset: () => {
|
|
49
|
-
throw new Error('Not implemented');
|
|
50
|
-
},
|
|
51
|
-
unregisterComposition: () => {
|
|
52
|
-
throw new Error('Not implemented');
|
|
53
|
-
},
|
|
54
|
-
unregisterFolder: () => {
|
|
55
|
-
throw new Error('Not implemented');
|
|
56
|
-
},
|
|
57
|
-
unregisterSequence: () => {
|
|
58
|
-
throw new Error('Not implemented');
|
|
59
|
-
},
|
|
60
|
-
};
|
|
23
|
+
const memo = (0, make_comp_manager_context_1.makeCompManagerContext)(composition);
|
|
61
24
|
const pool = new pool_1.Pool(new Array(4).fill(true).map((_, i) => i));
|
|
62
25
|
const downloadMap = (0, download_map_1.makeDownloadMap)();
|
|
63
26
|
const renderId = 'abc';
|
|
@@ -77,7 +40,7 @@ const renderOnServer = async (Comp, composition) => {
|
|
|
77
40
|
throw new Error('Not implemented');
|
|
78
41
|
},
|
|
79
42
|
};
|
|
80
|
-
const svg = (0, server_1.renderToStaticMarkup)((0, jsx_runtime_1.jsx)(remotion_1.Internals.Timeline.TimelineContext.Provider, { value: value, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.CompositionManager.Provider, { value: memo, children: (0, jsx_runtime_1.jsx)(Comp, {}) }) }));
|
|
43
|
+
const svg = (0, server_1.renderToStaticMarkup)((0, jsx_runtime_1.jsx)(remotion_1.Internals.SelectCompositionMode, { layer: 0, id: composition.id, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.Timeline.TimelineContext.Provider, { value: value, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.CompositionManager.Provider, { value: memo, children: (0, jsx_runtime_1.jsx)(Comp, {}) }) }) }));
|
|
81
44
|
const out = path_1.default.join(downloadMap.compositingDir, (0, get_frame_padded_index_1.getFrameOutputFileName)({
|
|
82
45
|
frame: i,
|
|
83
46
|
imageFormat: 'tiff',
|
package/dist/render-still.js
CHANGED
|
@@ -208,7 +208,7 @@ const renderStill = (options) => {
|
|
|
208
208
|
if (!(options === null || options === void 0 ? void 0 : options.downloadMap)) {
|
|
209
209
|
(0, download_map_1.cleanDownloadMap)(downloadMap);
|
|
210
210
|
}
|
|
211
|
-
return close === null || close === void 0 ? void 0 : close();
|
|
211
|
+
return close === null || close === void 0 ? void 0 : close(false);
|
|
212
212
|
});
|
|
213
213
|
});
|
|
214
214
|
return Promise.race([
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { TCompMetadata } from 'remotion';
|
|
3
|
+
export declare const renderSvg: ({ composition, Comp, frame, layer, }: {
|
|
4
|
+
composition: TCompMetadata;
|
|
5
|
+
Comp: ComponentType;
|
|
6
|
+
frame: number;
|
|
7
|
+
layer: number;
|
|
8
|
+
}) => string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderSvg = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const server_1 = require("react-dom/server");
|
|
6
|
+
const remotion_1 = require("remotion");
|
|
7
|
+
const make_comp_manager_context_1 = require("./make-comp-manager-context");
|
|
8
|
+
const makeTimelineContextValue = (composition, frame) => {
|
|
9
|
+
const value = {
|
|
10
|
+
audioAndVideoTags: { current: [] },
|
|
11
|
+
rootId: composition.id,
|
|
12
|
+
playing: false,
|
|
13
|
+
playbackRate: 1,
|
|
14
|
+
imperativePlaying: {
|
|
15
|
+
current: false,
|
|
16
|
+
},
|
|
17
|
+
frame,
|
|
18
|
+
setPlaybackRate: () => {
|
|
19
|
+
throw new Error('Not implemented');
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
const renderSvg = ({ composition, Comp, frame, layer, }) => {
|
|
25
|
+
const svg = (0, server_1.renderToStaticMarkup)((0, jsx_runtime_1.jsx)(remotion_1.Internals.SelectCompositionMode, { layer: layer, id: composition.id, children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.Timeline.TimelineContext.Provider, { value: makeTimelineContextValue(composition, frame), children: (0, jsx_runtime_1.jsx)(remotion_1.Internals.CompositionManager.Provider, { value: (0, make_comp_manager_context_1.makeCompManagerContext)(composition), children: (0, jsx_runtime_1.jsx)(Comp, {}) }) }) }));
|
|
26
|
+
return svg;
|
|
27
|
+
};
|
|
28
|
+
exports.renderSvg = renderSvg;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { SmallTCompMetadata, TAsset } from 'remotion
|
|
1
|
+
import type { SmallTCompMetadata, TAsset } from 'remotion';
|
|
2
2
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
3
3
|
import type { DownloadMap } from './assets/download-map';
|
|
4
4
|
import type { BrowserExecutable } from './browser-executable';
|
|
5
5
|
import type { BrowserLog } from './browser-log';
|
|
6
6
|
import type { Page } from './browser/BrowserPage';
|
|
7
|
+
import type { CompositorLayer } from './compositor/payloads';
|
|
7
8
|
import type { CountType } from './get-frame-padded-index';
|
|
8
9
|
import type { ServeUrl } from './legacy-webpack-config';
|
|
9
10
|
import type { ChromiumOptions } from './open-browser';
|
|
@@ -49,7 +50,10 @@ export declare const renderWebFrameAndRetryTargetClose: ({ frame, index, retries
|
|
|
49
50
|
timeoutInMilliseconds: number;
|
|
50
51
|
onDownload: RenderMediaOnDownload;
|
|
51
52
|
onError: (err: Error) => void;
|
|
52
|
-
}) => Promise<
|
|
53
|
+
}) => Promise<{
|
|
54
|
+
layer: CompositorLayer | null;
|
|
55
|
+
buffer: Buffer | null;
|
|
56
|
+
}>;
|
|
53
57
|
export declare const makePage: ({ browserReplacer, pagesArray, composition, scale, onBrowserLog, inputProps, envVariables, serveUrl, realFrameRange, timeoutInMilliseconds, proxyPort, imageFormat, muted, }: {
|
|
54
58
|
browserReplacer: BrowserReplacer;
|
|
55
59
|
pagesArray: Page[];
|
package/dist/render-web-frame.js
CHANGED
|
@@ -9,7 +9,6 @@ const download_and_map_assets_to_file_1 = require("./assets/download-and-map-ass
|
|
|
9
9
|
const browser_1 = require("./browser");
|
|
10
10
|
const compress_assets_1 = require("./compress-assets");
|
|
11
11
|
const handle_javascript_exception_1 = require("./error-handling/handle-javascript-exception");
|
|
12
|
-
const get_frame_padded_index_1 = require("./get-frame-padded-index");
|
|
13
12
|
const make_cancel_signal_1 = require("./make-cancel-signal");
|
|
14
13
|
const open_browser_1 = require("./open-browser");
|
|
15
14
|
const perf_1 = require("./perf");
|
|
@@ -18,11 +17,12 @@ const seek_to_frame_1 = require("./seek-to-frame");
|
|
|
18
17
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
19
18
|
const take_frame_and_compose_1 = require("./take-frame-and-compose");
|
|
20
19
|
const truthy_1 = require("./truthy");
|
|
21
|
-
const renderFrameWithOptionToReject = async ({ frame, index, reject, width, height, poolPromise, stopState,
|
|
20
|
+
const renderFrameWithOptionToReject = async ({ frame, index, reject, width, height, poolPromise, stopState, imageFormat, downloadMap, onFrameUpdate, scale, assets, quality, framesRendered, onDownload, onError, }) => {
|
|
22
21
|
const pool = await poolPromise;
|
|
23
22
|
const freePage = await pool.acquire();
|
|
24
23
|
if (stopState.isStopped) {
|
|
25
|
-
|
|
24
|
+
reject(new Error('Render was stopped'));
|
|
25
|
+
throw new Error('stopped');
|
|
26
26
|
}
|
|
27
27
|
const startTime = performance.now();
|
|
28
28
|
const errorCallbackOnFrame = (err) => {
|
|
@@ -35,39 +35,38 @@ const renderFrameWithOptionToReject = async ({ frame, index, reject, width, heig
|
|
|
35
35
|
});
|
|
36
36
|
freePage.on('error', errorCallbackOnFrame);
|
|
37
37
|
await (0, seek_to_frame_1.seekToFrame)({ frame, page: freePage });
|
|
38
|
-
if (!outputDir && !onFrameBuffer && imageFormat !== 'none') {
|
|
39
|
-
throw new Error('Called renderFrames() without specifying either `outputDir` or `onFrameBuffer`');
|
|
40
|
-
}
|
|
41
|
-
if (outputDir && onFrameBuffer && imageFormat !== 'none') {
|
|
42
|
-
throw new Error('Pass either `outputDir` or `onFrameBuffer` to renderFrames(), not both.');
|
|
43
|
-
}
|
|
44
38
|
const id = (0, perf_1.startPerfMeasure)('save');
|
|
45
|
-
const
|
|
46
|
-
const { buffer, collectedAssets } = await (0, take_frame_and_compose_1.
|
|
39
|
+
const output = path_1.default.join(downloadMap.compositingDir, `preframe-${index}.${imageFormat}`);
|
|
40
|
+
const { buffer, collectedAssets, clipRegion } = await (0, take_frame_and_compose_1.takeFrame)({
|
|
47
41
|
frame,
|
|
48
42
|
freePage,
|
|
49
43
|
height,
|
|
50
44
|
imageFormat,
|
|
51
|
-
output: path_1.default.join(frameDir, (0, get_frame_padded_index_1.getFrameOutputFileName)({
|
|
52
|
-
frame,
|
|
53
|
-
imageFormat,
|
|
54
|
-
index,
|
|
55
|
-
countType,
|
|
56
|
-
lastFrame,
|
|
57
|
-
totalFrames: framesToRender.length,
|
|
58
|
-
})),
|
|
59
45
|
quality,
|
|
60
46
|
width,
|
|
61
|
-
scale,
|
|
62
|
-
downloadMap,
|
|
63
|
-
wantsBuffer: Boolean(onFrameBuffer),
|
|
64
47
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
48
|
+
const needsComposing = clipRegion === null
|
|
49
|
+
? null
|
|
50
|
+
: {
|
|
51
|
+
tmpFile: path_1.default.join(downloadMap.compositingDir, `${frame}.${imageFormat}`),
|
|
52
|
+
finalOutfie: output !== null && output !== void 0 ? output : path_1.default.join(downloadMap.compositingDir, `${frame}-final.${imageFormat}`),
|
|
53
|
+
clipRegion: clipRegion,
|
|
54
|
+
};
|
|
55
|
+
const compositionLayer = !needsComposing || needsComposing.clipRegion === 'hide'
|
|
56
|
+
? null
|
|
57
|
+
: {
|
|
58
|
+
type: imageFormat === 'jpeg'
|
|
59
|
+
? 'JpgImage'
|
|
60
|
+
: 'PngImage',
|
|
61
|
+
params: {
|
|
62
|
+
height: needsComposing.clipRegion.height * scale,
|
|
63
|
+
width: needsComposing.clipRegion.width * scale,
|
|
64
|
+
src: needsComposing.tmpFile,
|
|
65
|
+
x: needsComposing.clipRegion.x * scale,
|
|
66
|
+
y: needsComposing.clipRegion.y * scale,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
// TODO: Always return buffer
|
|
71
70
|
(0, perf_1.stopPerfMeasure)(id);
|
|
72
71
|
const compressedAssets = collectedAssets.map((asset) => (0, compress_assets_1.compressAsset)(assets.filter(truthy_1.truthy).flat(1), asset));
|
|
73
72
|
assets[index] = compressedAssets;
|
|
@@ -85,8 +84,9 @@ const renderFrameWithOptionToReject = async ({ frame, index, reject, width, heig
|
|
|
85
84
|
cleanupPageError();
|
|
86
85
|
freePage.off('error', errorCallbackOnFrame);
|
|
87
86
|
pool.release(freePage);
|
|
87
|
+
return { layer: compositionLayer, buffer };
|
|
88
88
|
};
|
|
89
|
-
const renderWebFrame = ({ frame, index, downloadMap, imageFormat,
|
|
89
|
+
const renderWebFrame = ({ frame, index, downloadMap, imageFormat, onFrameUpdate, poolPromise, stopState, composition, assets, scale, quality, framesRendered, onDownload, onError, }) => {
|
|
90
90
|
return new Promise((resolve, reject) => {
|
|
91
91
|
renderFrameWithOptionToReject({
|
|
92
92
|
frame,
|
|
@@ -96,23 +96,18 @@ const renderWebFrame = ({ frame, index, downloadMap, imageFormat, onFrameBuffer,
|
|
|
96
96
|
height: composition.height,
|
|
97
97
|
downloadMap,
|
|
98
98
|
imageFormat,
|
|
99
|
-
onFrameBuffer,
|
|
100
99
|
onFrameUpdate,
|
|
101
|
-
outputDir,
|
|
102
100
|
poolPromise,
|
|
103
101
|
stopState,
|
|
104
102
|
assets,
|
|
105
|
-
countType,
|
|
106
103
|
scale,
|
|
107
104
|
quality,
|
|
108
|
-
framesToRender,
|
|
109
|
-
lastFrame,
|
|
110
105
|
framesRendered,
|
|
111
106
|
onDownload,
|
|
112
107
|
onError,
|
|
113
108
|
})
|
|
114
|
-
.then(() => {
|
|
115
|
-
resolve();
|
|
109
|
+
.then((res) => {
|
|
110
|
+
resolve(res);
|
|
116
111
|
})
|
|
117
112
|
.catch((err) => {
|
|
118
113
|
reject(err);
|
|
@@ -122,27 +117,23 @@ const renderWebFrame = ({ frame, index, downloadMap, imageFormat, onFrameBuffer,
|
|
|
122
117
|
const renderWebFrameAndRetryTargetClose = async ({ frame, index, retriesLeft, attempt, actualConcurrency, browserReplacer, poolPromise, composition, downloadMap, imageFormat, onFrameBuffer, onFrameUpdate, outputDir, stopState, assets, countType, scale, quality, framesToRender, lastFrame, framesRendered, browserExecutable, chromiumOptions, dumpBrowserLogs, pagesArray, onBrowserLog, inputProps, envVariables, muted, proxyPort, realFrameRange, serveUrl, timeoutInMilliseconds, onDownload, onError, }) => {
|
|
123
118
|
var _a, _b;
|
|
124
119
|
try {
|
|
125
|
-
await renderWebFrame({
|
|
120
|
+
const returnval = await renderWebFrame({
|
|
126
121
|
frame,
|
|
127
122
|
index,
|
|
128
123
|
poolPromise,
|
|
129
124
|
composition,
|
|
130
125
|
downloadMap,
|
|
131
126
|
imageFormat,
|
|
132
|
-
onFrameBuffer,
|
|
133
127
|
onFrameUpdate,
|
|
134
|
-
outputDir,
|
|
135
128
|
stopState,
|
|
136
129
|
assets,
|
|
137
|
-
countType,
|
|
138
130
|
scale,
|
|
139
131
|
quality,
|
|
140
|
-
framesToRender,
|
|
141
|
-
lastFrame,
|
|
142
132
|
framesRendered,
|
|
143
133
|
onDownload,
|
|
144
134
|
onError,
|
|
145
135
|
});
|
|
136
|
+
return returnval;
|
|
146
137
|
}
|
|
147
138
|
catch (err) {
|
|
148
139
|
if (!((_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.includes('Target closed')) &&
|
|
@@ -187,7 +178,7 @@ const renderWebFrameAndRetryTargetClose = async ({ frame, index, retriesLeft, at
|
|
|
187
178
|
pool.release(newPage);
|
|
188
179
|
}
|
|
189
180
|
});
|
|
190
|
-
await (0, exports.renderWebFrameAndRetryTargetClose)({
|
|
181
|
+
const fram = await (0, exports.renderWebFrameAndRetryTargetClose)({
|
|
191
182
|
frame,
|
|
192
183
|
index,
|
|
193
184
|
retriesLeft: retriesLeft - 1,
|
|
@@ -224,6 +215,7 @@ const renderWebFrameAndRetryTargetClose = async ({ frame, index, retriesLeft, at
|
|
|
224
215
|
onDownload,
|
|
225
216
|
onError,
|
|
226
217
|
});
|
|
218
|
+
return fram;
|
|
227
219
|
}
|
|
228
220
|
};
|
|
229
221
|
exports.renderWebFrameAndRetryTargetClose = renderWebFrameAndRetryTargetClose;
|
|
@@ -8,17 +8,22 @@ const validateConcurrency = (value, setting) => {
|
|
|
8
8
|
if (value === null) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
if (typeof value !== 'number') {
|
|
12
|
-
throw new Error(setting + ' must
|
|
11
|
+
if (typeof value !== 'number' && typeof value !== 'string') {
|
|
12
|
+
throw new Error(setting + ' must a number or a string but is ' + value);
|
|
13
13
|
}
|
|
14
|
-
if (value
|
|
15
|
-
|
|
14
|
+
if (typeof value === 'number') {
|
|
15
|
+
if (value % 1 !== 0) {
|
|
16
|
+
throw new Error(setting + ' must be an integer, but is ' + value);
|
|
17
|
+
}
|
|
18
|
+
if (value < 1) {
|
|
19
|
+
throw new Error(setting + ' must be at least 1, but is ' + value);
|
|
20
|
+
}
|
|
21
|
+
if (value > require('os').cpus().length) {
|
|
22
|
+
throw new Error(`${setting} is set higher than the amount of CPU cores available. Available CPU cores: ${require('os').cpus().length}, value set: ${value}`);
|
|
23
|
+
}
|
|
16
24
|
}
|
|
17
|
-
if (value
|
|
18
|
-
throw new Error(setting
|
|
19
|
-
}
|
|
20
|
-
if (value > require('os').cpus().length) {
|
|
21
|
-
throw new Error(`${setting} is set higher than the amount of CPU cores available. Available CPU cores: ${require('os').cpus().length}, value set: ${value}`);
|
|
25
|
+
else if (!/^\d+(\.\d+)?%$/.test(value)) {
|
|
26
|
+
throw new Error(`${setting} must be a number or percentage, but is ${JSON.stringify(value)}`);
|
|
22
27
|
}
|
|
23
28
|
};
|
|
24
29
|
exports.validateConcurrency = validateConcurrency;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.31",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"execa": "5.1.1",
|
|
26
26
|
"extract-zip": "2.0.1",
|
|
27
|
-
"remotion": "3.3.
|
|
27
|
+
"remotion": "3.3.31",
|
|
28
28
|
"source-map": "^0.8.0-beta.0",
|
|
29
29
|
"ws": "8.7.0"
|
|
30
30
|
},
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"vitest": "0.24.3"
|
|
50
50
|
},
|
|
51
51
|
"optionalDependencies": {
|
|
52
|
-
"@remotion/compositor-darwin-arm64": "3.3.
|
|
53
|
-
"@remotion/compositor-darwin-x64": "3.3.
|
|
54
|
-
"@remotion/compositor-linux-arm64-gnu": "3.3.
|
|
55
|
-
"@remotion/compositor-linux-arm64-musl": "3.3.
|
|
56
|
-
"@remotion/compositor-linux-x64-gnu": "3.3.
|
|
57
|
-
"@remotion/compositor-linux-x64-musl": "3.3.
|
|
58
|
-
"@remotion/compositor-win32-x64-msvc": "3.3.
|
|
52
|
+
"@remotion/compositor-darwin-arm64": "3.3.31",
|
|
53
|
+
"@remotion/compositor-darwin-x64": "3.3.31",
|
|
54
|
+
"@remotion/compositor-linux-arm64-gnu": "3.3.31",
|
|
55
|
+
"@remotion/compositor-linux-arm64-musl": "3.3.31",
|
|
56
|
+
"@remotion/compositor-linux-x64-gnu": "3.3.31",
|
|
57
|
+
"@remotion/compositor-linux-x64-musl": "3.3.31",
|
|
58
|
+
"@remotion/compositor-win32-x64-msvc": "3.3.31"
|
|
59
59
|
},
|
|
60
60
|
"keywords": [
|
|
61
61
|
"remotion",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "4b89462c98236d59641272bd0649d880514e685f"
|
|
71
71
|
}
|