@remotion/renderer 4.0.0-alpha.217 → 4.0.0-alpha4
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 +18 -12
- package/dist/assets/get-audio-channels.d.ts +2 -1
- package/dist/assets/get-audio-channels.js +9 -5
- package/dist/assets/get-video-stream-duration.d.ts +5 -2
- package/dist/assets/get-video-stream-duration.js +12 -6
- package/dist/audio-codec.d.ts +3 -4
- package/dist/audio-codec.js +9 -3
- package/dist/browser/BrowserFetcher.d.ts +16 -63
- package/dist/browser/BrowserFetcher.js +126 -213
- package/dist/browser/BrowserRunner.js +2 -8
- package/dist/browser/FrameManager.js +3 -2
- package/dist/browser/LaunchOptions.d.ts +0 -1
- package/dist/browser/Launcher.js +3 -9
- package/dist/browser/PuppeteerNode.d.ts +0 -3
- package/dist/browser/PuppeteerNode.js +0 -5
- package/dist/browser/create-browser-fetcher.js +34 -48
- package/dist/browser/devtools-commands.d.ts +1 -5
- package/dist/browser/devtools-types.d.ts +0 -78
- package/dist/check-apple-silicon.js +45 -2
- package/dist/client.d.ts +5 -29
- package/dist/client.js +1 -26
- package/dist/codec-supports-media.d.ts +1 -1
- package/dist/codec-supports-media.js +1 -1
- package/dist/combine-videos.d.ts +3 -0
- package/dist/combine-videos.js +9 -5
- package/dist/compositor/compose.js +2 -3
- package/dist/compositor/get-executable-path.d.ts +1 -1
- package/dist/compositor/get-executable-path.js +8 -15
- package/dist/create-ffmpeg-complex-filter.d.ts +4 -1
- package/dist/create-ffmpeg-complex-filter.js +4 -2
- package/dist/create-ffmpeg-merge-filter.d.ts +5 -2
- package/dist/create-ffmpeg-merge-filter.js +10 -2
- package/dist/create-silent-audio.d.ts +4 -1
- package/dist/create-silent-audio.js +7 -3
- package/dist/delete-directory.js +16 -16
- package/dist/ensure-presentation-timestamp.d.ts +9 -2
- package/dist/ensure-presentation-timestamp.js +13 -5
- package/dist/extract-frame-from-video.d.ts +3 -0
- package/dist/extract-frame-from-video.js +29 -7
- package/dist/file-extensions.d.ts +12 -1
- package/dist/file-extensions.js +13 -1
- package/dist/get-can-extract-frames-fast.d.ts +4 -1
- package/dist/get-can-extract-frames-fast.js +12 -1
- package/dist/get-compositions.d.ts +5 -2
- package/dist/get-compositions.js +11 -6
- package/dist/get-frame-of-video-slow.d.ts +4 -1
- package/dist/get-frame-of-video-slow.js +11 -3
- package/dist/get-frame-padded-index.d.ts +1 -2
- package/dist/get-local-browser-executable.js +3 -12
- package/dist/get-video-info.d.ts +5 -2
- package/dist/get-video-info.js +12 -6
- package/dist/guess-extension-for-media.d.ts +3 -1
- package/dist/guess-extension-for-media.js +8 -4
- package/dist/image-format.d.ts +6 -12
- package/dist/image-format.js +13 -16
- package/dist/index.d.ts +25 -36
- package/dist/index.js +15 -17
- package/dist/last-frame-from-video-cache.d.ts +4 -0
- package/dist/last-frame-from-video-cache.js +1 -0
- package/dist/merge-audio-track.d.ts +2 -0
- package/dist/merge-audio-track.js +10 -3
- package/dist/offthread-video-server.d.ts +4 -1
- package/dist/offthread-video-server.js +3 -1
- package/dist/open-browser.d.ts +0 -1
- package/dist/open-browser.js +6 -7
- package/dist/perf.d.ts +1 -1
- package/dist/perf.js +7 -9
- package/dist/prepare-server.d.ts +4 -1
- package/dist/prepare-server.js +5 -1
- package/dist/preprocess-audio-track.d.ts +4 -0
- package/dist/preprocess-audio-track.js +8 -4
- package/dist/prespawn-ffmpeg.d.ts +9 -6
- package/dist/prespawn-ffmpeg.js +12 -7
- package/dist/prestitcher-memory-usage.d.ts +4 -0
- package/dist/prestitcher-memory-usage.js +3 -2
- package/dist/prores-profile.d.ts +2 -1
- package/dist/prores-profile.js +4 -4
- package/dist/provide-screenshot.d.ts +4 -4
- package/dist/provide-screenshot.js +2 -2
- package/dist/puppeteer-screenshot.d.ts +2 -3
- package/dist/puppeteer-screenshot.js +32 -9
- package/dist/render-frames.d.ts +25 -12
- package/dist/render-frames.js +40 -27
- package/dist/render-media.d.ts +18 -16
- package/dist/render-media.js +43 -31
- package/dist/render-still.d.ts +8 -9
- package/dist/render-still.js +13 -12
- package/dist/screenshot-dom-element.d.ts +4 -4
- package/dist/screenshot-dom-element.js +3 -6
- package/dist/screenshot-task.d.ts +2 -2
- package/dist/screenshot-task.js +23 -38
- package/dist/serve-handler/index.js +4 -6
- package/dist/serve-static.d.ts +3 -0
- package/dist/serve-static.js +3 -3
- package/dist/stitch-frames-to-video.d.ts +11 -2
- package/dist/stitch-frames-to-video.js +33 -24
- package/dist/take-frame-and-compose.d.ts +4 -4
- package/dist/take-frame-and-compose.js +6 -12
- package/dist/tmp-dir.js +2 -1
- package/dist/try-to-extract-frame-of-video-fast.d.ts +4 -1
- package/dist/try-to-extract-frame-of-video-fast.js +7 -3
- package/dist/validate-concurrency.d.ts +0 -2
- package/dist/validate-concurrency.js +5 -11
- package/dist/validate-puppeteer-timeout.js +0 -1
- package/package.json +68 -71
- package/dist/browser/is-target-closed-err.d.ts +0 -1
- package/dist/browser/is-target-closed-err.js +0 -9
- package/dist/call-ffmpeg.d.ts +0 -17
- package/dist/call-ffmpeg.js +0 -34
- package/dist/compositor/compositor.d.ts +0 -15
- package/dist/compositor/compositor.js +0 -193
- package/dist/compositor/make-nonce.d.ts +0 -1
- package/dist/compositor/make-nonce.js +0 -8
- package/dist/jpeg-quality.d.ts +0 -1
- package/dist/jpeg-quality.js +0 -21
- package/dist/options/audio-bitrate.d.ts +0 -2
- package/dist/options/audio-bitrate.js +0 -11
- package/dist/options/crf.d.ts +0 -2
- package/dist/options/crf.js +0 -11
- package/dist/options/enforce-audio.d.ts +0 -2
- package/dist/options/enforce-audio.js +0 -11
- package/dist/options/jpeg-quality.d.ts +0 -2
- package/dist/options/jpeg-quality.js +0 -11
- package/dist/options/mute.d.ts +0 -2
- package/dist/options/mute.js +0 -11
- package/dist/options/option.d.ts +0 -8
- package/dist/options/option.js +0 -2
- package/dist/options/scale.d.ts +0 -2
- package/dist/options/scale.js +0 -11
- package/dist/options/video-bitrate.d.ts +0 -2
- package/dist/options/video-bitrate.js +0 -11
- package/dist/options/video-codec.d.ts +0 -2
- package/dist/options/video-codec.js +0 -11
- package/ffmpeg/SOURCE.md +0 -1
- package/ffmpeg/linux-arm-musl.gz +0 -0
- package/ffmpeg/linux-arm.gz +0 -0
- package/ffmpeg/linux-x64-musl.gz +0 -0
- package/ffmpeg/linux-x64.gz +0 -0
- package/ffmpeg/macos-arm.gz +0 -0
- package/ffmpeg/macos-x64.gz +0 -0
- package/ffmpeg/windows.gz +0 -0
- package/install-toolchain.mjs +0 -42
|
@@ -26,7 +26,8 @@ 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 = void 0;
|
|
29
|
+
exports.stitchFramesToVideo = exports.spawnFfmpeg = void 0;
|
|
30
|
+
const execa_1 = __importDefault(require("execa"));
|
|
30
31
|
const fs_1 = __importStar(require("fs"));
|
|
31
32
|
const path_1 = __importDefault(require("path"));
|
|
32
33
|
const remotion_1 = require("remotion");
|
|
@@ -34,14 +35,13 @@ const calculate_asset_positions_1 = require("./assets/calculate-asset-positions"
|
|
|
34
35
|
const convert_assets_to_file_urls_1 = require("./assets/convert-assets-to-file-urls");
|
|
35
36
|
const download_and_map_assets_to_file_1 = require("./assets/download-and-map-assets-to-file");
|
|
36
37
|
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");
|
|
41
40
|
const convert_number_of_gif_loops_to_ffmpeg_1 = require("./convert-number-of-gif-loops-to-ffmpeg");
|
|
42
41
|
const crf_1 = require("./crf");
|
|
43
42
|
const delete_directory_1 = require("./delete-directory");
|
|
44
43
|
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,12 +54,13 @@ 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");
|
|
57
58
|
const validate_videobitrate_1 = require("./validate-videobitrate");
|
|
58
59
|
const packageJsonPath = path_1.default.join(__dirname, '..', 'package.json');
|
|
59
60
|
const packageJson = fs_1.default.existsSync(packageJsonPath)
|
|
60
61
|
? JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8'))
|
|
61
62
|
: null;
|
|
62
|
-
const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose, onProgress, downloadMap, remotionRoot, }) => {
|
|
63
|
+
const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose, ffmpegExecutable, ffprobeExecutable, onProgress, downloadMap, remotionRoot, }) => {
|
|
63
64
|
const fileUrlAssets = await (0, convert_assets_to_file_urls_1.convertAssetsToFileUrls)({
|
|
64
65
|
assets,
|
|
65
66
|
onDownload: onDownload !== null && onDownload !== void 0 ? onDownload : (() => () => undefined),
|
|
@@ -77,11 +78,14 @@ const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose,
|
|
|
77
78
|
const preprocessed = (await Promise.all(assetPositions.map(async (asset, index) => {
|
|
78
79
|
const filterFile = path_1.default.join(downloadMap.audioMixing, `${index}.wav`);
|
|
79
80
|
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,
|
|
80
83
|
outName: filterFile,
|
|
81
84
|
asset,
|
|
82
85
|
expectedFrames,
|
|
83
86
|
fps,
|
|
84
87
|
downloadMap,
|
|
88
|
+
remotionRoot,
|
|
85
89
|
});
|
|
86
90
|
preprocessProgress[index] = 1;
|
|
87
91
|
updateProgress();
|
|
@@ -89,6 +93,7 @@ const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose,
|
|
|
89
93
|
}))).filter(truthy_1.truthy);
|
|
90
94
|
const outName = path_1.default.join(downloadMap.audioPreprocessing, `audio.wav`);
|
|
91
95
|
await (0, merge_audio_track_1.mergeAudioTrack)({
|
|
96
|
+
ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
|
|
92
97
|
files: preprocessed,
|
|
93
98
|
outName,
|
|
94
99
|
numberOfSeconds: Number((expectedFrames / fps).toFixed(3)),
|
|
@@ -103,7 +108,7 @@ const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose,
|
|
|
103
108
|
return outName;
|
|
104
109
|
};
|
|
105
110
|
const spawnFfmpeg = async (options, remotionRoot) => {
|
|
106
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
111
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
107
112
|
remotion_1.Internals.validateDimension(options.height, 'height', 'passed to `stitchFramesToVideo()`');
|
|
108
113
|
remotion_1.Internals.validateDimension(options.width, 'width', 'passed to `stitchFramesToVideo()`');
|
|
109
114
|
const codec = (_a = options.codec) !== null && _a !== void 0 ? _a : codec_1.DEFAULT_CODEC;
|
|
@@ -121,6 +126,7 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
121
126
|
(0, validate_videobitrate_1.validateBitrate)(options.videoBitrate, 'videoBitrate');
|
|
122
127
|
remotion_1.Internals.validateFps(options.fps, 'in `stitchFramesToVideo()`', false);
|
|
123
128
|
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');
|
|
124
130
|
const encoderName = (0, get_codec_name_1.getCodecName)(codec);
|
|
125
131
|
const proResProfileName = (0, get_prores_profile_name_1.getProResProfileName)(codec, options.proResProfile);
|
|
126
132
|
const mediaSupport = (0, codec_supports_media_1.codecSupportsMedia)(codec);
|
|
@@ -133,14 +139,14 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
133
139
|
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.');
|
|
134
140
|
}
|
|
135
141
|
// Explanation: https://github.com/remotion-dev/remotion/issues/1647
|
|
136
|
-
const resolvedAudioCodec = ((
|
|
142
|
+
const resolvedAudioCodec = ((_d = options.internalOptions) === null || _d === void 0 ? void 0 : _d.preferLossless)
|
|
137
143
|
? (0, audio_codec_1.getDefaultAudioCodec)({ codec, preferLossless: true })
|
|
138
|
-
: (
|
|
144
|
+
: (_e = options.audioCodec) !== null && _e !== void 0 ? _e : (0, audio_codec_1.getDefaultAudioCodec)({ codec, preferLossless: false });
|
|
139
145
|
const tempFile = options.outputLocation
|
|
140
146
|
? null
|
|
141
147
|
: path_1.default.join(options.assetsInfo.downloadMap.stitchFrames, `out.${(0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec, resolvedAudioCodec)}`);
|
|
142
148
|
if (options.verbose) {
|
|
143
|
-
console.log('[verbose] ffmpeg', (
|
|
149
|
+
console.log('[verbose] ffmpeg', (_f = options.ffmpegExecutable) !== null && _f !== void 0 ? _f : 'ffmpeg in PATH');
|
|
144
150
|
console.log('[verbose] encoder', encoderName);
|
|
145
151
|
console.log('[verbose] audioCodec', resolvedAudioCodec);
|
|
146
152
|
console.log('[verbose] pixelFormat', pixelFormat);
|
|
@@ -170,7 +176,9 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
170
176
|
onDownload: options.onDownload,
|
|
171
177
|
fps: options.fps,
|
|
172
178
|
expectedFrames,
|
|
173
|
-
verbose: (
|
|
179
|
+
verbose: (_g = options.verbose) !== null && _g !== void 0 ? _g : false,
|
|
180
|
+
ffmpegExecutable: (_h = options.ffmpegExecutable) !== null && _h !== void 0 ? _h : null,
|
|
181
|
+
ffprobeExecutable: (_j = options.ffprobeExecutable) !== null && _j !== void 0 ? _j : null,
|
|
174
182
|
onProgress: (prog) => updateProgress(prog, 0),
|
|
175
183
|
downloadMap: options.assetsInfo.downloadMap,
|
|
176
184
|
remotionRoot,
|
|
@@ -180,22 +188,22 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
180
188
|
if (!resolvedAudioCodec) {
|
|
181
189
|
throw new TypeError('exporting audio but has no audio codec name. Report this in the Remotion repo.');
|
|
182
190
|
}
|
|
183
|
-
const ffmpegTask = (0,
|
|
191
|
+
const ffmpegTask = (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)((_k = options.ffmpegExecutable) !== null && _k !== void 0 ? _k : null, remotionRoot, 'ffmpeg'), [
|
|
184
192
|
'-i',
|
|
185
193
|
audio,
|
|
186
194
|
'-c:a',
|
|
187
195
|
(0, audio_codec_1.mapAudioCodecToFfmpegAudioCodecName)(resolvedAudioCodec),
|
|
188
196
|
// Set bitrate up to 320k, for aac it might effectively be lower
|
|
189
197
|
'-b:a',
|
|
190
|
-
(
|
|
198
|
+
(_l = options.audioBitrate) !== null && _l !== void 0 ? _l : '320k',
|
|
191
199
|
options.force ? '-y' : null,
|
|
192
|
-
(
|
|
200
|
+
(_m = options.outputLocation) !== null && _m !== void 0 ? _m : tempFile,
|
|
193
201
|
].filter(remotion_1.Internals.truthy));
|
|
194
|
-
(
|
|
202
|
+
(_o = options.cancelSignal) === null || _o === void 0 ? void 0 : _o.call(options, () => {
|
|
195
203
|
ffmpegTask.kill();
|
|
196
204
|
});
|
|
197
205
|
await ffmpegTask;
|
|
198
|
-
(
|
|
206
|
+
(_p = options.onProgress) === null || _p === void 0 ? void 0 : _p.call(options, expectedFrames);
|
|
199
207
|
if (audio) {
|
|
200
208
|
(0, delete_directory_1.deleteDirectory)(path_1.default.dirname(audio));
|
|
201
209
|
}
|
|
@@ -220,8 +228,8 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
220
228
|
}
|
|
221
229
|
const ffmpegArgs = [
|
|
222
230
|
['-r', String(options.fps)],
|
|
223
|
-
...(((
|
|
224
|
-
? [['-i', (
|
|
231
|
+
...(((_q = options.internalOptions) === null || _q === void 0 ? void 0 : _q.preEncodedFileLocation)
|
|
232
|
+
? [['-i', (_r = options.internalOptions) === null || _r === void 0 ? void 0 : _r.preEncodedFileLocation]]
|
|
225
233
|
: [
|
|
226
234
|
['-f', 'image2'],
|
|
227
235
|
['-s', `${options.width}x${options.height}`],
|
|
@@ -229,16 +237,16 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
229
237
|
['-i', options.assetsInfo.imageSequenceName],
|
|
230
238
|
]),
|
|
231
239
|
audio ? ['-i', audio] : null,
|
|
232
|
-
((
|
|
240
|
+
((_s = options.numberOfGifLoops) !== null && _s !== void 0 ? _s : null) === null
|
|
233
241
|
? null
|
|
234
242
|
: [
|
|
235
243
|
'-loop',
|
|
236
|
-
(0, convert_number_of_gif_loops_to_ffmpeg_1.convertNumberOfGifLoopsToFfmpegSyntax)((
|
|
244
|
+
(0, convert_number_of_gif_loops_to_ffmpeg_1.convertNumberOfGifLoopsToFfmpegSyntax)((_t = options.numberOfGifLoops) !== null && _t !== void 0 ? _t : null),
|
|
237
245
|
],
|
|
238
246
|
// -c:v is the same as -vcodec as -codec:video
|
|
239
247
|
// and specified the video codec.
|
|
240
248
|
['-c:v', encoderName],
|
|
241
|
-
...(((
|
|
249
|
+
...(((_u = options.internalOptions) === null || _u === void 0 ? void 0 : _u.preEncodedFileLocation)
|
|
242
250
|
? []
|
|
243
251
|
: [
|
|
244
252
|
proResProfileName ? ['-profile:v', proResProfileName] : null,
|
|
@@ -266,7 +274,7 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
266
274
|
[`Made with Remotion`, packageJson ? packageJson.version : null].join(' '),
|
|
267
275
|
],
|
|
268
276
|
options.force ? '-y' : null,
|
|
269
|
-
(
|
|
277
|
+
(_v = options.outputLocation) !== null && _v !== void 0 ? _v : tempFile,
|
|
270
278
|
];
|
|
271
279
|
if (options.verbose) {
|
|
272
280
|
console.log('Generated FFMPEG command:');
|
|
@@ -280,15 +288,15 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
280
288
|
console.log('Generated final FFMPEG command:');
|
|
281
289
|
console.log(finalFfmpegString);
|
|
282
290
|
}
|
|
283
|
-
const task = (0,
|
|
291
|
+
const task = (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)((_w = options.ffmpegExecutable) !== null && _w !== void 0 ? _w : null, remotionRoot, 'ffmpeg'), finalFfmpegString, {
|
|
284
292
|
cwd: options.dir,
|
|
285
293
|
});
|
|
286
|
-
(
|
|
294
|
+
(_x = options.cancelSignal) === null || _x === void 0 ? void 0 : _x.call(options, () => {
|
|
287
295
|
task.kill();
|
|
288
296
|
});
|
|
289
297
|
let ffmpegOutput = '';
|
|
290
298
|
let isFinished = false;
|
|
291
|
-
(
|
|
299
|
+
(_y = task.stderr) === null || _y === void 0 ? void 0 : _y.on('data', (data) => {
|
|
292
300
|
var _a;
|
|
293
301
|
const str = data.toString();
|
|
294
302
|
ffmpegOutput += str;
|
|
@@ -331,6 +339,7 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
331
339
|
getLogs: () => ffmpegOutput,
|
|
332
340
|
};
|
|
333
341
|
};
|
|
342
|
+
exports.spawnFfmpeg = spawnFfmpeg;
|
|
334
343
|
/**
|
|
335
344
|
* @description Takes a series of images and audio information generated by renderFrames() and encodes it to a video.
|
|
336
345
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/stitch-frames-to-video)
|
|
@@ -338,7 +347,7 @@ const spawnFfmpeg = async (options, remotionRoot) => {
|
|
|
338
347
|
const stitchFramesToVideo = async (options) => {
|
|
339
348
|
var _a, _b;
|
|
340
349
|
const remotionRoot = (0, find_closest_package_json_1.findRemotionRoot)();
|
|
341
|
-
const { task, getLogs } = await spawnFfmpeg(options, remotionRoot);
|
|
350
|
+
const { task, getLogs } = await (0, exports.spawnFfmpeg)(options, remotionRoot);
|
|
342
351
|
const happyPath = task.catch(() => {
|
|
343
352
|
throw new Error(getLogs());
|
|
344
353
|
});
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import type { TAsset } from 'remotion';
|
|
3
3
|
import type { DownloadMap } from './assets/download-map';
|
|
4
4
|
import type { Page } from './browser/BrowserPage';
|
|
5
|
-
import type {
|
|
6
|
-
export declare const takeFrameAndCompose: ({ freePage, imageFormat,
|
|
5
|
+
import type { ImageFormat } from './image-format';
|
|
6
|
+
export declare const takeFrameAndCompose: ({ freePage, imageFormat, quality, frame, width, height, output, scale, downloadMap, wantsBuffer, }: {
|
|
7
7
|
freePage: Page;
|
|
8
|
-
imageFormat:
|
|
9
|
-
|
|
8
|
+
imageFormat: ImageFormat;
|
|
9
|
+
quality: number | undefined;
|
|
10
10
|
frame: number;
|
|
11
11
|
height: number;
|
|
12
12
|
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, quality, 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, jpegQuality, frame,
|
|
|
40
40
|
? null
|
|
41
41
|
: {
|
|
42
42
|
tmpFile: path_1.default.join(downloadMap.compositingDir, `${frame}.${imageFormat}`),
|
|
43
|
-
|
|
43
|
+
finalOutfie: 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, jpegQuality, frame,
|
|
|
48
48
|
const buf = await (0, provide_screenshot_1.provideScreenshot)({
|
|
49
49
|
page: freePage,
|
|
50
50
|
imageFormat,
|
|
51
|
-
|
|
51
|
+
quality,
|
|
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,12 +62,6 @@ const takeFrameAndCompose = async ({ freePage, imageFormat, jpegQuality, frame,
|
|
|
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
|
-
}
|
|
71
65
|
await (0, compose_1.compose)({
|
|
72
66
|
height: height * scale,
|
|
73
67
|
width: width * scale,
|
|
@@ -87,13 +81,13 @@ const takeFrameAndCompose = async ({ freePage, imageFormat, jpegQuality, frame,
|
|
|
87
81
|
},
|
|
88
82
|
},
|
|
89
83
|
].filter(truthy_1.truthy),
|
|
90
|
-
output: needsComposing.
|
|
84
|
+
output: needsComposing.finalOutfie,
|
|
91
85
|
downloadMap,
|
|
92
86
|
imageFormat: imageFormat === 'jpeg' ? 'Jpeg' : 'Png',
|
|
93
87
|
});
|
|
94
88
|
if (wantsBuffer) {
|
|
95
|
-
const buffer = await fs_1.default.promises.readFile(needsComposing.
|
|
96
|
-
await fs_1.default.promises.unlink(needsComposing.
|
|
89
|
+
const buffer = await fs_1.default.promises.readFile(needsComposing.finalOutfie);
|
|
90
|
+
await fs_1.default.promises.unlink(needsComposing.finalOutfie);
|
|
97
91
|
return { buffer, collectedAssets };
|
|
98
92
|
}
|
|
99
93
|
}
|
package/dist/tmp-dir.js
CHANGED
|
@@ -40,9 +40,10 @@ const randomHash = () => {
|
|
|
40
40
|
.join('');
|
|
41
41
|
};
|
|
42
42
|
const tmpDir = (str) => {
|
|
43
|
+
var _a;
|
|
43
44
|
const newDir = path_1.default.join(os_1.default.tmpdir(), str + randomHash());
|
|
44
45
|
if (fs_1.default.existsSync(newDir)) {
|
|
45
|
-
fs_1.default.rmSync(newDir, {
|
|
46
|
+
((_a = fs_1.default.rmSync) !== null && _a !== void 0 ? _a : fs_1.default.rmdirSync)(newDir, {
|
|
46
47
|
recursive: true,
|
|
47
48
|
force: true,
|
|
48
49
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { OffthreadVideoImageFormat } from 'remotion';
|
|
3
3
|
import type { NeedsResize, SpecialVCodecForTransparency } from './assets/download-map';
|
|
4
|
-
|
|
4
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
5
|
+
export declare const tryToExtractFrameOfVideoFast: ({ ffmpegExecutable, remotionRoot, specialVCodecForTransparency, imageFormat, needsResize, src, actualOffset, }: {
|
|
6
|
+
ffmpegExecutable: FfmpegExecutable;
|
|
7
|
+
remotionRoot: string;
|
|
5
8
|
imageFormat: OffthreadVideoImageFormat;
|
|
6
9
|
needsResize: NeedsResize;
|
|
7
10
|
src: string;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.tryToExtractFrameOfVideoFast = void 0;
|
|
4
|
-
const
|
|
7
|
+
const execa_1 = __importDefault(require("execa"));
|
|
5
8
|
const determine_resize_params_1 = require("./determine-resize-params");
|
|
6
9
|
const determine_vcodec_ffmpeg_flags_1 = require("./determine-vcodec-ffmpeg-flags");
|
|
10
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
7
11
|
const truthy_1 = require("./truthy");
|
|
8
|
-
const tryToExtractFrameOfVideoFast = async ({ specialVCodecForTransparency, imageFormat, needsResize, src, actualOffset, }) => {
|
|
9
|
-
const { stdout, stderr } = (0,
|
|
12
|
+
const tryToExtractFrameOfVideoFast = async ({ ffmpegExecutable, remotionRoot, specialVCodecForTransparency, imageFormat, needsResize, src, actualOffset, }) => {
|
|
13
|
+
const { stdout, stderr } = (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
|
|
10
14
|
'-ss',
|
|
11
15
|
actualOffset,
|
|
12
16
|
...(0, determine_vcodec_ffmpeg_flags_1.determineVcodecFfmpegFlags)(specialVCodecForTransparency),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
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(
|
|
18
|
+
if (value < 1) {
|
|
19
|
+
throw new Error(setting + ' must be at least 1, but is ' + 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 > require('os').cpus().length) {
|
|
22
|
+
throw new Error(`${setting} is set higher than the amount of CPU cores available. Available CPU cores: ${require('os').cpus().length}, value set: ${value}`);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
else if (!/^\d+(\.\d+)?%$/.test(value)) {
|
|
@@ -27,9 +27,3 @@ 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;
|
|
@@ -8,7 +8,6 @@ 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
|
|
12
11
|
if (timeoutInMilliseconds < 7000 && process.env.NODE_ENV !== 'test') {
|
|
13
12
|
throw new TypeError(`'timeoutInMilliseconds' should be bigger or equal than 7000, but is ${timeoutInMilliseconds}`);
|
|
14
13
|
}
|
package/package.json
CHANGED
|
@@ -1,72 +1,69 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
"gitHead": "27eff759935b19b666e29f4f46dd5bdd6214e188"
|
|
72
|
-
}
|
|
2
|
+
"name": "@remotion/renderer",
|
|
3
|
+
"version": "4.0.0-alpha4",
|
|
4
|
+
"description": "Renderer for Remotion",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"author": "Jonny Burger <jonny@remotion.dev>",
|
|
9
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
10
|
+
"repository": {
|
|
11
|
+
"url": "https://github.com/remotion-dev/remotion"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"execa": "5.1.1",
|
|
18
|
+
"extract-zip": "2.0.1",
|
|
19
|
+
"remotion": "4.0.0-alpha4",
|
|
20
|
+
"source-map": "^0.8.0-beta.0",
|
|
21
|
+
"ws": "8.7.0"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": ">=16.8.0",
|
|
25
|
+
"react-dom": ">=16.8.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@jonny/eslint-config": "3.0.266",
|
|
29
|
+
"@testing-library/dom": "^8.16.0",
|
|
30
|
+
"@testing-library/react": "13.3.0",
|
|
31
|
+
"@types/node": "^16.7.5",
|
|
32
|
+
"@types/progress": "2.0.5",
|
|
33
|
+
"@types/react": "18.0.26",
|
|
34
|
+
"@types/react-dom": "18.0.10",
|
|
35
|
+
"eslint": "8.25.0",
|
|
36
|
+
"prettier": "^2.7.1",
|
|
37
|
+
"prettier-plugin-organize-imports": "^2.3.4",
|
|
38
|
+
"react": "18.0.0",
|
|
39
|
+
"react-dom": "18.0.0",
|
|
40
|
+
"typescript": "^4.7.0",
|
|
41
|
+
"vitest": "0.24.3"
|
|
42
|
+
},
|
|
43
|
+
"optionalDependencies": {
|
|
44
|
+
"@remotion/compositor-darwin-arm64": "4.0.0-alpha4",
|
|
45
|
+
"@remotion/compositor-darwin-x64": "4.0.0-alpha4",
|
|
46
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.0-alpha4",
|
|
47
|
+
"@remotion/compositor-linux-arm64-musl": "4.0.0-alpha4",
|
|
48
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.0-alpha4",
|
|
49
|
+
"@remotion/compositor-linux-x64-musl": "4.0.0-alpha4",
|
|
50
|
+
"@remotion/compositor-win32-x64-msvc": "4.0.0-alpha4"
|
|
51
|
+
},
|
|
52
|
+
"keywords": [
|
|
53
|
+
"remotion",
|
|
54
|
+
"ffmpeg",
|
|
55
|
+
"video",
|
|
56
|
+
"react",
|
|
57
|
+
"player"
|
|
58
|
+
],
|
|
59
|
+
"publishConfig": {
|
|
60
|
+
"access": "public"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"lint": "eslint src --ext ts,tsx",
|
|
64
|
+
"test": "vitest --run",
|
|
65
|
+
"watch": "tsc -w",
|
|
66
|
+
"build": "node build.mjs && tsc -d",
|
|
67
|
+
"build-all": "node build.mjs --all"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isTargetClosedErr: (error: Error | undefined) => boolean | undefined;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTargetClosedErr = void 0;
|
|
4
|
-
const isTargetClosedErr = (error) => {
|
|
5
|
-
var _a, _b;
|
|
6
|
-
return (((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('Target closed')) ||
|
|
7
|
-
((_b = error === null || error === void 0 ? void 0 : error.message) === null || _b === void 0 ? void 0 : _b.includes('Session closed')));
|
|
8
|
-
};
|
|
9
|
-
exports.isTargetClosedErr = isTargetClosedErr;
|
package/dist/call-ffmpeg.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import execa from 'execa';
|
|
2
|
-
export declare const callFfExtraOptions: () => {
|
|
3
|
-
env: {
|
|
4
|
-
DYLD_LIBRARY_PATH: string;
|
|
5
|
-
PATH?: undefined;
|
|
6
|
-
LD_LIBRARY_PATH?: undefined;
|
|
7
|
-
} | {
|
|
8
|
-
PATH: string;
|
|
9
|
-
DYLD_LIBRARY_PATH?: undefined;
|
|
10
|
-
LD_LIBRARY_PATH?: undefined;
|
|
11
|
-
} | {
|
|
12
|
-
LD_LIBRARY_PATH: string;
|
|
13
|
-
DYLD_LIBRARY_PATH?: undefined;
|
|
14
|
-
PATH?: undefined;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export declare const callFf: (bin: 'ffmpeg' | 'ffprobe', args: (string | null)[], options?: execa.Options<string>) => execa.ExecaChildProcess<string>;
|
package/dist/call-ffmpeg.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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.callFf = exports.callFfExtraOptions = void 0;
|
|
7
|
-
const execa_1 = __importDefault(require("execa"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const get_executable_path_1 = require("./compositor/get-executable-path");
|
|
10
|
-
const truthy_1 = require("./truthy");
|
|
11
|
-
const callFfExtraOptions = () => {
|
|
12
|
-
const lib = path_1.default.join((0, get_executable_path_1.getExecutablePath)('ffmpeg-cwd'), 'remotion', 'lib');
|
|
13
|
-
return {
|
|
14
|
-
env: process.platform === 'darwin'
|
|
15
|
-
? {
|
|
16
|
-
DYLD_LIBRARY_PATH: lib,
|
|
17
|
-
}
|
|
18
|
-
: process.platform === 'win32'
|
|
19
|
-
? {
|
|
20
|
-
PATH: `${process.env.PATH};${lib}`,
|
|
21
|
-
}
|
|
22
|
-
: {
|
|
23
|
-
LD_LIBRARY_PATH: lib,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
exports.callFfExtraOptions = callFfExtraOptions;
|
|
28
|
-
const callFf = (bin, args, options) => {
|
|
29
|
-
return (0, execa_1.default)((0, get_executable_path_1.getExecutablePath)(bin), args.filter(truthy_1.truthy), {
|
|
30
|
-
...(0, exports.callFfExtraOptions)(),
|
|
31
|
-
...options,
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
exports.callFf = callFf;
|
|
@@ -1,15 +0,0 @@
|
|
|
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, type, }: {
|
|
9
|
-
type: T;
|
|
10
|
-
initiatePayload: CompositorCommand[T];
|
|
11
|
-
renderId: string;
|
|
12
|
-
}) => Compositor;
|
|
13
|
-
export declare const releaseCompositorWithId: (renderId: string) => void;
|
|
14
|
-
export declare const waitForCompositorWithIdToQuit: (renderId: string) => Promise<void>;
|
|
15
|
-
export declare const startCompositor: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T]) => Compositor;
|