@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
|
@@ -26,8 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.stitchFramesToVideo =
|
|
30
|
-
const execa_1 = __importDefault(require("execa"));
|
|
29
|
+
exports.stitchFramesToVideo = void 0;
|
|
31
30
|
const fs_1 = __importStar(require("fs"));
|
|
32
31
|
const path_1 = __importDefault(require("path"));
|
|
33
32
|
const remotion_1 = require("remotion");
|
|
@@ -35,13 +34,14 @@ const calculate_asset_positions_1 = require("./assets/calculate-asset-positions"
|
|
|
35
34
|
const convert_assets_to_file_urls_1 = require("./assets/convert-assets-to-file-urls");
|
|
36
35
|
const download_and_map_assets_to_file_1 = require("./assets/download-and-map-assets-to-file");
|
|
37
36
|
const audio_codec_1 = require("./audio-codec");
|
|
37
|
+
const call_ffmpeg_1 = require("./call-ffmpeg");
|
|
38
38
|
const codec_1 = require("./codec");
|
|
39
39
|
const codec_supports_media_1 = require("./codec-supports-media");
|
|
40
|
+
const get_executable_path_1 = require("./compositor/get-executable-path");
|
|
40
41
|
const convert_number_of_gif_loops_to_ffmpeg_1 = require("./convert-number-of-gif-loops-to-ffmpeg");
|
|
41
42
|
const crf_1 = require("./crf");
|
|
42
43
|
const delete_directory_1 = require("./delete-directory");
|
|
43
44
|
const does_have_m2_bug_1 = require("./does-have-m2-bug");
|
|
44
|
-
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
45
45
|
const find_closest_package_json_1 = require("./find-closest-package-json");
|
|
46
46
|
const get_codec_name_1 = require("./get-codec-name");
|
|
47
47
|
const get_extension_from_codec_1 = require("./get-extension-from-codec");
|
|
@@ -54,13 +54,12 @@ const preprocess_audio_track_1 = require("./preprocess-audio-track");
|
|
|
54
54
|
const prores_profile_1 = require("./prores-profile");
|
|
55
55
|
const truthy_1 = require("./truthy");
|
|
56
56
|
const validate_even_dimensions_with_codec_1 = require("./validate-even-dimensions-with-codec");
|
|
57
|
-
const validate_ffmpeg_1 = require("./validate-ffmpeg");
|
|
58
57
|
const validate_videobitrate_1 = require("./validate-videobitrate");
|
|
59
58
|
const packageJsonPath = path_1.default.join(__dirname, '..', 'package.json');
|
|
60
59
|
const packageJson = fs_1.default.existsSync(packageJsonPath)
|
|
61
60
|
? JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8'))
|
|
62
61
|
: null;
|
|
63
|
-
const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose,
|
|
62
|
+
const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose, onProgress, downloadMap, remotionRoot, }) => {
|
|
64
63
|
const fileUrlAssets = await (0, convert_assets_to_file_urls_1.convertAssetsToFileUrls)({
|
|
65
64
|
assets,
|
|
66
65
|
onDownload: onDownload !== null && onDownload !== void 0 ? onDownload : (() => () => undefined),
|
|
@@ -78,14 +77,11 @@ const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose,
|
|
|
78
77
|
const preprocessed = (await Promise.all(assetPositions.map(async (asset, index) => {
|
|
79
78
|
const filterFile = path_1.default.join(downloadMap.audioMixing, `${index}.wav`);
|
|
80
79
|
const result = await (0, preprocess_audio_track_1.preprocessAudioTrack)({
|
|
81
|
-
ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
|
|
82
|
-
ffprobeExecutable: ffprobeExecutable !== null && ffprobeExecutable !== void 0 ? ffprobeExecutable : null,
|
|
83
80
|
outName: filterFile,
|
|
84
81
|
asset,
|
|
85
82
|
expectedFrames,
|
|
86
83
|
fps,
|
|
87
84
|
downloadMap,
|
|
88
|
-
remotionRoot,
|
|
89
85
|
});
|
|
90
86
|
preprocessProgress[index] = 1;
|
|
91
87
|
updateProgress();
|
|
@@ -93,7 +89,6 @@ const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose,
|
|
|
93
89
|
}))).filter(truthy_1.truthy);
|
|
94
90
|
const outName = path_1.default.join(downloadMap.audioPreprocessing, `audio.wav`);
|
|
95
91
|
await (0, merge_audio_track_1.mergeAudioTrack)({
|
|
96
|
-
ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
|
|
97
92
|
files: preprocessed,
|
|
98
93
|
outName,
|
|
99
94
|
numberOfSeconds: Number((expectedFrames / fps).toFixed(3)),
|
|
@@ -108,7 +103,7 @@ const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose,
|
|
|
108
103
|
return outName;
|
|
109
104
|
};
|
|
110
105
|
const spawnFfmpeg = async (options, remotionRoot) => {
|
|
111
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s
|
|
106
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
112
107
|
remotion_1.Internals.validateDimension(options.height, 'height', 'passed to `stitchFramesToVideo()`');
|
|
113
108
|
remotion_1.Internals.validateDimension(options.width, 'width', 'passed to `stitchFramesToVideo()`');
|
|
114
109
|
const codec = (_a = options.codec) !== null && _a !== void 0 ? _a : codec_1.DEFAULT_CODEC;
|
|
@@ -126,7 +121,6 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
126
121
|
(0, validate_videobitrate_1.validateBitrate)(options.videoBitrate, 'videoBitrate');
|
|
127
122
|
remotion_1.Internals.validateFps(options.fps, 'in `stitchFramesToVideo()`', false);
|
|
128
123
|
const pixelFormat = (_b = options.pixelFormat) !== null && _b !== void 0 ? _b : pixel_format_1.DEFAULT_PIXEL_FORMAT;
|
|
129
|
-
await (0, validate_ffmpeg_1.validateFfmpeg)((_c = options.ffmpegExecutable) !== null && _c !== void 0 ? _c : null, remotionRoot, 'ffmpeg');
|
|
130
124
|
const encoderName = (0, get_codec_name_1.getCodecName)(codec);
|
|
131
125
|
const proResProfileName = (0, get_prores_profile_name_1.getProResProfileName)(codec, options.proResProfile);
|
|
132
126
|
const mediaSupport = (0, codec_supports_media_1.codecSupportsMedia)(codec);
|
|
@@ -139,14 +133,14 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
139
133
|
throw new Error('The output format has neither audio nor video. This can happen if you are rendering an audio codec and the output file has no audio or the muted flag was passed.');
|
|
140
134
|
}
|
|
141
135
|
// Explanation: https://github.com/remotion-dev/remotion/issues/1647
|
|
142
|
-
const resolvedAudioCodec = ((
|
|
136
|
+
const resolvedAudioCodec = ((_c = options.internalOptions) === null || _c === void 0 ? void 0 : _c.preferLossless)
|
|
143
137
|
? (0, audio_codec_1.getDefaultAudioCodec)({ codec, preferLossless: true })
|
|
144
|
-
: (
|
|
138
|
+
: (_d = options.audioCodec) !== null && _d !== void 0 ? _d : (0, audio_codec_1.getDefaultAudioCodec)({ codec, preferLossless: false });
|
|
145
139
|
const tempFile = options.outputLocation
|
|
146
140
|
? null
|
|
147
141
|
: path_1.default.join(options.assetsInfo.downloadMap.stitchFrames, `out.${(0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec, resolvedAudioCodec)}`);
|
|
148
142
|
if (options.verbose) {
|
|
149
|
-
console.log('[verbose] ffmpeg', (
|
|
143
|
+
console.log('[verbose] ffmpeg', (0, get_executable_path_1.getExecutablePath)('ffmpeg'));
|
|
150
144
|
console.log('[verbose] encoder', encoderName);
|
|
151
145
|
console.log('[verbose] audioCodec', resolvedAudioCodec);
|
|
152
146
|
console.log('[verbose] pixelFormat', pixelFormat);
|
|
@@ -176,9 +170,7 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
176
170
|
onDownload: options.onDownload,
|
|
177
171
|
fps: options.fps,
|
|
178
172
|
expectedFrames,
|
|
179
|
-
verbose: (
|
|
180
|
-
ffmpegExecutable: (_h = options.ffmpegExecutable) !== null && _h !== void 0 ? _h : null,
|
|
181
|
-
ffprobeExecutable: (_j = options.ffprobeExecutable) !== null && _j !== void 0 ? _j : null,
|
|
173
|
+
verbose: (_e = options.verbose) !== null && _e !== void 0 ? _e : false,
|
|
182
174
|
onProgress: (prog) => updateProgress(prog, 0),
|
|
183
175
|
downloadMap: options.assetsInfo.downloadMap,
|
|
184
176
|
remotionRoot,
|
|
@@ -188,22 +180,22 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
188
180
|
if (!resolvedAudioCodec) {
|
|
189
181
|
throw new TypeError('exporting audio but has no audio codec name. Report this in the Remotion repo.');
|
|
190
182
|
}
|
|
191
|
-
const ffmpegTask = (0,
|
|
183
|
+
const ffmpegTask = (0, call_ffmpeg_1.callFf)('ffmpeg', [
|
|
192
184
|
'-i',
|
|
193
185
|
audio,
|
|
194
186
|
'-c:a',
|
|
195
187
|
(0, audio_codec_1.mapAudioCodecToFfmpegAudioCodecName)(resolvedAudioCodec),
|
|
196
188
|
// Set bitrate up to 320k, for aac it might effectively be lower
|
|
197
189
|
'-b:a',
|
|
198
|
-
(
|
|
190
|
+
(_f = options.audioBitrate) !== null && _f !== void 0 ? _f : '320k',
|
|
199
191
|
options.force ? '-y' : null,
|
|
200
|
-
(
|
|
192
|
+
(_g = options.outputLocation) !== null && _g !== void 0 ? _g : tempFile,
|
|
201
193
|
].filter(remotion_1.Internals.truthy));
|
|
202
|
-
(
|
|
194
|
+
(_h = options.cancelSignal) === null || _h === void 0 ? void 0 : _h.call(options, () => {
|
|
203
195
|
ffmpegTask.kill();
|
|
204
196
|
});
|
|
205
197
|
await ffmpegTask;
|
|
206
|
-
(
|
|
198
|
+
(_j = options.onProgress) === null || _j === void 0 ? void 0 : _j.call(options, expectedFrames);
|
|
207
199
|
if (audio) {
|
|
208
200
|
(0, delete_directory_1.deleteDirectory)(path_1.default.dirname(audio));
|
|
209
201
|
}
|
|
@@ -228,8 +220,8 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
228
220
|
}
|
|
229
221
|
const ffmpegArgs = [
|
|
230
222
|
['-r', String(options.fps)],
|
|
231
|
-
...(((
|
|
232
|
-
? [['-i', (
|
|
223
|
+
...(((_k = options.internalOptions) === null || _k === void 0 ? void 0 : _k.preEncodedFileLocation)
|
|
224
|
+
? [['-i', (_l = options.internalOptions) === null || _l === void 0 ? void 0 : _l.preEncodedFileLocation]]
|
|
233
225
|
: [
|
|
234
226
|
['-f', 'image2'],
|
|
235
227
|
['-s', `${options.width}x${options.height}`],
|
|
@@ -237,16 +229,16 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
237
229
|
['-i', options.assetsInfo.imageSequenceName],
|
|
238
230
|
]),
|
|
239
231
|
audio ? ['-i', audio] : null,
|
|
240
|
-
((
|
|
232
|
+
((_m = options.numberOfGifLoops) !== null && _m !== void 0 ? _m : null) === null
|
|
241
233
|
? null
|
|
242
234
|
: [
|
|
243
235
|
'-loop',
|
|
244
|
-
(0, convert_number_of_gif_loops_to_ffmpeg_1.convertNumberOfGifLoopsToFfmpegSyntax)((
|
|
236
|
+
(0, convert_number_of_gif_loops_to_ffmpeg_1.convertNumberOfGifLoopsToFfmpegSyntax)((_o = options.numberOfGifLoops) !== null && _o !== void 0 ? _o : null),
|
|
245
237
|
],
|
|
246
238
|
// -c:v is the same as -vcodec as -codec:video
|
|
247
239
|
// and specified the video codec.
|
|
248
240
|
['-c:v', encoderName],
|
|
249
|
-
...(((
|
|
241
|
+
...(((_p = options.internalOptions) === null || _p === void 0 ? void 0 : _p.preEncodedFileLocation)
|
|
250
242
|
? []
|
|
251
243
|
: [
|
|
252
244
|
proResProfileName ? ['-profile:v', proResProfileName] : null,
|
|
@@ -274,7 +266,7 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
274
266
|
[`Made with Remotion`, packageJson ? packageJson.version : null].join(' '),
|
|
275
267
|
],
|
|
276
268
|
options.force ? '-y' : null,
|
|
277
|
-
(
|
|
269
|
+
(_q = options.outputLocation) !== null && _q !== void 0 ? _q : tempFile,
|
|
278
270
|
];
|
|
279
271
|
if (options.verbose) {
|
|
280
272
|
console.log('Generated FFMPEG command:');
|
|
@@ -288,15 +280,15 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
288
280
|
console.log('Generated final FFMPEG command:');
|
|
289
281
|
console.log(finalFfmpegString);
|
|
290
282
|
}
|
|
291
|
-
const task = (0,
|
|
283
|
+
const task = (0, call_ffmpeg_1.callFf)('ffmpeg', finalFfmpegString, {
|
|
292
284
|
cwd: options.dir,
|
|
293
285
|
});
|
|
294
|
-
(
|
|
286
|
+
(_r = options.cancelSignal) === null || _r === void 0 ? void 0 : _r.call(options, () => {
|
|
295
287
|
task.kill();
|
|
296
288
|
});
|
|
297
289
|
let ffmpegOutput = '';
|
|
298
290
|
let isFinished = false;
|
|
299
|
-
(
|
|
291
|
+
(_s = task.stderr) === null || _s === void 0 ? void 0 : _s.on('data', (data) => {
|
|
300
292
|
var _a;
|
|
301
293
|
const str = data.toString();
|
|
302
294
|
ffmpegOutput += str;
|
|
@@ -339,7 +331,6 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
339
331
|
getLogs: () => ffmpegOutput,
|
|
340
332
|
};
|
|
341
333
|
};
|
|
342
|
-
exports.spawnFfmpeg = spawnFfmpeg;
|
|
343
334
|
/**
|
|
344
335
|
* @description Takes a series of images and audio information generated by renderFrames() and encodes it to a video.
|
|
345
336
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/stitch-frames-to-video)
|
|
@@ -347,7 +338,7 @@ exports.spawnFfmpeg = spawnFfmpeg;
|
|
|
347
338
|
const stitchFramesToVideo = async (options) => {
|
|
348
339
|
var _a, _b;
|
|
349
340
|
const remotionRoot = (0, find_closest_package_json_1.findRemotionRoot)();
|
|
350
|
-
const { task, getLogs } = await
|
|
341
|
+
const { task, getLogs } = await spawnFfmpeg(options, remotionRoot);
|
|
351
342
|
const happyPath = task.catch(() => {
|
|
352
343
|
throw new Error(getLogs());
|
|
353
344
|
});
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { TAsset } from 'remotion';
|
|
3
2
|
import type { DownloadMap } from './assets/download-map';
|
|
4
3
|
import type { Page } from './browser/BrowserPage';
|
|
5
|
-
import type {
|
|
6
|
-
export declare const takeFrameAndCompose: ({ freePage, imageFormat,
|
|
4
|
+
import type { StillImageFormat, VideoImageFormat } from './image-format';
|
|
5
|
+
export declare const takeFrameAndCompose: ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, downloadMap, wantsBuffer, }: {
|
|
7
6
|
freePage: Page;
|
|
8
|
-
imageFormat:
|
|
9
|
-
|
|
7
|
+
imageFormat: VideoImageFormat | StillImageFormat;
|
|
8
|
+
jpegQuality: number | undefined;
|
|
10
9
|
frame: number;
|
|
11
10
|
height: number;
|
|
12
11
|
width: number;
|
|
@@ -10,7 +10,7 @@ const compose_1 = require("./compositor/compose");
|
|
|
10
10
|
const provide_screenshot_1 = require("./provide-screenshot");
|
|
11
11
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
12
12
|
const truthy_1 = require("./truthy");
|
|
13
|
-
const takeFrameAndCompose = async ({ freePage, imageFormat,
|
|
13
|
+
const takeFrameAndCompose = async ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, downloadMap, wantsBuffer, }) => {
|
|
14
14
|
var _a;
|
|
15
15
|
const [clipRegion, collectedAssets] = await Promise.all([
|
|
16
16
|
(0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
@@ -40,7 +40,7 @@ const takeFrameAndCompose = async ({ freePage, imageFormat, quality, frame, widt
|
|
|
40
40
|
? null
|
|
41
41
|
: {
|
|
42
42
|
tmpFile: path_1.default.join(downloadMap.compositingDir, `${frame}.${imageFormat}`),
|
|
43
|
-
|
|
43
|
+
finalOutFile: output !== null && output !== void 0 ? output : path_1.default.join(downloadMap.compositingDir, `${frame}-final.${imageFormat}`),
|
|
44
44
|
clipRegion: clipRegion,
|
|
45
45
|
};
|
|
46
46
|
if (clipRegion !== 'hide') {
|
|
@@ -48,7 +48,7 @@ const takeFrameAndCompose = async ({ freePage, imageFormat, quality, frame, widt
|
|
|
48
48
|
const buf = await (0, provide_screenshot_1.provideScreenshot)({
|
|
49
49
|
page: freePage,
|
|
50
50
|
imageFormat,
|
|
51
|
-
|
|
51
|
+
jpegQuality,
|
|
52
52
|
options: {
|
|
53
53
|
frame,
|
|
54
54
|
output: shouldMakeBuffer ? null : (_a = needsComposing === null || needsComposing === void 0 ? void 0 : needsComposing.tmpFile) !== null && _a !== void 0 ? _a : output,
|
|
@@ -62,6 +62,12 @@ const takeFrameAndCompose = async ({ freePage, imageFormat, quality, frame, widt
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
if (needsComposing) {
|
|
65
|
+
if (imageFormat === 'pdf') {
|
|
66
|
+
throw new Error("You cannot use compositor APIs (like <Clipper>) if `imageFormat` is 'pdf'.");
|
|
67
|
+
}
|
|
68
|
+
if (imageFormat === 'webp') {
|
|
69
|
+
throw new Error("You cannot use compositor APIs (like <Clipper>) if `imageFormat` is 'webp'.");
|
|
70
|
+
}
|
|
65
71
|
await (0, compose_1.compose)({
|
|
66
72
|
height: height * scale,
|
|
67
73
|
width: width * scale,
|
|
@@ -81,13 +87,13 @@ const takeFrameAndCompose = async ({ freePage, imageFormat, quality, frame, widt
|
|
|
81
87
|
},
|
|
82
88
|
},
|
|
83
89
|
].filter(truthy_1.truthy),
|
|
84
|
-
output: needsComposing.
|
|
90
|
+
output: needsComposing.finalOutFile,
|
|
85
91
|
downloadMap,
|
|
86
92
|
imageFormat: imageFormat === 'jpeg' ? 'Jpeg' : 'Png',
|
|
87
93
|
});
|
|
88
94
|
if (wantsBuffer) {
|
|
89
|
-
const buffer = await fs_1.default.promises.readFile(needsComposing.
|
|
90
|
-
await fs_1.default.promises.unlink(needsComposing.
|
|
95
|
+
const buffer = await fs_1.default.promises.readFile(needsComposing.finalOutFile);
|
|
96
|
+
await fs_1.default.promises.unlink(needsComposing.finalOutFile);
|
|
91
97
|
return { buffer, collectedAssets };
|
|
92
98
|
}
|
|
93
99
|
}
|
package/dist/tmp-dir.js
CHANGED
|
@@ -40,10 +40,9 @@ const randomHash = () => {
|
|
|
40
40
|
.join('');
|
|
41
41
|
};
|
|
42
42
|
const tmpDir = (str) => {
|
|
43
|
-
var _a;
|
|
44
43
|
const newDir = path_1.default.join(os_1.default.tmpdir(), str + randomHash());
|
|
45
44
|
if (fs_1.default.existsSync(newDir)) {
|
|
46
|
-
|
|
45
|
+
fs_1.default.rmSync(newDir, {
|
|
47
46
|
recursive: true,
|
|
48
47
|
force: true,
|
|
49
48
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateConcurrency = void 0;
|
|
3
|
+
exports.getMinConcurrency = exports.getMaxConcurrency = exports.validateConcurrency = void 0;
|
|
4
4
|
const validateConcurrency = (value, setting) => {
|
|
5
5
|
if (typeof value === 'undefined') {
|
|
6
6
|
return;
|
|
@@ -15,11 +15,11 @@ const validateConcurrency = (value, setting) => {
|
|
|
15
15
|
if (value % 1 !== 0) {
|
|
16
16
|
throw new Error(setting + ' must be an integer, but is ' + value);
|
|
17
17
|
}
|
|
18
|
-
if (value <
|
|
19
|
-
throw new Error(setting
|
|
18
|
+
if (value < (0, exports.getMinConcurrency)()) {
|
|
19
|
+
throw new Error(`${setting} must be at least ${(0, exports.getMinConcurrency)()}, but is ${JSON.stringify(value)}`);
|
|
20
20
|
}
|
|
21
|
-
if (value >
|
|
22
|
-
throw new Error(`${setting} is set higher than the amount of CPU cores available. Available CPU cores: ${
|
|
21
|
+
if (value > (0, exports.getMaxConcurrency)()) {
|
|
22
|
+
throw new Error(`${setting} is set higher than the amount of CPU cores available. Available CPU cores: ${(0, exports.getMaxConcurrency)()}, value set: ${value}`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
else if (!/^\d+(\.\d+)?%$/.test(value)) {
|
|
@@ -27,3 +27,9 @@ const validateConcurrency = (value, setting) => {
|
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
29
|
exports.validateConcurrency = validateConcurrency;
|
|
30
|
+
const getMaxConcurrency = () => {
|
|
31
|
+
return require('os').cpus().length;
|
|
32
|
+
};
|
|
33
|
+
exports.getMaxConcurrency = getMaxConcurrency;
|
|
34
|
+
const getMinConcurrency = () => 1;
|
|
35
|
+
exports.getMinConcurrency = getMinConcurrency;
|
|
@@ -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;
|
|
@@ -8,6 +8,7 @@ const validatePuppeteerTimeout = (timeoutInMilliseconds) => {
|
|
|
8
8
|
if (typeof timeoutInMilliseconds !== 'number') {
|
|
9
9
|
throw new TypeError(`'timeoutInMilliseconds' should be a number, but is: ${JSON.stringify(timeoutInMilliseconds)}`);
|
|
10
10
|
}
|
|
11
|
+
// Value also appears in packages/cli/src/editor/components/RenderModal/RenderModalAdvanced.tsx
|
|
11
12
|
if (timeoutInMilliseconds < 7000 && process.env.NODE_ENV !== 'test') {
|
|
12
13
|
throw new TypeError(`'timeoutInMilliseconds' should be bigger or equal than 7000, but is ${timeoutInMilliseconds}`);
|
|
13
14
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {execSync} from 'child_process';
|
|
2
|
+
import {existsSync, mkdirSync, unlinkSync} from 'fs';
|
|
3
|
+
import {toolchains} from './toolchains.mjs';
|
|
4
|
+
|
|
5
|
+
const unpatched = [
|
|
6
|
+
'x86_64-apple-darwin',
|
|
7
|
+
'aarch64-apple-darwin',
|
|
8
|
+
'x86_64-pc-windows-gnu',
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
for (const toolchain of toolchains) {
|
|
12
|
+
process.stdout.write(toolchain + '...');
|
|
13
|
+
|
|
14
|
+
execSync(
|
|
15
|
+
`curl https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/${toolchain}.zip -o ${toolchain}.zip`
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
if (!existsSync('toolchains')) {
|
|
19
|
+
mkdirSync('toolchains');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!existsSync('toolchains/' + toolchain)) {
|
|
23
|
+
mkdirSync('toolchains/' + toolchain);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
execSync(`tar -xzf ../../${toolchain}.zip`, {
|
|
27
|
+
cwd: `toolchains/${toolchain}`,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
unlinkSync(`${toolchain}.zip`);
|
|
31
|
+
process.stdout.write('Done.\n');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
for (const target of unpatched) {
|
|
35
|
+
execSync(`rustup target add ${target}`);
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/renderer",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-alpha5",
|
|
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": "4.0.0-
|
|
19
|
+
"remotion": "4.0.0-alpha5",
|
|
20
20
|
"source-map": "^0.8.0-beta.0",
|
|
21
21
|
"ws": "8.7.0"
|
|
22
22
|
},
|
|
@@ -38,16 +38,17 @@
|
|
|
38
38
|
"react": "18.0.0",
|
|
39
39
|
"react-dom": "18.0.0",
|
|
40
40
|
"typescript": "^4.7.0",
|
|
41
|
-
"vitest": "0.24.3"
|
|
41
|
+
"vitest": "0.24.3",
|
|
42
|
+
"zod": "^3.21.4"
|
|
42
43
|
},
|
|
43
44
|
"optionalDependencies": {
|
|
44
|
-
"@remotion/compositor-darwin-arm64": "4.0.0-
|
|
45
|
-
"@remotion/compositor-darwin-x64": "4.0.0-
|
|
46
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.0-
|
|
47
|
-
"@remotion/compositor-linux-arm64-musl": "4.0.0-
|
|
48
|
-
"@remotion/compositor-linux-x64-gnu": "4.0.0-
|
|
49
|
-
"@remotion/compositor-linux-x64-musl": "4.0.0-
|
|
50
|
-
"@remotion/compositor-win32-x64-msvc": "4.0.0-
|
|
45
|
+
"@remotion/compositor-darwin-arm64": "4.0.0-alpha5",
|
|
46
|
+
"@remotion/compositor-darwin-x64": "4.0.0-alpha5",
|
|
47
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.0-alpha5",
|
|
48
|
+
"@remotion/compositor-linux-arm64-musl": "4.0.0-alpha5",
|
|
49
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.0-alpha5",
|
|
50
|
+
"@remotion/compositor-linux-x64-musl": "4.0.0-alpha5",
|
|
51
|
+
"@remotion/compositor-win32-x64-msvc": "4.0.0-alpha5"
|
|
51
52
|
},
|
|
52
53
|
"keywords": [
|
|
53
54
|
"remotion",
|