@remotion/renderer 3.3.81 → 3.3.83
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-and-map-assets-to-file.js +6 -0
- package/dist/call-ffmpeg.d.ts +1 -1
- package/dist/call-ffmpeg.js +4 -4
- package/dist/client.d.ts +37 -37
- package/dist/compositor/compositor.d.ts +14 -0
- package/dist/compositor/compositor.js +168 -0
- package/dist/compositor/make-nonce.d.ts +1 -0
- package/dist/compositor/make-nonce.js +8 -0
- package/dist/create-ffmpeg-complex-filter.d.ts +4 -1
- package/dist/get-extension-from-codec.d.ts +2 -2
- package/dist/get-frame-to-render.js +1 -1
- package/dist/index.d.ts +30 -30
- package/dist/jpeg-quality.d.ts +1 -0
- package/dist/jpeg-quality.js +21 -0
- package/dist/open-browser.d.ts +1 -0
- package/dist/open-browser.js +5 -2
- package/dist/options/jpeg-quality.js +3 -3
- package/dist/validate-output-filename.d.ts +1 -1
- package/package.json +9 -9
|
@@ -37,6 +37,9 @@ const download_file_1 = require("./download-file");
|
|
|
37
37
|
const sanitize_filepath_1 = require("./sanitize-filepath");
|
|
38
38
|
const waitForAssetToBeDownloaded = ({ src, downloadDir, downloadMap, }) => {
|
|
39
39
|
var _a, _b;
|
|
40
|
+
if (process.env.NODE_ENV === 'test') {
|
|
41
|
+
console.log('waiting for asset to be downloaded', src);
|
|
42
|
+
}
|
|
40
43
|
if ((_a = downloadMap.hasBeenDownloadedMap[src]) === null || _a === void 0 ? void 0 : _a[downloadDir]) {
|
|
41
44
|
return Promise.resolve((_b = downloadMap.hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir]);
|
|
42
45
|
}
|
|
@@ -139,6 +142,9 @@ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
|
|
|
139
142
|
downloadMap.isDownloadingMap[src] = {};
|
|
140
143
|
}
|
|
141
144
|
downloadMap.isDownloadingMap[src][downloadDir] = true;
|
|
145
|
+
if (process.env.NODE_ENV === 'test') {
|
|
146
|
+
console.log('Actually downloading asset', src);
|
|
147
|
+
}
|
|
142
148
|
const onProgress = onDownload(src);
|
|
143
149
|
if (src.startsWith('data:')) {
|
|
144
150
|
const [assetDetails, assetData] = src.substring('data:'.length).split(',');
|
package/dist/call-ffmpeg.d.ts
CHANGED
package/dist/call-ffmpeg.js
CHANGED
|
@@ -3,12 +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.callFf = exports.
|
|
6
|
+
exports.callFf = exports.dynamicLibraryPathOptions = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const get_executable_path_1 = require("./compositor/get-executable-path");
|
|
10
10
|
const truthy_1 = require("./truthy");
|
|
11
|
-
const
|
|
11
|
+
const dynamicLibraryPathOptions = () => {
|
|
12
12
|
const lib = path_1.default.join((0, get_executable_path_1.getExecutablePath)('ffmpeg-cwd'), 'remotion', 'lib');
|
|
13
13
|
return {
|
|
14
14
|
env: process.platform === 'darwin'
|
|
@@ -24,10 +24,10 @@ const callFfExtraOptions = () => {
|
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
26
|
};
|
|
27
|
-
exports.
|
|
27
|
+
exports.dynamicLibraryPathOptions = dynamicLibraryPathOptions;
|
|
28
28
|
const callFf = (bin, args, options) => {
|
|
29
29
|
return (0, execa_1.default)((0, get_executable_path_1.getExecutablePath)(bin), args.filter(truthy_1.truthy), {
|
|
30
|
-
...(0, exports.
|
|
30
|
+
...(0, exports.dynamicLibraryPathOptions)(),
|
|
31
31
|
...options,
|
|
32
32
|
});
|
|
33
33
|
};
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const BrowserSafeApis: {
|
|
2
|
-
getFileExtensionFromCodec: <T extends "
|
|
2
|
+
getFileExtensionFromCodec: <T extends "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif">(codec: T, audioCodec: "pcm-16" | "aac" | "mp3" | "opus" | null) => import("./file-extensions").FileExtension;
|
|
3
3
|
validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
|
|
4
|
-
getDefaultCrfForCodec: (codec: "
|
|
5
|
-
getValidCrfRanges: (codec: "
|
|
6
|
-
isAudioCodec: (codec: "
|
|
4
|
+
getDefaultCrfForCodec: (codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif") => number;
|
|
5
|
+
getValidCrfRanges: (codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif") => [number, number];
|
|
6
|
+
isAudioCodec: (codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
|
|
7
7
|
validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
|
|
8
8
|
DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
|
|
9
9
|
supportedAudioCodecs: {
|
|
@@ -19,79 +19,79 @@ export declare const BrowserSafeApis: {
|
|
|
19
19
|
readonly wav: readonly ["pcm-16"];
|
|
20
20
|
};
|
|
21
21
|
defaultFileExtensionMap: {
|
|
22
|
-
|
|
22
|
+
aac: {
|
|
23
23
|
default: import("./file-extensions").FileExtension;
|
|
24
24
|
forAudioCodec: {
|
|
25
|
-
|
|
25
|
+
"pcm-16": {
|
|
26
26
|
possible: import("./file-extensions").FileExtension[];
|
|
27
27
|
default: import("./file-extensions").FileExtension;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
aac: {
|
|
30
30
|
possible: import("./file-extensions").FileExtension[];
|
|
31
31
|
default: import("./file-extensions").FileExtension;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
|
-
|
|
35
|
+
mp3: {
|
|
36
36
|
default: import("./file-extensions").FileExtension;
|
|
37
37
|
forAudioCodec: {
|
|
38
|
-
|
|
38
|
+
"pcm-16": {
|
|
39
39
|
possible: import("./file-extensions").FileExtension[];
|
|
40
40
|
default: import("./file-extensions").FileExtension;
|
|
41
41
|
};
|
|
42
|
-
|
|
42
|
+
mp3: {
|
|
43
43
|
possible: import("./file-extensions").FileExtension[];
|
|
44
44
|
default: import("./file-extensions").FileExtension;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
h264: {
|
|
49
49
|
default: import("./file-extensions").FileExtension;
|
|
50
50
|
forAudioCodec: {
|
|
51
51
|
"pcm-16": {
|
|
52
52
|
possible: import("./file-extensions").FileExtension[];
|
|
53
53
|
default: import("./file-extensions").FileExtension;
|
|
54
54
|
};
|
|
55
|
-
|
|
55
|
+
aac: {
|
|
56
56
|
possible: import("./file-extensions").FileExtension[];
|
|
57
57
|
default: import("./file-extensions").FileExtension;
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
|
-
|
|
61
|
+
h265: {
|
|
62
62
|
default: import("./file-extensions").FileExtension;
|
|
63
63
|
forAudioCodec: {
|
|
64
64
|
"pcm-16": {
|
|
65
65
|
possible: import("./file-extensions").FileExtension[];
|
|
66
66
|
default: import("./file-extensions").FileExtension;
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
aac: {
|
|
69
69
|
possible: import("./file-extensions").FileExtension[];
|
|
70
70
|
default: import("./file-extensions").FileExtension;
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
|
-
|
|
74
|
+
vp8: {
|
|
75
75
|
default: import("./file-extensions").FileExtension;
|
|
76
76
|
forAudioCodec: {
|
|
77
|
-
|
|
77
|
+
"pcm-16": {
|
|
78
78
|
possible: import("./file-extensions").FileExtension[];
|
|
79
79
|
default: import("./file-extensions").FileExtension;
|
|
80
80
|
};
|
|
81
|
-
|
|
81
|
+
opus: {
|
|
82
82
|
possible: import("./file-extensions").FileExtension[];
|
|
83
83
|
default: import("./file-extensions").FileExtension;
|
|
84
84
|
};
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
|
-
|
|
87
|
+
vp9: {
|
|
88
88
|
default: import("./file-extensions").FileExtension;
|
|
89
89
|
forAudioCodec: {
|
|
90
|
-
|
|
90
|
+
"pcm-16": {
|
|
91
91
|
possible: import("./file-extensions").FileExtension[];
|
|
92
92
|
default: import("./file-extensions").FileExtension;
|
|
93
93
|
};
|
|
94
|
-
|
|
94
|
+
opus: {
|
|
95
95
|
possible: import("./file-extensions").FileExtension[];
|
|
96
96
|
default: import("./file-extensions").FileExtension;
|
|
97
97
|
};
|
|
@@ -109,11 +109,11 @@ export declare const BrowserSafeApis: {
|
|
|
109
109
|
prores: {
|
|
110
110
|
default: import("./file-extensions").FileExtension;
|
|
111
111
|
forAudioCodec: {
|
|
112
|
-
|
|
112
|
+
"pcm-16": {
|
|
113
113
|
possible: import("./file-extensions").FileExtension[];
|
|
114
114
|
default: import("./file-extensions").FileExtension;
|
|
115
115
|
};
|
|
116
|
-
|
|
116
|
+
aac: {
|
|
117
117
|
possible: import("./file-extensions").FileExtension[];
|
|
118
118
|
default: import("./file-extensions").FileExtension;
|
|
119
119
|
};
|
|
@@ -134,13 +134,21 @@ export declare const BrowserSafeApis: {
|
|
|
134
134
|
};
|
|
135
135
|
};
|
|
136
136
|
defaultAudioCodecs: {
|
|
137
|
+
aac: {
|
|
138
|
+
compressed: "pcm-16" | "aac" | null;
|
|
139
|
+
lossless: "pcm-16" | "aac" | null;
|
|
140
|
+
};
|
|
141
|
+
mp3: {
|
|
142
|
+
compressed: "pcm-16" | "mp3" | null;
|
|
143
|
+
lossless: "pcm-16" | "mp3" | null;
|
|
144
|
+
};
|
|
137
145
|
h264: {
|
|
138
|
-
compressed: "
|
|
139
|
-
lossless: "
|
|
146
|
+
compressed: "pcm-16" | "aac" | null;
|
|
147
|
+
lossless: "pcm-16" | "aac" | null;
|
|
140
148
|
};
|
|
141
149
|
h265: {
|
|
142
|
-
compressed: "
|
|
143
|
-
lossless: "
|
|
150
|
+
compressed: "pcm-16" | "aac" | null;
|
|
151
|
+
lossless: "pcm-16" | "aac" | null;
|
|
144
152
|
};
|
|
145
153
|
vp8: {
|
|
146
154
|
compressed: "pcm-16" | "opus" | null;
|
|
@@ -150,21 +158,13 @@ export declare const BrowserSafeApis: {
|
|
|
150
158
|
compressed: "pcm-16" | "opus" | null;
|
|
151
159
|
lossless: "pcm-16" | "opus" | null;
|
|
152
160
|
};
|
|
153
|
-
mp3: {
|
|
154
|
-
compressed: "mp3" | "pcm-16" | null;
|
|
155
|
-
lossless: "mp3" | "pcm-16" | null;
|
|
156
|
-
};
|
|
157
|
-
aac: {
|
|
158
|
-
compressed: "aac" | "pcm-16" | null;
|
|
159
|
-
lossless: "aac" | "pcm-16" | null;
|
|
160
|
-
};
|
|
161
161
|
wav: {
|
|
162
162
|
compressed: "pcm-16" | null;
|
|
163
163
|
lossless: "pcm-16" | null;
|
|
164
164
|
};
|
|
165
165
|
prores: {
|
|
166
|
-
compressed: "
|
|
167
|
-
lossless: "
|
|
166
|
+
compressed: "pcm-16" | "aac" | null;
|
|
167
|
+
lossless: "pcm-16" | "aac" | null;
|
|
168
168
|
};
|
|
169
169
|
"h264-mkv": {
|
|
170
170
|
compressed: "pcm-16" | null;
|
|
@@ -175,5 +175,5 @@ export declare const BrowserSafeApis: {
|
|
|
175
175
|
lossless: null;
|
|
176
176
|
};
|
|
177
177
|
};
|
|
178
|
-
defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "
|
|
178
|
+
defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif">;
|
|
179
179
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { CompositorCommand } from './payloads';
|
|
3
|
+
export declare type Compositor = {
|
|
4
|
+
finishCommands: () => void;
|
|
5
|
+
executeCommand: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T]) => Promise<Buffer>;
|
|
6
|
+
waitForDone: () => Promise<void>;
|
|
7
|
+
};
|
|
8
|
+
export declare const spawnCompositorOrReuse: <T extends keyof CompositorCommand>({ initiatePayload, renderId, }: {
|
|
9
|
+
initiatePayload: CompositorCommand[T];
|
|
10
|
+
renderId: string;
|
|
11
|
+
}) => Compositor;
|
|
12
|
+
export declare const releaseCompositorWithId: (renderId: string) => void;
|
|
13
|
+
export declare const waitForCompositorWithIdToQuit: (renderId: string) => Promise<void>;
|
|
14
|
+
export declare const startCompositor: <T extends keyof CompositorCommand>(payload: CompositorCommand[T]) => Compositor;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startCompositor = exports.waitForCompositorWithIdToQuit = exports.releaseCompositorWithId = exports.spawnCompositorOrReuse = void 0;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const call_ffmpeg_1 = require("../call-ffmpeg");
|
|
6
|
+
const get_executable_path_1 = require("./get-executable-path");
|
|
7
|
+
const make_nonce_1 = require("./make-nonce");
|
|
8
|
+
const compositorMap = {};
|
|
9
|
+
const spawnCompositorOrReuse = ({ initiatePayload, renderId, }) => {
|
|
10
|
+
if (!compositorMap[renderId]) {
|
|
11
|
+
compositorMap[renderId] = (0, exports.startCompositor)(initiatePayload);
|
|
12
|
+
}
|
|
13
|
+
return compositorMap[renderId];
|
|
14
|
+
};
|
|
15
|
+
exports.spawnCompositorOrReuse = spawnCompositorOrReuse;
|
|
16
|
+
const releaseCompositorWithId = (renderId) => {
|
|
17
|
+
if (compositorMap[renderId]) {
|
|
18
|
+
compositorMap[renderId].finishCommands();
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.releaseCompositorWithId = releaseCompositorWithId;
|
|
22
|
+
const waitForCompositorWithIdToQuit = (renderId) => {
|
|
23
|
+
if (!compositorMap[renderId]) {
|
|
24
|
+
throw new TypeError('No compositor with that id');
|
|
25
|
+
}
|
|
26
|
+
return compositorMap[renderId].waitForDone();
|
|
27
|
+
};
|
|
28
|
+
exports.waitForCompositorWithIdToQuit = waitForCompositorWithIdToQuit;
|
|
29
|
+
const startCompositor = (payload) => {
|
|
30
|
+
const bin = (0, get_executable_path_1.getExecutablePath)('compositor');
|
|
31
|
+
const child = (0, child_process_1.spawn)(bin, [JSON.stringify(payload)], (0, call_ffmpeg_1.dynamicLibraryPathOptions)());
|
|
32
|
+
const stderrChunks = [];
|
|
33
|
+
let outputBuffer = Buffer.from('');
|
|
34
|
+
const separator = Buffer.from('remotion_buffer:');
|
|
35
|
+
const waiters = new Map();
|
|
36
|
+
const onMessage = (nonce, data) => {
|
|
37
|
+
if (nonce === '0') {
|
|
38
|
+
console.log(data.toString('utf8'));
|
|
39
|
+
}
|
|
40
|
+
if (waiters.has(nonce)) {
|
|
41
|
+
waiters.get(nonce).resolve(data);
|
|
42
|
+
waiters.delete(nonce);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
let quit = false;
|
|
46
|
+
let missingData = null;
|
|
47
|
+
const processInput = () => {
|
|
48
|
+
let separatorIndex = outputBuffer.indexOf(separator);
|
|
49
|
+
if (separatorIndex === -1) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
separatorIndex += separator.length;
|
|
53
|
+
let nonceString = '';
|
|
54
|
+
let lengthString = '';
|
|
55
|
+
// Each message from Rust is prefixed with `remotion_buffer;{[nonce]}:{[length]}`
|
|
56
|
+
// Let's read the buffer to extract the nonce, and if the full length is available,
|
|
57
|
+
// we'll extract the data and pass it to the callback.
|
|
58
|
+
// eslint-disable-next-line no-constant-condition
|
|
59
|
+
while (true) {
|
|
60
|
+
const nextDigit = outputBuffer[separatorIndex];
|
|
61
|
+
// 0x3b is the character ";"
|
|
62
|
+
if (nextDigit === 0x3b) {
|
|
63
|
+
separatorIndex++;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
separatorIndex++;
|
|
67
|
+
nonceString += String.fromCharCode(nextDigit);
|
|
68
|
+
}
|
|
69
|
+
// eslint-disable-next-line no-constant-condition
|
|
70
|
+
while (true) {
|
|
71
|
+
const nextDigit = outputBuffer[separatorIndex];
|
|
72
|
+
// 0x3a is the character ":"
|
|
73
|
+
if (nextDigit === 0x3a) {
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
separatorIndex++;
|
|
77
|
+
lengthString += String.fromCharCode(nextDigit);
|
|
78
|
+
}
|
|
79
|
+
const length = Number(lengthString);
|
|
80
|
+
const dataLength = outputBuffer.length - separatorIndex - 1;
|
|
81
|
+
if (dataLength < length) {
|
|
82
|
+
missingData = {
|
|
83
|
+
dataMissing: length - dataLength,
|
|
84
|
+
};
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const data = outputBuffer.subarray(separatorIndex + 1, separatorIndex + 1 + Number(lengthString));
|
|
88
|
+
onMessage(nonceString, data);
|
|
89
|
+
missingData = null;
|
|
90
|
+
outputBuffer = outputBuffer.subarray(separatorIndex + Number(lengthString) + 1);
|
|
91
|
+
processInput();
|
|
92
|
+
};
|
|
93
|
+
let unprocessedBuffers = [];
|
|
94
|
+
child.stdout.on('data', (data) => {
|
|
95
|
+
unprocessedBuffers.push(data);
|
|
96
|
+
const separatorIndex = data.indexOf(separator);
|
|
97
|
+
if (separatorIndex === -1) {
|
|
98
|
+
if (missingData) {
|
|
99
|
+
missingData.dataMissing -= data.length;
|
|
100
|
+
}
|
|
101
|
+
if (!missingData || missingData.dataMissing > 0) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
unprocessedBuffers.unshift(outputBuffer);
|
|
106
|
+
outputBuffer = Buffer.concat(unprocessedBuffers);
|
|
107
|
+
unprocessedBuffers = [];
|
|
108
|
+
processInput();
|
|
109
|
+
});
|
|
110
|
+
child.stderr.on('data', (data) => {
|
|
111
|
+
if (data.toString('utf-8').includes('No accelerated colorspace conversion')) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
console.log(data.toString('utf-8'));
|
|
115
|
+
});
|
|
116
|
+
return {
|
|
117
|
+
waitForDone: () => {
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
119
|
+
child.on('close', (code) => {
|
|
120
|
+
quit = true;
|
|
121
|
+
const waitersToKill = Array.from(waiters.values());
|
|
122
|
+
for (const waiter of waitersToKill) {
|
|
123
|
+
waiter.reject(new Error(`Compositor quit with code ${code}`));
|
|
124
|
+
}
|
|
125
|
+
waiters.clear();
|
|
126
|
+
if (code === 0) {
|
|
127
|
+
resolve();
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
reject(Buffer.concat(stderrChunks).toString('utf-8'));
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
finishCommands: () => {
|
|
136
|
+
if (quit) {
|
|
137
|
+
throw new Error('Compositor already quit');
|
|
138
|
+
}
|
|
139
|
+
child.stdin.write('EOF\n');
|
|
140
|
+
},
|
|
141
|
+
executeCommand: (command, params) => {
|
|
142
|
+
if (quit) {
|
|
143
|
+
throw new Error('Compositor already quit');
|
|
144
|
+
}
|
|
145
|
+
return new Promise((resolve, reject) => {
|
|
146
|
+
const nonce = (0, make_nonce_1.makeNonce)();
|
|
147
|
+
const composed = {
|
|
148
|
+
type: command,
|
|
149
|
+
params: {
|
|
150
|
+
...params,
|
|
151
|
+
nonce,
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
// TODO: Should have a way to error out a single task
|
|
155
|
+
child.stdin.write(JSON.stringify(composed) + '\n');
|
|
156
|
+
waiters.set(nonce, {
|
|
157
|
+
resolve: (data) => {
|
|
158
|
+
resolve(data);
|
|
159
|
+
},
|
|
160
|
+
reject: (err) => {
|
|
161
|
+
reject(err);
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
exports.startCompositor = startCompositor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const makeNonce: () => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeNonce = void 0;
|
|
4
|
+
const makeNonce = () => {
|
|
5
|
+
return (Math.random().toString(36).substring(2, 15) +
|
|
6
|
+
Math.random().toString(36).substring(2, 15));
|
|
7
|
+
};
|
|
8
|
+
exports.makeNonce = makeNonce;
|
|
@@ -7,6 +7,9 @@ export declare const createFfmpegComplexFilter: ({ filters, downloadMap, ffmpegE
|
|
|
7
7
|
ffmpegExecutable: FfmpegExecutable;
|
|
8
8
|
remotionRoot: string;
|
|
9
9
|
}) => Promise<{
|
|
10
|
-
complexFilterFlag: [
|
|
10
|
+
complexFilterFlag: [
|
|
11
|
+
string,
|
|
12
|
+
string
|
|
13
|
+
] | null;
|
|
11
14
|
cleanup: () => void;
|
|
12
15
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AudioCodec } from './audio-codec';
|
|
2
2
|
import type { Codec } from './codec';
|
|
3
3
|
import type { FileExtension } from './file-extensions';
|
|
4
|
-
export declare const getFileExtensionFromCodec: <T extends "
|
|
5
|
-
export declare const makeFileExtensionMap: () => Record<string, ("
|
|
4
|
+
export declare const getFileExtensionFromCodec: <T extends "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif">(codec: T, audioCodec: AudioCodec | null) => FileExtension;
|
|
5
|
+
export declare const makeFileExtensionMap: () => Record<string, ("aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif")[]>;
|
|
6
6
|
export declare const defaultCodecsForFileExtension: Record<FileExtension, Codec>;
|
|
@@ -12,7 +12,7 @@ const getRealFrameRange = (durationInFrames, frameRange) => {
|
|
|
12
12
|
return [frameRange, frameRange];
|
|
13
13
|
}
|
|
14
14
|
if (frameRange[1] >= durationInFrames || frameRange[0] < 0) {
|
|
15
|
-
throw new Error(`Frame range ${frameRange.join('-')} is not
|
|
15
|
+
throw new Error(`Frame range ${frameRange.join('-')} is not inbetween 0-${durationInFrames - 1}`);
|
|
16
16
|
}
|
|
17
17
|
return frameRange;
|
|
18
18
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -59,9 +59,9 @@ export declare const RenderInternals: {
|
|
|
59
59
|
width: number;
|
|
60
60
|
height: number;
|
|
61
61
|
scale: number;
|
|
62
|
-
codec: "
|
|
62
|
+
codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
63
63
|
}) => void;
|
|
64
|
-
getFileExtensionFromCodec: <T extends "
|
|
64
|
+
getFileExtensionFromCodec: <T extends "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif">(codec: T, audioCodec: "pcm-16" | "aac" | "mp3" | "opus" | null) => import("./file-extensions").FileExtension;
|
|
65
65
|
tmpDir: (str: string) => string;
|
|
66
66
|
deleteDirectory: (directory: string) => void;
|
|
67
67
|
isServeUrl: (potentialUrl: string) => boolean;
|
|
@@ -111,7 +111,7 @@ export declare const RenderInternals: {
|
|
|
111
111
|
};
|
|
112
112
|
registerErrorSymbolicationLock: () => number;
|
|
113
113
|
unlockErrorSymbolicationLock: (id: number) => void;
|
|
114
|
-
canUseParallelEncoding: (codec: "
|
|
114
|
+
canUseParallelEncoding: (codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif") => boolean;
|
|
115
115
|
mimeContentType: typeof mimeContentType;
|
|
116
116
|
mimeLookup: typeof mimeLookup;
|
|
117
117
|
validateConcurrency: (value: unknown, setting: string) => void;
|
|
@@ -125,10 +125,10 @@ export declare const RenderInternals: {
|
|
|
125
125
|
DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
|
|
126
126
|
validateQuality: (q: number | undefined) => void;
|
|
127
127
|
DEFAULT_TIMEOUT: number;
|
|
128
|
-
DEFAULT_CODEC: "
|
|
129
|
-
isAudioCodec: (codec: "
|
|
128
|
+
DEFAULT_CODEC: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
129
|
+
isAudioCodec: (codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
|
|
130
130
|
logLevels: readonly ["verbose", "info", "warn", "error"];
|
|
131
|
-
isEqualOrBelowLogLevel: (currentLevel: "verbose" | "
|
|
131
|
+
isEqualOrBelowLogLevel: (currentLevel: "verbose" | "info" | "warn" | "error", level: "verbose" | "info" | "warn" | "error") => boolean;
|
|
132
132
|
isValidLogLevel: (level: string) => boolean;
|
|
133
133
|
perf: typeof perf;
|
|
134
134
|
makeDownloadMap: () => import("./assets/download-map").DownloadMap;
|
|
@@ -150,92 +150,92 @@ export declare const RenderInternals: {
|
|
|
150
150
|
output: string;
|
|
151
151
|
onProgress: (p: number) => void;
|
|
152
152
|
numberOfFrames: number;
|
|
153
|
-
codec: "
|
|
153
|
+
codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
154
154
|
fps: number;
|
|
155
155
|
numberOfGifLoops: number | null;
|
|
156
156
|
remotionRoot: string;
|
|
157
157
|
ffmpegExecutable: import("./ffmpeg-executable").FfmpegExecutable;
|
|
158
|
-
audioCodec: "
|
|
158
|
+
audioCodec: "pcm-16" | "aac" | "mp3" | "opus" | null;
|
|
159
159
|
}) => Promise<void>;
|
|
160
160
|
getDefaultAudioCodec: ({ codec, preferLossless, }: {
|
|
161
|
-
codec: "
|
|
161
|
+
codec: "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif";
|
|
162
162
|
preferLossless: boolean;
|
|
163
|
-
}) => "
|
|
163
|
+
}) => "pcm-16" | "aac" | "mp3" | "opus" | null;
|
|
164
164
|
validAudioCodecs: readonly ["pcm-16", "aac", "mp3", "opus"];
|
|
165
165
|
defaultFileExtensionMap: {
|
|
166
|
-
|
|
166
|
+
aac: {
|
|
167
167
|
default: import("./file-extensions").FileExtension;
|
|
168
168
|
forAudioCodec: {
|
|
169
|
-
|
|
169
|
+
"pcm-16": {
|
|
170
170
|
possible: import("./file-extensions").FileExtension[];
|
|
171
171
|
default: import("./file-extensions").FileExtension;
|
|
172
172
|
};
|
|
173
|
-
|
|
173
|
+
aac: {
|
|
174
174
|
possible: import("./file-extensions").FileExtension[];
|
|
175
175
|
default: import("./file-extensions").FileExtension;
|
|
176
176
|
};
|
|
177
177
|
};
|
|
178
178
|
};
|
|
179
|
-
|
|
179
|
+
mp3: {
|
|
180
180
|
default: import("./file-extensions").FileExtension;
|
|
181
181
|
forAudioCodec: {
|
|
182
|
-
|
|
182
|
+
"pcm-16": {
|
|
183
183
|
possible: import("./file-extensions").FileExtension[];
|
|
184
184
|
default: import("./file-extensions").FileExtension;
|
|
185
185
|
};
|
|
186
|
-
|
|
186
|
+
mp3: {
|
|
187
187
|
possible: import("./file-extensions").FileExtension[];
|
|
188
188
|
default: import("./file-extensions").FileExtension;
|
|
189
189
|
};
|
|
190
190
|
};
|
|
191
191
|
};
|
|
192
|
-
|
|
192
|
+
h264: {
|
|
193
193
|
default: import("./file-extensions").FileExtension;
|
|
194
194
|
forAudioCodec: {
|
|
195
195
|
"pcm-16": {
|
|
196
196
|
possible: import("./file-extensions").FileExtension[];
|
|
197
197
|
default: import("./file-extensions").FileExtension;
|
|
198
198
|
};
|
|
199
|
-
|
|
199
|
+
aac: {
|
|
200
200
|
possible: import("./file-extensions").FileExtension[];
|
|
201
201
|
default: import("./file-extensions").FileExtension;
|
|
202
202
|
};
|
|
203
203
|
};
|
|
204
204
|
};
|
|
205
|
-
|
|
205
|
+
h265: {
|
|
206
206
|
default: import("./file-extensions").FileExtension;
|
|
207
207
|
forAudioCodec: {
|
|
208
208
|
"pcm-16": {
|
|
209
209
|
possible: import("./file-extensions").FileExtension[];
|
|
210
210
|
default: import("./file-extensions").FileExtension;
|
|
211
211
|
};
|
|
212
|
-
|
|
212
|
+
aac: {
|
|
213
213
|
possible: import("./file-extensions").FileExtension[];
|
|
214
214
|
default: import("./file-extensions").FileExtension;
|
|
215
215
|
};
|
|
216
216
|
};
|
|
217
217
|
};
|
|
218
|
-
|
|
218
|
+
vp8: {
|
|
219
219
|
default: import("./file-extensions").FileExtension;
|
|
220
220
|
forAudioCodec: {
|
|
221
|
-
|
|
221
|
+
"pcm-16": {
|
|
222
222
|
possible: import("./file-extensions").FileExtension[];
|
|
223
223
|
default: import("./file-extensions").FileExtension;
|
|
224
224
|
};
|
|
225
|
-
|
|
225
|
+
opus: {
|
|
226
226
|
possible: import("./file-extensions").FileExtension[];
|
|
227
227
|
default: import("./file-extensions").FileExtension;
|
|
228
228
|
};
|
|
229
229
|
};
|
|
230
230
|
};
|
|
231
|
-
|
|
231
|
+
vp9: {
|
|
232
232
|
default: import("./file-extensions").FileExtension;
|
|
233
233
|
forAudioCodec: {
|
|
234
|
-
|
|
234
|
+
"pcm-16": {
|
|
235
235
|
possible: import("./file-extensions").FileExtension[];
|
|
236
236
|
default: import("./file-extensions").FileExtension;
|
|
237
237
|
};
|
|
238
|
-
|
|
238
|
+
opus: {
|
|
239
239
|
possible: import("./file-extensions").FileExtension[];
|
|
240
240
|
default: import("./file-extensions").FileExtension;
|
|
241
241
|
};
|
|
@@ -253,11 +253,11 @@ export declare const RenderInternals: {
|
|
|
253
253
|
prores: {
|
|
254
254
|
default: import("./file-extensions").FileExtension;
|
|
255
255
|
forAudioCodec: {
|
|
256
|
-
|
|
256
|
+
"pcm-16": {
|
|
257
257
|
possible: import("./file-extensions").FileExtension[];
|
|
258
258
|
default: import("./file-extensions").FileExtension;
|
|
259
259
|
};
|
|
260
|
-
|
|
260
|
+
aac: {
|
|
261
261
|
possible: import("./file-extensions").FileExtension[];
|
|
262
262
|
default: import("./file-extensions").FileExtension;
|
|
263
263
|
};
|
|
@@ -289,6 +289,6 @@ export declare const RenderInternals: {
|
|
|
289
289
|
readonly vp9: readonly ["opus", "pcm-16"];
|
|
290
290
|
readonly wav: readonly ["pcm-16"];
|
|
291
291
|
};
|
|
292
|
-
makeFileExtensionMap: () => Record<string, ("
|
|
293
|
-
defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "
|
|
292
|
+
makeFileExtensionMap: () => Record<string, ("aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif")[]>;
|
|
293
|
+
defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif">;
|
|
294
294
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const validateJpegQuality: (q: number | undefined) => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateJpegQuality = void 0;
|
|
4
|
+
const validateJpegQuality = (q) => {
|
|
5
|
+
if (typeof q !== 'undefined' && typeof q !== 'number') {
|
|
6
|
+
throw new Error(`JPEG Quality option must be a number or undefined. Got ${typeof q} (${JSON.stringify(q)})`);
|
|
7
|
+
}
|
|
8
|
+
if (typeof q === 'undefined') {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (!Number.isFinite(q)) {
|
|
12
|
+
throw new RangeError(`JPEG Quality must be a finite number, but is ${q}`);
|
|
13
|
+
}
|
|
14
|
+
if (Number.isNaN(q)) {
|
|
15
|
+
throw new RangeError(`JPEG Quality is NaN, but must be a real number`);
|
|
16
|
+
}
|
|
17
|
+
if (q > 100 || q < 0) {
|
|
18
|
+
throw new RangeError('JPEG Quality option must be between 0 and 100.');
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.validateJpegQuality = validateJpegQuality;
|
package/dist/open-browser.d.ts
CHANGED
package/dist/open-browser.js
CHANGED
|
@@ -32,7 +32,7 @@ exports.killAllBrowsers = killAllBrowsers;
|
|
|
32
32
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/open-browser)
|
|
33
33
|
*/
|
|
34
34
|
const openBrowser = async (browser, options) => {
|
|
35
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
36
36
|
if (browser === 'firefox') {
|
|
37
37
|
throw new TypeError('Firefox supported is not yet turned on. Stay tuned for the future.');
|
|
38
38
|
}
|
|
@@ -102,8 +102,11 @@ const openBrowser = async (browser, options) => {
|
|
|
102
102
|
...(((_j = options === null || options === void 0 ? void 0 : options.chromiumOptions) === null || _j === void 0 ? void 0 : _j.disableWebSecurity)
|
|
103
103
|
? ['--disable-web-security']
|
|
104
104
|
: []),
|
|
105
|
+
((_k = options === null || options === void 0 ? void 0 : options.chromiumOptions) === null || _k === void 0 ? void 0 : _k.userAgent)
|
|
106
|
+
? `--user-agent="${options.chromiumOptions.userAgent}"`
|
|
107
|
+
: null,
|
|
105
108
|
].filter(Boolean),
|
|
106
|
-
defaultViewport: (
|
|
109
|
+
defaultViewport: (_l = options === null || options === void 0 ? void 0 : options.viewport) !== null && _l !== void 0 ? _l : {
|
|
107
110
|
height: 720,
|
|
108
111
|
width: 1280,
|
|
109
112
|
deviceScaleFactor: 1,
|
|
@@ -4,8 +4,8 @@ exports.jpegQualityOption = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
exports.jpegQualityOption = {
|
|
6
6
|
name: 'JPEG Quality',
|
|
7
|
-
cliFlag: '--quality',
|
|
7
|
+
cliFlag: '--jpeg-quality',
|
|
8
8
|
description: ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "Sets the quality of the generated JPEG images. Must be an integer between 0 and 100. Default is to leave it up to the browser, current default is 80." })),
|
|
9
|
-
ssrName: '
|
|
10
|
-
docLink: 'https://www.remotion.dev/docs/renderer/render-media#quality',
|
|
9
|
+
ssrName: 'jpegQuality',
|
|
10
|
+
docLink: 'https://www.remotion.dev/docs/renderer/render-media#jpeg-quality',
|
|
11
11
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AudioCodec } from './audio-codec';
|
|
2
|
-
export declare const validateOutputFilename: <T extends "
|
|
2
|
+
export declare const validateOutputFilename: <T extends "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif">({ codec, audioCodec, extension, preferLossless, }: {
|
|
3
3
|
codec: T;
|
|
4
4
|
audioCodec: AudioCodec | null;
|
|
5
5
|
extension: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.83",
|
|
4
4
|
"description": "Renderer for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"execa": "5.1.1",
|
|
18
18
|
"extract-zip": "2.0.1",
|
|
19
|
-
"remotion": "3.3.
|
|
19
|
+
"remotion": "3.3.83",
|
|
20
20
|
"source-map": "^0.8.0-beta.0",
|
|
21
21
|
"ws": "8.7.0"
|
|
22
22
|
},
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
"vitest": "0.24.3"
|
|
42
42
|
},
|
|
43
43
|
"optionalDependencies": {
|
|
44
|
-
"@remotion/compositor-darwin-arm64": "3.3.
|
|
45
|
-
"@remotion/compositor-darwin-x64": "3.3.
|
|
46
|
-
"@remotion/compositor-linux-arm64-gnu": "3.3.
|
|
47
|
-
"@remotion/compositor-linux-arm64-musl": "3.3.
|
|
48
|
-
"@remotion/compositor-linux-x64-gnu": "3.3.
|
|
49
|
-
"@remotion/compositor-linux-x64-musl": "3.3.
|
|
50
|
-
"@remotion/compositor-win32-x64-msvc": "3.3.
|
|
44
|
+
"@remotion/compositor-darwin-arm64": "3.3.83",
|
|
45
|
+
"@remotion/compositor-darwin-x64": "3.3.83",
|
|
46
|
+
"@remotion/compositor-linux-arm64-gnu": "3.3.83",
|
|
47
|
+
"@remotion/compositor-linux-arm64-musl": "3.3.83",
|
|
48
|
+
"@remotion/compositor-linux-x64-gnu": "3.3.83",
|
|
49
|
+
"@remotion/compositor-linux-x64-musl": "3.3.83",
|
|
50
|
+
"@remotion/compositor-win32-x64-msvc": "3.3.83"
|
|
51
51
|
},
|
|
52
52
|
"keywords": [
|
|
53
53
|
"remotion",
|