@remotion/renderer 3.1.5 → 3.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/convert-assets-to-file-urls.d.ts +3 -2
- package/dist/assets/convert-assets-to-file-urls.js +2 -2
- package/dist/assets/download-and-map-assets-to-file.d.ts +6 -5
- package/dist/assets/download-and-map-assets-to-file.js +47 -48
- package/dist/assets/download-map.d.ts +64 -0
- package/dist/assets/download-map.js +73 -0
- package/dist/assets/get-audio-channels.d.ts +3 -7
- package/dist/assets/get-audio-channels.js +6 -7
- package/dist/assets/get-video-stream-duration.d.ts +3 -0
- package/dist/assets/get-video-stream-duration.js +35 -0
- package/dist/browser/TimeoutSettings.d.ts +1 -0
- package/dist/browser/TimeoutSettings.js +4 -4
- package/dist/browser-executable.d.ts +1 -0
- package/dist/{assets/cleanup-assets.js → browser-executable.js} +0 -0
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +4 -0
- package/dist/can-use-parallel-encoding.d.ts +1 -1
- package/dist/can-use-parallel-encoding.js +2 -2
- package/dist/codec-supports-media.d.ts +1 -1
- package/dist/codec.d.ts +4 -0
- package/dist/codec.js +16 -0
- package/dist/combine-videos.d.ts +1 -1
- package/dist/combine-videos.js +7 -6
- package/dist/compress-assets.d.ts +7 -0
- package/dist/compress-assets.js +25 -0
- package/dist/convert-to-pcm.d.ts +1 -1
- package/dist/create-ffmpeg-complex-filter.d.ts +6 -2
- package/dist/create-ffmpeg-complex-filter.js +2 -11
- package/dist/create-ffmpeg-merge-filter.js +3 -3
- package/dist/create-silent-audio.d.ts +1 -1
- package/dist/crf.d.ts +5 -0
- package/dist/crf.js +64 -0
- package/dist/ensure-presentation-timestamp.d.ts +2 -1
- package/dist/ensure-presentation-timestamp.js +9 -7
- package/dist/extract-frame-from-video.d.ts +4 -2
- package/dist/extract-frame-from-video.js +22 -17
- package/dist/ffmpeg-executable.d.ts +1 -0
- package/dist/ffmpeg-executable.js +2 -0
- package/dist/ffmpeg-filter-file.d.ts +2 -1
- package/dist/ffmpeg-filter-file.js +4 -6
- package/dist/frame-range.d.ts +2 -0
- package/dist/frame-range.js +49 -0
- package/dist/get-audio-codec-name.d.ts +1 -1
- package/dist/get-audio-codec-name.js +2 -2
- package/dist/get-browser-instance.d.ts +1 -1
- package/dist/get-browser-instance.js +2 -2
- package/dist/get-codec-name.d.ts +1 -1
- package/dist/get-codec-name.js +2 -2
- package/dist/get-compositions.d.ts +8 -1
- package/dist/get-compositions.js +10 -6
- package/dist/get-extension-from-codec.d.ts +2 -2
- package/dist/get-extension-of-filename.d.ts +1 -1
- package/dist/get-extension-of-filename.js +3 -0
- package/dist/get-frame-to-render.d.ts +1 -1
- package/dist/get-local-browser-executable.d.ts +2 -1
- package/dist/get-prores-profile-name.d.ts +2 -1
- package/dist/get-video-info.d.ts +3 -8
- package/dist/get-video-info.js +7 -8
- package/dist/guess-extension-for-media.d.ts +1 -1
- package/dist/image-format.d.ts +6 -1
- package/dist/image-format.js +25 -1
- package/dist/index.d.ts +49 -10
- package/dist/index.js +71 -1
- package/dist/is-audio-codec.d.ts +2 -0
- package/dist/is-audio-codec.js +7 -0
- package/dist/is-beyond-last-frame.d.ts +3 -2
- package/dist/is-beyond-last-frame.js +5 -5
- package/dist/last-frame-from-video-cache.d.ts +5 -4
- package/dist/last-frame-from-video-cache.js +17 -17
- package/dist/log-level.d.ts +4 -0
- package/dist/log-level.js +15 -0
- package/dist/merge-audio-track.d.ts +3 -1
- package/dist/merge-audio-track.js +6 -4
- package/dist/offthread-video-server.d.ts +5 -3
- package/dist/offthread-video-server.js +3 -2
- package/dist/open-browser.d.ts +1 -1
- package/dist/open-browser.js +4 -4
- package/dist/overwrite.d.ts +1 -0
- package/dist/overwrite.js +4 -0
- package/dist/perf.d.ts +5 -0
- package/dist/perf.js +35 -0
- package/dist/pixel-format.d.ts +5 -0
- package/dist/pixel-format.js +26 -0
- package/dist/prepare-server.d.ts +4 -3
- package/dist/prepare-server.js +3 -3
- package/dist/preprocess-audio-track.d.ts +3 -1
- package/dist/preprocess-audio-track.js +3 -3
- package/dist/prespawn-ffmpeg.d.ts +5 -1
- package/dist/prespawn-ffmpeg.js +9 -6
- package/dist/prores-profile.d.ts +5 -0
- package/dist/prores-profile.js +23 -0
- package/dist/provide-screenshot.d.ts +1 -1
- package/dist/quality.d.ts +1 -0
- package/dist/quality.js +21 -0
- package/dist/render-frames.d.ts +10 -1
- package/dist/render-frames.js +22 -16
- package/dist/render-media.d.ts +13 -2
- package/dist/render-media.js +24 -13
- package/dist/render-still.d.ts +9 -1
- package/dist/render-still.js +21 -11
- package/dist/screenshot-dom-element.d.ts +1 -1
- package/dist/screenshot-task.d.ts +1 -1
- package/dist/screenshot-task.js +7 -7
- package/dist/serve-static.d.ts +3 -2
- package/dist/serve-static.js +3 -4
- package/dist/set-props-and-env.js +2 -2
- package/dist/stitch-frames-to-video.d.ts +6 -1
- package/dist/stitch-frames-to-video.js +30 -43
- package/dist/stringify-ffmpeg-filter.js +2 -2
- package/dist/symbolicate-stacktrace.js +3 -3
- package/dist/truthy.d.ts +3 -0
- package/dist/truthy.js +7 -0
- package/dist/types.d.ts +1 -1
- package/dist/validate-even-dimensions-with-codec.d.ts +1 -1
- package/dist/validate-even-dimensions-with-codec.js +2 -2
- package/dist/validate-every-nth-frame.d.ts +1 -0
- package/dist/validate-every-nth-frame.js +21 -0
- package/dist/validate-ffmpeg.js +2 -3
- package/dist/validate-frame.d.ts +1 -0
- package/dist/validate-frame.js +24 -0
- package/dist/validate-opengl-renderer.d.ts +5 -0
- package/dist/validate-opengl-renderer.js +15 -0
- package/dist/validate-output-filename.d.ts +1 -1
- package/package.json +3 -3
- package/dist/assets/calculate-asset-positions.d.ts.map +0 -1
- package/dist/assets/calculate-asset-positions.js.map +0 -1
- package/dist/assets/calculate-atempo.d.ts.map +0 -1
- package/dist/assets/calculate-atempo.js.map +0 -1
- package/dist/assets/cleanup-assets.d.ts +0 -2
- package/dist/assets/convert-assets-to-file-urls.d.ts.map +0 -1
- package/dist/assets/convert-assets-to-file-urls.js.map +0 -1
- package/dist/assets/download-and-map-assets-to-file.d.ts.map +0 -1
- package/dist/assets/download-and-map-assets-to-file.js.map +0 -1
- package/dist/assets/download-file.d.ts.map +0 -1
- package/dist/assets/download-file.js.map +0 -1
- package/dist/assets/ffmpeg-volume-expression.d.ts.map +0 -1
- package/dist/assets/ffmpeg-volume-expression.js.map +0 -1
- package/dist/assets/flatten-volume-array.d.ts.map +0 -1
- package/dist/assets/flatten-volume-array.js.map +0 -1
- package/dist/assets/get-audio-channels.d.ts.map +0 -1
- package/dist/assets/get-audio-channels.js.map +0 -1
- package/dist/assets/read-file.d.ts.map +0 -1
- package/dist/assets/read-file.js.map +0 -1
- package/dist/assets/round-volume-to-avoid-stack-overflow.d.ts.map +0 -1
- package/dist/assets/round-volume-to-avoid-stack-overflow.js.map +0 -1
- package/dist/assets/sanitize-filename.d.ts.map +0 -1
- package/dist/assets/sanitize-filename.js.map +0 -1
- package/dist/assets/sanitize-filepath.d.ts.map +0 -1
- package/dist/assets/sanitize-filepath.js.map +0 -1
- package/dist/assets/truncate-utf8-bytes.d.ts.map +0 -1
- package/dist/assets/truncate-utf8-bytes.js.map +0 -1
- package/dist/assets/types.d.ts.map +0 -1
- package/dist/assets/types.js.map +0 -1
- package/dist/browser/Accessibility.d.ts +0 -175
- package/dist/browser/Accessibility.js +0 -423
- package/dist/browser/AriaQueryHandler.d.ts +0 -20
- package/dist/browser/AriaQueryHandler.js +0 -108
- package/dist/browser/ConnectionTransport.d.ts +0 -21
- package/dist/browser/ConnectionTransport.js +0 -17
- package/dist/browser/Coverage.d.ts +0 -180
- package/dist/browser/Coverage.js +0 -371
- package/dist/browser/Debug.d.ts +0 -19
- package/dist/browser/Debug.js +0 -42
- package/dist/browser/DeviceDescriptors.d.ts +0 -40
- package/dist/browser/DeviceDescriptors.js +0 -1407
- package/dist/browser/EmulationManager.d.ts +0 -7
- package/dist/browser/EmulationManager.js +0 -40
- package/dist/browser/FileChooser.d.ts +0 -56
- package/dist/browser/FileChooser.js +0 -86
- package/dist/browser/Input.d.ts +0 -355
- package/dist/browser/Input.js +0 -592
- package/dist/browser/NetworkConditions.d.ts +0 -26
- package/dist/browser/NetworkConditions.js +0 -33
- package/dist/browser/PDFOptions.d.ts +0 -165
- package/dist/browser/PDFOptions.js +0 -34
- package/dist/browser/PipeTransport.d.ts +0 -10
- package/dist/browser/PipeTransport.js +0 -86
- package/dist/browser/Puppeteer.d.ts +0 -35
- package/dist/browser/Puppeteer.js +0 -17
- package/dist/browser/QueryHandler.d.ts +0 -64
- package/dist/browser/QueryHandler.js +0 -183
- package/dist/browser/SecurityDetails.d.ts +0 -55
- package/dist/browser/SecurityDetails.js +0 -95
- package/dist/browser/Tracing.d.ts +0 -45
- package/dist/browser/Tracing.js +0 -136
- package/dist/browser/USKeyboardLayout.d.ts +0 -39
- package/dist/browser/USKeyboardLayout.js +0 -406
- package/dist/browser/WebWorker.d.ts +0 -96
- package/dist/browser/WebWorker.js +0 -122
- package/dist/browser/compat.d.ts +0 -2
- package/dist/browser/compat.js +0 -17
- package/dist/browser/dialog.d.ts +0 -70
- package/dist/browser/dialog.js +0 -114
- package/dist/browser/environment.d.ts +0 -16
- package/dist/browser/environment.js +0 -19
- package/dist/browser/fetch.d.ts +0 -16
- package/dist/browser/fetch.js +0 -46
- package/dist/browser/find-up.d.ts +0 -4
- package/dist/browser/find-up.js +0 -85
- package/dist/browser/page.d.ts +0 -74
- package/dist/browser/page.js +0 -283
- package/dist/browser/pkg-dir.d.ts +0 -3
- package/dist/browser/pkg-dir.js +0 -13
- package/dist/browser-log.d.ts.map +0 -1
- package/dist/browser-log.js.map +0 -1
- package/dist/calculate-ffmpeg-filters.d.ts.map +0 -1
- package/dist/calculate-ffmpeg-filters.js.map +0 -1
- package/dist/can-use-parallel-encoding.d.ts.map +0 -1
- package/dist/can-use-parallel-encoding.js.map +0 -1
- package/dist/chunk.d.ts.map +0 -1
- package/dist/chunk.js.map +0 -1
- package/dist/combine-videos.d.ts.map +0 -1
- package/dist/combine-videos.js.map +0 -1
- package/dist/convert-to-pcm.d.ts.map +0 -1
- package/dist/convert-to-pcm.js.map +0 -1
- package/dist/create-ffmpeg-complex-filter.d.ts.map +0 -1
- package/dist/create-ffmpeg-complex-filter.js.map +0 -1
- package/dist/create-ffmpeg-merge-filter.d.ts.map +0 -1
- package/dist/create-ffmpeg-merge-filter.js.map +0 -1
- package/dist/create-silent-audio.d.ts.map +0 -1
- package/dist/create-silent-audio.js.map +0 -1
- package/dist/cycle-browser-tabs.d.ts.map +0 -1
- package/dist/cycle-browser-tabs.js.map +0 -1
- package/dist/delay-render-embedded-stack.d.ts.map +0 -1
- package/dist/delay-render-embedded-stack.js.map +0 -1
- package/dist/delete-directory.d.ts.map +0 -1
- package/dist/delete-directory.js.map +0 -1
- package/dist/ensure-frames-in-order.d.ts.map +0 -1
- package/dist/ensure-frames-in-order.js.map +0 -1
- package/dist/ensure-output-directory.d.ts.map +0 -1
- package/dist/ensure-output-directory.js.map +0 -1
- package/dist/error-handling/handle-javascript-exception.d.ts.map +0 -1
- package/dist/error-handling/handle-javascript-exception.js.map +0 -1
- package/dist/error-handling/symbolicate-error.d.ts.map +0 -1
- package/dist/error-handling/symbolicate-error.js.map +0 -1
- package/dist/error-handling/symbolicateable-error.d.ts.map +0 -1
- package/dist/error-handling/symbolicateable-error.js.map +0 -1
- package/dist/ffmpeg-filter-file.d.ts.map +0 -1
- package/dist/ffmpeg-filter-file.js.map +0 -1
- package/dist/ffmpeg-flags.d.ts.map +0 -1
- package/dist/ffmpeg-flags.js.map +0 -1
- package/dist/get-audio-codec-name.d.ts.map +0 -1
- package/dist/get-audio-codec-name.js.map +0 -1
- package/dist/get-browser-instance.d.ts.map +0 -1
- package/dist/get-browser-instance.js.map +0 -1
- package/dist/get-codec-name.d.ts.map +0 -1
- package/dist/get-codec-name.js.map +0 -1
- package/dist/get-compositions.d.ts.map +0 -1
- package/dist/get-compositions.js.map +0 -1
- package/dist/get-concurrency.d.ts.map +0 -1
- package/dist/get-concurrency.js.map +0 -1
- package/dist/get-duration-from-frame-range.d.ts.map +0 -1
- package/dist/get-duration-from-frame-range.js.map +0 -1
- package/dist/get-duration-of-asset.d.ts +0 -7
- package/dist/get-duration-of-asset.js +0 -36
- package/dist/get-extension-from-codec.d.ts.map +0 -1
- package/dist/get-extension-from-codec.js.map +0 -1
- package/dist/get-format-for-codec.d.ts +0 -2
- package/dist/get-format-for-codec.js +0 -34
- package/dist/get-frame-to-render.d.ts.map +0 -1
- package/dist/get-frame-to-render.js.map +0 -1
- package/dist/get-local-browser-executable.d.ts.map +0 -1
- package/dist/get-local-browser-executable.js.map +0 -1
- package/dist/get-port.d.ts.map +0 -1
- package/dist/get-port.js.map +0 -1
- package/dist/get-prores-profile-name.d.ts.map +0 -1
- package/dist/get-prores-profile-name.js.map +0 -1
- package/dist/image-format.d.ts.map +0 -1
- package/dist/image-format.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/is-serve-url.d.ts.map +0 -1
- package/dist/is-serve-url.js.map +0 -1
- package/dist/is-vp9-video.d.ts +0 -3
- package/dist/is-vp9-video.js +0 -24
- package/dist/legacy-webpack-config.d.ts.map +0 -1
- package/dist/legacy-webpack-config.js.map +0 -1
- package/dist/make-assets-download-dir.d.ts.map +0 -1
- package/dist/make-assets-download-dir.js.map +0 -1
- package/dist/merge-audio-track.d.ts.map +0 -1
- package/dist/merge-audio-track.js.map +0 -1
- package/dist/normalize-serve-url.d.ts.map +0 -1
- package/dist/normalize-serve-url.js.map +0 -1
- package/dist/open-browser.d.ts.map +0 -1
- package/dist/open-browser.js.map +0 -1
- package/dist/p-limit.d.ts.map +0 -1
- package/dist/p-limit.js.map +0 -1
- package/dist/parse-browser-error-stack.d.ts.map +0 -1
- package/dist/parse-browser-error-stack.js.map +0 -1
- package/dist/parse-ffmpeg-progress.d.ts.map +0 -1
- package/dist/parse-ffmpeg-progress.js.map +0 -1
- package/dist/pool.d.ts.map +0 -1
- package/dist/pool.js.map +0 -1
- package/dist/prepare-server.d.ts.map +0 -1
- package/dist/prepare-server.js.map +0 -1
- package/dist/preprocess-audio-track.d.ts.map +0 -1
- package/dist/preprocess-audio-track.js.map +0 -1
- package/dist/prespawn-ffmpeg.d.ts.map +0 -1
- package/dist/prespawn-ffmpeg.js.map +0 -1
- package/dist/provide-screenshot.d.ts.map +0 -1
- package/dist/provide-screenshot.js.map +0 -1
- package/dist/puppeteer-evaluate.d.ts.map +0 -1
- package/dist/puppeteer-evaluate.js.map +0 -1
- package/dist/puppeteer-screenshot.d.ts.map +0 -1
- package/dist/puppeteer-screenshot.js.map +0 -1
- package/dist/render-frames.d.ts.map +0 -1
- package/dist/render-frames.js.map +0 -1
- package/dist/render-media.d.ts.map +0 -1
- package/dist/render-media.js.map +0 -1
- package/dist/render-still.d.ts.map +0 -1
- package/dist/render-still.js.map +0 -1
- package/dist/resolve-asset-src.d.ts.map +0 -1
- package/dist/resolve-asset-src.js.map +0 -1
- package/dist/sample-rate.d.ts.map +0 -1
- package/dist/sample-rate.js.map +0 -1
- package/dist/screenshot-dom-element.d.ts.map +0 -1
- package/dist/screenshot-dom-element.js.map +0 -1
- package/dist/screenshot-task.d.ts.map +0 -1
- package/dist/screenshot-task.js.map +0 -1
- package/dist/seek-to-frame.d.ts.map +0 -1
- package/dist/seek-to-frame.js.map +0 -1
- package/dist/serve-handler/glob-slash.d.ts +0 -1
- package/dist/serve-handler/glob-slash.js +0 -12
- package/dist/serve-static.d.ts.map +0 -1
- package/dist/serve-static.js.map +0 -1
- package/dist/set-props-and-env.d.ts.map +0 -1
- package/dist/set-props-and-env.js.map +0 -1
- package/dist/stitch-frames-to-video.d.ts.map +0 -1
- package/dist/stitch-frames-to-video.js.map +0 -1
- package/dist/stringify-ffmpeg-filter.d.ts.map +0 -1
- package/dist/stringify-ffmpeg-filter.js.map +0 -1
- package/dist/symbolicate-stacktrace.d.ts.map +0 -1
- package/dist/symbolicate-stacktrace.js.map +0 -1
- package/dist/tmp-dir.d.ts.map +0 -1
- package/dist/tmp-dir.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/validate-even-dimensions-with-codec.d.ts.map +0 -1
- package/dist/validate-even-dimensions-with-codec.js.map +0 -1
- package/dist/validate-ffmpeg.d.ts.map +0 -1
- package/dist/validate-ffmpeg.js.map +0 -1
- package/dist/validate-fps-for-gif.d.ts +0 -2
- package/dist/validate-fps-for-gif.js +0 -9
- package/dist/validate-puppeteer-timeout.d.ts.map +0 -1
- package/dist/validate-puppeteer-timeout.js.map +0 -1
- package/dist/validate-scale.d.ts.map +0 -1
- package/dist/validate-scale.js.map +0 -1
package/dist/render-media.js
CHANGED
|
@@ -8,7 +8,10 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
10
|
const remotion_1 = require("remotion");
|
|
11
|
+
const download_map_1 = require("./assets/download-map");
|
|
11
12
|
const can_use_parallel_encoding_1 = require("./can-use-parallel-encoding");
|
|
13
|
+
const crf_1 = require("./crf");
|
|
14
|
+
const delete_directory_1 = require("./delete-directory");
|
|
12
15
|
const ensure_frames_in_order_1 = require("./ensure-frames-in-order");
|
|
13
16
|
const ensure_output_directory_1 = require("./ensure-output-directory");
|
|
14
17
|
const get_duration_from_frame_range_1 = require("./get-duration-from-frame-range");
|
|
@@ -17,10 +20,12 @@ const get_extension_of_filename_1 = require("./get-extension-of-filename");
|
|
|
17
20
|
const get_frame_to_render_1 = require("./get-frame-to-render");
|
|
18
21
|
const legacy_webpack_config_1 = require("./legacy-webpack-config");
|
|
19
22
|
const make_cancel_signal_1 = require("./make-cancel-signal");
|
|
23
|
+
const overwrite_1 = require("./overwrite");
|
|
24
|
+
const perf_1 = require("./perf");
|
|
20
25
|
const prespawn_ffmpeg_1 = require("./prespawn-ffmpeg");
|
|
26
|
+
const quality_1 = require("./quality");
|
|
21
27
|
const render_frames_1 = require("./render-frames");
|
|
22
28
|
const stitch_frames_to_video_1 = require("./stitch-frames-to-video");
|
|
23
|
-
const tmp_dir_1 = require("./tmp-dir");
|
|
24
29
|
const validate_even_dimensions_with_codec_1 = require("./validate-even-dimensions-with-codec");
|
|
25
30
|
const validate_output_filename_1 = require("./validate-output-filename");
|
|
26
31
|
const validate_scale_1 = require("./validate-scale");
|
|
@@ -30,10 +35,10 @@ const validate_scale_1 = require("./validate-scale");
|
|
|
30
35
|
* @link https://www.remotion.dev/docs/renderer/render-media
|
|
31
36
|
*/
|
|
32
37
|
const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat, ffmpegExecutable, ffprobeExecutable, inputProps, pixelFormat, codec, envVariables, quality, frameRange, puppeteerInstance, outputLocation, onProgress, overwrite, onDownload, dumpBrowserLogs, onBrowserLog, onStart, timeoutInMilliseconds, chromiumOptions, scale, browserExecutable, port, cancelSignal, ...options }) => {
|
|
33
|
-
var _a, _b;
|
|
34
|
-
|
|
38
|
+
var _a, _b, _c;
|
|
39
|
+
(0, quality_1.validateQuality)(quality);
|
|
35
40
|
if (typeof crf !== 'undefined' && crf !== null) {
|
|
36
|
-
|
|
41
|
+
(0, crf_1.validateSelectedCrfAndCodecCombination)(crf, codec);
|
|
37
42
|
}
|
|
38
43
|
if (outputLocation) {
|
|
39
44
|
(0, validate_output_filename_1.validateOutputFilename)(codec, (0, get_extension_of_filename_1.getExtensionOfFilename)(outputLocation));
|
|
@@ -51,11 +56,11 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
|
|
|
51
56
|
let encodedDoneIn = null;
|
|
52
57
|
let cancelled = false;
|
|
53
58
|
const renderStart = Date.now();
|
|
54
|
-
const
|
|
59
|
+
const downloadMap = (_c = options.downloadMap) !== null && _c !== void 0 ? _c : (0, download_map_1.makeDownloadMap)();
|
|
55
60
|
const parallelEncoding = (0, can_use_parallel_encoding_1.canUseParallelEncoding)(codec);
|
|
56
61
|
const actualImageFormat = imageFormat !== null && imageFormat !== void 0 ? imageFormat : 'jpeg';
|
|
57
62
|
const preEncodedFileLocation = parallelEncoding
|
|
58
|
-
? path_1.default.join(
|
|
63
|
+
? path_1.default.join(downloadMap.preEncode, 'pre-encode.' + (0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec, 'chunk'))
|
|
59
64
|
: null;
|
|
60
65
|
const outputDir = parallelEncoding
|
|
61
66
|
? null
|
|
@@ -84,8 +89,9 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
|
|
|
84
89
|
});
|
|
85
90
|
const { waitForRightTimeOfFrameToBeInserted, setFrameToStitch, waitForFinish } = (0, ensure_frames_in_order_1.ensureFramesInOrder)(realFrameRange);
|
|
86
91
|
const fps = composition.fps / (everyNthFrame !== null && everyNthFrame !== void 0 ? everyNthFrame : 1);
|
|
87
|
-
remotion_1.Internals.validateFps(fps, 'in "renderMedia()"', codec);
|
|
92
|
+
remotion_1.Internals.validateFps(fps, 'in "renderMedia()"', codec === 'gif');
|
|
88
93
|
const createPrestitcherIfNecessary = async () => {
|
|
94
|
+
var _a;
|
|
89
95
|
if (preEncodedFileLocation) {
|
|
90
96
|
preStitcher = await (0, prespawn_ffmpeg_1.prespawnFfmpeg)({
|
|
91
97
|
width: composition.width * (scale !== null && scale !== void 0 ? scale : 1),
|
|
@@ -100,7 +106,7 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
|
|
|
100
106
|
encodedFrames = frame;
|
|
101
107
|
callUpdate();
|
|
102
108
|
},
|
|
103
|
-
verbose:
|
|
109
|
+
verbose: (_a = options.verbose) !== null && _a !== void 0 ? _a : false,
|
|
104
110
|
ffmpegExecutable,
|
|
105
111
|
imageFormat: actualImageFormat,
|
|
106
112
|
signal: cancelPrestitcher.cancelSignal,
|
|
@@ -150,9 +156,9 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
|
|
|
150
156
|
if (cancelled) {
|
|
151
157
|
return;
|
|
152
158
|
}
|
|
153
|
-
const id =
|
|
159
|
+
const id = (0, perf_1.startPerfMeasure)('piping');
|
|
154
160
|
(_a = stitcherFfmpeg === null || stitcherFfmpeg === void 0 ? void 0 : stitcherFfmpeg.stdin) === null || _a === void 0 ? void 0 : _a.write(buffer);
|
|
155
|
-
|
|
161
|
+
(0, perf_1.stopPerfMeasure)(id);
|
|
156
162
|
setFrameToStitch(Math.min(realFrameRange[1] + 1, frame + everyNthFrame));
|
|
157
163
|
}
|
|
158
164
|
: undefined,
|
|
@@ -168,6 +174,7 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
|
|
|
168
174
|
browserExecutable,
|
|
169
175
|
port,
|
|
170
176
|
cancelSignal: cancelRenderFrames.cancelSignal,
|
|
177
|
+
downloadMap,
|
|
171
178
|
});
|
|
172
179
|
return renderFramesProc;
|
|
173
180
|
})
|
|
@@ -191,7 +198,7 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
|
|
|
191
198
|
preEncodedFileLocation,
|
|
192
199
|
imageFormat: actualImageFormat,
|
|
193
200
|
},
|
|
194
|
-
force: overwrite !== null && overwrite !== void 0 ? overwrite :
|
|
201
|
+
force: overwrite !== null && overwrite !== void 0 ? overwrite : overwrite_1.DEFAULT_OVERWRITE,
|
|
195
202
|
pixelFormat,
|
|
196
203
|
codec,
|
|
197
204
|
proResProfile,
|
|
@@ -206,7 +213,7 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
|
|
|
206
213
|
},
|
|
207
214
|
onDownload,
|
|
208
215
|
numberOfGifLoops,
|
|
209
|
-
verbose:
|
|
216
|
+
verbose: options.verbose,
|
|
210
217
|
dir: outputDir !== null && outputDir !== void 0 ? outputDir : undefined,
|
|
211
218
|
cancelSignal: cancelStitcher.cancelSignal,
|
|
212
219
|
}),
|
|
@@ -245,7 +252,11 @@ const renderMedia = ({ parallelism, proResProfile, crf, composition, imageFormat
|
|
|
245
252
|
.finally(() => {
|
|
246
253
|
if (preEncodedFileLocation !== null &&
|
|
247
254
|
fs_1.default.existsSync(preEncodedFileLocation)) {
|
|
248
|
-
|
|
255
|
+
(0, delete_directory_1.deleteDirectory)(path_1.default.dirname(preEncodedFileLocation));
|
|
256
|
+
}
|
|
257
|
+
// Clean download map if it was not passed in
|
|
258
|
+
if (!(options === null || options === void 0 ? void 0 : options.downloadMap)) {
|
|
259
|
+
(0, download_map_1.cleanDownloadMap)(downloadMap);
|
|
249
260
|
}
|
|
250
261
|
});
|
|
251
262
|
return Promise.race([
|
package/dist/render-still.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SmallTCompMetadata } from 'remotion';
|
|
2
2
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
3
|
+
import type { DownloadMap } from './assets/download-map';
|
|
4
|
+
import type { BrowserExecutable } from './browser-executable';
|
|
3
5
|
import type { Browser as PuppeteerBrowser } from './browser/Browser';
|
|
6
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
7
|
+
import type { StillImageFormat } from './image-format';
|
|
4
8
|
import type { ServeUrlOrWebpackBundle } from './legacy-webpack-config';
|
|
5
9
|
import type { CancelSignal } from './make-cancel-signal';
|
|
6
10
|
import type { ChromiumOptions } from './open-browser';
|
|
@@ -23,6 +27,10 @@ declare type InnerStillOptions = {
|
|
|
23
27
|
cancelSignal?: CancelSignal;
|
|
24
28
|
ffmpegExecutable?: FfmpegExecutable;
|
|
25
29
|
ffprobeExecutable?: FfmpegExecutable;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Only for Remotion internal usage
|
|
32
|
+
*/
|
|
33
|
+
downloadMap?: DownloadMap;
|
|
26
34
|
};
|
|
27
35
|
declare type RenderStillOptions = InnerStillOptions & ServeUrlOrWebpackBundle & {
|
|
28
36
|
port?: number | null;
|
package/dist/render-still.js
CHANGED
|
@@ -30,25 +30,29 @@ exports.renderStill = void 0;
|
|
|
30
30
|
const fs_1 = __importStar(require("fs"));
|
|
31
31
|
const path_1 = __importDefault(require("path"));
|
|
32
32
|
const remotion_1 = require("remotion");
|
|
33
|
+
const download_map_1 = require("./assets/download-map");
|
|
34
|
+
const browser_1 = require("./browser");
|
|
33
35
|
const ensure_output_directory_1 = require("./ensure-output-directory");
|
|
34
36
|
const handle_javascript_exception_1 = require("./error-handling/handle-javascript-exception");
|
|
37
|
+
const image_format_1 = require("./image-format");
|
|
35
38
|
const legacy_webpack_config_1 = require("./legacy-webpack-config");
|
|
36
|
-
const make_assets_download_dir_1 = require("./make-assets-download-dir");
|
|
37
39
|
const open_browser_1 = require("./open-browser");
|
|
38
40
|
const prepare_server_1 = require("./prepare-server");
|
|
39
41
|
const provide_screenshot_1 = require("./provide-screenshot");
|
|
40
42
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
43
|
+
const quality_1 = require("./quality");
|
|
41
44
|
const seek_to_frame_1 = require("./seek-to-frame");
|
|
42
45
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
46
|
+
const validate_frame_1 = require("./validate-frame");
|
|
43
47
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
44
48
|
const validate_scale_1 = require("./validate-scale");
|
|
45
49
|
const innerRenderStill = async ({ composition, quality, imageFormat = 'png', serveUrl, puppeteerInstance, dumpBrowserLogs = false, onError, inputProps, envVariables, output, frame = 0, overwrite = true, browserExecutable, timeoutInMilliseconds, chromiumOptions, scale, proxyPort, cancelSignal, }) => {
|
|
46
50
|
remotion_1.Internals.validateDimension(composition.height, 'height', 'in the `config` object passed to `renderStill()`');
|
|
47
51
|
remotion_1.Internals.validateDimension(composition.width, 'width', 'in the `config` object passed to `renderStill()`');
|
|
48
|
-
remotion_1.Internals.validateFps(composition.fps, 'in the `config` object of `renderStill()`',
|
|
52
|
+
remotion_1.Internals.validateFps(composition.fps, 'in the `config` object of `renderStill()`', false);
|
|
49
53
|
remotion_1.Internals.validateDurationInFrames(composition.durationInFrames, 'in the `config` object passed to `renderStill()`');
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
(0, image_format_1.validateNonNullImageFormat)(imageFormat);
|
|
55
|
+
(0, validate_frame_1.validateFrame)(frame, composition.durationInFrames);
|
|
52
56
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
53
57
|
(0, validate_scale_1.validateScale)(scale);
|
|
54
58
|
if (typeof output !== 'string') {
|
|
@@ -58,7 +62,7 @@ const innerRenderStill = async ({ composition, quality, imageFormat = 'png', ser
|
|
|
58
62
|
if (quality !== undefined && imageFormat !== 'jpeg') {
|
|
59
63
|
throw new Error("You can only pass the `quality` option if `imageFormat` is 'jpeg'.");
|
|
60
64
|
}
|
|
61
|
-
|
|
65
|
+
(0, quality_1.validateQuality)(quality);
|
|
62
66
|
if (fs_1.default.existsSync(output)) {
|
|
63
67
|
if (!overwrite) {
|
|
64
68
|
throw new Error(`Cannot render still - "overwrite" option was set to false, but the output destination ${output} already exists.`);
|
|
@@ -69,7 +73,7 @@ const innerRenderStill = async ({ composition, quality, imageFormat = 'png', ser
|
|
|
69
73
|
}
|
|
70
74
|
}
|
|
71
75
|
(0, ensure_output_directory_1.ensureOutputDirectory)(output);
|
|
72
|
-
const browserInstance = puppeteerInstance !== null && puppeteerInstance !== void 0 ? puppeteerInstance : (await (0, open_browser_1.openBrowser)(
|
|
76
|
+
const browserInstance = puppeteerInstance !== null && puppeteerInstance !== void 0 ? puppeteerInstance : (await (0, open_browser_1.openBrowser)(browser_1.DEFAULT_BROWSER, {
|
|
73
77
|
browserExecutable,
|
|
74
78
|
shouldDumpIo: dumpBrowserLogs,
|
|
75
79
|
chromiumOptions,
|
|
@@ -143,22 +147,22 @@ const innerRenderStill = async ({ composition, quality, imageFormat = 'png', ser
|
|
|
143
147
|
* @link https://www.remotion.dev/docs/renderer/render-still
|
|
144
148
|
*/
|
|
145
149
|
const renderStill = (options) => {
|
|
146
|
-
var _a;
|
|
150
|
+
var _a, _b;
|
|
147
151
|
const selectedServeUrl = (0, legacy_webpack_config_1.getServeUrlWithFallback)(options);
|
|
148
|
-
const
|
|
149
|
-
const onDownload = (
|
|
152
|
+
const downloadMap = (_a = options.downloadMap) !== null && _a !== void 0 ? _a : (0, download_map_1.makeDownloadMap)();
|
|
153
|
+
const onDownload = (_b = options.onDownload) !== null && _b !== void 0 ? _b : (() => () => undefined);
|
|
150
154
|
const happyPath = new Promise((resolve, reject) => {
|
|
151
155
|
var _a, _b, _c;
|
|
152
156
|
const onError = (err) => reject(err);
|
|
153
157
|
let close = null;
|
|
154
158
|
(0, prepare_server_1.prepareServer)({
|
|
155
159
|
webpackConfigOrServeUrl: selectedServeUrl,
|
|
156
|
-
downloadDir,
|
|
157
160
|
onDownload,
|
|
158
161
|
onError,
|
|
159
162
|
ffmpegExecutable: (_a = options.ffmpegExecutable) !== null && _a !== void 0 ? _a : null,
|
|
160
163
|
ffprobeExecutable: (_b = options.ffprobeExecutable) !== null && _b !== void 0 ? _b : null,
|
|
161
164
|
port: (_c = options.port) !== null && _c !== void 0 ? _c : null,
|
|
165
|
+
downloadMap,
|
|
162
166
|
})
|
|
163
167
|
.then(({ serveUrl, closeServer, offthreadPort }) => {
|
|
164
168
|
close = closeServer;
|
|
@@ -171,7 +175,13 @@ const renderStill = (options) => {
|
|
|
171
175
|
})
|
|
172
176
|
.then((res) => resolve(res))
|
|
173
177
|
.catch((err) => reject(err))
|
|
174
|
-
.finally(() =>
|
|
178
|
+
.finally(() => {
|
|
179
|
+
// Clean download map if it was not passed in
|
|
180
|
+
if (!(options === null || options === void 0 ? void 0 : options.downloadMap)) {
|
|
181
|
+
(0, download_map_1.cleanDownloadMap)(downloadMap);
|
|
182
|
+
}
|
|
183
|
+
return close === null || close === void 0 ? void 0 : close();
|
|
184
|
+
});
|
|
175
185
|
});
|
|
176
186
|
return Promise.race([
|
|
177
187
|
happyPath,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { ImageFormat } from 'remotion';
|
|
3
2
|
import type { Page } from './browser/BrowserPage';
|
|
3
|
+
import type { ImageFormat } from './image-format';
|
|
4
4
|
export declare const screenshotDOMElement: ({ page, imageFormat, quality, opts, }: {
|
|
5
5
|
page: Page;
|
|
6
6
|
imageFormat: ImageFormat;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { StillImageFormat } from 'remotion';
|
|
3
2
|
import type { Page } from './browser/BrowserPage';
|
|
4
3
|
import type { ScreenshotOptions } from './browser/ScreenshotOptions';
|
|
4
|
+
import type { StillImageFormat } from './image-format';
|
|
5
5
|
export declare const _screenshotTask: (page: Page, format: StillImageFormat, options: ScreenshotOptions) => Promise<Buffer | string>;
|
package/dist/screenshot-task.js
CHANGED
|
@@ -5,35 +5,35 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports._screenshotTask = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const
|
|
8
|
+
const perf_1 = require("./perf");
|
|
9
9
|
const _screenshotTask = async (page, format, options) => {
|
|
10
10
|
const client = page._client();
|
|
11
11
|
const target = page.target();
|
|
12
|
-
const perfTarget =
|
|
12
|
+
const perfTarget = (0, perf_1.startPerfMeasure)('activate-target');
|
|
13
13
|
await client.send('Target.activateTarget', {
|
|
14
14
|
targetId: target._targetId,
|
|
15
15
|
});
|
|
16
|
-
|
|
16
|
+
(0, perf_1.stopPerfMeasure)(perfTarget);
|
|
17
17
|
const shouldSetDefaultBackground = options.omitBackground && format === 'png';
|
|
18
18
|
if (shouldSetDefaultBackground)
|
|
19
19
|
await client.send('Emulation.setDefaultBackgroundColorOverride', {
|
|
20
20
|
color: { r: 0, g: 0, b: 0, a: 0 },
|
|
21
21
|
});
|
|
22
|
-
const cap =
|
|
22
|
+
const cap = (0, perf_1.startPerfMeasure)('capture');
|
|
23
23
|
const result = await client.send('Page.captureScreenshot', {
|
|
24
24
|
format,
|
|
25
25
|
quality: options.quality,
|
|
26
26
|
clip: undefined,
|
|
27
27
|
captureBeyondViewport: true,
|
|
28
28
|
});
|
|
29
|
-
|
|
29
|
+
(0, perf_1.stopPerfMeasure)(cap);
|
|
30
30
|
if (shouldSetDefaultBackground)
|
|
31
31
|
await client.send('Emulation.setDefaultBackgroundColorOverride');
|
|
32
|
-
const saveMarker =
|
|
32
|
+
const saveMarker = (0, perf_1.startPerfMeasure)('save');
|
|
33
33
|
const buffer = Buffer.from(result.data, 'base64');
|
|
34
34
|
if (options.path)
|
|
35
35
|
await fs_1.default.promises.writeFile(options.path, buffer);
|
|
36
|
-
|
|
36
|
+
(0, perf_1.stopPerfMeasure)(saveMarker);
|
|
37
37
|
return buffer;
|
|
38
38
|
};
|
|
39
39
|
exports._screenshotTask = _screenshotTask;
|
package/dist/serve-static.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type { FfmpegExecutable } from 'remotion';
|
|
2
1
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
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;
|
|
5
6
|
ffmpegExecutable: FfmpegExecutable;
|
|
6
7
|
ffprobeExecutable: FfmpegExecutable;
|
|
7
|
-
downloadDir: string;
|
|
8
8
|
onDownload: RenderMediaOnDownload;
|
|
9
9
|
onError: (err: Error) => void;
|
|
10
|
+
downloadMap: DownloadMap;
|
|
10
11
|
}) => Promise<{
|
|
11
12
|
port: number;
|
|
12
13
|
close: () => Promise<void>;
|
package/dist/serve-static.js
CHANGED
|
@@ -5,19 +5,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.serveStatic = void 0;
|
|
7
7
|
const http_1 = __importDefault(require("http"));
|
|
8
|
-
const remotion_1 = require("remotion");
|
|
9
8
|
const get_port_1 = require("./get-port");
|
|
10
9
|
const offthread_video_server_1 = require("./offthread-video-server");
|
|
11
10
|
const serve_handler_1 = require("./serve-handler");
|
|
12
11
|
const serveStatic = async (path, options) => {
|
|
13
|
-
var _a
|
|
14
|
-
const port = await (0, get_port_1.getDesiredPort)((
|
|
12
|
+
var _a;
|
|
13
|
+
const port = await (0, get_port_1.getDesiredPort)((_a = options === null || options === void 0 ? void 0 : options.port) !== null && _a !== void 0 ? _a : undefined, 3000, 3100);
|
|
15
14
|
const offthreadRequest = (0, offthread_video_server_1.startOffthreadVideoServer)({
|
|
16
15
|
ffmpegExecutable: options.ffmpegExecutable,
|
|
17
16
|
ffprobeExecutable: options.ffprobeExecutable,
|
|
18
|
-
downloadDir: options.downloadDir,
|
|
19
17
|
onDownload: options.onDownload,
|
|
20
18
|
onError: options.onError,
|
|
19
|
+
downloadMap: options.downloadMap,
|
|
21
20
|
});
|
|
22
21
|
try {
|
|
23
22
|
const server = http_1.default
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setPropsAndEnv = void 0;
|
|
4
|
-
const
|
|
4
|
+
const TimeoutSettings_1 = require("./browser/TimeoutSettings");
|
|
5
5
|
const normalize_serve_url_1 = require("./normalize-serve-url");
|
|
6
6
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
7
7
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
8
8
|
const setPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, initialFrame, timeoutInMilliseconds, proxyPort, retriesRemaining, }) => {
|
|
9
9
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
10
|
-
const actualTimeout = timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds :
|
|
10
|
+
const actualTimeout = timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : TimeoutSettings_1.DEFAULT_TIMEOUT;
|
|
11
11
|
page.setDefaultTimeout(actualTimeout);
|
|
12
12
|
page.setDefaultNavigationTimeout(actualTimeout);
|
|
13
13
|
const urlToVisit = (0, normalize_serve_url_1.normalizeServeUrl)(serveUrl);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import type { Codec, FfmpegExecutable, ImageFormat, PixelFormat, ProResProfile, RenderAssetInfo } from 'remotion';
|
|
3
2
|
import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
|
|
3
|
+
import type { RenderAssetInfo } from './assets/download-map';
|
|
4
|
+
import type { Codec } from './codec';
|
|
5
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
6
|
+
import type { ImageFormat } from './image-format';
|
|
4
7
|
import type { CancelSignal } from './make-cancel-signal';
|
|
8
|
+
import type { PixelFormat } from './pixel-format';
|
|
9
|
+
import type { ProResProfile } from './prores-profile';
|
|
5
10
|
export declare type StitcherOptions = {
|
|
6
11
|
fps: number;
|
|
7
12
|
width: number;
|
|
@@ -1,42 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.stitchFramesToVideo = exports.spawnFfmpeg = void 0;
|
|
30
7
|
const execa_1 = __importDefault(require("execa"));
|
|
31
|
-
const fs_1 =
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
32
9
|
const promises_1 = require("fs/promises");
|
|
33
10
|
const path_1 = __importDefault(require("path"));
|
|
34
11
|
const remotion_1 = require("remotion");
|
|
35
12
|
const calculate_asset_positions_1 = require("./assets/calculate-asset-positions");
|
|
36
13
|
const convert_assets_to_file_urls_1 = require("./assets/convert-assets-to-file-urls");
|
|
37
14
|
const download_and_map_assets_to_file_1 = require("./assets/download-and-map-assets-to-file");
|
|
15
|
+
const codec_1 = require("./codec");
|
|
38
16
|
const codec_supports_media_1 = require("./codec-supports-media");
|
|
39
17
|
const convert_number_of_gif_loops_to_ffmpeg_1 = require("./convert-number-of-gif-loops-to-ffmpeg");
|
|
18
|
+
const crf_1 = require("./crf");
|
|
40
19
|
const delete_directory_1 = require("./delete-directory");
|
|
41
20
|
const get_audio_codec_name_1 = require("./get-audio-codec-name");
|
|
42
21
|
const get_codec_name_1 = require("./get-codec-name");
|
|
@@ -44,32 +23,32 @@ const get_extension_from_codec_1 = require("./get-extension-from-codec");
|
|
|
44
23
|
const get_prores_profile_name_1 = require("./get-prores-profile-name");
|
|
45
24
|
const merge_audio_track_1 = require("./merge-audio-track");
|
|
46
25
|
const parse_ffmpeg_progress_1 = require("./parse-ffmpeg-progress");
|
|
26
|
+
const pixel_format_1 = require("./pixel-format");
|
|
47
27
|
const preprocess_audio_track_1 = require("./preprocess-audio-track");
|
|
48
|
-
const
|
|
28
|
+
const truthy_1 = require("./truthy");
|
|
49
29
|
const validate_even_dimensions_with_codec_1 = require("./validate-even-dimensions-with-codec");
|
|
50
30
|
const validate_ffmpeg_1 = require("./validate-ffmpeg");
|
|
51
31
|
const packageJsonPath = path_1.default.join(__dirname, '..', 'package.json');
|
|
52
32
|
const packageJson = fs_1.default.existsSync(packageJsonPath)
|
|
53
33
|
? JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8'))
|
|
54
34
|
: null;
|
|
55
|
-
const getAssetsData = async ({ assets,
|
|
35
|
+
const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose, ffmpegExecutable, ffprobeExecutable, onProgress, downloadMap, }) => {
|
|
56
36
|
const fileUrlAssets = await (0, convert_assets_to_file_urls_1.convertAssetsToFileUrls)({
|
|
57
37
|
assets,
|
|
58
|
-
downloadDir,
|
|
59
38
|
onDownload: onDownload !== null && onDownload !== void 0 ? onDownload : (() => () => undefined),
|
|
39
|
+
downloadMap,
|
|
60
40
|
});
|
|
61
|
-
(0, download_and_map_assets_to_file_1.markAllAssetsAsDownloaded)();
|
|
41
|
+
(0, download_and_map_assets_to_file_1.markAllAssetsAsDownloaded)(downloadMap);
|
|
62
42
|
const assetPositions = (0, calculate_asset_positions_1.calculateAssetPositions)(fileUrlAssets);
|
|
63
43
|
if (verbose) {
|
|
64
44
|
console.log('asset positions', assetPositions);
|
|
65
45
|
}
|
|
66
|
-
const tempPath = (0, tmp_dir_1.tmpDir)('remotion-audio-mixing');
|
|
67
46
|
const preprocessProgress = new Array(assetPositions.length).fill(0);
|
|
68
47
|
const updateProgress = () => {
|
|
69
48
|
onProgress(preprocessProgress.reduce((a, b) => a + b, 0) / assetPositions.length);
|
|
70
49
|
};
|
|
71
50
|
const preprocessed = (await Promise.all(assetPositions.map(async (asset, index) => {
|
|
72
|
-
const filterFile = path_1.default.join(
|
|
51
|
+
const filterFile = path_1.default.join(downloadMap.audioMixing, `${index}.wav`);
|
|
73
52
|
const result = await (0, preprocess_audio_track_1.preprocessAudioTrack)({
|
|
74
53
|
ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
|
|
75
54
|
ffprobeExecutable: ffprobeExecutable !== null && ffprobeExecutable !== void 0 ? ffprobeExecutable : null,
|
|
@@ -77,19 +56,21 @@ const getAssetsData = async ({ assets, downloadDir, onDownload, fps, expectedFra
|
|
|
77
56
|
asset,
|
|
78
57
|
expectedFrames,
|
|
79
58
|
fps,
|
|
59
|
+
downloadMap,
|
|
80
60
|
});
|
|
81
61
|
preprocessProgress[index] = 1;
|
|
82
62
|
updateProgress();
|
|
83
63
|
return result;
|
|
84
|
-
}))).filter(
|
|
85
|
-
const outName = path_1.default.join(
|
|
64
|
+
}))).filter(truthy_1.truthy);
|
|
65
|
+
const outName = path_1.default.join(downloadMap.audioPreprocessing, `audio.wav`);
|
|
86
66
|
await (0, merge_audio_track_1.mergeAudioTrack)({
|
|
87
67
|
ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
|
|
88
68
|
files: preprocessed,
|
|
89
69
|
outName,
|
|
90
70
|
numberOfSeconds: Number((expectedFrames / fps).toFixed(3)),
|
|
71
|
+
downloadMap,
|
|
91
72
|
});
|
|
92
|
-
(0, delete_directory_1.deleteDirectory)(
|
|
73
|
+
(0, delete_directory_1.deleteDirectory)(downloadMap.audioMixing);
|
|
93
74
|
onProgress(1);
|
|
94
75
|
preprocessed.forEach((p) => {
|
|
95
76
|
(0, delete_directory_1.deleteDirectory)(p);
|
|
@@ -100,16 +81,16 @@ const spawnFfmpeg = async (options) => {
|
|
|
100
81
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
101
82
|
remotion_1.Internals.validateDimension(options.height, 'height', 'passed to `stitchFramesToVideo()`');
|
|
102
83
|
remotion_1.Internals.validateDimension(options.width, 'width', 'passed to `stitchFramesToVideo()`');
|
|
103
|
-
const codec = (_a = options.codec) !== null && _a !== void 0 ? _a :
|
|
84
|
+
const codec = (_a = options.codec) !== null && _a !== void 0 ? _a : codec_1.DEFAULT_CODEC;
|
|
104
85
|
(0, validate_even_dimensions_with_codec_1.validateEvenDimensionsWithCodec)({
|
|
105
86
|
width: options.width,
|
|
106
87
|
height: options.height,
|
|
107
88
|
codec,
|
|
108
89
|
scale: 1,
|
|
109
90
|
});
|
|
110
|
-
remotion_1.Internals.validateFps(options.fps, 'in `stitchFramesToVideo()`',
|
|
111
|
-
const crf = (_b = options.crf) !== null && _b !== void 0 ? _b :
|
|
112
|
-
const pixelFormat = (_c = options.pixelFormat) !== null && _c !== void 0 ? _c :
|
|
91
|
+
remotion_1.Internals.validateFps(options.fps, 'in `stitchFramesToVideo()`', false);
|
|
92
|
+
const crf = (_b = options.crf) !== null && _b !== void 0 ? _b : (0, crf_1.getDefaultCrfForCodec)(codec);
|
|
93
|
+
const pixelFormat = (_c = options.pixelFormat) !== null && _c !== void 0 ? _c : pixel_format_1.DEFAULT_PIXEL_FORMAT;
|
|
113
94
|
await (0, validate_ffmpeg_1.validateFfmpeg)((_d = options.ffmpegExecutable) !== null && _d !== void 0 ? _d : null);
|
|
114
95
|
const encoderName = (0, get_codec_name_1.getCodecName)(codec);
|
|
115
96
|
const audioCodecName = (0, get_audio_codec_name_1.getAudioCodecName)(codec);
|
|
@@ -118,7 +99,7 @@ const spawnFfmpeg = async (options) => {
|
|
|
118
99
|
const supportsCrf = encoderName && codec !== 'prores';
|
|
119
100
|
const tempFile = options.outputLocation
|
|
120
101
|
? null
|
|
121
|
-
: path_1.default.join(
|
|
102
|
+
: path_1.default.join(options.assetsInfo.downloadMap.stitchFrames, `out.${(0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec, 'final')}`);
|
|
122
103
|
if (options.verbose) {
|
|
123
104
|
console.log('[verbose] ffmpeg', (_e = options.ffmpegExecutable) !== null && _e !== void 0 ? _e : 'ffmpeg in PATH');
|
|
124
105
|
console.log('[verbose] encoder', encoderName);
|
|
@@ -131,8 +112,8 @@ const spawnFfmpeg = async (options) => {
|
|
|
131
112
|
console.log('[verbose] isAudioOnly', mediaSupport.audio && !mediaSupport.video);
|
|
132
113
|
console.log('[verbose] proResProfileName', proResProfileName);
|
|
133
114
|
}
|
|
134
|
-
|
|
135
|
-
|
|
115
|
+
(0, crf_1.validateSelectedCrfAndCodecCombination)(crf, codec);
|
|
116
|
+
(0, pixel_format_1.validateSelectedPixelFormatAndCodecCombination)(pixelFormat, codec);
|
|
136
117
|
const expectedFrames = options.assetsInfo.assets.length;
|
|
137
118
|
const updateProgress = (preStitchProgress, muxProgress) => {
|
|
138
119
|
var _a;
|
|
@@ -142,7 +123,6 @@ const spawnFfmpeg = async (options) => {
|
|
|
142
123
|
const audio = mediaSupport.audio
|
|
143
124
|
? await getAssetsData({
|
|
144
125
|
assets: options.assetsInfo.assets,
|
|
145
|
-
downloadDir: options.assetsInfo.downloadDir,
|
|
146
126
|
onDownload: options.onDownload,
|
|
147
127
|
fps: options.fps,
|
|
148
128
|
expectedFrames,
|
|
@@ -150,6 +130,7 @@ const spawnFfmpeg = async (options) => {
|
|
|
150
130
|
ffmpegExecutable: (_g = options.ffmpegExecutable) !== null && _g !== void 0 ? _g : null,
|
|
151
131
|
ffprobeExecutable: (_h = options.ffprobeExecutable) !== null && _h !== void 0 ? _h : null,
|
|
152
132
|
onProgress: (prog) => updateProgress(prog, 0),
|
|
133
|
+
downloadMap: options.assetsInfo.downloadMap,
|
|
153
134
|
})
|
|
154
135
|
: null;
|
|
155
136
|
if (mediaSupport.audio && !mediaSupport.video) {
|
|
@@ -179,7 +160,6 @@ const spawnFfmpeg = async (options) => {
|
|
|
179
160
|
if (tempFile) {
|
|
180
161
|
(0, promises_1.readFile)(tempFile)
|
|
181
162
|
.then((f) => {
|
|
182
|
-
(0, fs_1.unlinkSync)(tempFile);
|
|
183
163
|
return resolve(f);
|
|
184
164
|
})
|
|
185
165
|
.catch((e) => reject(e));
|
|
@@ -188,6 +168,7 @@ const spawnFfmpeg = async (options) => {
|
|
|
188
168
|
resolve(null);
|
|
189
169
|
}
|
|
190
170
|
});
|
|
171
|
+
await (0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.stitchFrames);
|
|
191
172
|
return {
|
|
192
173
|
getLogs: () => '',
|
|
193
174
|
task: Promise.resolve(file),
|
|
@@ -275,12 +256,18 @@ const spawnFfmpeg = async (options) => {
|
|
|
275
256
|
});
|
|
276
257
|
return {
|
|
277
258
|
task: task.then(() => {
|
|
259
|
+
(0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.audioPreprocessing);
|
|
278
260
|
if (tempFile === null) {
|
|
261
|
+
(0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.stitchFrames);
|
|
279
262
|
return null;
|
|
280
263
|
}
|
|
281
264
|
return (0, promises_1.readFile)(tempFile)
|
|
282
265
|
.then((file) => {
|
|
283
|
-
return Promise.all([
|
|
266
|
+
return Promise.all([
|
|
267
|
+
file,
|
|
268
|
+
(0, delete_directory_1.deleteDirectory)(path_1.default.dirname(tempFile)),
|
|
269
|
+
(0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.stitchFrames),
|
|
270
|
+
]);
|
|
284
271
|
})
|
|
285
272
|
.then(([file]) => file);
|
|
286
273
|
}),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.stringifyFfmpegFilter = void 0;
|
|
4
|
-
const remotion_1 = require("remotion");
|
|
5
4
|
const calculate_atempo_1 = require("./assets/calculate-atempo");
|
|
6
5
|
const ffmpeg_volume_expression_1 = require("./assets/ffmpeg-volume-expression");
|
|
7
6
|
const sample_rate_1 = require("./sample-rate");
|
|
7
|
+
const truthy_1 = require("./truthy");
|
|
8
8
|
const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, volume, fps, playbackRate, durationInFrames, assetDuration, }) => {
|
|
9
9
|
const startInVideoSeconds = startInVideo / fps;
|
|
10
10
|
if (assetDuration && trimLeft >= assetDuration) {
|
|
@@ -50,7 +50,7 @@ const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, vo
|
|
|
50
50
|
? 'apad=pad_len=' + Math.round(padAtEnd * sample_rate_1.DEFAULT_SAMPLE_RATE)
|
|
51
51
|
: null,
|
|
52
52
|
]
|
|
53
|
-
.filter(
|
|
53
|
+
.filter(truthy_1.truthy)
|
|
54
54
|
.join(',') +
|
|
55
55
|
`[a0]`);
|
|
56
56
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.symbolicateStackTrace = void 0;
|
|
4
|
-
const remotion_1 = require("remotion");
|
|
5
4
|
const source_map_1 = require("source-map");
|
|
6
5
|
const read_file_1 = require("./assets/read-file");
|
|
6
|
+
const truthy_1 = require("./truthy");
|
|
7
7
|
function extractSourceMapUrl(fileContents) {
|
|
8
8
|
const regex = /\/\/[#@] ?sourceMappingURL=([^\s'"]+)\s*$/gm;
|
|
9
9
|
let match = null;
|
|
@@ -74,7 +74,7 @@ const symbolicateStackTrace = async (frames) => {
|
|
|
74
74
|
...new Set(frames
|
|
75
75
|
.map((f) => f.fileName)
|
|
76
76
|
.filter((f) => f.startsWith('http://') || f.startsWith('https://'))
|
|
77
|
-
.filter(
|
|
77
|
+
.filter(truthy_1.truthy)),
|
|
78
78
|
];
|
|
79
79
|
const maps = await Promise.all(uniqueFileNames.map(async (fileName) => {
|
|
80
80
|
const fileContents = await fetchUrl(fileName);
|
|
@@ -105,6 +105,6 @@ const symbolicateStackTrace = async (frames) => {
|
|
|
105
105
|
originalScriptCode: scriptCode,
|
|
106
106
|
};
|
|
107
107
|
})
|
|
108
|
-
.filter(
|
|
108
|
+
.filter(truthy_1.truthy);
|
|
109
109
|
};
|
|
110
110
|
exports.symbolicateStackTrace = symbolicateStackTrace;
|
package/dist/truthy.d.ts
ADDED