@remotion/renderer 4.0.0-defer.6 → 4.0.0-esm.17
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/LICENSE.md +8 -8
- package/README.md +47 -0
- package/dist/assets/calculate-asset-positions.d.ts +2 -2
- package/dist/assets/calculate-asset-positions.js +1 -0
- package/dist/assets/calculate-atempo.d.ts +0 -0
- package/dist/assets/calculate-atempo.js +0 -0
- package/dist/assets/convert-assets-to-file-urls.d.ts +5 -4
- package/dist/assets/convert-assets-to-file-urls.js +2 -2
- package/dist/assets/download-and-map-assets-to-file.d.ts +16 -12
- package/dist/assets/download-and-map-assets-to-file.js +145 -65
- package/dist/assets/download-file.d.ts +13 -6
- package/dist/assets/download-file.js +64 -8
- package/dist/assets/download-map.d.ts +69 -0
- package/dist/assets/download-map.js +77 -0
- package/dist/assets/ffmpeg-volume-expression.d.ts +3 -3
- package/dist/assets/ffmpeg-volume-expression.js +6 -5
- package/dist/assets/flatten-volume-array.d.ts +1 -1
- package/dist/assets/flatten-volume-array.js +0 -0
- package/dist/assets/get-audio-channels.d.ts +3 -5
- package/dist/assets/get-audio-channels.js +15 -4
- package/dist/assets/get-video-stream-duration.d.ts +9 -0
- package/dist/assets/get-video-stream-duration.js +71 -0
- package/dist/assets/read-file.d.ts +0 -0
- package/dist/assets/read-file.js +2 -1
- package/dist/assets/round-volume-to-avoid-stack-overflow.d.ts +0 -0
- package/dist/assets/round-volume-to-avoid-stack-overflow.js +0 -0
- package/dist/assets/sanitize-filename.d.ts +0 -0
- package/dist/assets/sanitize-filename.js +0 -0
- package/dist/assets/sanitize-filepath.d.ts +0 -0
- package/dist/assets/sanitize-filepath.js +0 -0
- package/dist/assets/truncate-utf8-bytes.d.ts +0 -0
- package/dist/assets/truncate-utf8-bytes.js +0 -0
- package/dist/assets/types.d.ts +2 -1
- package/dist/assets/types.js +0 -0
- package/dist/browser/Browser.d.ts +62 -0
- package/dist/browser/Browser.js +221 -0
- package/dist/browser/BrowserConnector.d.ts +19 -0
- package/dist/browser/BrowserConnector.js +17 -0
- package/dist/browser/BrowserFetcher.d.ts +90 -0
- package/dist/browser/BrowserFetcher.js +513 -0
- package/dist/browser/BrowserPage.d.ts +80 -0
- package/dist/browser/BrowserPage.js +280 -0
- package/dist/browser/BrowserRunner.d.ts +36 -0
- package/dist/browser/BrowserRunner.js +265 -0
- package/dist/browser/Connection.d.ts +42 -0
- package/dist/browser/Connection.js +242 -0
- package/dist/browser/ConsoleMessage.d.ts +31 -0
- package/dist/browser/ConsoleMessage.js +48 -0
- package/dist/browser/DOMWorld.d.ts +53 -0
- package/dist/browser/DOMWorld.js +279 -0
- package/dist/browser/Errors.d.ts +25 -0
- package/dist/browser/Errors.js +35 -0
- package/dist/browser/EvalTypes.d.ts +27 -0
- package/dist/browser/EvalTypes.js +17 -0
- package/dist/browser/EventEmitter.d.ts +23 -0
- package/dist/browser/EventEmitter.js +53 -0
- package/dist/browser/ExecutionContext.d.ts +34 -0
- package/dist/browser/ExecutionContext.js +174 -0
- package/dist/browser/FrameManager.d.ts +91 -0
- package/dist/browser/FrameManager.js +493 -0
- package/dist/browser/HTTPRequest.d.ts +28 -0
- package/dist/browser/HTTPRequest.js +37 -0
- package/dist/browser/HTTPResponse.d.ts +21 -0
- package/dist/browser/HTTPResponse.js +41 -0
- package/dist/browser/JSHandle.d.ts +35 -0
- package/dist/browser/JSHandle.js +90 -0
- package/dist/browser/LaunchOptions.d.ts +33 -0
- package/dist/browser/LaunchOptions.js +17 -0
- package/dist/browser/Launcher.d.ts +15 -0
- package/dist/browser/Launcher.js +144 -0
- package/dist/browser/LifecycleWatcher.d.ts +29 -0
- package/dist/browser/LifecycleWatcher.js +180 -0
- package/dist/browser/NetworkEventManager.d.ts +33 -0
- package/dist/browser/NetworkEventManager.js +81 -0
- package/dist/browser/NetworkManager.d.ts +34 -0
- package/dist/browser/NetworkManager.js +231 -0
- package/dist/browser/NodeWebSocketTransport.d.ts +17 -0
- package/dist/browser/NodeWebSocketTransport.js +87 -0
- package/dist/browser/Product.d.ts +16 -0
- package/dist/browser/Product.js +17 -0
- package/dist/browser/PuppeteerNode.d.ts +40 -0
- package/dist/browser/PuppeteerNode.js +74 -0
- package/dist/browser/PuppeteerViewport.d.ts +5 -0
- package/dist/{faststart/options.js → browser/PuppeteerViewport.js} +0 -0
- package/dist/{faststart/index.d.ts → browser/ScreenshotOptions.d.ts} +0 -0
- package/dist/{faststart/index.js → browser/ScreenshotOptions.js} +0 -0
- package/dist/browser/Target.d.ts +61 -0
- package/dist/browser/Target.js +146 -0
- package/dist/browser/TaskQueue.d.ts +20 -0
- package/dist/browser/TaskQueue.js +47 -0
- package/dist/browser/TimeoutSettings.d.ts +24 -0
- package/dist/browser/TimeoutSettings.js +62 -0
- package/dist/browser/assert.d.ts +1 -0
- package/dist/browser/assert.js +9 -0
- package/dist/browser/create-browser-fetcher.d.ts +17 -0
- package/dist/browser/create-browser-fetcher.js +77 -0
- package/dist/browser/devtools-commands.d.ts +270 -0
- package/dist/browser/devtools-commands.js +2 -0
- package/dist/browser/devtools-types.d.ts +1126 -0
- package/dist/browser/devtools-types.js +2 -0
- package/dist/browser/get-download-destination.d.ts +1 -0
- package/dist/browser/get-download-destination.js +38 -0
- package/dist/browser/is-target-closed-err.d.ts +1 -0
- package/dist/browser/is-target-closed-err.js +9 -0
- package/dist/browser/mitt/index.d.ts +22 -0
- package/dist/browser/mitt/index.js +49 -0
- package/dist/browser/node.d.ts +2 -0
- package/dist/browser/node.js +9 -0
- package/dist/browser/revisions.d.ts +20 -0
- package/dist/browser/revisions.js +21 -0
- package/dist/browser/util.d.ts +47 -0
- package/dist/browser/util.js +169 -0
- package/dist/browser-executable.d.ts +1 -0
- package/dist/{assets/cleanup-assets.js → browser-executable.js} +0 -0
- package/dist/browser-log.d.ts +1 -1
- package/dist/browser-log.js +0 -0
- package/dist/browser.d.ts +2 -0
- package/dist/browser.js +4 -0
- package/dist/calculate-ffmpeg-filters.d.ts +1 -1
- package/dist/calculate-ffmpeg-filters.js +1 -0
- package/dist/calculate-sar-dar-pixels.d.ts +9 -0
- package/dist/calculate-sar-dar-pixels.js +19 -0
- package/dist/can-use-parallel-encoding.d.ts +1 -1
- package/dist/can-use-parallel-encoding.js +2 -2
- package/dist/check-apple-silicon.d.ts +1 -0
- package/dist/check-apple-silicon.js +55 -0
- package/dist/chunk.d.ts +0 -0
- package/dist/chunk.js +0 -0
- package/dist/client.d.ts +10 -0
- package/dist/client.js +19 -0
- package/dist/codec-supports-media.d.ts +8 -0
- package/dist/codec-supports-media.js +56 -0
- package/dist/codec.d.ts +4 -0
- package/dist/codec.js +16 -0
- package/dist/combine-videos.d.ts +9 -3
- package/dist/combine-videos.js +18 -10
- package/dist/compositor/compose.d.ts +13 -0
- package/dist/compositor/compose.js +47 -0
- package/dist/compositor/compositor.d.ts +12 -0
- package/dist/compositor/compositor.js +111 -0
- package/dist/compositor/get-executable-path.d.ts +1 -0
- package/dist/compositor/get-executable-path.js +47 -0
- package/dist/compositor/payloads.d.ts +41 -0
- package/dist/compositor/payloads.js +2 -0
- package/dist/compress-assets.d.ts +7 -0
- package/dist/compress-assets.js +25 -0
- package/dist/convert-number-of-gif-loops-to-ffmpeg.d.ts +1 -0
- package/dist/convert-number-of-gif-loops-to-ffmpeg.js +17 -0
- package/dist/convert-to-pcm.d.ts +3 -2
- package/dist/convert-to-pcm.js +3 -2
- package/dist/convert-to-positive-frame-index.d.ts +4 -0
- package/dist/convert-to-positive-frame-index.js +8 -0
- package/dist/create-ffmpeg-complex-filter.d.ts +2 -1
- package/dist/create-ffmpeg-complex-filter.js +2 -11
- package/dist/create-ffmpeg-merge-filter.d.ts +0 -0
- package/dist/create-ffmpeg-merge-filter.js +3 -3
- package/dist/create-silent-audio.d.ts +3 -2
- package/dist/create-silent-audio.js +3 -2
- package/dist/crf.d.ts +9 -0
- package/dist/crf.js +91 -0
- package/dist/cycle-browser-tabs.d.ts +2 -5
- package/dist/cycle-browser-tabs.js +5 -5
- package/dist/delay-render-embedded-stack.d.ts +1 -1
- package/dist/delay-render-embedded-stack.js +0 -0
- package/dist/delete-directory.d.ts +0 -0
- package/dist/delete-directory.js +0 -0
- package/dist/determine-resize-params.d.ts +1 -0
- package/dist/determine-resize-params.js +10 -0
- package/dist/determine-vcodec-ffmepg-flags.d.ts +2 -0
- package/dist/determine-vcodec-ffmepg-flags.js +13 -0
- package/dist/determine-vcodec-ffmpeg-flags.d.ts +2 -0
- package/dist/determine-vcodec-ffmpeg-flags.js +13 -0
- package/dist/ensure-ffmpeg.d.ts +10 -0
- package/dist/ensure-ffmpeg.js +50 -0
- package/dist/ensure-frames-in-order.d.ts +1 -1
- package/dist/ensure-frames-in-order.js +3 -2
- package/dist/ensure-output-directory.d.ts +0 -0
- package/dist/ensure-output-directory.js +0 -0
- package/dist/ensure-presentation-timestamp.d.ts +15 -0
- package/dist/ensure-presentation-timestamp.js +88 -0
- package/dist/error-handling/handle-javascript-exception.d.ts +2 -2
- package/dist/error-handling/handle-javascript-exception.js +3 -4
- package/dist/error-handling/symbolicate-error.d.ts +1 -1
- package/dist/error-handling/symbolicate-error.js +0 -0
- package/dist/error-handling/symbolicateable-error.d.ts +1 -1
- package/dist/error-handling/symbolicateable-error.js +0 -0
- package/dist/extract-frame-from-video.d.ts +7 -6
- package/dist/extract-frame-from-video.js +91 -105
- 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/ffmpeg-flags.d.ts +20 -2
- package/dist/ffmpeg-flags.js +205 -9
- package/dist/ffmpeg-override.d.ts +4 -0
- package/dist/ffmpeg-override.js +2 -0
- package/dist/find-closest-package-json.d.ts +2 -0
- package/dist/find-closest-package-json.js +31 -0
- package/dist/frame-range.d.ts +2 -0
- package/dist/frame-range.js +49 -0
- package/dist/frame-to-ffmpeg-timestamp.d.ts +0 -0
- package/dist/frame-to-ffmpeg-timestamp.js +0 -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 +4 -3
- package/dist/get-browser-instance.js +3 -3
- package/dist/get-can-extract-frames-fast.d.ts +10 -0
- package/dist/get-can-extract-frames-fast.js +67 -0
- package/dist/get-codec-name.d.ts +1 -1
- package/dist/get-codec-name.js +5 -2
- package/dist/get-compositions-from-bundle.d.ts +7 -0
- package/dist/get-compositions-from-bundle.js +55 -0
- package/dist/get-compositions-from-markup.d.ts +3 -0
- package/dist/get-compositions-from-markup.js +17 -0
- package/dist/get-compositions-on-server.d.ts +3 -0
- package/dist/get-compositions-on-server.js +18 -0
- package/dist/get-compositions.d.ts +11 -4
- package/dist/get-compositions.js +30 -11
- package/dist/get-concurrency.d.ts +1 -1
- package/dist/get-concurrency.js +8 -1
- package/dist/get-duration-from-frame-range.d.ts +1 -2
- package/dist/get-duration-from-frame-range.js +13 -9
- package/dist/get-extension-from-codec.d.ts +2 -2
- package/dist/get-extension-from-codec.js +8 -5
- package/dist/get-extension-of-filename.d.ts +1 -1
- package/dist/get-extension-of-filename.js +8 -1
- package/dist/get-frame-of-video-slow.d.ts +15 -0
- package/dist/get-frame-of-video-slow.js +72 -0
- package/dist/get-frame-padded-index.d.ts +14 -0
- package/dist/get-frame-padded-index.js +34 -0
- package/dist/get-frame-to-render.d.ts +1 -1
- package/dist/get-frame-to-render.js +0 -0
- package/dist/get-local-browser-executable.d.ts +2 -1
- package/dist/get-local-browser-executable.js +8 -8
- package/dist/get-port.d.ts +4 -1
- package/dist/get-port.js +13 -22
- package/dist/get-prores-profile-name.d.ts +2 -1
- package/dist/get-prores-profile-name.js +0 -0
- package/dist/get-video-info.d.ts +8 -0
- package/dist/get-video-info.js +59 -0
- package/dist/get-video-signals.d.ts +2 -0
- package/dist/get-video-signals.js +28 -0
- package/dist/get-video-threads-flag.d.ts +1 -0
- package/dist/get-video-threads-flag.js +18 -0
- package/dist/guess-extension-for-media.d.ts +5 -0
- package/dist/guess-extension-for-media.js +28 -0
- package/dist/image-format.d.ts +6 -1
- package/dist/image-format.js +28 -1
- package/dist/index.d.ts +117 -34
- package/dist/index.js +101 -15
- 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/is-serve-url.d.ts +0 -0
- package/dist/is-serve-url.js +0 -0
- package/dist/last-frame-from-video-cache.d.ts +9 -4
- package/dist/last-frame-from-video-cache.js +24 -21
- package/dist/legacy-webpack-config.d.ts +0 -0
- package/dist/legacy-webpack-config.js +0 -0
- package/dist/lock-port-selection.d.ts +2 -0
- package/dist/lock-port-selection.js +11 -0
- package/dist/locks.d.ts +7 -0
- package/dist/locks.js +44 -0
- package/dist/log-level.d.ts +4 -0
- package/dist/log-level.js +15 -0
- package/dist/make-cancel-signal.d.ts +7 -0
- package/dist/make-cancel-signal.js +20 -1
- package/dist/make-comp-manager-context.d.ts +2 -0
- package/dist/make-comp-manager-context.js +45 -0
- package/dist/make-timeline-context-value.d.ts +2 -0
- package/dist/make-timeline-context-value.js +20 -0
- package/dist/merge-audio-track.d.ts +4 -1
- package/dist/merge-audio-track.js +18 -7
- package/dist/mime-db.d.ts +6 -0
- package/dist/mime-db.js +8636 -0
- package/dist/mime-types.d.ts +3 -0
- package/dist/mime-types.js +94 -0
- package/dist/normalize-serve-url.d.ts +0 -0
- package/dist/normalize-serve-url.js +0 -0
- package/dist/offthread-video-server.d.ts +9 -5
- package/dist/offthread-video-server.js +30 -10
- package/dist/open-browser.d.ts +5 -3
- package/dist/open-browser.js +18 -28
- package/dist/overwrite.d.ts +1 -0
- package/dist/overwrite.js +4 -0
- package/dist/p-limit.d.ts +0 -0
- package/dist/p-limit.js +0 -0
- package/dist/parse-browser-error-stack.d.ts +0 -0
- package/dist/parse-browser-error-stack.js +0 -0
- package/dist/parse-ffmpeg-progress.d.ts +0 -0
- package/dist/parse-ffmpeg-progress.js +0 -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 +29 -0
- package/dist/pool.d.ts +0 -0
- package/dist/pool.js +0 -0
- package/dist/prepare-server.d.ts +7 -5
- package/dist/prepare-server.js +24 -5
- package/dist/preprocess-audio-track.d.ts +5 -2
- package/dist/preprocess-audio-track.js +5 -4
- package/dist/prespawn-ffmpeg.d.ts +10 -3
- package/dist/prespawn-ffmpeg.js +24 -16
- package/dist/prestitcher-memory-usage.d.ts +12 -0
- package/dist/prestitcher-memory-usage.js +30 -0
- package/dist/prores-profile.d.ts +8 -0
- package/dist/prores-profile.js +23 -0
- package/dist/provide-screenshot.d.ts +9 -5
- package/dist/provide-screenshot.js +4 -2
- package/dist/puppeteer-evaluate.d.ts +1 -1
- package/dist/puppeteer-evaluate.js +3 -4
- package/dist/puppeteer-screenshot.d.ts +12 -2
- package/dist/puppeteer-screenshot.js +11 -16
- package/dist/quality.d.ts +1 -0
- package/dist/quality.js +21 -0
- package/dist/redirect-status-codes.d.ts +1 -0
- package/dist/redirect-status-codes.js +6 -0
- package/dist/render-frames.d.ts +30 -12
- package/dist/render-frames.js +232 -138
- package/dist/render-media.d.ts +49 -12
- package/dist/render-media.js +152 -30
- package/dist/render-on-server.d.ts +3 -0
- package/dist/render-on-server.js +90 -0
- package/dist/render-still.d.ts +21 -9
- package/dist/render-still.js +75 -37
- package/dist/render-svg.d.ts +8 -0
- package/dist/render-svg.js +13 -0
- package/dist/render-video-layer.d.ts +9 -0
- package/dist/render-video-layer.js +23 -0
- package/dist/render-web-frame.d.ts +74 -0
- package/dist/render-web-frame.js +259 -0
- package/dist/replace-browser.d.ts +6 -0
- package/dist/replace-browser.js +47 -0
- package/dist/resolve-asset-src.d.ts +0 -0
- package/dist/resolve-asset-src.js +0 -0
- package/dist/sample-rate.d.ts +0 -0
- package/dist/sample-rate.js +0 -0
- package/dist/screenshot-dom-element.d.ts +11 -8
- package/dist/screenshot-dom-element.js +12 -7
- package/dist/screenshot-task.d.ts +13 -3
- package/dist/screenshot-task.js +55 -27
- package/dist/seek-to-frame.d.ts +3 -2
- package/dist/seek-to-frame.js +24 -3
- package/dist/serve-handler/index.d.ts +1 -1
- package/dist/serve-handler/index.js +7 -15
- package/dist/serve-handler/is-path-inside.d.ts +0 -0
- package/dist/serve-handler/is-path-inside.js +0 -0
- package/dist/serve-handler/range-parser.d.ts +0 -0
- package/dist/serve-handler/range-parser.js +0 -0
- package/dist/serve-static.d.ts +5 -3
- package/dist/serve-static.js +20 -4
- package/dist/set-props-and-env.d.ts +4 -2
- package/dist/set-props-and-env.js +41 -15
- package/dist/stitch-frames-to-video.d.ts +20 -7
- package/dist/stitch-frames-to-video.js +175 -59
- package/dist/stringify-ffmpeg-filter.d.ts +4 -3
- package/dist/stringify-ffmpeg-filter.js +15 -11
- package/dist/symbolicate-stacktrace.d.ts +1 -1
- package/dist/symbolicate-stacktrace.js +3 -3
- package/dist/take-frame-and-compose.d.ts +20 -0
- package/dist/take-frame-and-compose.js +96 -0
- package/dist/tmp-dir.d.ts +0 -0
- package/dist/tmp-dir.js +0 -0
- package/dist/truthy.d.ts +3 -0
- package/dist/truthy.js +7 -0
- package/dist/try-to-extract-frame-of-video-fast.d.ts +13 -0
- package/dist/try-to-extract-frame-of-video-fast.js +55 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +0 -0
- package/dist/validate-concurrency.d.ts +1 -0
- package/dist/validate-concurrency.js +29 -0
- 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 +2 -0
- package/dist/validate-every-nth-frame.js +28 -0
- package/dist/validate-ffmpeg-override.d.ts +2 -0
- package/dist/validate-ffmpeg-override.js +12 -0
- package/dist/validate-ffmpeg.d.ts +7 -2
- package/dist/validate-ffmpeg.js +48 -44
- package/dist/validate-frame.d.ts +1 -0
- package/dist/validate-frame.js +24 -0
- package/dist/validate-number-of-gif-loops.d.ts +2 -0
- package/dist/validate-number-of-gif-loops.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/dist/validate-output-filename.js +5 -0
- package/dist/validate-puppeteer-timeout.d.ts +0 -0
- package/dist/validate-puppeteer-timeout.js +1 -1
- package/dist/validate-scale.d.ts +0 -0
- package/dist/validate-scale.js +0 -0
- package/dist/validate-videobitrate.d.ts +1 -0
- package/dist/validate-videobitrate.js +20 -0
- package/dist/wait-for-symbolication-error-to-be-done.d.ts +3 -0
- package/dist/wait-for-symbolication-error-to-be-done.js +8 -0
- package/dist/warn-about-ffmpeg-version.d.ts +5 -0
- package/dist/warn-about-ffmpeg-version.js +37 -0
- package/dist/ws/ws-types.d.ts +14 -0
- package/dist/ws/ws-types.js +10 -0
- package/package.json +30 -22
- package/types/ws/index.d.ts +509 -0
- package/.prettierrc.js +0 -14
- package/dist/abort.d.ts +0 -7
- package/dist/abort.js +0 -20
- package/dist/assets/cleanup-assets.d.ts +0 -2
- package/dist/cancel.d.ts +0 -7
- package/dist/cancel.js +0 -25
- package/dist/ensure-faststart.d.ts +0 -1
- package/dist/ensure-faststart.js +0 -14
- package/dist/faststart/atom.d.ts +0 -35
- package/dist/faststart/atom.js +0 -138
- package/dist/faststart/options.d.ts +0 -6
- package/dist/faststart/qt-faststart.d.ts +0 -18
- package/dist/faststart/qt-faststart.js +0 -66
- package/dist/faststart/update-chunk-offsets.d.ts +0 -10
- package/dist/faststart/update-chunk-offsets.js +0 -114
- package/dist/faststart/util.d.ts +0 -9
- package/dist/faststart/util.js +0 -34
- package/dist/get-duration-of-asset.d.ts +0 -7
- package/dist/get-duration-of-asset.js +0 -36
- package/dist/make-assets-download-dir.d.ts +0 -1
- package/dist/make-assets-download-dir.js +0 -13
- package/dist/offthread/index.d.ts +0 -0
- package/dist/offthread/index.js +0 -1
- package/dist/render-gif.d.ts +0 -2
- package/dist/render-gif.js +0 -242
- package/dist/serve-handler/glob-slash.d.ts +0 -1
- package/dist/serve-handler/glob-slash.js +0 -12
- package/dist/stitch-frames-to-gif.d.ts +0 -8
- package/dist/stitch-frames-to-gif.js +0 -128
- package/dist/validate-fps-for-gif.d.ts +0 -2
- package/dist/validate-fps-for-gif.js +0 -9
- package/tsconfig.json +0 -10
|
@@ -1,48 +1,81 @@
|
|
|
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
|
+
};
|
|
2
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
27
|
};
|
|
5
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
29
|
exports.stitchFramesToVideo = exports.spawnFfmpeg = void 0;
|
|
7
30
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
-
const fs_1 =
|
|
31
|
+
const fs_1 = __importStar(require("fs"));
|
|
9
32
|
const path_1 = __importDefault(require("path"));
|
|
10
33
|
const remotion_1 = require("remotion");
|
|
11
34
|
const calculate_asset_positions_1 = require("./assets/calculate-asset-positions");
|
|
12
35
|
const convert_assets_to_file_urls_1 = require("./assets/convert-assets-to-file-urls");
|
|
13
36
|
const download_and_map_assets_to_file_1 = require("./assets/download-and-map-assets-to-file");
|
|
37
|
+
const codec_1 = require("./codec");
|
|
38
|
+
const codec_supports_media_1 = require("./codec-supports-media");
|
|
39
|
+
const convert_number_of_gif_loops_to_ffmpeg_1 = require("./convert-number-of-gif-loops-to-ffmpeg");
|
|
40
|
+
const crf_1 = require("./crf");
|
|
14
41
|
const delete_directory_1 = require("./delete-directory");
|
|
42
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
43
|
+
const find_closest_package_json_1 = require("./find-closest-package-json");
|
|
15
44
|
const get_audio_codec_name_1 = require("./get-audio-codec-name");
|
|
16
45
|
const get_codec_name_1 = require("./get-codec-name");
|
|
46
|
+
const get_extension_from_codec_1 = require("./get-extension-from-codec");
|
|
17
47
|
const get_prores_profile_name_1 = require("./get-prores-profile-name");
|
|
48
|
+
const make_cancel_signal_1 = require("./make-cancel-signal");
|
|
18
49
|
const merge_audio_track_1 = require("./merge-audio-track");
|
|
19
50
|
const parse_ffmpeg_progress_1 = require("./parse-ffmpeg-progress");
|
|
51
|
+
const pixel_format_1 = require("./pixel-format");
|
|
20
52
|
const preprocess_audio_track_1 = require("./preprocess-audio-track");
|
|
21
|
-
const
|
|
53
|
+
const prores_profile_1 = require("./prores-profile");
|
|
54
|
+
const truthy_1 = require("./truthy");
|
|
22
55
|
const validate_even_dimensions_with_codec_1 = require("./validate-even-dimensions-with-codec");
|
|
23
56
|
const validate_ffmpeg_1 = require("./validate-ffmpeg");
|
|
57
|
+
const validate_videobitrate_1 = require("./validate-videobitrate");
|
|
24
58
|
const packageJsonPath = path_1.default.join(__dirname, '..', 'package.json');
|
|
25
59
|
const packageJson = fs_1.default.existsSync(packageJsonPath)
|
|
26
60
|
? JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8'))
|
|
27
61
|
: null;
|
|
28
|
-
const getAssetsData = async ({ assets,
|
|
62
|
+
const getAssetsData = async ({ assets, onDownload, fps, expectedFrames, verbose, ffmpegExecutable, ffprobeExecutable, onProgress, downloadMap, remotionRoot, }) => {
|
|
29
63
|
const fileUrlAssets = await (0, convert_assets_to_file_urls_1.convertAssetsToFileUrls)({
|
|
30
64
|
assets,
|
|
31
|
-
downloadDir,
|
|
32
65
|
onDownload: onDownload !== null && onDownload !== void 0 ? onDownload : (() => () => undefined),
|
|
66
|
+
downloadMap,
|
|
33
67
|
});
|
|
34
|
-
(0, download_and_map_assets_to_file_1.markAllAssetsAsDownloaded)();
|
|
68
|
+
(0, download_and_map_assets_to_file_1.markAllAssetsAsDownloaded)(downloadMap);
|
|
35
69
|
const assetPositions = (0, calculate_asset_positions_1.calculateAssetPositions)(fileUrlAssets);
|
|
36
70
|
if (verbose) {
|
|
37
71
|
console.log('asset positions', assetPositions);
|
|
38
72
|
}
|
|
39
|
-
const tempPath = (0, tmp_dir_1.tmpDir)('remotion-audio-mixing');
|
|
40
73
|
const preprocessProgress = new Array(assetPositions.length).fill(0);
|
|
41
74
|
const updateProgress = () => {
|
|
42
75
|
onProgress(preprocessProgress.reduce((a, b) => a + b, 0) / assetPositions.length);
|
|
43
76
|
};
|
|
44
77
|
const preprocessed = (await Promise.all(assetPositions.map(async (asset, index) => {
|
|
45
|
-
const filterFile = path_1.default.join(
|
|
78
|
+
const filterFile = path_1.default.join(downloadMap.audioMixing, `${index}.wav`);
|
|
46
79
|
const result = await (0, preprocess_audio_track_1.preprocessAudioTrack)({
|
|
47
80
|
ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
|
|
48
81
|
ffprobeExecutable: ffprobeExecutable !== null && ffprobeExecutable !== void 0 ? ffprobeExecutable : null,
|
|
@@ -50,129 +83,185 @@ const getAssetsData = async ({ assets, downloadDir, onDownload, fps, expectedFra
|
|
|
50
83
|
asset,
|
|
51
84
|
expectedFrames,
|
|
52
85
|
fps,
|
|
86
|
+
downloadMap,
|
|
87
|
+
remotionRoot,
|
|
53
88
|
});
|
|
54
89
|
preprocessProgress[index] = 1;
|
|
55
90
|
updateProgress();
|
|
56
91
|
return result;
|
|
57
|
-
}))).filter(
|
|
58
|
-
const outName = path_1.default.join(
|
|
92
|
+
}))).filter(truthy_1.truthy);
|
|
93
|
+
const outName = path_1.default.join(downloadMap.audioPreprocessing, `audio.wav`);
|
|
59
94
|
await (0, merge_audio_track_1.mergeAudioTrack)({
|
|
60
95
|
ffmpegExecutable: ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : null,
|
|
61
96
|
files: preprocessed,
|
|
62
97
|
outName,
|
|
63
98
|
numberOfSeconds: Number((expectedFrames / fps).toFixed(3)),
|
|
99
|
+
downloadMap,
|
|
100
|
+
remotionRoot,
|
|
64
101
|
});
|
|
65
102
|
onProgress(1);
|
|
66
|
-
|
|
67
|
-
(0, delete_directory_1.deleteDirectory)(
|
|
68
|
-
|
|
103
|
+
await Promise.all([
|
|
104
|
+
(0, delete_directory_1.deleteDirectory)(downloadMap.audioMixing),
|
|
105
|
+
...preprocessed.map((p) => {
|
|
106
|
+
return (0, delete_directory_1.deleteDirectory)(p);
|
|
107
|
+
}),
|
|
108
|
+
]);
|
|
69
109
|
return outName;
|
|
70
110
|
};
|
|
71
|
-
const spawnFfmpeg = async (options) => {
|
|
72
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
111
|
+
const spawnFfmpeg = async (options, remotionRoot) => {
|
|
112
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
73
113
|
remotion_1.Internals.validateDimension(options.height, 'height', 'passed to `stitchFramesToVideo()`');
|
|
74
114
|
remotion_1.Internals.validateDimension(options.width, 'width', 'passed to `stitchFramesToVideo()`');
|
|
75
|
-
|
|
76
|
-
const codec = (_a = options.codec) !== null && _a !== void 0 ? _a : remotion_1.Internals.DEFAULT_CODEC;
|
|
115
|
+
const codec = (_a = options.codec) !== null && _a !== void 0 ? _a : codec_1.DEFAULT_CODEC;
|
|
77
116
|
(0, validate_even_dimensions_with_codec_1.validateEvenDimensionsWithCodec)({
|
|
78
117
|
width: options.width,
|
|
79
118
|
height: options.height,
|
|
80
119
|
codec,
|
|
81
120
|
scale: 1,
|
|
82
121
|
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
122
|
+
(0, prores_profile_1.validateSelectedCodecAndProResCombination)({
|
|
123
|
+
codec,
|
|
124
|
+
proResProfile: options.proResProfile,
|
|
125
|
+
});
|
|
126
|
+
(0, validate_videobitrate_1.validateBitrate)(options.audioBitrate, 'audioBitrate');
|
|
127
|
+
(0, validate_videobitrate_1.validateBitrate)(options.videoBitrate, 'videoBitrate');
|
|
128
|
+
remotion_1.Internals.validateFps(options.fps, 'in `stitchFramesToVideo()`', false);
|
|
129
|
+
const pixelFormat = (_b = options.pixelFormat) !== null && _b !== void 0 ? _b : pixel_format_1.DEFAULT_PIXEL_FORMAT;
|
|
130
|
+
await (0, validate_ffmpeg_1.validateFfmpeg)((_c = options.ffmpegExecutable) !== null && _c !== void 0 ? _c : null, remotionRoot, 'ffmpeg');
|
|
86
131
|
const encoderName = (0, get_codec_name_1.getCodecName)(codec);
|
|
87
132
|
const audioCodecName = (0, get_audio_codec_name_1.getAudioCodecName)(codec);
|
|
88
133
|
const proResProfileName = (0, get_prores_profile_name_1.getProResProfileName)(codec, options.proResProfile);
|
|
89
|
-
const
|
|
90
|
-
const
|
|
134
|
+
const mediaSupport = (0, codec_supports_media_1.codecSupportsMedia)(codec);
|
|
135
|
+
const tempFile = options.outputLocation
|
|
136
|
+
? null
|
|
137
|
+
: path_1.default.join(options.assetsInfo.downloadMap.stitchFrames, `out.${(0, get_extension_from_codec_1.getFileExtensionFromCodec)(codec)}`);
|
|
138
|
+
const shouldRenderAudio = mediaSupport.audio &&
|
|
139
|
+
(options.assetsInfo.assets.flat(1).length > 0 ||
|
|
140
|
+
options.enforceAudioTrack) &&
|
|
141
|
+
!options.muted;
|
|
142
|
+
const shouldRenderVideo = mediaSupport.video;
|
|
143
|
+
if (!shouldRenderAudio && !shouldRenderVideo) {
|
|
144
|
+
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.');
|
|
145
|
+
}
|
|
91
146
|
if (options.verbose) {
|
|
92
|
-
console.log('[verbose] ffmpeg', (
|
|
147
|
+
console.log('[verbose] ffmpeg', (_d = options.ffmpegExecutable) !== null && _d !== void 0 ? _d : 'ffmpeg in PATH');
|
|
93
148
|
console.log('[verbose] encoder', encoderName);
|
|
94
149
|
console.log('[verbose] audioCodec', audioCodecName);
|
|
95
150
|
console.log('[verbose] pixelFormat', pixelFormat);
|
|
96
|
-
if (
|
|
97
|
-
console.log('[verbose]
|
|
151
|
+
if (options.ffmpegOverride) {
|
|
152
|
+
console.log('[verbose] ffmpegOverride', options.ffmpegOverride);
|
|
98
153
|
}
|
|
99
154
|
console.log('[verbose] codec', codec);
|
|
100
|
-
console.log('[verbose]
|
|
155
|
+
console.log('[verbose] shouldRenderAudio', shouldRenderAudio);
|
|
156
|
+
console.log('[verbose] shouldRenderVideo', shouldRenderVideo);
|
|
101
157
|
console.log('[verbose] proResProfileName', proResProfileName);
|
|
102
158
|
}
|
|
103
|
-
|
|
104
|
-
|
|
159
|
+
(0, crf_1.validateQualitySettings)({
|
|
160
|
+
crf: options.crf,
|
|
161
|
+
codec,
|
|
162
|
+
videoBitrate: options.videoBitrate,
|
|
163
|
+
});
|
|
164
|
+
(0, pixel_format_1.validateSelectedPixelFormatAndCodecCombination)(pixelFormat, codec);
|
|
105
165
|
const expectedFrames = options.assetsInfo.assets.length;
|
|
106
166
|
const updateProgress = (preStitchProgress, muxProgress) => {
|
|
107
167
|
var _a;
|
|
108
168
|
const totalFrameProgress = 0.5 * preStitchProgress * expectedFrames + muxProgress * 0.5;
|
|
109
169
|
(_a = options.onProgress) === null || _a === void 0 ? void 0 : _a.call(options, Math.round(totalFrameProgress));
|
|
110
170
|
};
|
|
111
|
-
const audio =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
171
|
+
const audio = shouldRenderAudio
|
|
172
|
+
? await getAssetsData({
|
|
173
|
+
assets: options.assetsInfo.assets,
|
|
174
|
+
onDownload: options.onDownload,
|
|
175
|
+
fps: options.fps,
|
|
176
|
+
expectedFrames,
|
|
177
|
+
verbose: (_e = options.verbose) !== null && _e !== void 0 ? _e : false,
|
|
178
|
+
ffmpegExecutable: (_f = options.ffmpegExecutable) !== null && _f !== void 0 ? _f : null,
|
|
179
|
+
ffprobeExecutable: (_g = options.ffprobeExecutable) !== null && _g !== void 0 ? _g : null,
|
|
180
|
+
onProgress: (prog) => updateProgress(prog, 0),
|
|
181
|
+
downloadMap: options.assetsInfo.downloadMap,
|
|
182
|
+
remotionRoot,
|
|
183
|
+
})
|
|
184
|
+
: null;
|
|
185
|
+
if (mediaSupport.audio && !mediaSupport.video) {
|
|
123
186
|
if (!audioCodecName) {
|
|
124
187
|
throw new TypeError('exporting audio but has no audio codec name. Report this in the Remotion repo.');
|
|
125
188
|
}
|
|
126
|
-
const ffmpegTask = (0, execa_1.default)('ffmpeg', [
|
|
189
|
+
const ffmpegTask = (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)((_h = options.ffmpegExecutable) !== null && _h !== void 0 ? _h : null, remotionRoot, 'ffmpeg'), [
|
|
127
190
|
'-i',
|
|
128
191
|
audio,
|
|
129
192
|
'-c:a',
|
|
130
193
|
audioCodecName,
|
|
131
194
|
// Set bitrate up to 320k, for aac it might effectively be lower
|
|
132
195
|
'-b:a',
|
|
133
|
-
'320k',
|
|
196
|
+
(_j = options.audioBitrate) !== null && _j !== void 0 ? _j : '320k',
|
|
134
197
|
options.force ? '-y' : null,
|
|
135
|
-
options.outputLocation,
|
|
198
|
+
(_k = options.outputLocation) !== null && _k !== void 0 ? _k : tempFile,
|
|
136
199
|
].filter(remotion_1.Internals.truthy));
|
|
137
|
-
(
|
|
200
|
+
(_l = options.cancelSignal) === null || _l === void 0 ? void 0 : _l.call(options, () => {
|
|
138
201
|
ffmpegTask.kill();
|
|
139
202
|
});
|
|
140
203
|
await ffmpegTask;
|
|
141
|
-
(
|
|
204
|
+
(_m = options.onProgress) === null || _m === void 0 ? void 0 : _m.call(options, expectedFrames);
|
|
205
|
+
if (audio) {
|
|
206
|
+
await (0, delete_directory_1.deleteDirectory)(path_1.default.dirname(audio));
|
|
207
|
+
}
|
|
208
|
+
const file = await new Promise((resolve, reject) => {
|
|
209
|
+
if (tempFile) {
|
|
210
|
+
fs_1.promises
|
|
211
|
+
.readFile(tempFile)
|
|
212
|
+
.then((f) => {
|
|
213
|
+
return resolve(f);
|
|
214
|
+
})
|
|
215
|
+
.catch((e) => reject(e));
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
resolve(null);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
await (0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.stitchFrames);
|
|
142
222
|
return {
|
|
143
223
|
getLogs: () => '',
|
|
144
|
-
task: Promise.resolve(),
|
|
224
|
+
task: Promise.resolve(file),
|
|
145
225
|
};
|
|
146
226
|
}
|
|
147
227
|
const ffmpegArgs = [
|
|
148
228
|
['-r', String(options.fps)],
|
|
149
|
-
...(((
|
|
150
|
-
? [['-i', (
|
|
229
|
+
...(((_o = options.internalOptions) === null || _o === void 0 ? void 0 : _o.preEncodedFileLocation)
|
|
230
|
+
? [['-i', (_p = options.internalOptions) === null || _p === void 0 ? void 0 : _p.preEncodedFileLocation]]
|
|
151
231
|
: [
|
|
152
232
|
['-f', 'image2'],
|
|
153
233
|
['-s', `${options.width}x${options.height}`],
|
|
154
234
|
['-start_number', String(options.assetsInfo.firstFrameIndex)],
|
|
155
235
|
['-i', options.assetsInfo.imageSequenceName],
|
|
156
236
|
]),
|
|
157
|
-
['-i', audio],
|
|
237
|
+
audio ? ['-i', audio] : null,
|
|
238
|
+
((_q = options.numberOfGifLoops) !== null && _q !== void 0 ? _q : null) === null
|
|
239
|
+
? null
|
|
240
|
+
: [
|
|
241
|
+
'-loop',
|
|
242
|
+
(0, convert_number_of_gif_loops_to_ffmpeg_1.convertNumberOfGifLoopsToFfmpegSyntax)((_r = options.numberOfGifLoops) !== null && _r !== void 0 ? _r : null),
|
|
243
|
+
],
|
|
158
244
|
// -c:v is the same as -vcodec as -codec:video
|
|
159
245
|
// and specified the video codec.
|
|
160
246
|
['-c:v', encoderName],
|
|
161
|
-
...(((
|
|
247
|
+
...(((_s = options.internalOptions) === null || _s === void 0 ? void 0 : _s.preEncodedFileLocation)
|
|
162
248
|
? []
|
|
163
249
|
: [
|
|
164
250
|
proResProfileName ? ['-profile:v', proResProfileName] : null,
|
|
165
|
-
supportsCrf ? ['-crf', String(crf)] : null,
|
|
166
251
|
['-pix_fmt', pixelFormat],
|
|
167
252
|
// Without explicitly disabling auto-alt-ref,
|
|
168
253
|
// transparent WebM generation doesn't work
|
|
169
254
|
pixelFormat === 'yuva420p' ? ['-auto-alt-ref', '0'] : null,
|
|
170
|
-
|
|
255
|
+
...(0, crf_1.validateQualitySettings)({
|
|
256
|
+
crf: options.crf,
|
|
257
|
+
videoBitrate: options.videoBitrate,
|
|
258
|
+
codec,
|
|
259
|
+
}),
|
|
171
260
|
]),
|
|
172
261
|
codec === 'h264' ? ['-movflags', 'faststart'] : null,
|
|
173
262
|
audioCodecName ? ['-c:a', audioCodecName] : null,
|
|
174
263
|
// Set max bitrate up to 1024kbps, will choose lower if that's too much
|
|
175
|
-
audioCodecName ? ['-b:a', '512K'] : null,
|
|
264
|
+
audioCodecName ? ['-b:a', options.audioBitrate || '512K'] : null,
|
|
176
265
|
// Ignore metadata that may come from remote media
|
|
177
266
|
['-map_metadata', '-1'],
|
|
178
267
|
[
|
|
@@ -181,22 +270,29 @@ const spawnFfmpeg = async (options) => {
|
|
|
181
270
|
[`Made with Remotion`, packageJson ? packageJson.version : null].join(' '),
|
|
182
271
|
],
|
|
183
272
|
options.force ? '-y' : null,
|
|
184
|
-
options.outputLocation,
|
|
273
|
+
(_t = options.outputLocation) !== null && _t !== void 0 ? _t : tempFile,
|
|
185
274
|
];
|
|
186
275
|
if (options.verbose) {
|
|
187
276
|
console.log('Generated FFMPEG command:');
|
|
188
277
|
console.log(ffmpegArgs);
|
|
189
278
|
}
|
|
190
279
|
const ffmpegString = ffmpegArgs.flat(2).filter(Boolean);
|
|
191
|
-
const
|
|
280
|
+
const finalFfmpegString = options.ffmpegOverride
|
|
281
|
+
? options.ffmpegOverride({ type: 'stitcher', args: ffmpegString })
|
|
282
|
+
: ffmpegString;
|
|
283
|
+
if (options.verbose && options.ffmpegOverride) {
|
|
284
|
+
console.log('Generated final FFMPEG command:');
|
|
285
|
+
console.log(finalFfmpegString);
|
|
286
|
+
}
|
|
287
|
+
const task = (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)((_u = options.ffmpegExecutable) !== null && _u !== void 0 ? _u : null, remotionRoot, 'ffmpeg'), finalFfmpegString, {
|
|
192
288
|
cwd: options.dir,
|
|
193
289
|
});
|
|
194
|
-
(
|
|
290
|
+
(_v = options.cancelSignal) === null || _v === void 0 ? void 0 : _v.call(options, () => {
|
|
195
291
|
task.kill();
|
|
196
292
|
});
|
|
197
293
|
let ffmpegOutput = '';
|
|
198
294
|
let isFinished = false;
|
|
199
|
-
(
|
|
295
|
+
(_w = task.stderr) === null || _w === void 0 ? void 0 : _w.on('data', (data) => {
|
|
200
296
|
var _a;
|
|
201
297
|
const str = data.toString();
|
|
202
298
|
ffmpegOutput += str;
|
|
@@ -218,11 +314,31 @@ const spawnFfmpeg = async (options) => {
|
|
|
218
314
|
}
|
|
219
315
|
}
|
|
220
316
|
});
|
|
221
|
-
return {
|
|
317
|
+
return {
|
|
318
|
+
task: task.then(() => {
|
|
319
|
+
(0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.audioPreprocessing);
|
|
320
|
+
if (tempFile === null) {
|
|
321
|
+
(0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.stitchFrames);
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
return fs_1.promises
|
|
325
|
+
.readFile(tempFile)
|
|
326
|
+
.then((file) => {
|
|
327
|
+
return Promise.all([
|
|
328
|
+
file,
|
|
329
|
+
(0, delete_directory_1.deleteDirectory)(path_1.default.dirname(tempFile)),
|
|
330
|
+
(0, delete_directory_1.deleteDirectory)(options.assetsInfo.downloadMap.stitchFrames),
|
|
331
|
+
]);
|
|
332
|
+
})
|
|
333
|
+
.then(([file]) => file);
|
|
334
|
+
}),
|
|
335
|
+
getLogs: () => ffmpegOutput,
|
|
336
|
+
};
|
|
222
337
|
};
|
|
223
338
|
exports.spawnFfmpeg = spawnFfmpeg;
|
|
224
339
|
const stitchFramesToVideo = async (options) => {
|
|
225
|
-
const
|
|
340
|
+
const remotionRoot = (0, find_closest_package_json_1.findRemotionRoot)();
|
|
341
|
+
const { task, getLogs } = await (0, exports.spawnFfmpeg)(options, remotionRoot);
|
|
226
342
|
const happyPath = task.catch(() => {
|
|
227
343
|
throw new Error(getLogs());
|
|
228
344
|
});
|
|
@@ -231,7 +347,7 @@ const stitchFramesToVideo = async (options) => {
|
|
|
231
347
|
new Promise((_resolve, reject) => {
|
|
232
348
|
var _a;
|
|
233
349
|
(_a = options.cancelSignal) === null || _a === void 0 ? void 0 : _a.call(options, () => {
|
|
234
|
-
reject(new Error(
|
|
350
|
+
reject(new Error(make_cancel_signal_1.cancelErrorMessages.stitchFramesToVideo));
|
|
235
351
|
});
|
|
236
352
|
}),
|
|
237
353
|
]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AssetVolume } from './assets/types';
|
|
2
|
-
export declare const stringifyFfmpegFilter: ({ trimLeft, trimRight, channels, startInVideo, volume, fps, playbackRate, durationInFrames, assetDuration, }: {
|
|
1
|
+
import type { AssetVolume } from './assets/types';
|
|
2
|
+
export declare const stringifyFfmpegFilter: ({ trimLeft, trimRight, channels, startInVideo, volume, fps, playbackRate, durationInFrames, assetDuration, allowAmplificationDuringRender, }: {
|
|
3
3
|
trimLeft: number;
|
|
4
4
|
trimRight: number;
|
|
5
5
|
channels: number;
|
|
@@ -9,4 +9,5 @@ export declare const stringifyFfmpegFilter: ({ trimLeft, trimRight, channels, st
|
|
|
9
9
|
durationInFrames: number;
|
|
10
10
|
playbackRate: number;
|
|
11
11
|
assetDuration: number | null;
|
|
12
|
-
|
|
12
|
+
allowAmplificationDuringRender: boolean;
|
|
13
|
+
}) => string | null;
|
|
@@ -1,24 +1,28 @@
|
|
|
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");
|
|
8
|
-
const
|
|
7
|
+
const truthy_1 = require("./truthy");
|
|
8
|
+
const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, volume, fps, playbackRate, durationInFrames, assetDuration, allowAmplificationDuringRender, }) => {
|
|
9
9
|
const startInVideoSeconds = startInVideo / fps;
|
|
10
|
+
if (assetDuration && trimLeft >= assetDuration) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
10
13
|
const volumeFilter = (0, ffmpeg_volume_expression_1.ffmpegVolumeExpression)({
|
|
11
14
|
volume,
|
|
12
|
-
startInVideo,
|
|
13
15
|
fps,
|
|
14
16
|
trimLeft,
|
|
17
|
+
allowAmplificationDuringRender,
|
|
15
18
|
});
|
|
16
19
|
// Avoid setting filters if possible, as combining them can create noise
|
|
17
20
|
const chunkLength = durationInFrames / fps;
|
|
18
21
|
const actualTrimRight = assetDuration
|
|
19
22
|
? Math.min(trimRight, assetDuration)
|
|
20
23
|
: trimRight;
|
|
21
|
-
const
|
|
24
|
+
const audibleDuration = (actualTrimRight - trimLeft) / playbackRate;
|
|
25
|
+
const padAtEnd = chunkLength - audibleDuration - startInVideoSeconds;
|
|
22
26
|
return (`[0:a]` +
|
|
23
27
|
[
|
|
24
28
|
`aformat=sample_fmts=s32:sample_rates=${sample_rate_1.DEFAULT_SAMPLE_RATE}`,
|
|
@@ -26,6 +30,12 @@ const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, vo
|
|
|
26
30
|
`atrim=${trimLeft.toFixed(6)}:${actualTrimRight.toFixed(6)}`,
|
|
27
31
|
// then set the tempo
|
|
28
32
|
(0, calculate_atempo_1.calculateATempo)(playbackRate),
|
|
33
|
+
// set the volume if needed
|
|
34
|
+
// The timings for volume must include whatever is in atrim, unless the volume
|
|
35
|
+
// filter gets applied before atrim
|
|
36
|
+
volumeFilter.value === '1'
|
|
37
|
+
? null
|
|
38
|
+
: `volume=${volumeFilter.value}:eval=${volumeFilter.eval}`,
|
|
29
39
|
// For n channels, we delay n + 1 channels.
|
|
30
40
|
// This is because `ffprobe` for some audio files reports the wrong amount
|
|
31
41
|
// of channels.
|
|
@@ -37,18 +47,12 @@ const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, vo
|
|
|
37
47
|
: `adelay=${new Array(channels + 1)
|
|
38
48
|
.fill((startInVideoSeconds * 1000).toFixed(0))
|
|
39
49
|
.join('|')}`,
|
|
40
|
-
// set the volume if needed
|
|
41
|
-
// The timings for volume must include whatever is in atrim, unless the volume
|
|
42
|
-
// filter gets applied before atrim
|
|
43
|
-
volumeFilter.value === '1'
|
|
44
|
-
? null
|
|
45
|
-
: `volume=${volumeFilter.value}:eval=${volumeFilter.eval}`,
|
|
46
50
|
// Only in the end, we pad to the full length.
|
|
47
51
|
padAtEnd > 0.0000001
|
|
48
52
|
? 'apad=pad_len=' + Math.round(padAtEnd * sample_rate_1.DEFAULT_SAMPLE_RATE)
|
|
49
53
|
: null,
|
|
50
54
|
]
|
|
51
|
-
.filter(
|
|
55
|
+
.filter(truthy_1.truthy)
|
|
52
56
|
.join(',') +
|
|
53
57
|
`[a0]`);
|
|
54
58
|
};
|
|
@@ -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;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { TAsset } from 'remotion';
|
|
3
|
+
import type { DownloadMap } from './assets/download-map';
|
|
4
|
+
import type { Page } from './browser/BrowserPage';
|
|
5
|
+
import type { ImageFormat } from './image-format';
|
|
6
|
+
export declare const takeFrameAndCompose: ({ freePage, imageFormat, quality, frame, width, height, output, scale, downloadMap, wantsBuffer, }: {
|
|
7
|
+
freePage: Page;
|
|
8
|
+
imageFormat: ImageFormat;
|
|
9
|
+
quality: number | undefined;
|
|
10
|
+
frame: number;
|
|
11
|
+
height: number;
|
|
12
|
+
width: number;
|
|
13
|
+
output: string | null;
|
|
14
|
+
scale: number;
|
|
15
|
+
downloadMap: DownloadMap;
|
|
16
|
+
wantsBuffer: boolean;
|
|
17
|
+
}) => Promise<{
|
|
18
|
+
buffer: Buffer | null;
|
|
19
|
+
collectedAssets: TAsset[];
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,96 @@
|
|
|
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.takeFrameAndCompose = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const compose_1 = require("./compositor/compose");
|
|
10
|
+
const provide_screenshot_1 = require("./provide-screenshot");
|
|
11
|
+
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
12
|
+
const truthy_1 = require("./truthy");
|
|
13
|
+
const takeFrameAndCompose = async ({ freePage, imageFormat, quality, frame, width, height, output, scale, downloadMap, wantsBuffer, }) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const [clipRegion, collectedAssets] = await Promise.all([
|
|
16
|
+
(0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
17
|
+
pageFunction: () => {
|
|
18
|
+
if (typeof window.remotion_getClipRegion === 'undefined') {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
return window.remotion_getClipRegion();
|
|
22
|
+
},
|
|
23
|
+
args: [],
|
|
24
|
+
frame,
|
|
25
|
+
page: freePage,
|
|
26
|
+
}),
|
|
27
|
+
(0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
28
|
+
pageFunction: () => {
|
|
29
|
+
return window.remotion_collectAssets();
|
|
30
|
+
},
|
|
31
|
+
args: [],
|
|
32
|
+
frame,
|
|
33
|
+
page: freePage,
|
|
34
|
+
}),
|
|
35
|
+
]);
|
|
36
|
+
if (imageFormat === 'none') {
|
|
37
|
+
return { buffer: null, collectedAssets };
|
|
38
|
+
}
|
|
39
|
+
const needsComposing = clipRegion === null
|
|
40
|
+
? null
|
|
41
|
+
: {
|
|
42
|
+
tmpFile: path_1.default.join(downloadMap.compositingDir, `${frame}.${imageFormat}`),
|
|
43
|
+
finalOutfie: output !== null && output !== void 0 ? output : path_1.default.join(downloadMap.compositingDir, `${frame}-final.${imageFormat}`),
|
|
44
|
+
clipRegion: clipRegion,
|
|
45
|
+
};
|
|
46
|
+
if (clipRegion !== 'hide') {
|
|
47
|
+
const shouldMakeBuffer = wantsBuffer && !needsComposing;
|
|
48
|
+
const buf = await (0, provide_screenshot_1.provideScreenshot)({
|
|
49
|
+
page: freePage,
|
|
50
|
+
imageFormat,
|
|
51
|
+
quality,
|
|
52
|
+
options: {
|
|
53
|
+
frame,
|
|
54
|
+
output: shouldMakeBuffer ? null : (_a = needsComposing === null || needsComposing === void 0 ? void 0 : needsComposing.tmpFile) !== null && _a !== void 0 ? _a : output,
|
|
55
|
+
},
|
|
56
|
+
height,
|
|
57
|
+
width,
|
|
58
|
+
clipRegion,
|
|
59
|
+
});
|
|
60
|
+
if (shouldMakeBuffer) {
|
|
61
|
+
return { buffer: buf, collectedAssets };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (needsComposing) {
|
|
65
|
+
await (0, compose_1.compose)({
|
|
66
|
+
height: height * scale,
|
|
67
|
+
width: width * scale,
|
|
68
|
+
layers: [
|
|
69
|
+
needsComposing.clipRegion === 'hide'
|
|
70
|
+
? null
|
|
71
|
+
: {
|
|
72
|
+
type: imageFormat === 'jpeg'
|
|
73
|
+
? 'JpgImage'
|
|
74
|
+
: 'PngImage',
|
|
75
|
+
params: {
|
|
76
|
+
height: needsComposing.clipRegion.height * scale,
|
|
77
|
+
width: needsComposing.clipRegion.width * scale,
|
|
78
|
+
src: needsComposing.tmpFile,
|
|
79
|
+
x: needsComposing.clipRegion.x * scale,
|
|
80
|
+
y: needsComposing.clipRegion.y * scale,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
].filter(truthy_1.truthy),
|
|
84
|
+
output: needsComposing.finalOutfie,
|
|
85
|
+
downloadMap,
|
|
86
|
+
imageFormat: imageFormat === 'jpeg' ? 'Jpeg' : 'Png',
|
|
87
|
+
});
|
|
88
|
+
if (wantsBuffer) {
|
|
89
|
+
const buffer = await fs_1.default.promises.readFile(needsComposing.finalOutfie);
|
|
90
|
+
await fs_1.default.promises.unlink(needsComposing.finalOutfie);
|
|
91
|
+
return { buffer, collectedAssets };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return { buffer: null, collectedAssets };
|
|
95
|
+
};
|
|
96
|
+
exports.takeFrameAndCompose = takeFrameAndCompose;
|
package/dist/tmp-dir.d.ts
CHANGED
|
File without changes
|
package/dist/tmp-dir.js
CHANGED
|
File without changes
|
package/dist/truthy.d.ts
ADDED