@remotion/renderer 4.0.0-alpha4 → 4.0.0-alpha5
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-map.d.ts +0 -26
- package/dist/assets/download-map.js +0 -5
- package/dist/assets/get-audio-channels.d.ts +1 -2
- package/dist/assets/get-audio-channels.js +5 -9
- 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 +1 -2
- package/dist/browser/BrowserRunner.js +8 -2
- package/dist/browser/FrameManager.js +2 -3
- package/dist/browser/LaunchOptions.d.ts +1 -0
- package/dist/browser/Launcher.js +2 -1
- package/dist/browser/devtools-commands.d.ts +5 -1
- package/dist/browser/devtools-types.d.ts +78 -0
- 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 +37 -0
- package/dist/check-apple-silicon.js +2 -45
- package/dist/client.d.ts +67 -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 +5 -9
- package/dist/compositor/compose.d.ts +3 -1
- package/dist/compositor/compose.js +34 -14
- package/dist/compositor/compositor.d.ts +12 -0
- package/dist/compositor/compositor.js +202 -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 +16 -16
- package/dist/file-extensions.d.ts +1 -12
- package/dist/file-extensions.js +1 -13
- package/dist/get-compositions.d.ts +3 -5
- package/dist/get-compositions.js +8 -11
- package/dist/get-extension-from-codec.d.ts +2 -2
- package/dist/get-frame-padded-index.d.ts +2 -1
- 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 +66 -59
- 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 +3 -10
- package/dist/offthread-video-server.d.ts +8 -8
- package/dist/offthread-video-server.js +63 -56
- 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 +5 -5
- 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 +2 -3
- 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 +9 -32
- package/dist/render-frames.d.ts +13 -25
- package/dist/render-frames.js +29 -40
- package/dist/render-media.d.ts +16 -18
- package/dist/render-media.js +33 -43
- package/dist/render-still.d.ts +10 -8
- package/dist/render-still.js +14 -13
- 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 +38 -23
- package/dist/serve-handler/index.js +6 -4
- package/dist/serve-static.d.ts +2 -3
- package/dist/serve-static.js +24 -20
- package/dist/stitch-frames-to-video.d.ts +2 -12
- package/dist/stitch-frames-to-video.js +24 -33
- package/dist/take-frame-and-compose.d.ts +4 -5
- package/dist/take-frame-and-compose.js +12 -6
- package/dist/tmp-dir.js +1 -2
- 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
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.startCompositor = exports.startLongRunningCompositor = exports.getIdealMaximumFrameCacheItems = void 0;
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const os_1 = __importDefault(require("os"));
|
|
9
|
+
const call_ffmpeg_1 = require("../call-ffmpeg");
|
|
10
|
+
const get_concurrency_1 = require("../get-concurrency");
|
|
11
|
+
const compose_1 = require("./compose");
|
|
12
|
+
const get_executable_path_1 = require("./get-executable-path");
|
|
13
|
+
const make_nonce_1 = require("./make-nonce");
|
|
14
|
+
const getIdealMaximumFrameCacheItems = () => {
|
|
15
|
+
const freeMemory = os_1.default.freemem();
|
|
16
|
+
// Assuming 1 frame is approximately 6MB
|
|
17
|
+
// Assuming only half the available memory should be used
|
|
18
|
+
const max = Math.floor(freeMemory / (1024 * 1024 * 6));
|
|
19
|
+
// Never store more than 1000 frames
|
|
20
|
+
// But 100 is needed even if it's going to swap
|
|
21
|
+
return Math.max(100, Math.min(max, 1000));
|
|
22
|
+
};
|
|
23
|
+
exports.getIdealMaximumFrameCacheItems = getIdealMaximumFrameCacheItems;
|
|
24
|
+
const startLongRunningCompositor = (maximumFrameCacheItems, verbose) => {
|
|
25
|
+
return (0, exports.startCompositor)('StartLongRunningProcess', {
|
|
26
|
+
concurrency: (0, get_concurrency_1.getActualConcurrency)(null),
|
|
27
|
+
maximum_frame_cache_items: maximumFrameCacheItems,
|
|
28
|
+
verbose,
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
exports.startLongRunningCompositor = startLongRunningCompositor;
|
|
32
|
+
const startCompositor = (type, payload) => {
|
|
33
|
+
var _a;
|
|
34
|
+
const bin = (0, get_executable_path_1.getExecutablePath)('compositor');
|
|
35
|
+
const fullCommand = (0, compose_1.serializeCommand)(type, payload);
|
|
36
|
+
const child = (0, child_process_1.spawn)(bin, [JSON.stringify(fullCommand)], (0, call_ffmpeg_1.dynamicLibraryPathOptions)());
|
|
37
|
+
const stderrChunks = [];
|
|
38
|
+
let outputBuffer = Buffer.from('');
|
|
39
|
+
const separator = Buffer.from('remotion_buffer:');
|
|
40
|
+
const waiters = new Map();
|
|
41
|
+
const onMessage = (statusType, nonce, data) => {
|
|
42
|
+
if (nonce === '0') {
|
|
43
|
+
console.log(data.toString('utf8'));
|
|
44
|
+
}
|
|
45
|
+
if (waiters.has(nonce)) {
|
|
46
|
+
if (statusType === 'error') {
|
|
47
|
+
try {
|
|
48
|
+
const parsed = JSON.parse(data.toString('utf8'));
|
|
49
|
+
waiters.get(nonce).reject(new Error(`Compositor error: ${parsed.error}\n${parsed.backtrace}`));
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
waiters.get(nonce).reject(new Error(data.toString('utf8')));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
waiters.get(nonce).resolve(data);
|
|
57
|
+
}
|
|
58
|
+
waiters.delete(nonce);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
let quit = false;
|
|
62
|
+
let missingData = null;
|
|
63
|
+
const processInput = () => {
|
|
64
|
+
let separatorIndex = outputBuffer.indexOf(separator);
|
|
65
|
+
if (separatorIndex === -1) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
separatorIndex += separator.length;
|
|
69
|
+
let nonceString = '';
|
|
70
|
+
let lengthString = '';
|
|
71
|
+
let statusString = '';
|
|
72
|
+
// Each message from Rust is prefixed with `remotion_buffer;{[nonce]}:{[length]}`
|
|
73
|
+
// Let's read the buffer to extract the nonce, and if the full length is available,
|
|
74
|
+
// we'll extract the data and pass it to the callback.
|
|
75
|
+
// eslint-disable-next-line no-constant-condition
|
|
76
|
+
while (true) {
|
|
77
|
+
const nextDigit = outputBuffer[separatorIndex];
|
|
78
|
+
// 0x3a is the character ":"
|
|
79
|
+
if (nextDigit === 0x3a) {
|
|
80
|
+
separatorIndex++;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
separatorIndex++;
|
|
84
|
+
nonceString += String.fromCharCode(nextDigit);
|
|
85
|
+
}
|
|
86
|
+
// eslint-disable-next-line no-constant-condition
|
|
87
|
+
while (true) {
|
|
88
|
+
const nextDigit = outputBuffer[separatorIndex];
|
|
89
|
+
if (nextDigit === 0x3a) {
|
|
90
|
+
separatorIndex++;
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
separatorIndex++;
|
|
94
|
+
lengthString += String.fromCharCode(nextDigit);
|
|
95
|
+
}
|
|
96
|
+
// eslint-disable-next-line no-constant-condition
|
|
97
|
+
while (true) {
|
|
98
|
+
const nextDigit = outputBuffer[separatorIndex];
|
|
99
|
+
if (nextDigit === 0x3a) {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
separatorIndex++;
|
|
103
|
+
statusString += String.fromCharCode(nextDigit);
|
|
104
|
+
}
|
|
105
|
+
const length = Number(lengthString);
|
|
106
|
+
const status = Number(statusString);
|
|
107
|
+
const dataLength = outputBuffer.length - separatorIndex - 1;
|
|
108
|
+
if (dataLength < length) {
|
|
109
|
+
missingData = {
|
|
110
|
+
dataMissing: length - dataLength,
|
|
111
|
+
};
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const data = outputBuffer.subarray(separatorIndex + 1, separatorIndex + 1 + Number(lengthString));
|
|
115
|
+
onMessage(status === 1 ? 'error' : 'success', nonceString, data);
|
|
116
|
+
missingData = null;
|
|
117
|
+
outputBuffer = outputBuffer.subarray(separatorIndex + Number(lengthString) + 1);
|
|
118
|
+
processInput();
|
|
119
|
+
};
|
|
120
|
+
let unprocessedBuffers = [];
|
|
121
|
+
child.stdout.on('data', (data) => {
|
|
122
|
+
unprocessedBuffers.push(data);
|
|
123
|
+
const separatorIndex = data.indexOf(separator);
|
|
124
|
+
if (separatorIndex === -1) {
|
|
125
|
+
if (missingData) {
|
|
126
|
+
missingData.dataMissing -= data.length;
|
|
127
|
+
}
|
|
128
|
+
if (!missingData || missingData.dataMissing > 0) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
unprocessedBuffers.unshift(outputBuffer);
|
|
133
|
+
outputBuffer = Buffer.concat(unprocessedBuffers);
|
|
134
|
+
unprocessedBuffers = [];
|
|
135
|
+
processInput();
|
|
136
|
+
});
|
|
137
|
+
child.stderr.on('data', (data) => {
|
|
138
|
+
stderrChunks.push(data);
|
|
139
|
+
});
|
|
140
|
+
let resolve = null;
|
|
141
|
+
let reject = null;
|
|
142
|
+
child.on('close', (code) => {
|
|
143
|
+
quit = true;
|
|
144
|
+
const waitersToKill = Array.from(waiters.values());
|
|
145
|
+
if (code === 0) {
|
|
146
|
+
resolve === null || resolve === void 0 ? void 0 : resolve();
|
|
147
|
+
for (const waiter of waitersToKill) {
|
|
148
|
+
waiter.reject(new Error(`Compositor already quit`));
|
|
149
|
+
}
|
|
150
|
+
waiters.clear();
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
const error = new Error(`Compositor panicked: ${Buffer.concat(stderrChunks).toString('utf-8')}`);
|
|
154
|
+
for (const waiter of waitersToKill) {
|
|
155
|
+
waiter.reject(error);
|
|
156
|
+
}
|
|
157
|
+
waiters.clear();
|
|
158
|
+
reject === null || reject === void 0 ? void 0 : reject(error);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
return {
|
|
162
|
+
waitForDone: () => {
|
|
163
|
+
return new Promise((res, rej) => {
|
|
164
|
+
if (quit) {
|
|
165
|
+
rej(new Error('Compositor already quit'));
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
resolve = res;
|
|
169
|
+
reject = rej;
|
|
170
|
+
});
|
|
171
|
+
},
|
|
172
|
+
finishCommands: () => {
|
|
173
|
+
if (quit) {
|
|
174
|
+
throw new Error('Compositor already quit');
|
|
175
|
+
}
|
|
176
|
+
child.stdin.write('EOF\n');
|
|
177
|
+
},
|
|
178
|
+
executeCommand: (command, params) => {
|
|
179
|
+
if (quit) {
|
|
180
|
+
throw new Error('Compositor already quit');
|
|
181
|
+
}
|
|
182
|
+
return new Promise((_resolve, _reject) => {
|
|
183
|
+
const nonce = (0, make_nonce_1.makeNonce)();
|
|
184
|
+
const composed = {
|
|
185
|
+
nonce,
|
|
186
|
+
payload: {
|
|
187
|
+
type: command,
|
|
188
|
+
params,
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
// TODO: Should have a way to error out a single task
|
|
192
|
+
child.stdin.write(JSON.stringify(composed) + '\n');
|
|
193
|
+
waiters.set(nonce, {
|
|
194
|
+
resolve: _resolve,
|
|
195
|
+
reject: _reject,
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
pid: (_a = child.pid) !== null && _a !== void 0 ? _a : null,
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
exports.startCompositor = startCompositor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const getExecutablePath: () =>
|
|
1
|
+
export declare const getExecutablePath: (type: 'compositor' | 'ffmpeg' | 'ffprobe' | 'ffmpeg-cwd') => string;
|
|
@@ -7,21 +7,40 @@ function isMusl() {
|
|
|
7
7
|
const { glibcVersionRuntime } = process.report.getReport().header;
|
|
8
8
|
return !glibcVersionRuntime;
|
|
9
9
|
}
|
|
10
|
-
const getExecutablePath = () => {
|
|
10
|
+
const getExecutablePath = (type) => {
|
|
11
|
+
if (type === 'ffmpeg' && process.env.FFMPEG_BIN_PATH) {
|
|
12
|
+
return '/opt/ffmpeg/remotion/bin/ffmpeg';
|
|
13
|
+
}
|
|
14
|
+
if (type === 'ffprobe' && process.env.FFPROBE_BIN_PATH) {
|
|
15
|
+
return '/opt/ffmpeg/remotion/bin/ffprobe';
|
|
16
|
+
}
|
|
17
|
+
if (type === 'ffmpeg-cwd' && process.env.FFMPEG_CWD) {
|
|
18
|
+
return '/opt/ffmpeg';
|
|
19
|
+
}
|
|
20
|
+
if (type === 'compositor' && process.env.COMPOSITOR_PATH) {
|
|
21
|
+
return './compositor';
|
|
22
|
+
}
|
|
23
|
+
const key = type === 'compositor'
|
|
24
|
+
? 'binaryPath'
|
|
25
|
+
: type === 'ffmpeg'
|
|
26
|
+
? 'ffmpegPath'
|
|
27
|
+
: type === 'ffprobe'
|
|
28
|
+
? 'ffprobePath'
|
|
29
|
+
: 'ffmpegCwd';
|
|
11
30
|
switch (process.platform) {
|
|
12
31
|
case 'win32':
|
|
13
32
|
switch (process.arch) {
|
|
14
33
|
case 'x64':
|
|
15
|
-
return require('@remotion/compositor-win32-x64-msvc')
|
|
34
|
+
return require('@remotion/compositor-win32-x64-msvc')[key];
|
|
16
35
|
default:
|
|
17
36
|
throw new Error(`Unsupported architecture on Windows: ${process.arch}`);
|
|
18
37
|
}
|
|
19
38
|
case 'darwin':
|
|
20
39
|
switch (process.arch) {
|
|
21
40
|
case 'x64':
|
|
22
|
-
return require('@remotion/compositor-darwin-x64')
|
|
41
|
+
return require('@remotion/compositor-darwin-x64')[key];
|
|
23
42
|
case 'arm64':
|
|
24
|
-
return require('@remotion/compositor-darwin-arm64')
|
|
43
|
+
return require('@remotion/compositor-darwin-arm64')[key];
|
|
25
44
|
default:
|
|
26
45
|
throw new Error(`Unsupported architecture on macOS: ${process.arch}`);
|
|
27
46
|
}
|
|
@@ -29,14 +48,14 @@ const getExecutablePath = () => {
|
|
|
29
48
|
switch (process.arch) {
|
|
30
49
|
case 'x64':
|
|
31
50
|
if (isMusl()) {
|
|
32
|
-
return require('@remotion/compositor-linux-x64-musl')
|
|
51
|
+
return require('@remotion/compositor-linux-x64-musl')[key];
|
|
33
52
|
}
|
|
34
|
-
return require('@remotion/compositor-linux-x64-gnu')
|
|
53
|
+
return require('@remotion/compositor-linux-x64-gnu')[key];
|
|
35
54
|
case 'arm64':
|
|
36
55
|
if (isMusl()) {
|
|
37
|
-
return require('@remotion/compositor-linux-arm64-musl')
|
|
56
|
+
return require('@remotion/compositor-linux-arm64-musl')[key];
|
|
38
57
|
}
|
|
39
|
-
return require('@remotion/compositor-linux-arm64-gnu')
|
|
58
|
+
return require('@remotion/compositor-linux-arm64-gnu')[key];
|
|
40
59
|
default:
|
|
41
60
|
throw new Error(`Unsupported architecture on Linux: ${process.arch}`);
|
|
42
61
|
}
|
|
@@ -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;
|
|
@@ -27,13 +27,40 @@ export declare type Layer = {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
export declare type CompositorImageFormat = 'Png' | 'Jpeg';
|
|
30
|
-
export declare type
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
export declare type CompositorCommand = {
|
|
31
|
+
Compose: {
|
|
32
|
+
output: string;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
layers: Layer[];
|
|
36
|
+
output_format: CompositorImageFormat;
|
|
37
|
+
};
|
|
38
|
+
ExtractFrame: {
|
|
39
|
+
input: string;
|
|
40
|
+
time: number;
|
|
41
|
+
transparent: boolean;
|
|
42
|
+
};
|
|
43
|
+
Echo: {
|
|
44
|
+
message: string;
|
|
45
|
+
};
|
|
46
|
+
StartLongRunningProcess: {
|
|
47
|
+
concurrency: number;
|
|
48
|
+
maximum_frame_cache_items: number;
|
|
49
|
+
verbose: boolean;
|
|
50
|
+
};
|
|
51
|
+
GetOpenVideoStats: {};
|
|
52
|
+
DeliberatePanic: {};
|
|
53
|
+
CloseAllVideos: {};
|
|
54
|
+
FreeUpMemory: {
|
|
55
|
+
percent_of_memory: number;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export declare type CompositorCommandSerialized<T extends keyof CompositorCommand> = {
|
|
59
|
+
nonce: string;
|
|
60
|
+
payload: {
|
|
61
|
+
type: T;
|
|
62
|
+
params: CompositorCommand[T];
|
|
63
|
+
};
|
|
37
64
|
};
|
|
38
65
|
export declare type ErrorPayload = {
|
|
39
66
|
error: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { DownloadMap } from './assets/download-map';
|
|
2
|
-
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
3
2
|
import type { PreprocessedAudioTrack } from './preprocess-audio-track';
|
|
4
|
-
export declare const createFfmpegComplexFilter: ({ filters, downloadMap,
|
|
3
|
+
export declare const createFfmpegComplexFilter: ({ filters, downloadMap, }: {
|
|
5
4
|
filters: PreprocessedAudioTrack[];
|
|
6
5
|
downloadMap: DownloadMap;
|
|
7
|
-
ffmpegExecutable: FfmpegExecutable;
|
|
8
|
-
remotionRoot: string;
|
|
9
6
|
}) => Promise<{
|
|
10
|
-
complexFilterFlag: [
|
|
7
|
+
complexFilterFlag: [
|
|
8
|
+
string,
|
|
9
|
+
string
|
|
10
|
+
] | null;
|
|
11
11
|
cleanup: () => void;
|
|
12
12
|
}>;
|
|
@@ -3,14 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createFfmpegComplexFilter = void 0;
|
|
4
4
|
const create_ffmpeg_merge_filter_1 = require("./create-ffmpeg-merge-filter");
|
|
5
5
|
const ffmpeg_filter_file_1 = require("./ffmpeg-filter-file");
|
|
6
|
-
const createFfmpegComplexFilter = async ({ filters, downloadMap,
|
|
6
|
+
const createFfmpegComplexFilter = async ({ filters, downloadMap, }) => {
|
|
7
7
|
if (filters.length === 0) {
|
|
8
8
|
return { complexFilterFlag: null, cleanup: () => undefined };
|
|
9
9
|
}
|
|
10
|
-
const complexFilter =
|
|
10
|
+
const complexFilter = (0, create_ffmpeg_merge_filter_1.createFfmpegMergeFilter)({
|
|
11
11
|
inputs: filters,
|
|
12
|
-
ffmpegExecutable,
|
|
13
|
-
remotionRoot,
|
|
14
12
|
});
|
|
15
13
|
const { file, cleanup } = await (0, ffmpeg_filter_file_1.makeFfmpegFilterFileStr)(complexFilter, downloadMap);
|
|
16
14
|
return {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
2
1
|
import type { PreprocessedAudioTrack } from './preprocess-audio-track';
|
|
3
2
|
export declare const OUTPUT_FILTER_NAME = "outputaudio";
|
|
4
|
-
export declare const createFfmpegMergeFilter: ({ inputs,
|
|
3
|
+
export declare const createFfmpegMergeFilter: ({ inputs, }: {
|
|
5
4
|
inputs: PreprocessedAudioTrack[];
|
|
6
|
-
|
|
7
|
-
remotionRoot: string;
|
|
8
|
-
}) => Promise<string>;
|
|
5
|
+
}) => string;
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createFfmpegMergeFilter = exports.OUTPUT_FILTER_NAME = void 0;
|
|
4
|
-
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
5
4
|
const truthy_1 = require("./truthy");
|
|
6
5
|
exports.OUTPUT_FILTER_NAME = 'outputaudio';
|
|
7
|
-
const createFfmpegMergeFilter =
|
|
8
|
-
const ffmpegVersion = await (0, ffmpeg_flags_1.getFfmpegVersion)({
|
|
9
|
-
ffmpegExecutable,
|
|
10
|
-
remotionRoot,
|
|
11
|
-
});
|
|
12
|
-
const supportsNormalize = ffmpegVersion === null ||
|
|
13
|
-
(ffmpegVersion[0] === 4 && ffmpegVersion[1] >= 4) ||
|
|
14
|
-
ffmpegVersion[0] >= 5;
|
|
6
|
+
const createFfmpegMergeFilter = ({ inputs, }) => {
|
|
15
7
|
const pads = inputs.map((input, index) => {
|
|
16
8
|
const filters = [
|
|
17
9
|
input.filter.pad_start ? input.filter.pad_start : null,
|
|
@@ -20,7 +12,7 @@ const createFfmpegMergeFilter = async ({ inputs, ffmpegExecutable, remotionRoot,
|
|
|
20
12
|
];
|
|
21
13
|
return `[${index}:a]${filters.filter(truthy_1.truthy).join(',')}[padded${index}]`;
|
|
22
14
|
});
|
|
23
|
-
const normalize =
|
|
15
|
+
const normalize = ':normalize=0';
|
|
24
16
|
return [
|
|
25
17
|
...pads,
|
|
26
18
|
`${new Array(inputs.length)
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const createSilentAudio: ({ ffmpegExecutable, numberOfSeconds, outName, remotionRoot, }: {
|
|
3
|
-
ffmpegExecutable: FfmpegExecutable;
|
|
1
|
+
export declare const createSilentAudio: ({ numberOfSeconds, outName, }: {
|
|
4
2
|
numberOfSeconds: number;
|
|
5
3
|
outName: string;
|
|
6
|
-
remotionRoot: string;
|
|
7
4
|
}) => Promise<void>;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.createSilentAudio = void 0;
|
|
7
|
-
const
|
|
8
|
-
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
4
|
+
const call_ffmpeg_1 = require("./call-ffmpeg");
|
|
9
5
|
const sample_rate_1 = require("./sample-rate");
|
|
10
|
-
const createSilentAudio = async ({
|
|
11
|
-
await (0,
|
|
6
|
+
const createSilentAudio = async ({ numberOfSeconds, outName, }) => {
|
|
7
|
+
await (0, call_ffmpeg_1.callFf)('ffmpeg', [
|
|
12
8
|
'-f',
|
|
13
9
|
'lavfi',
|
|
14
10
|
'-i',
|
package/dist/crf.js
CHANGED
|
@@ -9,7 +9,7 @@ const getDefaultCrfForCodec = (codec) => {
|
|
|
9
9
|
if (codec === 'h264' || codec === 'h264-mkv') {
|
|
10
10
|
return 18; // FFMPEG default 23
|
|
11
11
|
}
|
|
12
|
-
if (codec === 'h265'
|
|
12
|
+
if (codec === 'h265') {
|
|
13
13
|
return 23; // FFMPEG default 28
|
|
14
14
|
}
|
|
15
15
|
if (codec === 'vp8') {
|
|
@@ -21,6 +21,9 @@ const getDefaultCrfForCodec = (codec) => {
|
|
|
21
21
|
if (codec === 'prores') {
|
|
22
22
|
return 0;
|
|
23
23
|
}
|
|
24
|
+
if (codec === 'gif') {
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
24
27
|
throw new TypeError(`Got unexpected codec "${codec}"`);
|
|
25
28
|
};
|
|
26
29
|
exports.getDefaultCrfForCodec = getDefaultCrfForCodec;
|
|
@@ -31,10 +34,13 @@ const getValidCrfRanges = (codec) => {
|
|
|
31
34
|
if (codec === 'prores') {
|
|
32
35
|
return [0, 0];
|
|
33
36
|
}
|
|
37
|
+
if (codec === 'gif') {
|
|
38
|
+
return [0, 0];
|
|
39
|
+
}
|
|
34
40
|
if (codec === 'h264' || codec === 'h264-mkv') {
|
|
35
41
|
return [1, 51];
|
|
36
42
|
}
|
|
37
|
-
if (codec === 'h265'
|
|
43
|
+
if (codec === 'h265') {
|
|
38
44
|
return [0, 51];
|
|
39
45
|
}
|
|
40
46
|
if (codec === 'vp8') {
|
package/dist/delete-directory.js
CHANGED
|
@@ -22,37 +22,37 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
26
|
exports.deleteDirectory = void 0;
|
|
30
|
-
const execa_1 = __importDefault(require("execa"));
|
|
31
27
|
const fs_1 = __importStar(require("fs"));
|
|
32
28
|
const is_serve_url_1 = require("./is-serve-url");
|
|
33
29
|
const deleteDirectory = (directory) => {
|
|
34
|
-
var _a;
|
|
35
30
|
if ((0, is_serve_url_1.isServeUrl)(directory)) {
|
|
36
31
|
return;
|
|
37
32
|
}
|
|
38
33
|
if (!(0, fs_1.existsSync)(directory)) {
|
|
39
34
|
return;
|
|
40
35
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
// Working around a bug with NodeJS 16 on Windows:
|
|
37
|
+
// If a subdirectory is already deleted, it will fail with EPERM
|
|
38
|
+
// even with force: true and recursive and maxRetries set higher.
|
|
39
|
+
// This is even with the fixWinEPERMSync function being called by Node.JS.
|
|
40
|
+
// This is a workaround for this issue.
|
|
41
|
+
let retries = 2;
|
|
42
|
+
while (retries >= 0) {
|
|
45
43
|
try {
|
|
46
|
-
|
|
44
|
+
fs_1.default.rmSync(directory, {
|
|
45
|
+
maxRetries: 2,
|
|
46
|
+
recursive: true,
|
|
47
|
+
force: true,
|
|
48
|
+
retryDelay: 100,
|
|
49
|
+
});
|
|
47
50
|
}
|
|
48
51
|
catch (err) {
|
|
49
|
-
|
|
52
|
+
retries--;
|
|
53
|
+
continue;
|
|
50
54
|
}
|
|
51
|
-
|
|
52
|
-
else {
|
|
53
|
-
((_a = fs_1.default.rmSync) !== null && _a !== void 0 ? _a : fs_1.default.rmdirSync)(directory, {
|
|
54
|
-
recursive: true,
|
|
55
|
-
});
|
|
55
|
+
break;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
exports.deleteDirectory = deleteDirectory;
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
+
import type { supportedAudioCodecs } from './audio-codec';
|
|
1
2
|
import type { Codec } from './codec';
|
|
2
|
-
export declare const supportedAudioCodecs: {
|
|
3
|
-
readonly h264: readonly ["aac", "pcm-16"];
|
|
4
|
-
readonly 'h264-mkv': readonly ["pcm-16"];
|
|
5
|
-
readonly aac: readonly ["aac", "pcm-16"];
|
|
6
|
-
readonly gif: readonly [];
|
|
7
|
-
readonly h265: readonly ["aac", "pcm-16"];
|
|
8
|
-
readonly mp3: readonly ["mp3", "pcm-16"];
|
|
9
|
-
readonly prores: readonly ["pcm-16", "aac"];
|
|
10
|
-
readonly vp8: readonly ["opus", "pcm-16"];
|
|
11
|
-
readonly vp9: readonly ["opus", "pcm-16"];
|
|
12
|
-
readonly wav: readonly ["pcm-16"];
|
|
13
|
-
};
|
|
14
3
|
export declare type FileExtension = 'aac' | '3gp' | 'm4a' | 'm4b' | 'mpg' | 'mpeg' | 'mkv' | 'mp4' | 'gif' | 'hevc' | 'mp3' | 'mov' | 'mxf' | 'wav' | 'webm';
|
|
15
4
|
export declare const defaultFileExtensionMap: {
|
|
16
5
|
[key in Codec]: {
|
package/dist/file-extensions.js
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultFileExtensionMap =
|
|
4
|
-
exports.supportedAudioCodecs = {
|
|
5
|
-
h264: ['aac', 'pcm-16'],
|
|
6
|
-
'h264-mkv': ['pcm-16'],
|
|
7
|
-
aac: ['aac', 'pcm-16'],
|
|
8
|
-
gif: [],
|
|
9
|
-
h265: ['aac', 'pcm-16'],
|
|
10
|
-
mp3: ['mp3', 'pcm-16'],
|
|
11
|
-
prores: ['pcm-16', 'aac'],
|
|
12
|
-
vp8: ['opus', 'pcm-16'],
|
|
13
|
-
vp9: ['opus', 'pcm-16'],
|
|
14
|
-
wav: ['pcm-16'],
|
|
15
|
-
};
|
|
3
|
+
exports.defaultFileExtensionMap = void 0;
|
|
16
4
|
exports.defaultFileExtensionMap = {
|
|
17
5
|
'h264-mkv': {
|
|
18
6
|
default: 'mkv',
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AnyCompMetadata } from 'remotion';
|
|
2
2
|
import type { DownloadMap } from './assets/download-map';
|
|
3
3
|
import type { BrowserExecutable } from './browser-executable';
|
|
4
4
|
import type { BrowserLog } from './browser-log';
|
|
5
5
|
import type { Browser } from './browser/Browser';
|
|
6
|
-
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
7
6
|
import type { ChromiumOptions } from './open-browser';
|
|
8
7
|
declare type GetCompositionsConfig = {
|
|
9
8
|
inputProps?: object | null;
|
|
@@ -13,17 +12,16 @@ declare type GetCompositionsConfig = {
|
|
|
13
12
|
browserExecutable?: BrowserExecutable;
|
|
14
13
|
timeoutInMilliseconds?: number;
|
|
15
14
|
chromiumOptions?: ChromiumOptions;
|
|
16
|
-
ffmpegExecutable?: FfmpegExecutable;
|
|
17
|
-
ffprobeExecutable?: FfmpegExecutable;
|
|
18
15
|
port?: number | null;
|
|
19
16
|
/**
|
|
20
17
|
* @deprecated Only for Remotion internal usage
|
|
21
18
|
*/
|
|
22
19
|
downloadMap?: DownloadMap;
|
|
20
|
+
verbose?: boolean;
|
|
23
21
|
};
|
|
24
22
|
/**
|
|
25
23
|
* @description Gets the compositions defined in a Remotion project based on a Webpack bundle.
|
|
26
24
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/get-compositions)
|
|
27
25
|
*/
|
|
28
|
-
export declare const getCompositions: (serveUrlOrWebpackUrl: string, config?: GetCompositionsConfig) => Promise<
|
|
26
|
+
export declare const getCompositions: (serveUrlOrWebpackUrl: string, config?: GetCompositionsConfig) => Promise<AnyCompMetadata[]>;
|
|
29
27
|
export {};
|
package/dist/get-compositions.js
CHANGED
|
@@ -9,7 +9,6 @@ const prepare_server_1 = require("./prepare-server");
|
|
|
9
9
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
10
10
|
const seek_to_frame_1 = require("./seek-to-frame");
|
|
11
11
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
12
|
-
const validate_ffmpeg_1 = require("./validate-ffmpeg");
|
|
13
12
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
14
13
|
const innerGetCompositions = async (serveUrl, page, config, proxyPort) => {
|
|
15
14
|
if (config === null || config === void 0 ? void 0 : config.onBrowserLog) {
|
|
@@ -61,17 +60,15 @@ const innerGetCompositions = async (serveUrl, page, config, proxyPort) => {
|
|
|
61
60
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/get-compositions)
|
|
62
61
|
*/
|
|
63
62
|
const getCompositions = async (serveUrlOrWebpackUrl, config) => {
|
|
64
|
-
var _a, _b, _c
|
|
65
|
-
|
|
66
|
-
await (0, validate_ffmpeg_1.validateFfmpeg)((_b = config === null || config === void 0 ? void 0 : config.ffprobeExecutable) !== null && _b !== void 0 ? _b : null, (0, find_closest_package_json_1.findRemotionRoot)(), 'ffprobe');
|
|
67
|
-
const downloadMap = (_c = config === null || config === void 0 ? void 0 : config.downloadMap) !== null && _c !== void 0 ? _c : (0, download_map_1.makeDownloadMap)();
|
|
63
|
+
var _a, _b, _c;
|
|
64
|
+
const downloadMap = (_a = config === null || config === void 0 ? void 0 : config.downloadMap) !== null && _a !== void 0 ? _a : (0, download_map_1.makeDownloadMap)();
|
|
68
65
|
const { page, cleanup } = await (0, get_browser_instance_1.getPageAndCleanupFn)({
|
|
69
66
|
passedInInstance: config === null || config === void 0 ? void 0 : config.puppeteerInstance,
|
|
70
|
-
browserExecutable: (
|
|
71
|
-
chromiumOptions: (
|
|
67
|
+
browserExecutable: (_b = config === null || config === void 0 ? void 0 : config.browserExecutable) !== null && _b !== void 0 ? _b : null,
|
|
68
|
+
chromiumOptions: (_c = config === null || config === void 0 ? void 0 : config.chromiumOptions) !== null && _c !== void 0 ? _c : {},
|
|
72
69
|
});
|
|
73
70
|
return new Promise((resolve, reject) => {
|
|
74
|
-
var _a, _b
|
|
71
|
+
var _a, _b;
|
|
75
72
|
const onError = (err) => reject(err);
|
|
76
73
|
const cleanupPageError = (0, handle_javascript_exception_1.handleJavascriptException)({
|
|
77
74
|
page,
|
|
@@ -83,11 +80,11 @@ const getCompositions = async (serveUrlOrWebpackUrl, config) => {
|
|
|
83
80
|
webpackConfigOrServeUrl: serveUrlOrWebpackUrl,
|
|
84
81
|
onDownload: () => undefined,
|
|
85
82
|
onError,
|
|
86
|
-
|
|
87
|
-
ffprobeExecutable: (_b = config === null || config === void 0 ? void 0 : config.ffprobeExecutable) !== null && _b !== void 0 ? _b : null,
|
|
88
|
-
port: (_c = config === null || config === void 0 ? void 0 : config.port) !== null && _c !== void 0 ? _c : null,
|
|
83
|
+
port: (_a = config === null || config === void 0 ? void 0 : config.port) !== null && _a !== void 0 ? _a : null,
|
|
89
84
|
downloadMap,
|
|
90
85
|
remotionRoot: (0, find_closest_package_json_1.findRemotionRoot)(),
|
|
86
|
+
concurrency: 1,
|
|
87
|
+
verbose: (_b = config === null || config === void 0 ? void 0 : config.verbose) !== null && _b !== void 0 ? _b : false,
|
|
91
88
|
})
|
|
92
89
|
.then(({ serveUrl, closeServer, offthreadPort }) => {
|
|
93
90
|
close = closeServer;
|
|
@@ -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>;
|