@remotion/renderer 4.0.227 → 4.0.229
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/assets/download-map.d.ts +0 -3
- package/dist/assets/download-map.js +0 -1
- package/dist/client.d.ts +50 -3
- package/dist/client.js +2 -0
- package/dist/compositor/compose.d.ts +1 -21
- package/dist/compositor/compose.js +1 -33
- package/dist/compositor/payloads.d.ts +0 -35
- package/dist/crf.d.ts +4 -2
- package/dist/crf.js +12 -6
- package/dist/ffmpeg-args.d.ts +6 -1
- package/dist/ffmpeg-args.js +14 -5
- package/dist/get-codec-name.d.ts +5 -1
- package/dist/get-codec-name.js +38 -15
- package/dist/index.d.ts +7 -41
- package/dist/index.js +0 -2
- package/dist/logger.d.ts +4 -4
- package/dist/logger.js +19 -1
- package/dist/options/gl.d.ts +1 -1
- package/dist/options/hardware-acceleration.d.ts +18 -0
- package/dist/options/hardware-acceleration.js +56 -0
- package/dist/options/index.d.ts +17 -2
- package/dist/options/index.js +2 -0
- package/dist/options/metadata.d.ts +1 -1
- package/dist/options/options-map.d.ts +30 -0
- package/dist/options/options-map.js +3 -0
- package/dist/options/webhook-custom-data.d.ts +1 -1
- package/dist/prespawn-ffmpeg.d.ts +2 -0
- package/dist/prespawn-ffmpeg.js +3 -0
- package/dist/provide-screenshot.d.ts +1 -3
- package/dist/provide-screenshot.js +1 -2
- package/dist/puppeteer-screenshot.d.ts +0 -2
- package/dist/puppeteer-screenshot.js +0 -1
- package/dist/render-frames.js +4 -7
- package/dist/render-media.d.ts +1 -1
- package/dist/render-media.js +6 -2
- package/dist/render-still.js +4 -8
- package/dist/screenshot-dom-element.d.ts +1 -3
- package/dist/screenshot-dom-element.js +1 -2
- package/dist/screenshot-task.d.ts +1 -3
- package/dist/screenshot-task.js +8 -16
- package/dist/stitch-frames-to-video.d.ts +2 -2
- package/dist/stitch-frames-to-video.js +7 -2
- package/dist/take-frame.d.ts +18 -0
- package/dist/take-frame.js +34 -0
- package/ensure-browser.mjs +13 -1
- package/package.json +12 -11
|
@@ -61,7 +61,6 @@ const makeDownloadMap = () => {
|
|
|
61
61
|
audioPreprocessing: makeAndReturn(dir, 'remotion-audio-preprocessing'),
|
|
62
62
|
stitchFrames: makeAndReturn(dir, 'remotion-stitch-temp-dir'),
|
|
63
63
|
compositingDir: makeAndReturn(dir, 'remotion-compositing-temp-dir'),
|
|
64
|
-
compositorCache: {},
|
|
65
64
|
emitter: new offthread_video_server_1.OffthreadVideoServerEmitter(),
|
|
66
65
|
preventCleanup: () => {
|
|
67
66
|
prevented = true;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export { AvailableOptions, TypeOfOption } from './options';
|
|
2
|
+
export { HardwareAccelerationOption } from './options/hardware-acceleration';
|
|
2
3
|
export declare const BrowserSafeApis: {
|
|
3
4
|
getFileExtensionFromCodec: <T extends import("./codec").Codec>(codec: T, audioCodec: import("./options/audio-codec").AudioCodec | null) => import("./file-extensions").FileExtension;
|
|
4
5
|
validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "h264-ts", "gif"];
|
|
5
6
|
validAudioCodecs: readonly ["pcm-16", "aac", "mp3", "opus"];
|
|
6
|
-
getDefaultCrfForCodec: (codec: import("./codec").Codec) => number;
|
|
7
|
+
getDefaultCrfForCodec: (codec: import("./codec").Codec) => number | null;
|
|
7
8
|
getValidCrfRanges: (codec: import("./codec").Codec) => [number, number];
|
|
8
9
|
proResProfileOptions: readonly ["4444-xq", "4444", "hq", "standard", "light", "proxy"];
|
|
9
10
|
x264PresetOptions: readonly ["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo"];
|
|
11
|
+
hardwareAccelerationOptions: readonly ["disable", "if-possible", "required"];
|
|
10
12
|
validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
|
|
11
13
|
validOpenGlRenderers: readonly ["swangle", "angle", "egl", "swiftshader", "vulkan", "angle-egl"];
|
|
12
14
|
validPixelFormatsForCodec: (codec: import("./codec").Codec) => readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"] | ("yuv420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le")[];
|
|
@@ -392,7 +394,7 @@ export declare const BrowserSafeApis: {
|
|
|
392
394
|
webhookCustomDataOption: {
|
|
393
395
|
name: string;
|
|
394
396
|
cliFlag: "webhook-custom-data";
|
|
395
|
-
description: (type: "
|
|
397
|
+
description: (type: "ssr" | "cli") => import("react/jsx-runtime").JSX.Element;
|
|
396
398
|
ssrName: "customData";
|
|
397
399
|
docLink: string;
|
|
398
400
|
type: Record<string, unknown> | null;
|
|
@@ -805,7 +807,7 @@ export declare const BrowserSafeApis: {
|
|
|
805
807
|
metadataOption: {
|
|
806
808
|
name: string;
|
|
807
809
|
cliFlag: "metadata";
|
|
808
|
-
description: (mode: "
|
|
810
|
+
description: (mode: "ssr" | "cli") => import("react/jsx-runtime").JSX.Element;
|
|
809
811
|
docLink: string;
|
|
810
812
|
type: import("./options/metadata").Metadata;
|
|
811
813
|
getValue: ({ commandLine }: {
|
|
@@ -819,6 +821,21 @@ export declare const BrowserSafeApis: {
|
|
|
819
821
|
setConfig: (newMetadata: import("./options/metadata").Metadata) => void;
|
|
820
822
|
ssrName: string;
|
|
821
823
|
};
|
|
824
|
+
hardwareAccelerationOption: {
|
|
825
|
+
name: string;
|
|
826
|
+
cliFlag: "hardware-acceleration";
|
|
827
|
+
description: () => string;
|
|
828
|
+
ssrName: string;
|
|
829
|
+
docLink: string;
|
|
830
|
+
type: import("./options/hardware-acceleration").HardwareAccelerationOption;
|
|
831
|
+
getValue: ({ commandLine }: {
|
|
832
|
+
commandLine: Record<string, unknown>;
|
|
833
|
+
}) => {
|
|
834
|
+
source: string;
|
|
835
|
+
value: "disable" | "if-possible" | "required";
|
|
836
|
+
};
|
|
837
|
+
setConfig: (value: import("./options/hardware-acceleration").HardwareAccelerationOption) => void;
|
|
838
|
+
};
|
|
822
839
|
};
|
|
823
840
|
validColorSpaces: readonly ["default", "bt709", "bt2020-ncl"];
|
|
824
841
|
optionsMap: {
|
|
@@ -1136,6 +1153,21 @@ export declare const BrowserSafeApis: {
|
|
|
1136
1153
|
getValue: () => never;
|
|
1137
1154
|
setConfig: () => never;
|
|
1138
1155
|
};
|
|
1156
|
+
readonly hardwareAcceleration: {
|
|
1157
|
+
name: string;
|
|
1158
|
+
cliFlag: "hardware-acceleration";
|
|
1159
|
+
description: () => string;
|
|
1160
|
+
ssrName: string;
|
|
1161
|
+
docLink: string;
|
|
1162
|
+
type: import("./options/hardware-acceleration").HardwareAccelerationOption;
|
|
1163
|
+
getValue: ({ commandLine }: {
|
|
1164
|
+
commandLine: Record<string, unknown>;
|
|
1165
|
+
}) => {
|
|
1166
|
+
source: string;
|
|
1167
|
+
value: "disable" | "if-possible" | "required";
|
|
1168
|
+
};
|
|
1169
|
+
setConfig: (value: import("./options/hardware-acceleration").HardwareAccelerationOption) => void;
|
|
1170
|
+
};
|
|
1139
1171
|
};
|
|
1140
1172
|
readonly stitchFramesToVideo: {
|
|
1141
1173
|
readonly separateAudioTo: {
|
|
@@ -1156,6 +1188,21 @@ export declare const BrowserSafeApis: {
|
|
|
1156
1188
|
ssrName: string;
|
|
1157
1189
|
type: string | null;
|
|
1158
1190
|
};
|
|
1191
|
+
readonly hardwareAcceleration: {
|
|
1192
|
+
name: string;
|
|
1193
|
+
cliFlag: "hardware-acceleration";
|
|
1194
|
+
description: () => string;
|
|
1195
|
+
ssrName: string;
|
|
1196
|
+
docLink: string;
|
|
1197
|
+
type: import("./options/hardware-acceleration").HardwareAccelerationOption;
|
|
1198
|
+
getValue: ({ commandLine }: {
|
|
1199
|
+
commandLine: Record<string, unknown>;
|
|
1200
|
+
}) => {
|
|
1201
|
+
source: string;
|
|
1202
|
+
value: "disable" | "if-possible" | "required";
|
|
1203
|
+
};
|
|
1204
|
+
setConfig: (value: import("./options/hardware-acceleration").HardwareAccelerationOption) => void;
|
|
1205
|
+
};
|
|
1159
1206
|
};
|
|
1160
1207
|
readonly renderStill: {
|
|
1161
1208
|
readonly offthreadVideoCacheSizeInBytes: {
|
package/dist/client.js
CHANGED
|
@@ -14,6 +14,7 @@ const options_1 = require("./options");
|
|
|
14
14
|
const audio_codec_1 = require("./options/audio-codec");
|
|
15
15
|
const color_space_1 = require("./options/color-space");
|
|
16
16
|
const gl_1 = require("./options/gl");
|
|
17
|
+
const hardware_acceleration_1 = require("./options/hardware-acceleration");
|
|
17
18
|
const options_map_1 = require("./options/options-map");
|
|
18
19
|
const video_codec_1 = require("./options/video-codec");
|
|
19
20
|
const x264_preset_1 = require("./options/x264-preset");
|
|
@@ -28,6 +29,7 @@ exports.BrowserSafeApis = {
|
|
|
28
29
|
getValidCrfRanges: crf_1.getValidCrfRanges,
|
|
29
30
|
proResProfileOptions: prores_profile_1.proResProfileOptions,
|
|
30
31
|
x264PresetOptions: x264_preset_1.x264PresetOptions,
|
|
32
|
+
hardwareAccelerationOptions: hardware_acceleration_1.hardwareAccelerationOptions,
|
|
31
33
|
validPixelFormats: pixel_format_1.validPixelFormats,
|
|
32
34
|
validOpenGlRenderers: gl_1.validOpenGlRenderers,
|
|
33
35
|
validPixelFormatsForCodec: pixel_format_1.validPixelFormatsForCodec,
|
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
import type { DownloadMap } from '../assets/download-map';
|
|
2
1
|
import type { LogLevel } from '../log-level';
|
|
3
|
-
import type {
|
|
4
|
-
import type { CompositorCommand, CompositorCommandSerialized, CompositorImageFormat, Layer } from './payloads';
|
|
5
|
-
type CompositorInput = {
|
|
6
|
-
height: number;
|
|
7
|
-
width: number;
|
|
8
|
-
layers: Layer[];
|
|
9
|
-
imageFormat: CompositorImageFormat;
|
|
10
|
-
};
|
|
11
|
-
type ComposeInput = CompositorInput & {
|
|
12
|
-
output: string;
|
|
13
|
-
compositor: Compositor;
|
|
14
|
-
};
|
|
2
|
+
import type { CompositorCommand, CompositorCommandSerialized } from './payloads';
|
|
15
3
|
export declare const serializeCommand: <Type extends keyof CompositorCommand>(command: Type, params: CompositorCommand[Type]) => CompositorCommandSerialized<Type>;
|
|
16
|
-
export declare const composeWithoutCache: ({ height, width, layers, output, imageFormat, compositor, }: CompositorInput & {
|
|
17
|
-
output: string;
|
|
18
|
-
compositor: Compositor;
|
|
19
|
-
}) => Promise<void>;
|
|
20
|
-
export declare const compose: ({ height, width, layers, output, downloadMap, imageFormat, compositor, }: ComposeInput & {
|
|
21
|
-
downloadMap: DownloadMap;
|
|
22
|
-
}) => Promise<void>;
|
|
23
4
|
export declare const callCompositor: (payload: string, indent: boolean, logLevel: LogLevel, binariesDirectory: string | null) => Promise<void>;
|
|
24
|
-
export {};
|
|
@@ -3,17 +3,12 @@ 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.callCompositor = exports.
|
|
6
|
+
exports.callCompositor = exports.serializeCommand = void 0;
|
|
7
7
|
const node_child_process_1 = require("node:child_process");
|
|
8
|
-
const node_crypto_1 = require("node:crypto");
|
|
9
|
-
const promises_1 = require("node:fs/promises");
|
|
10
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
11
9
|
const get_executable_path_1 = require("./get-executable-path");
|
|
12
10
|
const make_file_executable_1 = require("./make-file-executable");
|
|
13
11
|
const make_nonce_1 = require("./make-nonce");
|
|
14
|
-
const getCompositorHash = ({ ...input }) => {
|
|
15
|
-
return (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(input)).digest('base64');
|
|
16
|
-
};
|
|
17
12
|
const serializeCommand = (command, params) => {
|
|
18
13
|
return {
|
|
19
14
|
nonce: (0, make_nonce_1.makeNonce)(),
|
|
@@ -24,33 +19,6 @@ const serializeCommand = (command, params) => {
|
|
|
24
19
|
};
|
|
25
20
|
};
|
|
26
21
|
exports.serializeCommand = serializeCommand;
|
|
27
|
-
const composeWithoutCache = async ({ height, width, layers, output, imageFormat, compositor, }) => {
|
|
28
|
-
await compositor.executeCommand('Compose', {
|
|
29
|
-
height,
|
|
30
|
-
width,
|
|
31
|
-
layers,
|
|
32
|
-
output,
|
|
33
|
-
output_format: imageFormat,
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
exports.composeWithoutCache = composeWithoutCache;
|
|
37
|
-
const compose = async ({ height, width, layers, output, downloadMap, imageFormat, compositor, }) => {
|
|
38
|
-
const hash = getCompositorHash({ height, width, layers, imageFormat });
|
|
39
|
-
if (downloadMap.compositorCache[hash]) {
|
|
40
|
-
await (0, promises_1.copyFile)(downloadMap.compositorCache[hash], output);
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
await (0, exports.composeWithoutCache)({
|
|
44
|
-
compositor,
|
|
45
|
-
height,
|
|
46
|
-
imageFormat,
|
|
47
|
-
layers,
|
|
48
|
-
output,
|
|
49
|
-
width,
|
|
50
|
-
});
|
|
51
|
-
downloadMap.compositorCache[hash] = output;
|
|
52
|
-
};
|
|
53
|
-
exports.compose = compose;
|
|
54
22
|
const callCompositor = (payload, indent, logLevel, binariesDirectory) => {
|
|
55
23
|
return new Promise((resolve, reject) => {
|
|
56
24
|
const execPath = (0, get_executable_path_1.getExecutablePath)({
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
export type Layer = {
|
|
2
|
-
type: 'PngImage';
|
|
3
|
-
params: {
|
|
4
|
-
src: string;
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
};
|
|
10
|
-
} | {
|
|
11
|
-
type: 'JpgImage';
|
|
12
|
-
params: {
|
|
13
|
-
src: string;
|
|
14
|
-
x: number;
|
|
15
|
-
y: number;
|
|
16
|
-
width: number;
|
|
17
|
-
height: number;
|
|
18
|
-
};
|
|
19
|
-
} | {
|
|
20
|
-
type: 'Solid';
|
|
21
|
-
params: {
|
|
22
|
-
fill: [number, number, number, number];
|
|
23
|
-
x: number;
|
|
24
|
-
y: number;
|
|
25
|
-
width: number;
|
|
26
|
-
height: number;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
1
|
export type CompositorImageFormat = 'Png' | 'Jpeg';
|
|
30
2
|
export type VideoMetadata = {
|
|
31
3
|
fps: number;
|
|
@@ -53,13 +25,6 @@ export type GetSilentPartsResponse = GetSilentPartsResponseRust & {
|
|
|
53
25
|
audibleParts: SilentParts;
|
|
54
26
|
};
|
|
55
27
|
export type CompositorCommand = {
|
|
56
|
-
Compose: {
|
|
57
|
-
output: string;
|
|
58
|
-
width: number;
|
|
59
|
-
height: number;
|
|
60
|
-
layers: Layer[];
|
|
61
|
-
output_format: CompositorImageFormat;
|
|
62
|
-
};
|
|
63
28
|
ExtractFrame: {
|
|
64
29
|
src: string;
|
|
65
30
|
original_src: string;
|
package/dist/crf.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import type { HardwareAccelerationOption } from './client';
|
|
1
2
|
import type { Codec } from './codec';
|
|
2
3
|
export type Crf = number | undefined;
|
|
3
|
-
export declare const getDefaultCrfForCodec: (codec: Codec) => number;
|
|
4
|
+
export declare const getDefaultCrfForCodec: (codec: Codec) => number | null;
|
|
4
5
|
export declare const getValidCrfRanges: (codec: Codec) => [number, number];
|
|
5
|
-
export declare const validateQualitySettings: ({ codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, }: {
|
|
6
|
+
export declare const validateQualitySettings: ({ codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, hardwareAcceleration, }: {
|
|
6
7
|
crf: unknown;
|
|
7
8
|
codec: Codec;
|
|
8
9
|
videoBitrate: string | null;
|
|
9
10
|
encodingMaxRate: string | null;
|
|
10
11
|
encodingBufferSize: string | null;
|
|
12
|
+
hardwareAcceleration: HardwareAccelerationOption;
|
|
11
13
|
}) => string[];
|
package/dist/crf.js
CHANGED
|
@@ -7,13 +7,13 @@ const defaultCrfMap = {
|
|
|
7
7
|
h265: 23,
|
|
8
8
|
vp8: 9,
|
|
9
9
|
vp9: 28,
|
|
10
|
-
prores:
|
|
11
|
-
gif:
|
|
10
|
+
prores: null,
|
|
11
|
+
gif: null,
|
|
12
12
|
'h264-mkv': 18,
|
|
13
13
|
'h264-ts': 18,
|
|
14
|
-
aac:
|
|
15
|
-
mp3:
|
|
16
|
-
wav:
|
|
14
|
+
aac: null,
|
|
15
|
+
mp3: null,
|
|
16
|
+
wav: null,
|
|
17
17
|
};
|
|
18
18
|
const getDefaultCrfForCodec = (codec) => {
|
|
19
19
|
const val = defaultCrfMap[codec];
|
|
@@ -44,10 +44,13 @@ const getValidCrfRanges = (codec) => {
|
|
|
44
44
|
return val;
|
|
45
45
|
};
|
|
46
46
|
exports.getValidCrfRanges = getValidCrfRanges;
|
|
47
|
-
const validateQualitySettings = ({ codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, }) => {
|
|
47
|
+
const validateQualitySettings = ({ codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, hardwareAcceleration, }) => {
|
|
48
48
|
if (crf && videoBitrate) {
|
|
49
49
|
throw new Error('"crf" and "videoBitrate" can not both be set. Choose one of either.');
|
|
50
50
|
}
|
|
51
|
+
if (crf && hardwareAcceleration === 'required') {
|
|
52
|
+
throw new Error('"crf" option is not supported with hardware acceleration');
|
|
53
|
+
}
|
|
51
54
|
if (encodingMaxRate && !encodingBufferSize) {
|
|
52
55
|
throw new Error('"encodingMaxRate" can not be set without also setting "encodingBufferSize".');
|
|
53
56
|
}
|
|
@@ -68,6 +71,9 @@ const validateQualitySettings = ({ codec, crf, videoBitrate, encodingMaxRate, en
|
|
|
68
71
|
}
|
|
69
72
|
if (crf === null || typeof crf === 'undefined') {
|
|
70
73
|
const actualCrf = (0, exports.getDefaultCrfForCodec)(codec);
|
|
74
|
+
if (actualCrf === null) {
|
|
75
|
+
return [...bufSizeArray, ...maxRateArray];
|
|
76
|
+
}
|
|
71
77
|
return ['-crf', String(actualCrf), ...bufSizeArray, ...maxRateArray];
|
|
72
78
|
}
|
|
73
79
|
if (typeof crf !== 'number') {
|
package/dist/ffmpeg-args.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { HardwareAccelerationOption } from './client';
|
|
1
2
|
import type { Codec } from './codec';
|
|
3
|
+
import type { LogLevel } from './log-level';
|
|
2
4
|
import { type ColorSpace } from './options/color-space';
|
|
3
5
|
import type { X264Preset } from './options/x264-preset';
|
|
4
6
|
import type { PixelFormat } from './pixel-format';
|
|
5
|
-
export declare const generateFfmpegArgs: ({ hasPreencoded, proResProfileName, pixelFormat, x264Preset, codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, colorSpace, }: {
|
|
7
|
+
export declare const generateFfmpegArgs: ({ hasPreencoded, proResProfileName, pixelFormat, x264Preset, codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, colorSpace, hardwareAcceleration, indent, logLevel, }: {
|
|
6
8
|
hasPreencoded: boolean;
|
|
7
9
|
proResProfileName: string | null;
|
|
8
10
|
pixelFormat: PixelFormat;
|
|
@@ -13,4 +15,7 @@ export declare const generateFfmpegArgs: ({ hasPreencoded, proResProfileName, pi
|
|
|
13
15
|
encodingMaxRate: string | null;
|
|
14
16
|
encodingBufferSize: string | null;
|
|
15
17
|
colorSpace: ColorSpace | null;
|
|
18
|
+
hardwareAcceleration: HardwareAccelerationOption;
|
|
19
|
+
indent: boolean;
|
|
20
|
+
logLevel: LogLevel;
|
|
16
21
|
}) => string[][];
|
package/dist/ffmpeg-args.js
CHANGED
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.generateFfmpegArgs = void 0;
|
|
4
4
|
const crf_1 = require("./crf");
|
|
5
5
|
const get_codec_name_1 = require("./get-codec-name");
|
|
6
|
+
const logger_1 = require("./logger");
|
|
6
7
|
const color_space_1 = require("./options/color-space");
|
|
7
8
|
const truthy_1 = require("./truthy");
|
|
8
|
-
const firstEncodingStepOnly = ({ hasPreencoded, proResProfileName, pixelFormat, x264Preset, codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, }) => {
|
|
9
|
+
const firstEncodingStepOnly = ({ hasPreencoded, proResProfileName, pixelFormat, x264Preset, codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, hardwareAcceleration, }) => {
|
|
9
10
|
if (hasPreencoded || codec === 'gif') {
|
|
10
11
|
return [];
|
|
11
12
|
}
|
|
@@ -22,14 +23,21 @@ const firstEncodingStepOnly = ({ hasPreencoded, proResProfileName, pixelFormat,
|
|
|
22
23
|
codec,
|
|
23
24
|
encodingMaxRate,
|
|
24
25
|
encodingBufferSize,
|
|
26
|
+
hardwareAcceleration,
|
|
25
27
|
}),
|
|
26
28
|
].filter(truthy_1.truthy);
|
|
27
29
|
};
|
|
28
|
-
const generateFfmpegArgs = ({ hasPreencoded, proResProfileName, pixelFormat, x264Preset, codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, colorSpace, }) => {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const generateFfmpegArgs = ({ hasPreencoded, proResProfileName, pixelFormat, x264Preset, codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, colorSpace, hardwareAcceleration, indent, logLevel, }) => {
|
|
31
|
+
const encoderSettings = (0, get_codec_name_1.getCodecName)(codec, hardwareAcceleration === 'required' ||
|
|
32
|
+
hardwareAcceleration === 'if-possible');
|
|
33
|
+
if (encoderSettings === null) {
|
|
34
|
+
throw new TypeError(`encoderSettings is null: ${JSON.stringify(codec)} (hwaccel = ${hardwareAcceleration})`);
|
|
32
35
|
}
|
|
36
|
+
const { encoderName, hardwareAccelerated } = encoderSettings;
|
|
37
|
+
if (!hardwareAccelerated && hardwareAcceleration === 'required') {
|
|
38
|
+
throw new Error(`Codec ${codec} does not support hardware acceleration on ${process.platform}, but "hardwareAcceleration" is set to "required"`);
|
|
39
|
+
}
|
|
40
|
+
logger_1.Log.verbose({ indent, logLevel, tag: 'stitchFramesToVideo()' }, `Encoder: ${encoderName}, hardware accelerated: ${hardwareAccelerated}`);
|
|
33
41
|
const resolvedColorSpace = colorSpace !== null && colorSpace !== void 0 ? colorSpace : color_space_1.DEFAULT_COLOR_SPACE;
|
|
34
42
|
const colorSpaceOptions = resolvedColorSpace === 'bt709'
|
|
35
43
|
? [
|
|
@@ -74,6 +82,7 @@ const generateFfmpegArgs = ({ hasPreencoded, proResProfileName, pixelFormat, x26
|
|
|
74
82
|
encodingMaxRate,
|
|
75
83
|
encodingBufferSize,
|
|
76
84
|
x264Preset,
|
|
85
|
+
hardwareAcceleration,
|
|
77
86
|
}),
|
|
78
87
|
].filter(truthy_1.truthy);
|
|
79
88
|
};
|
package/dist/get-codec-name.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { Codec } from './codec';
|
|
2
|
-
export
|
|
2
|
+
export type CodecSettings = {
|
|
3
|
+
encoderName: string;
|
|
4
|
+
hardwareAccelerated: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const getCodecName: (codec: Codec, preferredHwAcceleration: boolean) => CodecSettings | null;
|
package/dist/get-codec-name.js
CHANGED
|
@@ -1,20 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCodecName = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
'
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
const getCodecName = (codec, preferredHwAcceleration) => {
|
|
5
|
+
if (codec === 'prores') {
|
|
6
|
+
if (preferredHwAcceleration && process.platform === 'darwin') {
|
|
7
|
+
return { encoderName: 'prores_videotoolbox', hardwareAccelerated: true };
|
|
8
|
+
}
|
|
9
|
+
return { encoderName: 'prores_ks', hardwareAccelerated: false };
|
|
10
|
+
}
|
|
11
|
+
if (codec === 'h264') {
|
|
12
|
+
return { encoderName: 'libx264', hardwareAccelerated: false };
|
|
13
|
+
}
|
|
14
|
+
if (codec === 'h265') {
|
|
15
|
+
return { encoderName: 'libx265', hardwareAccelerated: false };
|
|
16
|
+
}
|
|
17
|
+
if (codec === 'vp8') {
|
|
18
|
+
return { encoderName: 'libvpx', hardwareAccelerated: false };
|
|
19
|
+
}
|
|
20
|
+
if (codec === 'vp9') {
|
|
21
|
+
return { encoderName: 'libvpx-vp9', hardwareAccelerated: false };
|
|
22
|
+
}
|
|
23
|
+
if (codec === 'gif') {
|
|
24
|
+
return { encoderName: 'gif', hardwareAccelerated: false };
|
|
25
|
+
}
|
|
26
|
+
if (codec === 'mp3') {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
if (codec === 'aac') {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
if (codec === 'wav') {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
if (codec === 'h264-mkv') {
|
|
36
|
+
return { encoderName: 'libx264', hardwareAccelerated: false };
|
|
37
|
+
}
|
|
38
|
+
if (codec === 'h264-ts') {
|
|
39
|
+
return { encoderName: 'libx264', hardwareAccelerated: false };
|
|
40
|
+
}
|
|
41
|
+
throw new Error(`Could not get codec for ${codec}`);
|
|
19
42
|
};
|
|
20
43
|
exports.getCodecName = getCodecName;
|
package/dist/index.d.ts
CHANGED
|
@@ -139,7 +139,7 @@ export declare const RenderInternals: {
|
|
|
139
139
|
validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
|
|
140
140
|
DEFAULT_BROWSER: "chrome";
|
|
141
141
|
validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
|
|
142
|
-
DEFAULT_OPENGL_RENDERER: "
|
|
142
|
+
DEFAULT_OPENGL_RENDERER: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
|
|
143
143
|
validateOpenGlRenderer: (option: unknown) => import("./options/gl").OpenGlRenderer | null;
|
|
144
144
|
validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "h264-ts", "gif"];
|
|
145
145
|
DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
|
|
@@ -352,8 +352,8 @@ export declare const RenderInternals: {
|
|
|
352
352
|
}) => execa.ExecaChildProcess<string>;
|
|
353
353
|
validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
|
|
354
354
|
validVideoImageFormats: readonly ["png", "jpeg", "none"];
|
|
355
|
-
DEFAULT_STILL_IMAGE_FORMAT: "
|
|
356
|
-
DEFAULT_VIDEO_IMAGE_FORMAT: "
|
|
355
|
+
DEFAULT_STILL_IMAGE_FORMAT: "jpeg" | "png" | "webp" | "pdf";
|
|
356
|
+
DEFAULT_VIDEO_IMAGE_FORMAT: "none" | "jpeg" | "png";
|
|
357
357
|
DEFAULT_JPEG_QUALITY: number;
|
|
358
358
|
chalk: {
|
|
359
359
|
enabled: () => boolean;
|
|
@@ -408,12 +408,12 @@ export declare const RenderInternals: {
|
|
|
408
408
|
Log: {
|
|
409
409
|
verbose: (options: import("./logger").LogOptions & {
|
|
410
410
|
tag?: string;
|
|
411
|
-
}, ...args: Parameters<typeof console.log>) => void;
|
|
412
|
-
info: (options: import("./logger").LogOptions, ...args: Parameters<typeof console.log>) => void;
|
|
413
|
-
warn: (options: import("./logger").LogOptions, ...args: Parameters<typeof console.log>) => void;
|
|
411
|
+
}, ...args: Parameters<typeof console.log>) => boolean | void;
|
|
412
|
+
info: (options: import("./logger").LogOptions, ...args: Parameters<typeof console.log>) => boolean | void;
|
|
413
|
+
warn: (options: import("./logger").LogOptions, ...args: Parameters<typeof console.log>) => boolean | void;
|
|
414
414
|
error: (options: import("./logger").LogOptions & {
|
|
415
415
|
tag?: string;
|
|
416
|
-
}, ...args: Parameters<typeof console.log>) => void;
|
|
416
|
+
}, ...args: Parameters<typeof console.log>) => boolean | void;
|
|
417
417
|
};
|
|
418
418
|
INDENT_TOKEN: string;
|
|
419
419
|
isColorSupported: () => boolean;
|
|
@@ -955,39 +955,5 @@ export declare const RenderInternals: {
|
|
|
955
955
|
setConfig: () => never;
|
|
956
956
|
};
|
|
957
957
|
}>) => Promise<import("./ensure-browser").BrowserStatus>;
|
|
958
|
-
exampleVideos: {
|
|
959
|
-
bigBuckBunny: string;
|
|
960
|
-
transparentWebm: string;
|
|
961
|
-
framerWithoutFileExtension: string;
|
|
962
|
-
corrupted: string;
|
|
963
|
-
customDar: string;
|
|
964
|
-
screenrecording: string;
|
|
965
|
-
nofps: string;
|
|
966
|
-
variablefps: string;
|
|
967
|
-
zerotimestamp: string;
|
|
968
|
-
webcam: string;
|
|
969
|
-
iphonevideo: string;
|
|
970
|
-
av1: string;
|
|
971
|
-
framer24fps: string;
|
|
972
|
-
music: string;
|
|
973
|
-
notavideo: string;
|
|
974
|
-
notafile: string;
|
|
975
|
-
transparentwithdar: string;
|
|
976
|
-
prores: string;
|
|
977
|
-
iphonehevc: string;
|
|
978
|
-
matroskaPcm16: string;
|
|
979
|
-
mp4withmp3: string;
|
|
980
|
-
av1bbb: string;
|
|
981
|
-
av1mp4: string;
|
|
982
|
-
av1mp4WithColr: string;
|
|
983
|
-
vp8Vorbis: string;
|
|
984
|
-
vp9: string;
|
|
985
|
-
stretchedVp8: string;
|
|
986
|
-
matroskaMp3: string;
|
|
987
|
-
matroskaH265Aac: string;
|
|
988
|
-
opusWebm: string;
|
|
989
|
-
avi: string;
|
|
990
|
-
opus51Webm: string;
|
|
991
|
-
};
|
|
992
958
|
printUsefulErrorMessage: (err: Error, logLevel: import("./log-level").LogLevel, indent: boolean) => void;
|
|
993
959
|
};
|
package/dist/index.js
CHANGED
|
@@ -113,7 +113,6 @@ const browser_instances_1 = require("./browser-instances");
|
|
|
113
113
|
const codec_supports_media_1 = require("./codec-supports-media");
|
|
114
114
|
const make_file_executable_1 = require("./compositor/make-file-executable");
|
|
115
115
|
const ensure_browser_2 = require("./ensure-browser");
|
|
116
|
-
const example_videos_1 = require("./example-videos");
|
|
117
116
|
const audio_codec_1 = require("./options/audio-codec");
|
|
118
117
|
const print_useful_error_message_1 = require("./print-useful-error-message");
|
|
119
118
|
const render_has_audio_1 = require("./render-has-audio");
|
|
@@ -205,7 +204,6 @@ exports.RenderInternals = {
|
|
|
205
204
|
codecSupportsMedia: codec_supports_media_1.codecSupportsMedia,
|
|
206
205
|
toMegabytes: to_megabytes_1.toMegabytes,
|
|
207
206
|
internalEnsureBrowser: ensure_browser_2.internalEnsureBrowser,
|
|
208
|
-
exampleVideos: example_videos_1.exampleVideos,
|
|
209
207
|
printUsefulErrorMessage: print_useful_error_message_1.printUsefulErrorMessage,
|
|
210
208
|
};
|
|
211
209
|
// Warn of potential performance issues with Apple Silicon (M1 chip under Rosetta)
|
package/dist/logger.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ type VerboseLogOptions = LogOptions & {
|
|
|
10
10
|
export declare const verboseTag: (str: string) => string;
|
|
11
11
|
export declare const secondverboseTag: (str: string) => string;
|
|
12
12
|
export declare const Log: {
|
|
13
|
-
verbose: (options: VerboseLogOptions, ...args: Parameters<typeof console.log>) => void;
|
|
14
|
-
info: (options: LogOptions, ...args: Parameters<typeof console.log>) => void;
|
|
15
|
-
warn: (options: LogOptions, ...args: Parameters<typeof console.log>) => void;
|
|
16
|
-
error: (options: VerboseLogOptions, ...args: Parameters<typeof console.log>) => void;
|
|
13
|
+
verbose: (options: VerboseLogOptions, ...args: Parameters<typeof console.log>) => boolean | void;
|
|
14
|
+
info: (options: LogOptions, ...args: Parameters<typeof console.log>) => boolean | void;
|
|
15
|
+
warn: (options: LogOptions, ...args: Parameters<typeof console.log>) => boolean | void;
|
|
16
|
+
error: (options: VerboseLogOptions, ...args: Parameters<typeof console.log>) => boolean | void;
|
|
17
17
|
};
|
|
18
18
|
export {};
|
package/dist/logger.js
CHANGED
|
@@ -20,6 +20,10 @@ exports.Log = {
|
|
|
20
20
|
verbose: (options, ...args) => {
|
|
21
21
|
(0, repro_1.writeInRepro)('verbose', ...args);
|
|
22
22
|
if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'verbose')) {
|
|
23
|
+
if (args.length === 0) {
|
|
24
|
+
// Lambda will print "undefined" otherwise
|
|
25
|
+
return process.stdout.write('\n');
|
|
26
|
+
}
|
|
23
27
|
return console.log(...[
|
|
24
28
|
options.indent ? exports.INDENT_TOKEN : null,
|
|
25
29
|
options.tag ? (0, exports.verboseTag)(options.tag) : null,
|
|
@@ -31,12 +35,22 @@ exports.Log = {
|
|
|
31
35
|
info: (options, ...args) => {
|
|
32
36
|
(0, repro_1.writeInRepro)('info', ...args);
|
|
33
37
|
if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'info')) {
|
|
34
|
-
|
|
38
|
+
if (args.length === 0) {
|
|
39
|
+
// Lambda will print "undefined" otherwise
|
|
40
|
+
return process.stdout.write('\n');
|
|
41
|
+
}
|
|
42
|
+
return console.log(...[options.indent ? exports.INDENT_TOKEN : null]
|
|
43
|
+
.filter(truthy_1.truthy)
|
|
44
|
+
.concat(args !== null && args !== void 0 ? args : []));
|
|
35
45
|
}
|
|
36
46
|
},
|
|
37
47
|
warn: (options, ...args) => {
|
|
38
48
|
(0, repro_1.writeInRepro)('warn', ...args);
|
|
39
49
|
if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'warn')) {
|
|
50
|
+
if (args.length === 0) {
|
|
51
|
+
// Lambda will print "undefined" otherwise
|
|
52
|
+
return process.stdout.write('\n');
|
|
53
|
+
}
|
|
40
54
|
return console.warn(...[options.indent ? chalk_1.chalk.yellow(exports.INDENT_TOKEN) : null]
|
|
41
55
|
.filter(truthy_1.truthy)
|
|
42
56
|
.concat(args.map((a) => chalk_1.chalk.yellow(a))));
|
|
@@ -45,6 +59,10 @@ exports.Log = {
|
|
|
45
59
|
error: (options, ...args) => {
|
|
46
60
|
(0, repro_1.writeInRepro)('error', ...args);
|
|
47
61
|
if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, 'error')) {
|
|
62
|
+
if (args.length === 0) {
|
|
63
|
+
// Lambda will print "undefined" otherwise
|
|
64
|
+
return process.stdout.write('\n');
|
|
65
|
+
}
|
|
48
66
|
return console.error(...[
|
|
49
67
|
options.indent ? exports.INDENT_TOKEN : null,
|
|
50
68
|
options.tag ? (0, exports.verboseTag)(options.tag) : null,
|
package/dist/options/gl.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const validOpenGlRenderers: readonly ["swangle", "angle", "egl", "swiftshader", "vulkan", "angle-egl"];
|
|
2
2
|
export type OpenGlRenderer = (typeof validOpenGlRenderers)[number];
|
|
3
3
|
export declare const DEFAULT_OPENGL_RENDERER: OpenGlRenderer | null;
|
|
4
|
-
export declare const getChromiumOpenGlRenderer: () => "
|
|
4
|
+
export declare const getChromiumOpenGlRenderer: () => "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
|
|
5
5
|
export declare const setChromiumOpenGlRenderer: (renderer: OpenGlRenderer) => void;
|
|
6
6
|
export declare const glOption: {
|
|
7
7
|
cliFlag: "gl";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const hardwareAccelerationOptions: readonly ["disable", "if-possible", "required"];
|
|
2
|
+
export type HardwareAccelerationOption = (typeof hardwareAccelerationOptions)[number];
|
|
3
|
+
export declare const getHardwareAcceleration: () => "disable" | "if-possible" | "required" | null;
|
|
4
|
+
export declare const hardwareAccelerationOption: {
|
|
5
|
+
name: string;
|
|
6
|
+
cliFlag: "hardware-acceleration";
|
|
7
|
+
description: () => string;
|
|
8
|
+
ssrName: string;
|
|
9
|
+
docLink: string;
|
|
10
|
+
type: HardwareAccelerationOption;
|
|
11
|
+
getValue: ({ commandLine }: {
|
|
12
|
+
commandLine: Record<string, unknown>;
|
|
13
|
+
}) => {
|
|
14
|
+
source: string;
|
|
15
|
+
value: "disable" | "if-possible" | "required";
|
|
16
|
+
};
|
|
17
|
+
setConfig: (value: HardwareAccelerationOption) => void;
|
|
18
|
+
};
|