@remotion/renderer 4.0.0-alpha4 → 4.0.0-alpha6
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/README.md +5 -43
- package/dist/assets/download-and-map-assets-to-file.js +6 -6
- package/dist/assets/download-file.d.ts +3 -2
- package/dist/assets/download-file.js +18 -3
- package/dist/assets/download-map.d.ts +0 -26
- package/dist/assets/download-map.js +7 -12
- package/dist/assets/get-audio-channels.d.ts +1 -2
- package/dist/assets/get-audio-channels.js +5 -9
- package/dist/assets/read-file.d.ts +1 -1
- package/dist/assets/read-file.js +2 -2
- package/dist/assets/sanitize-filepath.js +2 -2
- package/dist/audio-codec.d.ts +4 -3
- package/dist/audio-codec.js +3 -9
- package/dist/browser/BrowserFetcher.d.ts +0 -1
- package/dist/browser/BrowserFetcher.js +14 -15
- package/dist/browser/BrowserRunner.d.ts +1 -1
- package/dist/browser/BrowserRunner.js +10 -4
- package/dist/browser/FrameManager.js +2 -3
- package/dist/browser/LaunchOptions.d.ts +1 -0
- package/dist/browser/Launcher.js +6 -5
- package/dist/browser/NodeWebSocketTransport.js +4 -4
- package/dist/browser/devtools-commands.d.ts +5 -1
- package/dist/browser/devtools-types.d.ts +78 -0
- package/dist/browser/get-download-destination.js +8 -8
- package/dist/browser/is-target-closed-err.d.ts +1 -0
- package/dist/browser/is-target-closed-err.js +9 -0
- package/dist/call-ffmpeg.d.ts +14 -0
- package/dist/call-ffmpeg.js +40 -0
- package/dist/check-apple-silicon.js +2 -45
- package/dist/client.d.ts +79 -42
- package/dist/client.js +27 -1
- package/dist/codec-supports-media.d.ts +2 -1
- package/dist/codec-supports-media.js +20 -5
- package/dist/combine-videos.d.ts +0 -3
- package/dist/combine-videos.js +9 -13
- package/dist/compositor/compose.d.ts +3 -1
- package/dist/compositor/compose.js +41 -18
- package/dist/compositor/compositor.d.ts +12 -0
- package/dist/compositor/compositor.js +204 -0
- package/dist/compositor/get-executable-path.d.ts +1 -1
- package/dist/compositor/get-executable-path.js +27 -8
- package/dist/compositor/make-nonce.d.ts +1 -0
- package/dist/compositor/make-nonce.js +8 -0
- package/dist/compositor/payloads.d.ts +34 -7
- package/dist/create-ffmpeg-complex-filter.d.ts +5 -5
- package/dist/create-ffmpeg-complex-filter.js +2 -4
- package/dist/create-ffmpeg-merge-filter.d.ts +2 -5
- package/dist/create-ffmpeg-merge-filter.js +2 -10
- package/dist/create-silent-audio.d.ts +1 -4
- package/dist/create-silent-audio.js +3 -7
- package/dist/crf.js +8 -2
- package/dist/delete-directory.js +18 -18
- package/dist/does-have-m2-bug.js +2 -2
- package/dist/ensure-output-directory.js +5 -5
- package/dist/ffmpeg-filter-file.js +7 -7
- package/dist/file-extensions.d.ts +1 -12
- package/dist/file-extensions.js +8 -14
- package/dist/find-closest-package-json.js +6 -6
- package/dist/get-compositions.d.ts +3 -5
- package/dist/get-compositions.js +8 -11
- package/dist/get-concurrency.js +3 -3
- package/dist/get-extension-from-codec.d.ts +2 -2
- package/dist/get-extension-of-filename.js +2 -2
- package/dist/get-frame-padded-index.d.ts +2 -1
- package/dist/get-local-browser-executable.js +4 -4
- package/dist/get-video-threads-flag.js +3 -3
- package/dist/guess-extension-for-media.d.ts +1 -3
- package/dist/guess-extension-for-media.js +4 -8
- package/dist/image-format.d.ts +12 -6
- package/dist/image-format.js +16 -13
- package/dist/index.d.ts +80 -61
- package/dist/index.js +15 -17
- package/dist/jpeg-quality.d.ts +1 -0
- package/dist/jpeg-quality.js +21 -0
- package/dist/merge-audio-track.d.ts +0 -2
- package/dist/merge-audio-track.js +5 -12
- package/dist/mime-types.js +2 -2
- package/dist/offthread-video-server.d.ts +9 -9
- package/dist/offthread-video-server.js +65 -58
- package/dist/open-browser.d.ts +1 -0
- package/dist/open-browser.js +7 -6
- package/dist/options/audio-bitrate.d.ts +2 -0
- package/dist/options/audio-bitrate.js +11 -0
- package/dist/options/crf.d.ts +2 -0
- package/dist/options/crf.js +11 -0
- package/dist/options/enforce-audio.d.ts +2 -0
- package/dist/options/enforce-audio.js +11 -0
- package/dist/options/jpeg-quality.d.ts +2 -0
- package/dist/options/jpeg-quality.js +11 -0
- package/dist/options/mute.d.ts +2 -0
- package/dist/options/mute.js +11 -0
- package/dist/options/option.d.ts +8 -0
- package/dist/options/option.js +2 -0
- package/dist/options/scale.d.ts +2 -0
- package/dist/options/scale.js +11 -0
- package/dist/options/video-bitrate.d.ts +2 -0
- package/dist/options/video-bitrate.js +11 -0
- package/dist/options/video-codec.d.ts +2 -0
- package/dist/options/video-codec.js +11 -0
- package/dist/perf.d.ts +1 -1
- package/dist/perf.js +9 -7
- package/dist/prepare-server.d.ts +3 -4
- package/dist/prepare-server.js +9 -9
- package/dist/preprocess-audio-track.d.ts +0 -4
- package/dist/preprocess-audio-track.js +4 -8
- package/dist/prespawn-ffmpeg.d.ts +6 -9
- package/dist/prespawn-ffmpeg.js +7 -12
- package/dist/prestitcher-memory-usage.d.ts +0 -4
- package/dist/prestitcher-memory-usage.js +4 -5
- package/dist/prores-profile.d.ts +1 -2
- package/dist/prores-profile.js +4 -4
- package/dist/provide-screenshot.d.ts +4 -5
- package/dist/provide-screenshot.js +2 -2
- package/dist/puppeteer-screenshot.d.ts +3 -3
- package/dist/puppeteer-screenshot.js +10 -33
- package/dist/render-frames.d.ts +13 -25
- package/dist/render-frames.js +34 -45
- package/dist/render-media.d.ts +16 -18
- package/dist/render-media.js +42 -52
- package/dist/render-still.d.ts +12 -8
- package/dist/render-still.js +30 -18
- package/dist/resolve-asset-src.js +2 -2
- package/dist/screenshot-dom-element.d.ts +4 -5
- package/dist/screenshot-dom-element.js +6 -3
- package/dist/screenshot-task.d.ts +2 -3
- package/dist/screenshot-task.js +40 -25
- package/dist/serve-handler/index.d.ts +1 -1
- package/dist/serve-handler/index.js +21 -19
- package/dist/serve-handler/is-path-inside.js +3 -3
- package/dist/serve-static.d.ts +2 -3
- package/dist/serve-static.js +26 -22
- package/dist/stitch-frames-to-video.d.ts +2 -12
- package/dist/stitch-frames-to-video.js +37 -46
- package/dist/take-frame-and-compose.d.ts +4 -5
- package/dist/take-frame-and-compose.js +15 -9
- package/dist/tmp-dir.js +7 -8
- package/dist/validate-concurrency.d.ts +2 -0
- package/dist/validate-concurrency.js +11 -5
- package/dist/validate-output-filename.d.ts +1 -1
- package/dist/validate-puppeteer-timeout.js +1 -0
- package/install-toolchain.mjs +36 -0
- package/package.json +11 -10
- package/types/ws/index.d.ts +5 -5
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.shouldUseParallelEncoding =
|
|
7
|
-
const
|
|
6
|
+
exports.shouldUseParallelEncoding = void 0;
|
|
7
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
8
8
|
const estimateMemoryUsageForPrestitcher = ({ width, height, }) => {
|
|
9
9
|
// Empirically we detected that per 1 million pixels, FFMPEG uses around 1GB of memory, relatively independent of
|
|
10
10
|
// the duration of the video.
|
|
@@ -12,10 +12,9 @@ const estimateMemoryUsageForPrestitcher = ({ width, height, }) => {
|
|
|
12
12
|
const memoryUsageOfPixel = memoryUsageFor4K / 1000000;
|
|
13
13
|
return memoryUsageOfPixel * width * height;
|
|
14
14
|
};
|
|
15
|
-
exports.estimateMemoryUsageForPrestitcher = estimateMemoryUsageForPrestitcher;
|
|
16
15
|
const shouldUseParallelEncoding = ({ width, height, }) => {
|
|
17
|
-
const freeMemory =
|
|
18
|
-
const estimatedUsage =
|
|
16
|
+
const freeMemory = node_os_1.default.freemem();
|
|
17
|
+
const estimatedUsage = estimateMemoryUsageForPrestitcher({
|
|
19
18
|
height,
|
|
20
19
|
width,
|
|
21
20
|
});
|
package/dist/prores-profile.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Codec } from './codec';
|
|
2
|
-
declare const proResProfileOptions: readonly ["4444-xq", "4444", "hq", "standard", "light", "proxy"];
|
|
2
|
+
export declare const proResProfileOptions: readonly ["4444-xq", "4444", "hq", "standard", "light", "proxy"];
|
|
3
3
|
export declare type ProResProfile = typeof proResProfileOptions[number];
|
|
4
4
|
export declare const validateSelectedCodecAndProResCombination: ({ codec, proResProfile, }: {
|
|
5
5
|
codec: Codec;
|
|
6
6
|
proResProfile: ProResProfile | undefined;
|
|
7
7
|
}) => void;
|
|
8
|
-
export {};
|
package/dist/prores-profile.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateSelectedCodecAndProResCombination = void 0;
|
|
4
|
-
|
|
3
|
+
exports.validateSelectedCodecAndProResCombination = exports.proResProfileOptions = void 0;
|
|
4
|
+
exports.proResProfileOptions = [
|
|
5
5
|
'4444-xq',
|
|
6
6
|
'4444',
|
|
7
7
|
'hq',
|
|
@@ -14,8 +14,8 @@ const validateSelectedCodecAndProResCombination = ({ codec, proResProfile, }) =>
|
|
|
14
14
|
throw new TypeError(`You have set a ProRes profile but the codec is "${codec}". Set the codec to "prores" or remove the ProRes profile.`);
|
|
15
15
|
}
|
|
16
16
|
if (proResProfile !== undefined &&
|
|
17
|
-
!proResProfileOptions.includes(proResProfile)) {
|
|
18
|
-
throw new TypeError(`The ProRes profile "${proResProfile}" is not valid. Valid options are ${proResProfileOptions
|
|
17
|
+
!exports.proResProfileOptions.includes(proResProfile)) {
|
|
18
|
+
throw new TypeError(`The ProRes profile "${proResProfile}" is not valid. Valid options are ${exports.proResProfileOptions
|
|
19
19
|
.map((p) => `"${p}"`)
|
|
20
20
|
.join(', ')}`);
|
|
21
21
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { ClipRegion } from 'remotion';
|
|
3
2
|
import type { Page } from './browser/BrowserPage';
|
|
4
|
-
import type {
|
|
5
|
-
export declare const provideScreenshot: ({ page, imageFormat, options,
|
|
3
|
+
import type { StillImageFormat } from './image-format';
|
|
4
|
+
export declare const provideScreenshot: ({ page, imageFormat, options, jpegQuality, height, width, clipRegion, }: {
|
|
6
5
|
page: Page;
|
|
7
|
-
imageFormat:
|
|
8
|
-
|
|
6
|
+
imageFormat: StillImageFormat;
|
|
7
|
+
jpegQuality: number | undefined;
|
|
9
8
|
options: {
|
|
10
9
|
frame: number;
|
|
11
10
|
output: string | null;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.provideScreenshot = void 0;
|
|
4
4
|
const screenshot_dom_element_1 = require("./screenshot-dom-element");
|
|
5
|
-
const provideScreenshot = ({ page, imageFormat, options,
|
|
5
|
+
const provideScreenshot = ({ page, imageFormat, options, jpegQuality, height, width, clipRegion, }) => {
|
|
6
6
|
return (0, screenshot_dom_element_1.screenshotDOMElement)({
|
|
7
7
|
page,
|
|
8
8
|
opts: {
|
|
9
9
|
path: options.output,
|
|
10
10
|
},
|
|
11
11
|
imageFormat,
|
|
12
|
-
|
|
12
|
+
jpegQuality,
|
|
13
13
|
height,
|
|
14
14
|
width,
|
|
15
15
|
clipRegion,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { ClipRegion } from 'remotion';
|
|
3
2
|
import type { Page } from './browser/BrowserPage';
|
|
3
|
+
import type { StillImageFormat } from './image-format';
|
|
4
4
|
export declare const screenshot: (options: {
|
|
5
5
|
page: Page;
|
|
6
|
-
type:
|
|
6
|
+
type: StillImageFormat;
|
|
7
7
|
path?: string;
|
|
8
|
-
|
|
8
|
+
jpegQuality?: number;
|
|
9
9
|
omitBackground: boolean;
|
|
10
10
|
width: number;
|
|
11
11
|
height: number;
|
|
@@ -24,48 +24,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.screenshot = void 0;
|
|
27
|
-
const assert = __importStar(require("assert"));
|
|
27
|
+
const assert = __importStar(require("node:assert"));
|
|
28
28
|
const screenshot_task_1 = require("./screenshot-task");
|
|
29
29
|
const screenshot = (options) => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
assert.ok(options.
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
else if (options.path) {
|
|
39
|
-
const filePath = options.path;
|
|
40
|
-
const extension = filePath
|
|
41
|
-
.slice(filePath.lastIndexOf('.') + 1)
|
|
42
|
-
.toLowerCase();
|
|
43
|
-
if (extension === 'png')
|
|
44
|
-
screenshotType = 'png';
|
|
45
|
-
else if (extension === 'jpg' || extension === 'jpeg')
|
|
46
|
-
screenshotType = 'jpeg';
|
|
47
|
-
assert.ok(screenshotType, `Unsupported screenshot type for extension \`.${extension}\``);
|
|
48
|
-
}
|
|
49
|
-
if (!screenshotType)
|
|
50
|
-
screenshotType = 'png';
|
|
51
|
-
if (options.quality) {
|
|
52
|
-
assert.ok(screenshotType === 'jpeg', 'options.quality is unsupported for the ' +
|
|
53
|
-
screenshotType +
|
|
54
|
-
' screenshots');
|
|
55
|
-
assert.ok(typeof options.quality === 'number', 'Expected options.quality to be a number but found ' +
|
|
56
|
-
typeof options.quality);
|
|
57
|
-
assert.ok(Number.isInteger(options.quality), 'Expected options.quality to be an integer');
|
|
58
|
-
assert.ok(options.quality >= 0 && options.quality <= 100, 'Expected options.quality to be between 0 and 100 (inclusive), got ' +
|
|
59
|
-
options.quality);
|
|
30
|
+
if (options.jpegQuality) {
|
|
31
|
+
assert.ok(options.type === 'jpeg', `options.quality is unsupported for the ${options.type} screenshots`);
|
|
32
|
+
assert.ok(typeof options.jpegQuality === 'number', 'Expected options.quality to be a number but found ' +
|
|
33
|
+
typeof options.jpegQuality);
|
|
34
|
+
assert.ok(Number.isInteger(options.jpegQuality), 'Expected options.quality to be an integer');
|
|
35
|
+
assert.ok(options.jpegQuality >= 0 && options.jpegQuality <= 100, 'Expected options.quality to be between 0 and 100 (inclusive), got ' +
|
|
36
|
+
options.jpegQuality);
|
|
60
37
|
}
|
|
61
38
|
return options.page.screenshotTaskQueue.postTask(() => (0, screenshot_task_1.screenshotTask)({
|
|
62
39
|
page: options.page,
|
|
63
|
-
format:
|
|
40
|
+
format: options.type,
|
|
64
41
|
height: options.height,
|
|
65
42
|
width: options.width,
|
|
66
43
|
omitBackground: options.omitBackground,
|
|
67
44
|
path: options.path,
|
|
68
|
-
|
|
45
|
+
jpegQuality: options.jpegQuality,
|
|
69
46
|
clipRegion: options.clipRegion,
|
|
70
47
|
}));
|
|
71
48
|
};
|
package/dist/render-frames.d.ts
CHANGED
|
@@ -1,41 +1,27 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { AnySmallCompMetadata } from 'remotion';
|
|
3
3
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
4
4
|
import type { DownloadMap } from './assets/download-map';
|
|
5
5
|
import type { BrowserExecutable } from './browser-executable';
|
|
6
6
|
import type { BrowserLog } from './browser-log';
|
|
7
7
|
import type { Browser } from './browser/Browser';
|
|
8
|
-
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
9
8
|
import type { FrameRange } from './frame-range';
|
|
10
|
-
import type {
|
|
11
|
-
import type { ServeUrlOrWebpackBundle } from './legacy-webpack-config';
|
|
9
|
+
import type { VideoImageFormat } from './image-format';
|
|
12
10
|
import type { CancelSignal } from './make-cancel-signal';
|
|
13
11
|
import type { ChromiumOptions } from './open-browser';
|
|
14
12
|
import type { OnStartData, RenderFramesOutput } from './types';
|
|
15
|
-
declare type ConfigOrComposition = {
|
|
16
|
-
/**
|
|
17
|
-
* @deprecated This field has been renamed to `composition`
|
|
18
|
-
*/
|
|
19
|
-
config: SmallTCompMetadata;
|
|
20
|
-
} | {
|
|
21
|
-
composition: SmallTCompMetadata;
|
|
22
|
-
};
|
|
23
|
-
declare type ConcurrencyOrParallelism = {
|
|
24
|
-
concurrency?: number | string | null;
|
|
25
|
-
} | {
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated This field has been renamed to `concurrency`
|
|
28
|
-
*/
|
|
29
|
-
parallelism?: number | null;
|
|
30
|
-
};
|
|
31
13
|
declare type RenderFramesOptions = {
|
|
32
14
|
onStart: (data: OnStartData) => void;
|
|
33
15
|
onFrameUpdate: (framesRendered: number, frameIndex: number, timeToRenderInMilliseconds: number) => void;
|
|
34
16
|
outputDir: string | null;
|
|
35
17
|
inputProps: unknown;
|
|
36
18
|
envVariables?: Record<string, string>;
|
|
37
|
-
imageFormat
|
|
38
|
-
|
|
19
|
+
imageFormat?: VideoImageFormat;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Renamed to "jpegQuality"
|
|
22
|
+
*/
|
|
23
|
+
quality?: never;
|
|
24
|
+
jpegQuality?: number;
|
|
39
25
|
frameRange?: FrameRange | null;
|
|
40
26
|
everyNthFrame?: number;
|
|
41
27
|
dumpBrowserLogs?: boolean;
|
|
@@ -47,16 +33,18 @@ declare type RenderFramesOptions = {
|
|
|
47
33
|
timeoutInMilliseconds?: number;
|
|
48
34
|
chromiumOptions?: ChromiumOptions;
|
|
49
35
|
scale?: number;
|
|
50
|
-
ffmpegExecutable?: FfmpegExecutable;
|
|
51
|
-
ffprobeExecutable?: FfmpegExecutable;
|
|
52
36
|
port?: number | null;
|
|
53
37
|
cancelSignal?: CancelSignal;
|
|
38
|
+
composition: AnySmallCompMetadata;
|
|
54
39
|
/**
|
|
55
40
|
* @deprecated Only for Remotion internal usage
|
|
56
41
|
*/
|
|
57
42
|
downloadMap?: DownloadMap;
|
|
58
43
|
muted?: boolean;
|
|
59
|
-
|
|
44
|
+
concurrency?: number | string | null;
|
|
45
|
+
serveUrl: string;
|
|
46
|
+
verbose?: boolean;
|
|
47
|
+
};
|
|
60
48
|
/**
|
|
61
49
|
* @description Renders a series of images using Puppeteer and computes information for mixing audio.
|
|
62
50
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/render-frames)
|
package/dist/render-frames.js
CHANGED
|
@@ -4,13 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.renderFrames = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const perf_hooks_1 = require("perf_hooks");
|
|
10
10
|
const remotion_1 = require("remotion");
|
|
11
11
|
const download_and_map_assets_to_file_1 = require("./assets/download-and-map-assets-to-file");
|
|
12
12
|
const download_map_1 = require("./assets/download-map");
|
|
13
13
|
const browser_1 = require("./browser");
|
|
14
|
+
const is_target_closed_err_1 = require("./browser/is-target-closed-err");
|
|
14
15
|
const compress_assets_1 = require("./compress-assets");
|
|
15
16
|
const cycle_browser_tabs_1 = require("./cycle-browser-tabs");
|
|
16
17
|
const handle_javascript_exception_1 = require("./error-handling/handle-javascript-exception");
|
|
@@ -20,14 +21,13 @@ const get_duration_from_frame_range_1 = require("./get-duration-from-frame-range
|
|
|
20
21
|
const get_frame_padded_index_1 = require("./get-frame-padded-index");
|
|
21
22
|
const get_frame_to_render_1 = require("./get-frame-to-render");
|
|
22
23
|
const image_format_1 = require("./image-format");
|
|
23
|
-
const
|
|
24
|
+
const jpeg_quality_1 = require("./jpeg-quality");
|
|
24
25
|
const make_cancel_signal_1 = require("./make-cancel-signal");
|
|
25
26
|
const open_browser_1 = require("./open-browser");
|
|
26
27
|
const perf_1 = require("./perf");
|
|
27
28
|
const pool_1 = require("./pool");
|
|
28
29
|
const prepare_server_1 = require("./prepare-server");
|
|
29
30
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
30
|
-
const quality_1 = require("./quality");
|
|
31
31
|
const replace_browser_1 = require("./replace-browser");
|
|
32
32
|
const seek_to_frame_1 = require("./seek-to-frame");
|
|
33
33
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
@@ -35,32 +35,17 @@ 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
|
|
39
|
-
if ('composition' in others) {
|
|
40
|
-
return others.composition;
|
|
41
|
-
}
|
|
42
|
-
if ('config' in others) {
|
|
43
|
-
return others.config;
|
|
44
|
-
}
|
|
45
|
-
return undefined;
|
|
46
|
-
};
|
|
47
|
-
const getConcurrency = (others) => {
|
|
48
|
-
if ('concurrency' in others) {
|
|
49
|
-
return others.concurrency;
|
|
50
|
-
}
|
|
51
|
-
if ('parallelism' in others) {
|
|
52
|
-
return others.parallelism;
|
|
53
|
-
}
|
|
54
|
-
return undefined;
|
|
55
|
-
};
|
|
56
|
-
const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, quality, imageFormat = image_format_1.DEFAULT_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, }) => {
|
|
57
39
|
if (outputDir) {
|
|
58
|
-
if (!
|
|
59
|
-
|
|
40
|
+
if (!node_fs_1.default.existsSync(outputDir)) {
|
|
41
|
+
node_fs_1.default.mkdirSync(outputDir, {
|
|
60
42
|
recursive: true,
|
|
61
43
|
});
|
|
62
44
|
}
|
|
63
45
|
}
|
|
46
|
+
if (quality) {
|
|
47
|
+
throw new Error(`The "quality" option has been renamed. Use "jpegQuality" instead.`);
|
|
48
|
+
}
|
|
64
49
|
const downloadPromises = [];
|
|
65
50
|
const realFrameRange = (0, get_frame_to_render_1.getRealFrameRange)(composition.durationInFrames, frameRange !== null && frameRange !== void 0 ? frameRange : null);
|
|
66
51
|
const framesToRender = (0, get_duration_from_frame_range_1.getFramesToRender)(realFrameRange, everyNthFrame);
|
|
@@ -177,7 +162,7 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
177
162
|
freePage,
|
|
178
163
|
height,
|
|
179
164
|
imageFormat,
|
|
180
|
-
output:
|
|
165
|
+
output: node_path_1.default.join(frameDir, (0, get_frame_padded_index_1.getFrameOutputFileName)({
|
|
181
166
|
frame,
|
|
182
167
|
imageFormat,
|
|
183
168
|
index,
|
|
@@ -185,7 +170,7 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
185
170
|
lastFrame,
|
|
186
171
|
totalFrames: framesToRender.length,
|
|
187
172
|
})),
|
|
188
|
-
|
|
173
|
+
jpegQuality,
|
|
189
174
|
width,
|
|
190
175
|
scale,
|
|
191
176
|
downloadMap,
|
|
@@ -233,16 +218,21 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
233
218
|
});
|
|
234
219
|
};
|
|
235
220
|
const renderFrameAndRetryTargetClose = async (frame, index, retriesLeft, attempt) => {
|
|
236
|
-
var _a, _b;
|
|
237
221
|
try {
|
|
238
|
-
await
|
|
222
|
+
await Promise.race([
|
|
223
|
+
renderFrame(frame, index),
|
|
224
|
+
new Promise((_, reject) => {
|
|
225
|
+
cancelSignal === null || cancelSignal === void 0 ? void 0 : cancelSignal(() => {
|
|
226
|
+
reject(new Error(make_cancel_signal_1.cancelErrorMessages.renderFrames));
|
|
227
|
+
});
|
|
228
|
+
}),
|
|
229
|
+
]);
|
|
239
230
|
}
|
|
240
231
|
catch (err) {
|
|
241
|
-
if (
|
|
242
|
-
!((_b = err === null || err === void 0 ? void 0 : err.message) === null || _b === void 0 ? void 0 : _b.includes('Session closed'))) {
|
|
232
|
+
if ((0, make_cancel_signal_1.isUserCancelledRender)(err)) {
|
|
243
233
|
throw err;
|
|
244
234
|
}
|
|
245
|
-
if ((0,
|
|
235
|
+
if (!(0, is_target_closed_err_1.isTargetClosedErr)(err)) {
|
|
246
236
|
throw err;
|
|
247
237
|
}
|
|
248
238
|
if (stopped) {
|
|
@@ -292,8 +282,7 @@ const innerRenderFrames = ({ onFrameUpdate, outputDir, onStart, inputProps, qual
|
|
|
292
282
|
*/
|
|
293
283
|
const renderFrames = (options) => {
|
|
294
284
|
var _a, _b, _c;
|
|
295
|
-
const composition =
|
|
296
|
-
const concurrency = getConcurrency(options);
|
|
285
|
+
const { composition, concurrency } = options;
|
|
297
286
|
if (!composition) {
|
|
298
287
|
throw new Error('No `composition` option has been specified for renderFrames()');
|
|
299
288
|
}
|
|
@@ -305,11 +294,10 @@ const renderFrames = (options) => {
|
|
|
305
294
|
component: 'in the `config` object passed to `renderFrames()`',
|
|
306
295
|
allowFloats: false,
|
|
307
296
|
});
|
|
308
|
-
if (options.
|
|
309
|
-
throw new Error("You can only pass the `
|
|
297
|
+
if (options.jpegQuality !== undefined && options.imageFormat !== 'jpeg') {
|
|
298
|
+
throw new Error("You can only pass the `jpegQuality` option if `imageFormat` is 'jpeg'.");
|
|
310
299
|
}
|
|
311
|
-
|
|
312
|
-
(0, quality_1.validateQuality)(options.quality);
|
|
300
|
+
(0, jpeg_quality_1.validateJpegQuality)(options.jpegQuality);
|
|
313
301
|
(0, validate_scale_1.validateScale)(options.scale);
|
|
314
302
|
const makeBrowser = () => {
|
|
315
303
|
var _a;
|
|
@@ -326,7 +314,7 @@ const renderFrames = (options) => {
|
|
|
326
314
|
const actualConcurrency = (0, get_concurrency_1.getActualConcurrency)(concurrency !== null && concurrency !== void 0 ? concurrency : null);
|
|
327
315
|
const openedPages = [];
|
|
328
316
|
return new Promise((resolve, reject) => {
|
|
329
|
-
var _a, _b
|
|
317
|
+
var _a, _b;
|
|
330
318
|
const cleanup = [];
|
|
331
319
|
if (!options.downloadMap) {
|
|
332
320
|
cleanup.push(() => (0, download_map_1.cleanDownloadMap)(downloadMap));
|
|
@@ -343,14 +331,14 @@ const renderFrames = (options) => {
|
|
|
343
331
|
}),
|
|
344
332
|
Promise.all([
|
|
345
333
|
(0, prepare_server_1.prepareServer)({
|
|
346
|
-
webpackConfigOrServeUrl:
|
|
334
|
+
webpackConfigOrServeUrl: options.serveUrl,
|
|
347
335
|
onDownload,
|
|
348
336
|
onError,
|
|
349
|
-
|
|
350
|
-
ffprobeExecutable: (_b = options.ffprobeExecutable) !== null && _b !== void 0 ? _b : null,
|
|
351
|
-
port: (_c = options.port) !== null && _c !== void 0 ? _c : null,
|
|
337
|
+
port: (_a = options.port) !== null && _a !== void 0 ? _a : null,
|
|
352
338
|
downloadMap,
|
|
353
339
|
remotionRoot: (0, find_closest_package_json_1.findRemotionRoot)(),
|
|
340
|
+
concurrency: actualConcurrency,
|
|
341
|
+
verbose: (_b = options.verbose) !== null && _b !== void 0 ? _b : false,
|
|
354
342
|
}),
|
|
355
343
|
browserInstance,
|
|
356
344
|
]).then(([{ serveUrl, closeServer, offthreadPort }, puppeteerInstance]) => {
|
|
@@ -384,9 +372,10 @@ const renderFrames = (options) => {
|
|
|
384
372
|
// If new browser was opened, then closing the browser as a cleanup.
|
|
385
373
|
if (options.puppeteerInstance) {
|
|
386
374
|
Promise.all(openedPages.map((p) => p.close())).catch((err) => {
|
|
387
|
-
if (
|
|
388
|
-
|
|
375
|
+
if ((0, is_target_closed_err_1.isTargetClosedErr)(err)) {
|
|
376
|
+
return;
|
|
389
377
|
}
|
|
378
|
+
console.log('Unable to close browser tab', err);
|
|
390
379
|
});
|
|
391
380
|
}
|
|
392
381
|
else {
|
package/dist/render-media.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { AnySmallCompMetadata } from 'remotion';
|
|
3
3
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
4
4
|
import type { DownloadMap } from './assets/download-map';
|
|
5
5
|
import type { AudioCodec } from './audio-codec';
|
|
@@ -7,10 +7,9 @@ import type { BrowserExecutable } from './browser-executable';
|
|
|
7
7
|
import type { BrowserLog } from './browser-log';
|
|
8
8
|
import type { Browser as PuppeteerBrowser } from './browser/Browser';
|
|
9
9
|
import type { Codec } from './codec';
|
|
10
|
-
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
11
10
|
import type { FfmpegOverrideFn } from './ffmpeg-override';
|
|
12
11
|
import type { FrameRange } from './frame-range';
|
|
13
|
-
import type {
|
|
12
|
+
import type { VideoImageFormat } from './image-format';
|
|
14
13
|
import type { CancelSignal } from './make-cancel-signal';
|
|
15
14
|
import type { ChromiumOptions } from './open-browser';
|
|
16
15
|
import type { PixelFormat } from './pixel-format';
|
|
@@ -21,7 +20,6 @@ export declare type SlowFrame = {
|
|
|
21
20
|
frame: number;
|
|
22
21
|
time: number;
|
|
23
22
|
};
|
|
24
|
-
export declare type OnSlowestFrames = (frames: SlowFrame[]) => void;
|
|
25
23
|
export declare type RenderMediaOnProgress = (progress: {
|
|
26
24
|
renderedFrames: number;
|
|
27
25
|
encodedFrames: number;
|
|
@@ -33,15 +31,17 @@ export declare type RenderMediaOnProgress = (progress: {
|
|
|
33
31
|
export declare type RenderMediaOptions = {
|
|
34
32
|
outputLocation?: string | null;
|
|
35
33
|
codec: Codec;
|
|
36
|
-
composition:
|
|
34
|
+
composition: AnySmallCompMetadata;
|
|
37
35
|
inputProps?: unknown;
|
|
38
36
|
crf?: number | null;
|
|
39
|
-
imageFormat?:
|
|
40
|
-
ffmpegExecutable?: FfmpegExecutable;
|
|
41
|
-
ffprobeExecutable?: FfmpegExecutable;
|
|
37
|
+
imageFormat?: VideoImageFormat;
|
|
42
38
|
pixelFormat?: PixelFormat;
|
|
43
39
|
envVariables?: Record<string, string>;
|
|
44
|
-
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Renamed to `jpegQuality`
|
|
42
|
+
*/
|
|
43
|
+
quality?: never;
|
|
44
|
+
jpegQuality?: number;
|
|
45
45
|
frameRange?: FrameRange | null;
|
|
46
46
|
everyNthFrame?: number;
|
|
47
47
|
numberOfGifLoops?: number | null;
|
|
@@ -76,22 +76,20 @@ export declare type RenderMediaOptions = {
|
|
|
76
76
|
ffmpegOverride?: FfmpegOverrideFn;
|
|
77
77
|
audioBitrate?: string | null;
|
|
78
78
|
videoBitrate?: string | null;
|
|
79
|
-
onSlowestFrames?: OnSlowestFrames;
|
|
80
79
|
disallowParallelEncoding?: boolean;
|
|
80
|
+
printLog?: (...data: unknown[]) => void;
|
|
81
81
|
audioCodec?: AudioCodec | null;
|
|
82
|
-
|
|
83
|
-
declare type ConcurrencyOrParallelism = {
|
|
82
|
+
serveUrl: string;
|
|
84
83
|
concurrency?: number | string | null;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
parallelism?: number | null;
|
|
84
|
+
};
|
|
85
|
+
declare type RenderMediaResult = {
|
|
86
|
+
buffer: Buffer | null;
|
|
87
|
+
slowestFrames: SlowFrame[];
|
|
90
88
|
};
|
|
91
89
|
/**
|
|
92
90
|
*
|
|
93
91
|
* @description Render a video from a composition
|
|
94
92
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/render-media)
|
|
95
93
|
*/
|
|
96
|
-
export declare const renderMedia: ({ proResProfile, crf, composition,
|
|
94
|
+
export declare const renderMedia: ({ proResProfile, crf, composition, inputProps, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, audioCodec, ...options }: RenderMediaOptions) => Promise<RenderMediaResult>;
|
|
97
95
|
export {};
|