@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
package/dist/render-media.js
CHANGED
|
@@ -15,13 +15,14 @@ const crf_1 = require("./crf");
|
|
|
15
15
|
const delete_directory_1 = require("./delete-directory");
|
|
16
16
|
const ensure_frames_in_order_1 = require("./ensure-frames-in-order");
|
|
17
17
|
const ensure_output_directory_1 = require("./ensure-output-directory");
|
|
18
|
+
const find_closest_package_json_1 = require("./find-closest-package-json");
|
|
18
19
|
const get_duration_from_frame_range_1 = require("./get-duration-from-frame-range");
|
|
19
20
|
const get_extension_from_codec_1 = require("./get-extension-from-codec");
|
|
20
21
|
const get_extension_of_filename_1 = require("./get-extension-of-filename");
|
|
21
22
|
const get_frame_to_render_1 = require("./get-frame-to-render");
|
|
22
23
|
const image_format_1 = require("./image-format");
|
|
23
24
|
const is_audio_codec_1 = require("./is-audio-codec");
|
|
24
|
-
const
|
|
25
|
+
const legacy_webpack_config_1 = require("./legacy-webpack-config");
|
|
25
26
|
const make_cancel_signal_1 = require("./make-cancel-signal");
|
|
26
27
|
const overwrite_1 = require("./overwrite");
|
|
27
28
|
const perf_1 = require("./perf");
|
|
@@ -29,27 +30,36 @@ const pixel_format_1 = require("./pixel-format");
|
|
|
29
30
|
const prespawn_ffmpeg_1 = require("./prespawn-ffmpeg");
|
|
30
31
|
const prestitcher_memory_usage_1 = require("./prestitcher-memory-usage");
|
|
31
32
|
const prores_profile_1 = require("./prores-profile");
|
|
33
|
+
const quality_1 = require("./quality");
|
|
32
34
|
const render_frames_1 = require("./render-frames");
|
|
33
35
|
const stitch_frames_to_video_1 = require("./stitch-frames-to-video");
|
|
34
36
|
const validate_even_dimensions_with_codec_1 = require("./validate-even-dimensions-with-codec");
|
|
35
37
|
const validate_every_nth_frame_1 = require("./validate-every-nth-frame");
|
|
38
|
+
const validate_ffmpeg_1 = require("./validate-ffmpeg");
|
|
36
39
|
const validate_ffmpeg_override_1 = require("./validate-ffmpeg-override");
|
|
37
|
-
const validate_number_of_gif_loops_1 = require("./validate-number-of-gif-loops");
|
|
38
40
|
const validate_output_filename_1 = require("./validate-output-filename");
|
|
39
41
|
const validate_scale_1 = require("./validate-scale");
|
|
40
42
|
const validate_videobitrate_1 = require("./validate-videobitrate");
|
|
41
43
|
const SLOWEST_FRAME_COUNT = 10;
|
|
44
|
+
const getConcurrency = (others) => {
|
|
45
|
+
if ('concurrency' in others) {
|
|
46
|
+
return others.concurrency;
|
|
47
|
+
}
|
|
48
|
+
if ('parallelism' in others) {
|
|
49
|
+
return others.parallelism;
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
};
|
|
42
53
|
/**
|
|
43
54
|
*
|
|
44
55
|
* @description Render a video from a composition
|
|
45
56
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/render-media)
|
|
46
57
|
*/
|
|
47
|
-
const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, audioCodec, ...options }) => {
|
|
48
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
(0, jpeg_quality_1.validateJpegQuality)(options.jpegQuality);
|
|
58
|
+
const renderMedia = ({ proResProfile, crf, composition, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, muted, enforceAudioTrack, ffmpegOverride, audioBitrate, videoBitrate, onSlowestFrames, audioCodec, ...options }) => {
|
|
59
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
60
|
+
const remotionRoot = (0, find_closest_package_json_1.findRemotionRoot)();
|
|
61
|
+
(0, validate_ffmpeg_1.validateFfmpeg)(ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null, remotionRoot, 'ffmpeg');
|
|
62
|
+
(0, quality_1.validateQuality)(options.quality);
|
|
53
63
|
(0, crf_1.validateQualitySettings)({ crf, codec, videoBitrate });
|
|
54
64
|
(0, validate_videobitrate_1.validateBitrate)(audioBitrate, 'audioBitrate');
|
|
55
65
|
(0, validate_videobitrate_1.validateBitrate)(videoBitrate, 'videoBitrate');
|
|
@@ -70,11 +80,12 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
70
80
|
? path_1.default.resolve(process.cwd(), outputLocation)
|
|
71
81
|
: null;
|
|
72
82
|
(0, validate_scale_1.validateScale)(scale);
|
|
83
|
+
const concurrency = getConcurrency(options);
|
|
73
84
|
(0, validate_ffmpeg_override_1.validateFfmpegOverride)(ffmpegOverride);
|
|
74
85
|
const everyNthFrame = (_b = options.everyNthFrame) !== null && _b !== void 0 ? _b : 1;
|
|
75
86
|
(0, validate_every_nth_frame_1.validateEveryNthFrame)(everyNthFrame, codec);
|
|
76
87
|
const numberOfGifLoops = (_c = options.numberOfGifLoops) !== null && _c !== void 0 ? _c : null;
|
|
77
|
-
(0,
|
|
88
|
+
const serveUrl = (0, legacy_webpack_config_1.getServeUrlWithFallback)(options);
|
|
78
89
|
let stitchStage = 'encoding';
|
|
79
90
|
let stitcherFfmpeg;
|
|
80
91
|
let preStitcher = null;
|
|
@@ -93,21 +104,20 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
93
104
|
hasEnoughMemory &&
|
|
94
105
|
(0, can_use_parallel_encoding_1.canUseParallelEncoding)(codec);
|
|
95
106
|
if (options.verbose) {
|
|
96
|
-
|
|
97
|
-
log('[PRESTITCHER]
|
|
98
|
-
log('[PRESTITCHER]:
|
|
99
|
-
log('[PRESTITCHER]: User disallowed parallel encoding:', Boolean(options.disallowParallelEncoding));
|
|
107
|
+
console.log('[PRESTITCHER] Free memory:', freeMemory, 'Estimated usage parallel encoding', estimatedUsage);
|
|
108
|
+
console.log('[PRESTITCHER]: Codec supports parallel rendering:', (0, can_use_parallel_encoding_1.canUseParallelEncoding)(codec));
|
|
109
|
+
console.log('[PRESTITCHER]: User disallowed parallel encoding:', Boolean(options.disallowParallelEncoding));
|
|
100
110
|
if (parallelEncoding) {
|
|
101
|
-
log('[PRESTITCHER] Parallel encoding is enabled.');
|
|
111
|
+
console.log('[PRESTITCHER] Parallel encoding is enabled.');
|
|
102
112
|
}
|
|
103
113
|
else {
|
|
104
|
-
log('[PRESTITCHER] Parallel encoding is disabled.');
|
|
114
|
+
console.log('[PRESTITCHER] Parallel encoding is disabled.');
|
|
105
115
|
}
|
|
106
116
|
}
|
|
107
117
|
const imageFormat = (0, is_audio_codec_1.isAudioCodec)(codec)
|
|
108
118
|
? 'none'
|
|
109
|
-
: (
|
|
110
|
-
const
|
|
119
|
+
: (_f = options.imageFormat) !== null && _f !== void 0 ? _f : 'jpeg';
|
|
120
|
+
const quality = imageFormat === 'jpeg' ? options.quality : undefined;
|
|
111
121
|
(0, image_format_1.validateSelectedPixelFormatAndImageFormatCombination)(pixelFormat, imageFormat);
|
|
112
122
|
const preEncodedFileLocation = parallelEncoding
|
|
113
123
|
? path_1.default.join(downloadMap.preEncode, 'pre-encode.' + (0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec, audioCodec !== null && audioCodec !== void 0 ? audioCodec : null))
|
|
@@ -115,7 +125,7 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
115
125
|
const outputDir = parallelEncoding
|
|
116
126
|
? null
|
|
117
127
|
: fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'react-motion-render'));
|
|
118
|
-
if (((
|
|
128
|
+
if (((_g = options.internal) === null || _g === void 0 ? void 0 : _g.onCtrlCExit) && outputDir) {
|
|
119
129
|
options.internal.onCtrlCExit(() => (0, delete_directory_1.deleteDirectory)(outputDir));
|
|
120
130
|
}
|
|
121
131
|
(0, validate_even_dimensions_with_codec_1.validateEvenDimensionsWithCodec)({
|
|
@@ -146,10 +156,10 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
146
156
|
const { waitForRightTimeOfFrameToBeInserted, setFrameToStitch, waitForFinish } = (0, ensure_frames_in_order_1.ensureFramesInOrder)(realFrameRange);
|
|
147
157
|
const fps = composition.fps / (everyNthFrame !== null && everyNthFrame !== void 0 ? everyNthFrame : 1);
|
|
148
158
|
remotion_1.Internals.validateFps(fps, 'in "renderMedia()"', codec === 'gif');
|
|
149
|
-
const createPrestitcherIfNecessary = () => {
|
|
159
|
+
const createPrestitcherIfNecessary = async () => {
|
|
150
160
|
var _a;
|
|
151
161
|
if (preEncodedFileLocation) {
|
|
152
|
-
preStitcher = (0, prespawn_ffmpeg_1.prespawnFfmpeg)({
|
|
162
|
+
preStitcher = await (0, prespawn_ffmpeg_1.prespawnFfmpeg)({
|
|
153
163
|
width: composition.width * (scale !== null && scale !== void 0 ? scale : 1),
|
|
154
164
|
height: composition.height * (scale !== null && scale !== void 0 ? scale : 1),
|
|
155
165
|
fps,
|
|
@@ -163,11 +173,12 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
163
173
|
callUpdate();
|
|
164
174
|
},
|
|
165
175
|
verbose: (_a = options.verbose) !== null && _a !== void 0 ? _a : false,
|
|
176
|
+
ffmpegExecutable,
|
|
166
177
|
imageFormat,
|
|
167
178
|
signal: cancelPrestitcher.cancelSignal,
|
|
168
179
|
ffmpegOverride: ffmpegOverride !== null && ffmpegOverride !== void 0 ? ffmpegOverride : (({ args }) => args),
|
|
169
180
|
videoBitrate: videoBitrate !== null && videoBitrate !== void 0 ? videoBitrate : null,
|
|
170
|
-
});
|
|
181
|
+
}, remotionRoot);
|
|
171
182
|
stitcherFfmpeg = preStitcher.task;
|
|
172
183
|
}
|
|
173
184
|
};
|
|
@@ -210,16 +221,16 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
210
221
|
}
|
|
211
222
|
minTime = (_b = (_a = slowestFrames[slowestFrames.length - 1]) === null || _a === void 0 ? void 0 : _a.time) !== null && _b !== void 0 ? _b : minTime;
|
|
212
223
|
};
|
|
213
|
-
const happyPath =
|
|
224
|
+
const happyPath = createPrestitcherIfNecessary()
|
|
214
225
|
.then(() => {
|
|
215
226
|
const renderFramesProc = (0, render_frames_1.renderFrames)({
|
|
216
|
-
composition,
|
|
227
|
+
config: composition,
|
|
217
228
|
onFrameUpdate: (frame, frameIndex, timeToRenderInMilliseconds) => {
|
|
218
229
|
renderedFrames = frame;
|
|
219
230
|
callUpdate();
|
|
220
231
|
recordFrameTime(frameIndex, timeToRenderInMilliseconds);
|
|
221
232
|
},
|
|
222
|
-
concurrency
|
|
233
|
+
concurrency,
|
|
223
234
|
outputDir,
|
|
224
235
|
onStart: (data) => {
|
|
225
236
|
renderedFrames = 0;
|
|
@@ -229,7 +240,7 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
229
240
|
inputProps,
|
|
230
241
|
envVariables,
|
|
231
242
|
imageFormat,
|
|
232
|
-
|
|
243
|
+
quality,
|
|
233
244
|
frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : null,
|
|
234
245
|
puppeteerInstance,
|
|
235
246
|
everyNthFrame,
|
|
@@ -246,13 +257,15 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
246
257
|
setFrameToStitch(Math.min(realFrameRange[1] + 1, frame + everyNthFrame));
|
|
247
258
|
}
|
|
248
259
|
: undefined,
|
|
249
|
-
serveUrl
|
|
260
|
+
serveUrl,
|
|
250
261
|
dumpBrowserLogs,
|
|
251
262
|
onBrowserLog,
|
|
252
263
|
onDownload,
|
|
253
264
|
timeoutInMilliseconds,
|
|
254
265
|
chromiumOptions,
|
|
255
266
|
scale,
|
|
267
|
+
ffmpegExecutable,
|
|
268
|
+
ffprobeExecutable,
|
|
256
269
|
browserExecutable,
|
|
257
270
|
port,
|
|
258
271
|
cancelSignal: cancelRenderFrames.cancelSignal,
|
|
@@ -289,6 +302,8 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
289
302
|
proResProfile,
|
|
290
303
|
crf,
|
|
291
304
|
assetsInfo,
|
|
305
|
+
ffmpegExecutable,
|
|
306
|
+
ffprobeExecutable,
|
|
292
307
|
onProgress: (frame) => {
|
|
293
308
|
stitchStage = 'muxing';
|
|
294
309
|
encodedFrames = frame;
|
|
@@ -314,11 +329,8 @@ const renderMedia = ({ proResProfile, crf, composition, inputProps, pixelFormat,
|
|
|
314
329
|
encodedDoneIn = Date.now() - stitchStart;
|
|
315
330
|
callUpdate();
|
|
316
331
|
slowestFrames.sort((a, b) => b.time - a.time);
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
slowestFrames,
|
|
320
|
-
};
|
|
321
|
-
return result;
|
|
332
|
+
onSlowestFrames === null || onSlowestFrames === void 0 ? void 0 : onSlowestFrames(slowestFrames);
|
|
333
|
+
return buffer;
|
|
322
334
|
})
|
|
323
335
|
.catch((err) => {
|
|
324
336
|
/**
|
package/dist/render-still.d.ts
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { SmallTCompMetadata } from 'remotion';
|
|
3
3
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
4
4
|
import type { DownloadMap } from './assets/download-map';
|
|
5
5
|
import type { BrowserExecutable } from './browser-executable';
|
|
6
6
|
import type { Browser as PuppeteerBrowser } from './browser/Browser';
|
|
7
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
7
8
|
import type { StillImageFormat } from './image-format';
|
|
9
|
+
import type { ServeUrlOrWebpackBundle } from './legacy-webpack-config';
|
|
8
10
|
import type { CancelSignal } from './make-cancel-signal';
|
|
9
11
|
import type { ChromiumOptions } from './open-browser';
|
|
10
12
|
declare type InnerStillOptions = {
|
|
11
|
-
composition:
|
|
13
|
+
composition: SmallTCompMetadata;
|
|
12
14
|
output?: string | null;
|
|
13
15
|
frame?: number;
|
|
14
16
|
inputProps?: unknown;
|
|
15
17
|
imageFormat?: StillImageFormat;
|
|
16
|
-
|
|
17
|
-
* @deprecated Renamed to `jpegQuality`
|
|
18
|
-
*/
|
|
19
|
-
quality?: never;
|
|
20
|
-
jpegQuality?: number;
|
|
18
|
+
quality?: number;
|
|
21
19
|
puppeteerInstance?: PuppeteerBrowser;
|
|
22
20
|
dumpBrowserLogs?: boolean;
|
|
23
21
|
envVariables?: Record<string, string>;
|
|
@@ -28,6 +26,8 @@ declare type InnerStillOptions = {
|
|
|
28
26
|
scale?: number;
|
|
29
27
|
onDownload?: RenderMediaOnDownload;
|
|
30
28
|
cancelSignal?: CancelSignal;
|
|
29
|
+
ffmpegExecutable?: FfmpegExecutable;
|
|
30
|
+
ffprobeExecutable?: FfmpegExecutable;
|
|
31
31
|
/**
|
|
32
32
|
* @deprecated Only for Remotion internal usage
|
|
33
33
|
*/
|
|
@@ -36,8 +36,7 @@ declare type InnerStillOptions = {
|
|
|
36
36
|
declare type RenderStillReturnValue = {
|
|
37
37
|
buffer: Buffer | null;
|
|
38
38
|
};
|
|
39
|
-
export declare type RenderStillOptions = InnerStillOptions & {
|
|
40
|
-
serveUrl: string;
|
|
39
|
+
export declare type RenderStillOptions = InnerStillOptions & ServeUrlOrWebpackBundle & {
|
|
41
40
|
port?: number | null;
|
|
42
41
|
};
|
|
43
42
|
/**
|
package/dist/render-still.js
CHANGED
|
@@ -37,20 +37,18 @@ const ensure_output_directory_1 = require("./ensure-output-directory");
|
|
|
37
37
|
const handle_javascript_exception_1 = require("./error-handling/handle-javascript-exception");
|
|
38
38
|
const find_closest_package_json_1 = require("./find-closest-package-json");
|
|
39
39
|
const image_format_1 = require("./image-format");
|
|
40
|
-
const
|
|
40
|
+
const legacy_webpack_config_1 = require("./legacy-webpack-config");
|
|
41
41
|
const make_cancel_signal_1 = require("./make-cancel-signal");
|
|
42
42
|
const open_browser_1 = require("./open-browser");
|
|
43
43
|
const prepare_server_1 = require("./prepare-server");
|
|
44
44
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
45
|
+
const quality_1 = require("./quality");
|
|
45
46
|
const seek_to_frame_1 = require("./seek-to-frame");
|
|
46
47
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
47
48
|
const take_frame_and_compose_1 = require("./take-frame-and-compose");
|
|
48
49
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
49
50
|
const validate_scale_1 = require("./validate-scale");
|
|
50
|
-
const innerRenderStill = async ({ composition, quality, imageFormat =
|
|
51
|
-
if (quality) {
|
|
52
|
-
throw new Error('quality has been renamed to jpegQuality. Please rename the option.');
|
|
53
|
-
}
|
|
51
|
+
const innerRenderStill = async ({ composition, quality, imageFormat = 'png', serveUrl, puppeteerInstance, dumpBrowserLogs = false, onError, inputProps, envVariables, output, frame = 0, overwrite = true, browserExecutable, timeoutInMilliseconds, chromiumOptions, scale = 1, proxyPort, cancelSignal, downloadMap, }) => {
|
|
54
52
|
remotion_1.Internals.validateDimension(composition.height, 'height', 'in the `config` object passed to `renderStill()`');
|
|
55
53
|
remotion_1.Internals.validateDimension(composition.width, 'width', 'in the `config` object passed to `renderStill()`');
|
|
56
54
|
remotion_1.Internals.validateFps(composition.fps, 'in the `config` object of `renderStill()`', false);
|
|
@@ -59,7 +57,7 @@ const innerRenderStill = async ({ composition, quality, imageFormat = image_form
|
|
|
59
57
|
component: 'in the `config` object passed to `renderStill()`',
|
|
60
58
|
allowFloats: false,
|
|
61
59
|
});
|
|
62
|
-
(0, image_format_1.
|
|
60
|
+
(0, image_format_1.validateNonNullImageFormat)(imageFormat);
|
|
63
61
|
remotion_1.Internals.validateFrame({
|
|
64
62
|
frame,
|
|
65
63
|
durationInFrames: composition.durationInFrames,
|
|
@@ -73,10 +71,10 @@ const innerRenderStill = async ({ composition, quality, imageFormat = image_form
|
|
|
73
71
|
(0, validate_scale_1.validateScale)(scale);
|
|
74
72
|
output =
|
|
75
73
|
typeof output === 'string' ? path_1.default.resolve(process.cwd(), output) : null;
|
|
76
|
-
if (
|
|
74
|
+
if (quality !== undefined && imageFormat !== 'jpeg') {
|
|
77
75
|
throw new Error("You can only pass the `quality` option if `imageFormat` is 'jpeg'.");
|
|
78
76
|
}
|
|
79
|
-
(0,
|
|
77
|
+
(0, quality_1.validateQuality)(quality);
|
|
80
78
|
if (output) {
|
|
81
79
|
if (fs_1.default.existsSync(output)) {
|
|
82
80
|
if (!overwrite) {
|
|
@@ -170,7 +168,7 @@ const innerRenderStill = async ({ composition, quality, imageFormat = image_form
|
|
|
170
168
|
imageFormat,
|
|
171
169
|
scale,
|
|
172
170
|
output,
|
|
173
|
-
|
|
171
|
+
quality,
|
|
174
172
|
wantsBuffer: !output,
|
|
175
173
|
});
|
|
176
174
|
await cleanup();
|
|
@@ -183,17 +181,20 @@ const innerRenderStill = async ({ composition, quality, imageFormat = image_form
|
|
|
183
181
|
*/
|
|
184
182
|
const renderStill = (options) => {
|
|
185
183
|
var _a, _b;
|
|
184
|
+
const selectedServeUrl = (0, legacy_webpack_config_1.getServeUrlWithFallback)(options);
|
|
186
185
|
const downloadMap = (_a = options.downloadMap) !== null && _a !== void 0 ? _a : (0, download_map_1.makeDownloadMap)();
|
|
187
186
|
const onDownload = (_b = options.onDownload) !== null && _b !== void 0 ? _b : (() => () => undefined);
|
|
188
187
|
const happyPath = new Promise((resolve, reject) => {
|
|
189
|
-
var _a;
|
|
188
|
+
var _a, _b, _c;
|
|
190
189
|
const onError = (err) => reject(err);
|
|
191
190
|
let close = null;
|
|
192
191
|
(0, prepare_server_1.prepareServer)({
|
|
193
|
-
webpackConfigOrServeUrl:
|
|
192
|
+
webpackConfigOrServeUrl: selectedServeUrl,
|
|
194
193
|
onDownload,
|
|
195
194
|
onError,
|
|
196
|
-
|
|
195
|
+
ffmpegExecutable: (_a = options.ffmpegExecutable) !== null && _a !== void 0 ? _a : null,
|
|
196
|
+
ffprobeExecutable: (_b = options.ffprobeExecutable) !== null && _b !== void 0 ? _b : null,
|
|
197
|
+
port: (_c = options.port) !== null && _c !== void 0 ? _c : null,
|
|
197
198
|
downloadMap,
|
|
198
199
|
remotionRoot: (0, find_closest_package_json_1.findRemotionRoot)(),
|
|
199
200
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { ClipRegion } from 'remotion';
|
|
3
3
|
import type { Page } from './browser/BrowserPage';
|
|
4
|
-
import type {
|
|
5
|
-
export declare const screenshotDOMElement: ({ page, imageFormat,
|
|
4
|
+
import type { ImageFormat } from './image-format';
|
|
5
|
+
export declare const screenshotDOMElement: ({ page, imageFormat, quality, opts, height, width, clipRegion, }: {
|
|
6
6
|
page: Page;
|
|
7
|
-
imageFormat:
|
|
8
|
-
|
|
7
|
+
imageFormat: ImageFormat;
|
|
8
|
+
quality: number | undefined;
|
|
9
9
|
opts: {
|
|
10
10
|
path: string | null;
|
|
11
11
|
};
|
|
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.screenshotDOMElement = void 0;
|
|
4
4
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
5
5
|
const puppeteer_screenshot_1 = require("./puppeteer-screenshot");
|
|
6
|
-
const screenshotDOMElement = async ({ page, imageFormat,
|
|
6
|
+
const screenshotDOMElement = async ({ page, imageFormat, quality, opts, height, width, clipRegion, }) => {
|
|
7
7
|
const { path } = opts;
|
|
8
|
-
if (imageFormat === 'png'
|
|
9
|
-
imageFormat === 'pdf' ||
|
|
10
|
-
imageFormat === 'webp') {
|
|
8
|
+
if (imageFormat === 'png') {
|
|
11
9
|
await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
12
10
|
pageFunction: () => {
|
|
13
11
|
document.body.style.background = 'transparent';
|
|
@@ -27,7 +25,6 @@ const screenshotDOMElement = async ({ page, imageFormat, jpegQuality, opts, heig
|
|
|
27
25
|
page,
|
|
28
26
|
});
|
|
29
27
|
}
|
|
30
|
-
// @ts-expect-error
|
|
31
28
|
if (imageFormat === 'none') {
|
|
32
29
|
throw new TypeError('Tried to make a screenshot with format "none"');
|
|
33
30
|
}
|
|
@@ -36,7 +33,7 @@ const screenshotDOMElement = async ({ page, imageFormat, jpegQuality, opts, heig
|
|
|
36
33
|
omitBackground: imageFormat === 'png',
|
|
37
34
|
path: path !== null && path !== void 0 ? path : undefined,
|
|
38
35
|
type: imageFormat,
|
|
39
|
-
|
|
36
|
+
quality,
|
|
40
37
|
width,
|
|
41
38
|
height,
|
|
42
39
|
clipRegion,
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import type { ClipRegion } from 'remotion';
|
|
3
3
|
import type { Page } from './browser/BrowserPage';
|
|
4
4
|
import type { StillImageFormat } from './image-format';
|
|
5
|
-
export declare const screenshotTask: ({ format, height, omitBackground, page, width, path,
|
|
5
|
+
export declare const screenshotTask: ({ format, height, omitBackground, page, width, path, quality, clipRegion, }: {
|
|
6
6
|
page: Page;
|
|
7
7
|
format: StillImageFormat;
|
|
8
8
|
path?: string | undefined;
|
|
9
|
-
|
|
9
|
+
quality?: number | undefined;
|
|
10
10
|
omitBackground: boolean;
|
|
11
11
|
width: number;
|
|
12
12
|
height: number;
|
package/dist/screenshot-task.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.screenshotTask = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const perf_1 = require("./perf");
|
|
9
|
-
const screenshotTask = async ({ format, height, omitBackground, page, width, path,
|
|
9
|
+
const screenshotTask = async ({ format, height, omitBackground, page, width, path, quality, clipRegion, }) => {
|
|
10
10
|
var _a;
|
|
11
11
|
const client = page._client();
|
|
12
12
|
const target = page.target();
|
|
@@ -15,49 +15,34 @@ const screenshotTask = async ({ format, height, omitBackground, page, width, pat
|
|
|
15
15
|
targetId: target._targetId,
|
|
16
16
|
});
|
|
17
17
|
(0, perf_1.stopPerfMeasure)(perfTarget);
|
|
18
|
-
const shouldSetDefaultBackground = omitBackground;
|
|
18
|
+
const shouldSetDefaultBackground = omitBackground && format === 'png';
|
|
19
19
|
if (shouldSetDefaultBackground)
|
|
20
20
|
await client.send('Emulation.setDefaultBackgroundColorOverride', {
|
|
21
21
|
color: { r: 0, g: 0, b: 0, a: 0 },
|
|
22
22
|
});
|
|
23
23
|
const cap = (0, perf_1.startPerfMeasure)('capture');
|
|
24
24
|
try {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
height: clipRegion.height,
|
|
47
|
-
scale: 1,
|
|
48
|
-
width: clipRegion.width,
|
|
49
|
-
}
|
|
50
|
-
: {
|
|
51
|
-
x: 0,
|
|
52
|
-
y: 0,
|
|
53
|
-
height,
|
|
54
|
-
scale: 1,
|
|
55
|
-
width,
|
|
56
|
-
},
|
|
57
|
-
captureBeyondViewport: true,
|
|
58
|
-
optimizeForSpeed: true,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
25
|
+
const result = await client.send('Page.captureScreenshot', {
|
|
26
|
+
format,
|
|
27
|
+
quality,
|
|
28
|
+
clip: clipRegion !== null && clipRegion !== 'hide'
|
|
29
|
+
? {
|
|
30
|
+
x: clipRegion.x,
|
|
31
|
+
y: clipRegion.y,
|
|
32
|
+
height: clipRegion.height,
|
|
33
|
+
scale: 1,
|
|
34
|
+
width: clipRegion.width,
|
|
35
|
+
}
|
|
36
|
+
: {
|
|
37
|
+
x: 0,
|
|
38
|
+
y: 0,
|
|
39
|
+
height,
|
|
40
|
+
scale: 1,
|
|
41
|
+
width,
|
|
42
|
+
},
|
|
43
|
+
captureBeyondViewport: true,
|
|
44
|
+
optimizeForSpeed: true,
|
|
45
|
+
});
|
|
61
46
|
(0, perf_1.stopPerfMeasure)(cap);
|
|
62
47
|
if (shouldSetDefaultBackground)
|
|
63
48
|
await client.send('Emulation.setDefaultBackgroundColorOverride');
|
|
@@ -59,11 +59,10 @@ const findRelated = async (current, relativePath) => {
|
|
|
59
59
|
};
|
|
60
60
|
const sendError = (absolutePath, response, spec) => {
|
|
61
61
|
const { message, statusCode } = spec;
|
|
62
|
+
response.statusCode = statusCode;
|
|
62
63
|
const headers = getHeaders(absolutePath, null);
|
|
63
|
-
response.writeHead(statusCode,
|
|
64
|
-
|
|
65
|
-
'Content-Type': 'application/json',
|
|
66
|
-
});
|
|
64
|
+
response.writeHead(statusCode, headers);
|
|
65
|
+
response.setHeader('content-type', 'application/json');
|
|
67
66
|
response.end(JSON.stringify({ statusCode, message }));
|
|
68
67
|
};
|
|
69
68
|
const internalError = (absolutePath, response) => {
|
|
@@ -124,8 +123,7 @@ const serveHandler = async (request, response, config) => {
|
|
|
124
123
|
try {
|
|
125
124
|
const related = await findRelated(current, relativePath);
|
|
126
125
|
if (related) {
|
|
127
|
-
stats = related
|
|
128
|
-
absolutePath = related.absolutePath;
|
|
126
|
+
({ stats, absolutePath } = related);
|
|
129
127
|
}
|
|
130
128
|
}
|
|
131
129
|
catch (err) {
|
package/dist/serve-static.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
2
2
|
import type { DownloadMap } from './assets/download-map';
|
|
3
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
3
4
|
export declare const serveStatic: (path: string | null, options: {
|
|
4
5
|
port: number | null;
|
|
6
|
+
ffmpegExecutable: FfmpegExecutable;
|
|
7
|
+
ffprobeExecutable: FfmpegExecutable;
|
|
5
8
|
onDownload: RenderMediaOnDownload;
|
|
6
9
|
onError: (err: Error) => void;
|
|
7
10
|
downloadMap: DownloadMap;
|
package/dist/serve-static.js
CHANGED
|
@@ -10,6 +10,8 @@ const offthread_video_server_1 = require("./offthread-video-server");
|
|
|
10
10
|
const serve_handler_1 = require("./serve-handler");
|
|
11
11
|
const serveStatic = async (path, options) => {
|
|
12
12
|
const offthreadRequest = (0, offthread_video_server_1.startOffthreadVideoServer)({
|
|
13
|
+
ffmpegExecutable: options.ffmpegExecutable,
|
|
14
|
+
ffprobeExecutable: options.ffprobeExecutable,
|
|
13
15
|
onDownload: options.onDownload,
|
|
14
16
|
onError: options.onError,
|
|
15
17
|
downloadMap: options.downloadMap,
|
|
@@ -29,9 +31,7 @@ const serveStatic = async (path, options) => {
|
|
|
29
31
|
(0, serve_handler_1.serveHandler)(request, response, {
|
|
30
32
|
public: path,
|
|
31
33
|
}).catch(() => {
|
|
32
|
-
|
|
33
|
-
response.writeHead(500);
|
|
34
|
-
}
|
|
34
|
+
response.statusCode = 500;
|
|
35
35
|
response.end('Error serving file');
|
|
36
36
|
});
|
|
37
37
|
});
|
|
@@ -3,8 +3,9 @@ import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-
|
|
|
3
3
|
import type { RenderAssetInfo } from './assets/download-map';
|
|
4
4
|
import type { AudioCodec } from './audio-codec';
|
|
5
5
|
import type { Codec } from './codec';
|
|
6
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
6
7
|
import type { FfmpegOverrideFn } from './ffmpeg-override';
|
|
7
|
-
import type {
|
|
8
|
+
import type { ImageFormat } from './image-format';
|
|
8
9
|
import type { CancelSignal } from './make-cancel-signal';
|
|
9
10
|
import type { PixelFormat } from './pixel-format';
|
|
10
11
|
import type { ProResProfile } from './prores-profile';
|
|
@@ -26,19 +27,27 @@ export declare type StitcherOptions = {
|
|
|
26
27
|
onDownload?: RenderMediaOnDownload;
|
|
27
28
|
proResProfile?: ProResProfile;
|
|
28
29
|
verbose?: boolean;
|
|
30
|
+
ffmpegExecutable?: FfmpegExecutable;
|
|
31
|
+
ffprobeExecutable?: FfmpegExecutable;
|
|
29
32
|
dir?: string;
|
|
30
33
|
cancelSignal?: CancelSignal;
|
|
31
34
|
internalOptions?: {
|
|
32
35
|
preEncodedFileLocation: string | null;
|
|
33
|
-
imageFormat:
|
|
36
|
+
imageFormat: ImageFormat;
|
|
34
37
|
preferLossless: boolean;
|
|
35
38
|
};
|
|
36
39
|
muted?: boolean;
|
|
37
40
|
enforceAudioTrack?: boolean;
|
|
38
41
|
ffmpegOverride?: FfmpegOverrideFn;
|
|
39
42
|
};
|
|
43
|
+
declare type ReturnType = {
|
|
44
|
+
task: Promise<Buffer | null>;
|
|
45
|
+
getLogs: () => string;
|
|
46
|
+
};
|
|
47
|
+
export declare const spawnFfmpeg: (options: StitcherOptions, remotionRoot: string) => Promise<ReturnType>;
|
|
40
48
|
/**
|
|
41
49
|
* @description Takes a series of images and audio information generated by renderFrames() and encodes it to a video.
|
|
42
50
|
* @see [Documentation](https://www.remotion.dev/docs/renderer/stitch-frames-to-video)
|
|
43
51
|
*/
|
|
44
52
|
export declare const stitchFramesToVideo: (options: StitcherOptions) => Promise<Buffer | null>;
|
|
53
|
+
export {};
|