@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
|
@@ -3,129 +3,73 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.extractFrameFromVideo = exports.
|
|
6
|
+
exports.extractFrameFromVideo = exports.getLastFrameOfVideo = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
-
const
|
|
8
|
+
const get_video_stream_duration_1 = require("./assets/get-video-stream-duration");
|
|
9
|
+
const determine_resize_params_1 = require("./determine-resize-params");
|
|
10
|
+
const determine_vcodec_ffmpeg_flags_1 = require("./determine-vcodec-ffmpeg-flags");
|
|
11
|
+
const ensure_presentation_timestamp_1 = require("./ensure-presentation-timestamp");
|
|
12
|
+
const ffmpeg_flags_1 = require("./ffmpeg-flags");
|
|
9
13
|
const frame_to_ffmpeg_timestamp_1 = require("./frame-to-ffmpeg-timestamp");
|
|
10
|
-
const
|
|
14
|
+
const get_can_extract_frames_fast_1 = require("./get-can-extract-frames-fast");
|
|
15
|
+
const get_frame_of_video_slow_1 = require("./get-frame-of-video-slow");
|
|
16
|
+
const get_video_info_1 = require("./get-video-info");
|
|
11
17
|
const is_beyond_last_frame_1 = require("./is-beyond-last-frame");
|
|
12
18
|
const last_frame_from_video_cache_1 = require("./last-frame-from-video-cache");
|
|
13
19
|
const p_limit_1 = require("./p-limit");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
stream.on('data', (chunk) => chunks.push(Buffer.from(chunk)));
|
|
18
|
-
stream.on('error', (err) => reject(err));
|
|
19
|
-
stream.on('end', () => resolve(Buffer.concat(chunks).toString('utf8')));
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
exports.streamToString = streamToString;
|
|
20
|
+
const perf_1 = require("./perf");
|
|
21
|
+
const truthy_1 = require("./truthy");
|
|
22
|
+
const try_to_extract_frame_of_video_fast_1 = require("./try-to-extract-frame-of-video-fast");
|
|
23
23
|
const lastFrameLimit = (0, p_limit_1.pLimit)(1);
|
|
24
24
|
const mainLimit = (0, p_limit_1.pLimit)(5);
|
|
25
|
-
// Uses no seeking, therefore the whole video has to be decoded. This is a last resort and should only happen
|
|
26
|
-
// if the video is corrupted
|
|
27
|
-
const getLastFrameOfVideoSlow = async ({ src, duration, ffmpegExecutable, }) => {
|
|
28
|
-
console.warn(`\nUsing a slow method to determine the last frame of ${src}. The render can be sped up by re-encoding the video properly.`);
|
|
29
|
-
const actualOffset = `-${duration * 1000}ms`;
|
|
30
|
-
const command = [
|
|
31
|
-
'-itsoffset',
|
|
32
|
-
actualOffset,
|
|
33
|
-
'-i',
|
|
34
|
-
src,
|
|
35
|
-
'-frames:v',
|
|
36
|
-
'1',
|
|
37
|
-
'-f',
|
|
38
|
-
'image2pipe',
|
|
39
|
-
'-',
|
|
40
|
-
];
|
|
41
|
-
const { stdout, stderr } = (0, execa_1.default)(ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : 'ffmpeg', command);
|
|
42
|
-
if (!stderr) {
|
|
43
|
-
throw new Error('unexpectedly did not get stderr');
|
|
44
|
-
}
|
|
45
|
-
if (!stdout) {
|
|
46
|
-
throw new Error('unexpectedly did not get stdout');
|
|
47
|
-
}
|
|
48
|
-
const stderrChunks = [];
|
|
49
|
-
const stdoutChunks = [];
|
|
50
|
-
const stdErrString = new Promise((resolve, reject) => {
|
|
51
|
-
stderr.on('data', (d) => stderrChunks.push(d));
|
|
52
|
-
stderr.on('error', (err) => reject(err));
|
|
53
|
-
stderr.on('end', () => resolve(Buffer.concat(stderrChunks).toString('utf-8')));
|
|
54
|
-
});
|
|
55
|
-
const stdoutChunk = new Promise((resolve, reject) => {
|
|
56
|
-
stdout.on('data', (d) => stdoutChunks.push(d));
|
|
57
|
-
stdout.on('error', (err) => reject(err));
|
|
58
|
-
stdout.on('end', () => resolve(Buffer.concat(stdoutChunks)));
|
|
59
|
-
});
|
|
60
|
-
const [stdErr, stdoutBuffer] = await Promise.all([stdErrString, stdoutChunk]);
|
|
61
|
-
const isEmpty = stdErr.includes('Output file is empty');
|
|
62
|
-
if (isEmpty) {
|
|
63
|
-
throw new Error(`Could not get last frame of ${src}. Tried to seek to the end using the command "ffmpeg ${command.join(' ')}" but got no frame. Most likely this video is corrupted.`);
|
|
64
|
-
}
|
|
65
|
-
return stdoutBuffer;
|
|
66
|
-
};
|
|
67
25
|
const getLastFrameOfVideoFastUnlimited = async (options) => {
|
|
68
|
-
const { ffmpegExecutable, ffprobeExecutable, offset, src } = options;
|
|
26
|
+
const { ffmpegExecutable, ffprobeExecutable, offset, src, downloadMap } = options;
|
|
69
27
|
const fromCache = (0, last_frame_from_video_cache_1.getLastFrameFromCache)({ ...options, offset: 0 });
|
|
70
28
|
if (fromCache) {
|
|
71
29
|
return fromCache;
|
|
72
30
|
}
|
|
73
|
-
const duration = await (0,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
if (
|
|
78
|
-
|
|
31
|
+
const { duration, fps } = await (0, get_video_stream_duration_1.getVideoStreamDuration)(downloadMap, src, ffprobeExecutable, options.remotionRoot);
|
|
32
|
+
if (duration === null) {
|
|
33
|
+
throw new Error(`Could not determine the duration of ${src} using FFMPEG. The file is not supported.`);
|
|
34
|
+
}
|
|
35
|
+
if (options.specialVCodecForTransparency === 'vp8' ||
|
|
36
|
+
offset > get_can_extract_frames_fast_1.ACCEPTABLE_OFFSET_THRESHOLD) {
|
|
37
|
+
const last = await (0, get_frame_of_video_slow_1.getFrameOfVideoSlow)({
|
|
79
38
|
duration,
|
|
80
39
|
ffmpegExecutable,
|
|
81
40
|
src,
|
|
41
|
+
imageFormat: options.imageFormat,
|
|
42
|
+
specialVCodecForTransparency: options.specialVCodecForTransparency,
|
|
43
|
+
needsResize: options.needsResize,
|
|
44
|
+
offset: offset - 1000 / (fps === null ? 10 : fps),
|
|
45
|
+
fps,
|
|
46
|
+
remotionRoot: options.remotionRoot,
|
|
82
47
|
});
|
|
83
48
|
return last;
|
|
84
49
|
}
|
|
85
|
-
const actualOffset = `${duration * 1000 - offset
|
|
86
|
-
const
|
|
87
|
-
'-ss',
|
|
50
|
+
const actualOffset = `${duration * 1000 - offset}ms`;
|
|
51
|
+
const [stdErr, stdoutBuffer] = await (0, try_to_extract_frame_of_video_fast_1.tryToExtractFrameOfVideoFast)({
|
|
88
52
|
actualOffset,
|
|
89
|
-
|
|
53
|
+
ffmpegExecutable,
|
|
54
|
+
imageFormat: options.imageFormat,
|
|
55
|
+
needsResize: options.needsResize,
|
|
56
|
+
remotionRoot: options.remotionRoot,
|
|
57
|
+
specialVCodecForTransparency: options.specialVCodecForTransparency,
|
|
90
58
|
src,
|
|
91
|
-
'-frames:v',
|
|
92
|
-
'1',
|
|
93
|
-
'-f',
|
|
94
|
-
'image2pipe',
|
|
95
|
-
'-',
|
|
96
|
-
]);
|
|
97
|
-
if (!stderr) {
|
|
98
|
-
throw new Error('unexpectedly did not get stderr');
|
|
99
|
-
}
|
|
100
|
-
if (!stdout) {
|
|
101
|
-
throw new Error('unexpectedly did not get stdout');
|
|
102
|
-
}
|
|
103
|
-
const stderrChunks = [];
|
|
104
|
-
const stdoutChunks = [];
|
|
105
|
-
const stdErrString = new Promise((resolve, reject) => {
|
|
106
|
-
stderr.on('data', (d) => stderrChunks.push(d));
|
|
107
|
-
stderr.on('error', (err) => reject(err));
|
|
108
|
-
stderr.on('end', () => resolve(Buffer.concat(stderrChunks).toString('utf-8')));
|
|
109
|
-
});
|
|
110
|
-
const stdoutChunk = new Promise((resolve, reject) => {
|
|
111
|
-
stdout.on('data', (d) => {
|
|
112
|
-
stdoutChunks.push(d);
|
|
113
|
-
});
|
|
114
|
-
stdout.on('error', (err) => {
|
|
115
|
-
reject(err);
|
|
116
|
-
});
|
|
117
|
-
stdout.on('end', () => {
|
|
118
|
-
resolve(Buffer.concat(stdoutChunks));
|
|
119
|
-
});
|
|
120
59
|
});
|
|
121
|
-
const [stdErr, stdoutBuffer] = await Promise.all([stdErrString, stdoutChunk]);
|
|
122
60
|
const isEmpty = stdErr.includes('Output file is empty');
|
|
123
61
|
if (isEmpty) {
|
|
124
62
|
const unlimited = await getLastFrameOfVideoFastUnlimited({
|
|
125
63
|
ffmpegExecutable,
|
|
126
|
-
|
|
64
|
+
// Decrement in 10ms increments, or 1 frame (e.g. fps = 25 --> 40ms)
|
|
65
|
+
offset: offset + (fps === null ? 10 : 1000 / fps),
|
|
127
66
|
src,
|
|
128
67
|
ffprobeExecutable,
|
|
68
|
+
imageFormat: options.imageFormat,
|
|
69
|
+
specialVCodecForTransparency: options.specialVCodecForTransparency,
|
|
70
|
+
needsResize: options.needsResize,
|
|
71
|
+
downloadMap: options.downloadMap,
|
|
72
|
+
remotionRoot: options.remotionRoot,
|
|
129
73
|
});
|
|
130
74
|
return unlimited;
|
|
131
75
|
}
|
|
@@ -137,28 +81,61 @@ const getLastFrameOfVideo = async (options) => {
|
|
|
137
81
|
return result;
|
|
138
82
|
};
|
|
139
83
|
exports.getLastFrameOfVideo = getLastFrameOfVideo;
|
|
140
|
-
const extractFrameFromVideoFn = async ({ time,
|
|
141
|
-
|
|
84
|
+
const extractFrameFromVideoFn = async ({ time, ffmpegExecutable, ffprobeExecutable, imageFormat, downloadMap, remotionRoot, ...options }) => {
|
|
85
|
+
// We make a new copy of the video only for video because the conversion may affect
|
|
86
|
+
// audio rendering, so we work with 2 different files
|
|
87
|
+
const src = await (0, ensure_presentation_timestamp_1.ensurePresentationTimestamps)({
|
|
88
|
+
downloadMap,
|
|
89
|
+
src: options.src,
|
|
90
|
+
remotionRoot,
|
|
91
|
+
ffmpegExecutable,
|
|
92
|
+
ffprobeExecutable,
|
|
93
|
+
});
|
|
94
|
+
const { specialVcodecForTransparency: specialVcodec, needsResize } = await (0, get_video_info_1.getVideoInfo)(downloadMap, src, ffprobeExecutable, remotionRoot);
|
|
95
|
+
if (specialVcodec === 'vp8') {
|
|
96
|
+
const { fps } = await (0, get_video_stream_duration_1.getVideoStreamDuration)(downloadMap, src, ffprobeExecutable, remotionRoot);
|
|
97
|
+
return (0, get_frame_of_video_slow_1.getFrameOfVideoSlow)({
|
|
98
|
+
ffmpegExecutable,
|
|
99
|
+
imageFormat,
|
|
100
|
+
specialVCodecForTransparency: specialVcodec,
|
|
101
|
+
src,
|
|
102
|
+
duration: time,
|
|
103
|
+
needsResize,
|
|
104
|
+
offset: 0,
|
|
105
|
+
fps,
|
|
106
|
+
remotionRoot,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
if ((0, is_beyond_last_frame_1.isBeyondLastFrame)(downloadMap, src, time)) {
|
|
142
110
|
const lastFrame = await (0, exports.getLastFrameOfVideo)({
|
|
143
111
|
ffmpegExecutable,
|
|
144
112
|
ffprobeExecutable,
|
|
145
113
|
offset: 0,
|
|
146
114
|
src,
|
|
115
|
+
imageFormat,
|
|
116
|
+
specialVCodecForTransparency: specialVcodec,
|
|
117
|
+
needsResize,
|
|
118
|
+
downloadMap,
|
|
119
|
+
remotionRoot,
|
|
147
120
|
});
|
|
148
121
|
return lastFrame;
|
|
149
122
|
}
|
|
150
123
|
const ffmpegTimestamp = (0, frame_to_ffmpeg_timestamp_1.frameToFfmpegTimestamp)(time);
|
|
151
|
-
const { stdout, stderr } = (0, execa_1.default)(
|
|
124
|
+
const { stdout, stderr } = (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffmpegExecutable, remotionRoot, 'ffmpeg'), [
|
|
152
125
|
'-ss',
|
|
153
126
|
ffmpegTimestamp,
|
|
127
|
+
...(0, determine_vcodec_ffmpeg_flags_1.determineVcodecFfmpegFlags)(specialVcodec),
|
|
154
128
|
'-i',
|
|
155
129
|
src,
|
|
156
130
|
'-frames:v',
|
|
157
131
|
'1',
|
|
158
132
|
'-f',
|
|
159
133
|
'image2pipe',
|
|
134
|
+
'-vcodec',
|
|
135
|
+
imageFormat === 'jpeg' ? 'mjpeg' : 'png',
|
|
136
|
+
...(0, determine_resize_params_1.determineResizeParams)(needsResize),
|
|
160
137
|
'-',
|
|
161
|
-
], {
|
|
138
|
+
].filter(truthy_1.truthy), {
|
|
162
139
|
buffer: false,
|
|
163
140
|
});
|
|
164
141
|
if (!stderr) {
|
|
@@ -184,22 +161,31 @@ const extractFrameFromVideoFn = async ({ time, src, ffmpegExecutable, ffprobeExe
|
|
|
184
161
|
stdoutBuffer,
|
|
185
162
|
]);
|
|
186
163
|
if (stderrStr.includes('Output file is empty')) {
|
|
187
|
-
(0, is_beyond_last_frame_1.markAsBeyondLastFrame)(src, time);
|
|
164
|
+
(0, is_beyond_last_frame_1.markAsBeyondLastFrame)(downloadMap, src, time);
|
|
188
165
|
const last = await (0, exports.getLastFrameOfVideo)({
|
|
189
166
|
ffmpegExecutable,
|
|
190
167
|
ffprobeExecutable,
|
|
191
168
|
offset: 0,
|
|
192
169
|
src,
|
|
170
|
+
imageFormat,
|
|
171
|
+
specialVCodecForTransparency: specialVcodec,
|
|
172
|
+
needsResize,
|
|
173
|
+
downloadMap,
|
|
174
|
+
remotionRoot,
|
|
193
175
|
});
|
|
194
176
|
return last;
|
|
195
177
|
}
|
|
178
|
+
if (stdOut.length === 0) {
|
|
179
|
+
console.log('FFMPEG Logs:');
|
|
180
|
+
console.log(stderrStr);
|
|
181
|
+
throw new Error("Couldn't extract frame from video - FFMPEG did not return any data. Check logs to see more information");
|
|
182
|
+
}
|
|
196
183
|
return stdOut;
|
|
197
184
|
};
|
|
198
|
-
exports.extractFrameFromVideoFn = extractFrameFromVideoFn;
|
|
199
185
|
const extractFrameFromVideo = async (options) => {
|
|
200
|
-
const perf =
|
|
201
|
-
const res = await mainLimit(
|
|
202
|
-
|
|
186
|
+
const perf = (0, perf_1.startPerfMeasure)('extract-frame');
|
|
187
|
+
const res = await mainLimit(extractFrameFromVideoFn, options);
|
|
188
|
+
(0, perf_1.stopPerfMeasure)(perf);
|
|
203
189
|
return res;
|
|
204
190
|
};
|
|
205
191
|
exports.extractFrameFromVideo = extractFrameFromVideo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare type FfmpegExecutable = string | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DownloadMap } from './assets/download-map';
|
|
2
|
+
export declare const makeFfmpegFilterFile: (complexFilter: string, downloadMap: DownloadMap) => Promise<{
|
|
2
3
|
file: string;
|
|
3
4
|
cleanup: () => void;
|
|
4
5
|
}>;
|
|
@@ -8,16 +8,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.makeFfmpegFilterFile = void 0;
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const tempPath = (0, tmp_dir_1.tmpDir)('remotion-complex-filter');
|
|
15
|
-
const filterFile = path_1.default.join(tempPath, 'complex-filter.txt');
|
|
11
|
+
const makeFfmpegFilterFile = async (complexFilter, downloadMap) => {
|
|
12
|
+
const random = Math.random().toString().replace('.', '');
|
|
13
|
+
const filterFile = path_1.default.join(downloadMap.complexFilter, 'complex-filter-' + random + '.txt');
|
|
16
14
|
await fs_1.default.promises.writeFile(filterFile, complexFilter);
|
|
17
15
|
return {
|
|
18
16
|
file: filterFile,
|
|
19
17
|
cleanup: () => {
|
|
20
|
-
|
|
18
|
+
fs_1.default.unlinkSync(filterFile);
|
|
21
19
|
},
|
|
22
20
|
};
|
|
23
21
|
};
|
package/dist/ffmpeg-flags.d.ts
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
|
+
import type { FfmpegExecutable } from './ffmpeg-executable';
|
|
1
2
|
export declare type FfmpegVersion = [number, number, number] | null;
|
|
2
3
|
export declare const getFfmpegBuildInfo: (options: {
|
|
3
4
|
ffmpegExecutable: string | null;
|
|
5
|
+
remotionRoot: string;
|
|
4
6
|
}) => Promise<string>;
|
|
5
|
-
export declare const
|
|
7
|
+
export declare const ffmpegInNodeModules: (remotionRoot: string, binary: 'ffmpeg' | 'ffprobe') => string | null;
|
|
8
|
+
export declare const ffmpegHasFeature: ({ ffmpegExecutable, feature, remotionRoot, }: {
|
|
6
9
|
ffmpegExecutable: string | null;
|
|
7
10
|
feature: 'enable-gpl' | 'enable-libx265' | 'enable-libvpx';
|
|
8
|
-
|
|
11
|
+
remotionRoot: string;
|
|
9
12
|
}) => Promise<boolean>;
|
|
10
13
|
export declare const parseFfmpegVersion: (buildconf: string) => FfmpegVersion;
|
|
11
14
|
export declare const getFfmpegVersion: (options: {
|
|
12
15
|
ffmpegExecutable: string | null;
|
|
16
|
+
remotionRoot: string;
|
|
13
17
|
}) => Promise<FfmpegVersion>;
|
|
18
|
+
export declare const downloadBinary: (remotionRoot: string, url: string, binary: 'ffmpeg' | 'ffprobe') => Promise<string>;
|
|
19
|
+
export declare const lambdaFfmpegPaths: {
|
|
20
|
+
readonly ffmpeg: "/opt/bin/ffmpeg";
|
|
21
|
+
readonly ffprobe: "/opt/bin/ffprobe";
|
|
22
|
+
};
|
|
23
|
+
export declare const getExecutableBinary: (ffmpegExecutable: FfmpegExecutable, remotionRoot: string, binary: 'ffmpeg' | 'ffprobe') => string | Promise<string>;
|
|
24
|
+
export declare const getBinaryDownloadUrl: (binary: 'ffmpeg' | 'ffprobe') => {
|
|
25
|
+
url: string;
|
|
26
|
+
contentLength: number;
|
|
27
|
+
} | null;
|
|
28
|
+
export declare const warnAboutFfmpegVersion: ({ ffmpegVersion, buildConf, }: {
|
|
29
|
+
ffmpegVersion: FfmpegVersion;
|
|
30
|
+
buildConf: string | null;
|
|
31
|
+
}) => null | undefined;
|
package/dist/ffmpeg-flags.js
CHANGED
|
@@ -3,31 +3,81 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getFfmpegVersion = exports.parseFfmpegVersion = exports.ffmpegHasFeature = exports.getFfmpegBuildInfo = void 0;
|
|
6
|
+
exports.warnAboutFfmpegVersion = exports.getBinaryDownloadUrl = exports.getExecutableBinary = exports.lambdaFfmpegPaths = exports.downloadBinary = exports.getFfmpegVersion = exports.parseFfmpegVersion = exports.ffmpegHasFeature = exports.ffmpegInNodeModules = exports.getFfmpegBuildInfo = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const os_1 = __importDefault(require("os"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const BrowserFetcher_1 = require("./browser/BrowserFetcher");
|
|
8
12
|
const validate_ffmpeg_1 = require("./validate-ffmpeg");
|
|
9
13
|
let buildConfig = null;
|
|
14
|
+
const listeners = {};
|
|
15
|
+
const isDownloading = {};
|
|
10
16
|
const getFfmpegBuildInfo = async (options) => {
|
|
11
|
-
var _a;
|
|
12
17
|
if (buildConfig !== null) {
|
|
13
18
|
return buildConfig;
|
|
14
19
|
}
|
|
15
|
-
const data = await (0, execa_1.default)((
|
|
20
|
+
const data = await (0, execa_1.default)(await (0, exports.getExecutableBinary)(options.ffmpegExecutable, options.remotionRoot, 'ffmpeg'), ['-buildconf'], {
|
|
16
21
|
reject: false,
|
|
17
22
|
});
|
|
18
23
|
buildConfig = data.stderr;
|
|
19
24
|
return buildConfig;
|
|
20
25
|
};
|
|
21
26
|
exports.getFfmpegBuildInfo = getFfmpegBuildInfo;
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
const getFfmpegFolderName = (remotionRoot) => {
|
|
28
|
+
return path_1.default.resolve(remotionRoot, 'node_modules/.ffmpeg');
|
|
29
|
+
};
|
|
30
|
+
const binaryPrefix = { ffmpeg: 'ffmpeg-', ffprobe: 'ffprobe-' };
|
|
31
|
+
const randomFfmpegRuntimeId = String(Math.random()).replace('0.', '');
|
|
32
|
+
const ffmpegInNodeModules = (remotionRoot, binary) => {
|
|
33
|
+
const folderName = getFfmpegFolderName(remotionRoot);
|
|
34
|
+
if (!fs_1.default.existsSync(folderName)) {
|
|
35
|
+
fs_1.default.mkdirSync(folderName, {
|
|
36
|
+
recursive: true,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
// Check if a version of FFMPEG is already installed.
|
|
40
|
+
// To qualify, it must have the expected file size
|
|
41
|
+
// to avoid finding binaries that are still being downloaded
|
|
42
|
+
// A random ID is being assigned to the download to avoid conflicts when multiple Remotion processes are running
|
|
43
|
+
const ffmpegInstalled = fs_1.default.readdirSync(folderName).find((filename) => {
|
|
44
|
+
if (!filename.startsWith(binaryPrefix[binary])) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
const dlUrl = (0, exports.getBinaryDownloadUrl)(binary);
|
|
48
|
+
if (!dlUrl) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
const expectedLength = dlUrl.contentLength;
|
|
52
|
+
if (fs_1.default.statSync(path_1.default.join(folderName, filename)).size === expectedLength) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
});
|
|
57
|
+
if (ffmpegInstalled) {
|
|
58
|
+
return path_1.default.join(folderName, ffmpegInstalled);
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
};
|
|
62
|
+
exports.ffmpegInNodeModules = ffmpegInNodeModules;
|
|
63
|
+
const getFfmpegAbsolutePath = (remotionRoot, binary) => {
|
|
64
|
+
const folderName = getFfmpegFolderName(remotionRoot);
|
|
65
|
+
if (!fs_1.default.existsSync(folderName)) {
|
|
66
|
+
fs_1.default.mkdirSync(folderName);
|
|
67
|
+
}
|
|
68
|
+
if (os_1.default.platform() === 'win32') {
|
|
69
|
+
return path_1.default.resolve(folderName, `${binaryPrefix[binary]}${randomFfmpegRuntimeId}.exe`);
|
|
70
|
+
}
|
|
71
|
+
return path_1.default.resolve(folderName, `${binaryPrefix[binary]}${randomFfmpegRuntimeId}`);
|
|
72
|
+
};
|
|
73
|
+
const ffmpegHasFeature = async ({ ffmpegExecutable, feature, remotionRoot, }) => {
|
|
74
|
+
if (ffmpegExecutable && !(0, validate_ffmpeg_1.customExecutableExists)(ffmpegExecutable)) {
|
|
75
|
+
return false;
|
|
26
76
|
}
|
|
27
|
-
if (!(
|
|
77
|
+
if (!(0, validate_ffmpeg_1.binaryExists)('ffmpeg')) {
|
|
28
78
|
return false;
|
|
29
79
|
}
|
|
30
|
-
const config = await (0, exports.getFfmpegBuildInfo)({ ffmpegExecutable });
|
|
80
|
+
const config = await (0, exports.getFfmpegBuildInfo)({ ffmpegExecutable, remotionRoot });
|
|
31
81
|
return config.includes(feature);
|
|
32
82
|
};
|
|
33
83
|
exports.ffmpegHasFeature = ffmpegHasFeature;
|
|
@@ -43,7 +93,153 @@ exports.parseFfmpegVersion = parseFfmpegVersion;
|
|
|
43
93
|
const getFfmpegVersion = async (options) => {
|
|
44
94
|
const buildInfo = await (0, exports.getFfmpegBuildInfo)({
|
|
45
95
|
ffmpegExecutable: options.ffmpegExecutable,
|
|
96
|
+
remotionRoot: options.remotionRoot,
|
|
46
97
|
});
|
|
47
98
|
return (0, exports.parseFfmpegVersion)(buildInfo);
|
|
48
99
|
};
|
|
49
100
|
exports.getFfmpegVersion = getFfmpegVersion;
|
|
101
|
+
const waitForFfmpegToBeDownloaded = (url) => {
|
|
102
|
+
return new Promise((resolve) => {
|
|
103
|
+
if (!listeners[url]) {
|
|
104
|
+
listeners[url] = [];
|
|
105
|
+
}
|
|
106
|
+
listeners[url].push((src) => resolve(src));
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
const onProgress = (downloadedBytes, totalBytesToDownload, binary) => {
|
|
110
|
+
console.log('Downloading ', binary, `${toMegabytes(downloadedBytes)}/${toMegabytes(totalBytesToDownload)}`);
|
|
111
|
+
};
|
|
112
|
+
const downloadBinary = async (remotionRoot, url, binary) => {
|
|
113
|
+
const destinationPath = getFfmpegAbsolutePath(remotionRoot, binary);
|
|
114
|
+
const onProgressCallback = (downloadedBytes, _totalBytes) => {
|
|
115
|
+
onProgress(downloadedBytes, _totalBytes, binary);
|
|
116
|
+
};
|
|
117
|
+
isDownloading[url] = true;
|
|
118
|
+
const totalBytes = await (0, BrowserFetcher_1._downloadFile)(url, destinationPath, onProgressCallback);
|
|
119
|
+
onProgress(totalBytes, totalBytes, binary);
|
|
120
|
+
if (os_1.default.platform() !== 'win32') {
|
|
121
|
+
fs_1.default.chmodSync(destinationPath, '777');
|
|
122
|
+
}
|
|
123
|
+
isDownloading[url] = false;
|
|
124
|
+
if (!listeners[url]) {
|
|
125
|
+
listeners[url] = [];
|
|
126
|
+
}
|
|
127
|
+
listeners[url].forEach((listener) => listener(destinationPath));
|
|
128
|
+
listeners[url] = [];
|
|
129
|
+
return destinationPath;
|
|
130
|
+
};
|
|
131
|
+
exports.downloadBinary = downloadBinary;
|
|
132
|
+
exports.lambdaFfmpegPaths = {
|
|
133
|
+
ffmpeg: '/opt/bin/ffmpeg',
|
|
134
|
+
ffprobe: '/opt/bin/ffprobe',
|
|
135
|
+
};
|
|
136
|
+
const getExecutableBinary = (ffmpegExecutable, remotionRoot, binary) => {
|
|
137
|
+
if (fs_1.default.existsSync(exports.lambdaFfmpegPaths[binary])) {
|
|
138
|
+
return exports.lambdaFfmpegPaths[binary];
|
|
139
|
+
}
|
|
140
|
+
if (ffmpegExecutable && (0, validate_ffmpeg_1.customExecutableExists)(ffmpegExecutable)) {
|
|
141
|
+
return ffmpegExecutable;
|
|
142
|
+
}
|
|
143
|
+
if ((0, validate_ffmpeg_1.binaryExists)(binary)) {
|
|
144
|
+
return binary;
|
|
145
|
+
}
|
|
146
|
+
const dlUrl = (0, exports.getBinaryDownloadUrl)(binary);
|
|
147
|
+
if (dlUrl && isDownloading[dlUrl.url]) {
|
|
148
|
+
return waitForFfmpegToBeDownloaded(dlUrl.url);
|
|
149
|
+
}
|
|
150
|
+
const inNodeMod = (0, exports.ffmpegInNodeModules)(remotionRoot, binary);
|
|
151
|
+
if (inNodeMod) {
|
|
152
|
+
return inNodeMod;
|
|
153
|
+
}
|
|
154
|
+
if (!dlUrl) {
|
|
155
|
+
throw new Error(`${binary} could not be installed automatically. Your architecture and OS combination (os = ${os_1.default.platform()}, arch = ${process.arch}) is not supported. Please install ${binary} manually and add "${binary}" to your PATH.`);
|
|
156
|
+
}
|
|
157
|
+
return (0, exports.downloadBinary)(remotionRoot, dlUrl.url, binary);
|
|
158
|
+
};
|
|
159
|
+
exports.getExecutableBinary = getExecutableBinary;
|
|
160
|
+
function toMegabytes(bytes) {
|
|
161
|
+
const mb = bytes / 1024 / 1024;
|
|
162
|
+
return `${Math.round(mb * 10) / 10} Mb`;
|
|
163
|
+
}
|
|
164
|
+
const getBinaryDownloadUrl = (binary) => {
|
|
165
|
+
if (os_1.default.platform() === 'win32' && process.arch === 'x64') {
|
|
166
|
+
return binary === 'ffmpeg'
|
|
167
|
+
? {
|
|
168
|
+
url: 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffmpeg-win-x86.exe',
|
|
169
|
+
contentLength: 127531008,
|
|
170
|
+
}
|
|
171
|
+
: {
|
|
172
|
+
url: 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffprobe-win-x86.exe',
|
|
173
|
+
contentLength: 127425536,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
if (os_1.default.platform() === 'darwin' && process.arch === 'arm64') {
|
|
177
|
+
return binary === 'ffmpeg'
|
|
178
|
+
? {
|
|
179
|
+
url: 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffmpeg-macos-arm64',
|
|
180
|
+
contentLength: 42093320,
|
|
181
|
+
}
|
|
182
|
+
: {
|
|
183
|
+
url: 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffprobe-macos-arm64-v2',
|
|
184
|
+
contentLength: 46690008,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
if (os_1.default.platform() === 'darwin' && process.arch === 'x64') {
|
|
188
|
+
return binary === 'ffmpeg'
|
|
189
|
+
? {
|
|
190
|
+
url: 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffmpeg-macos-x86',
|
|
191
|
+
contentLength: 78380700,
|
|
192
|
+
}
|
|
193
|
+
: {
|
|
194
|
+
url: 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffprobe-macos-x86',
|
|
195
|
+
contentLength: 77364284,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
if (os_1.default.platform() === 'linux' && process.arch === 'x64') {
|
|
199
|
+
return binary === 'ffmpeg'
|
|
200
|
+
? {
|
|
201
|
+
url: 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffmpeg-linux-amd64',
|
|
202
|
+
contentLength: 78502560,
|
|
203
|
+
}
|
|
204
|
+
: {
|
|
205
|
+
url: 'https://remotion-ffmpeg-binaries.s3.eu-central-1.amazonaws.com/ffprobe-linux-amd64',
|
|
206
|
+
contentLength: 78400704,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return null;
|
|
210
|
+
};
|
|
211
|
+
exports.getBinaryDownloadUrl = getBinaryDownloadUrl;
|
|
212
|
+
const printMessage = (ffmpegVersion) => {
|
|
213
|
+
console.warn('⚠️Old FFMPEG version detected: ' + ffmpegVersion.join('.'));
|
|
214
|
+
console.warn(' You need at least version 4.1.0.');
|
|
215
|
+
console.warn(' Upgrade FFMPEG to get rid of this warning.');
|
|
216
|
+
};
|
|
217
|
+
const printBuildConfMessage = () => {
|
|
218
|
+
console.error('⚠️ Unsupported FFMPEG version detected.');
|
|
219
|
+
console.error(" Your version doesn't support the -buildconf flag");
|
|
220
|
+
console.error(' Audio will not be supported and you may experience other issues.');
|
|
221
|
+
console.error(' Upgrade FFMPEG to at least v4.1.0 to get rid of this warning.');
|
|
222
|
+
};
|
|
223
|
+
const warnAboutFfmpegVersion = ({ ffmpegVersion, buildConf, }) => {
|
|
224
|
+
if (buildConf === null) {
|
|
225
|
+
printBuildConfMessage();
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (ffmpegVersion === null) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
const [major, minor] = ffmpegVersion;
|
|
232
|
+
// 3.x and below definitely is too old
|
|
233
|
+
if (major < 4) {
|
|
234
|
+
printMessage(ffmpegVersion);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
// 5.x will be all good
|
|
238
|
+
if (major > 4) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (minor < 1) {
|
|
242
|
+
printMessage(ffmpegVersion);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
exports.warnAboutFfmpegVersion = warnAboutFfmpegVersion;
|
|
@@ -0,0 +1,31 @@
|
|
|
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.findRemotionRoot = exports.findClosestPackageJson = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const recursionLimit = 5;
|
|
10
|
+
const findClosestPackageJson = () => {
|
|
11
|
+
let currentDir = process.cwd();
|
|
12
|
+
let possiblePackageJson = '';
|
|
13
|
+
for (let i = 0; i < recursionLimit; i++) {
|
|
14
|
+
possiblePackageJson = path_1.default.join(currentDir, 'package.json');
|
|
15
|
+
const exists = fs_1.default.existsSync(possiblePackageJson);
|
|
16
|
+
if (exists) {
|
|
17
|
+
return possiblePackageJson;
|
|
18
|
+
}
|
|
19
|
+
currentDir = path_1.default.dirname(currentDir);
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
exports.findClosestPackageJson = findClosestPackageJson;
|
|
24
|
+
const findRemotionRoot = () => {
|
|
25
|
+
const closestPackageJson = (0, exports.findClosestPackageJson)();
|
|
26
|
+
if (closestPackageJson === null) {
|
|
27
|
+
return process.cwd();
|
|
28
|
+
}
|
|
29
|
+
return path_1.default.dirname(closestPackageJson);
|
|
30
|
+
};
|
|
31
|
+
exports.findRemotionRoot = findRemotionRoot;
|