@remotion/renderer 4.0.0-reorg.7 → 4.0.0-retry.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +8 -8
- package/dist/assets/calculate-asset-positions.d.ts +0 -0
- package/dist/assets/calculate-asset-positions.js +0 -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 +3 -2
- package/dist/assets/convert-assets-to-file-urls.js +2 -2
- package/dist/assets/download-and-map-assets-to-file.d.ts +8 -6
- package/dist/assets/download-and-map-assets-to-file.js +91 -50
- package/dist/assets/download-file.d.ts +1 -1
- package/dist/assets/download-file.js +4 -2
- package/dist/assets/download-map.d.ts +64 -0
- package/dist/assets/download-map.js +73 -0
- package/dist/assets/ffmpeg-volume-expression.d.ts +0 -0
- package/dist/assets/ffmpeg-volume-expression.js +0 -0
- package/dist/assets/flatten-volume-array.d.ts +0 -0
- package/dist/assets/flatten-volume-array.js +0 -0
- package/dist/assets/get-audio-channels.d.ts +2 -6
- package/dist/assets/get-audio-channels.js +6 -7
- package/dist/assets/get-video-stream-duration.d.ts +3 -5
- package/dist/assets/get-video-stream-duration.js +39 -14
- package/dist/assets/read-file.d.ts +0 -0
- package/dist/assets/read-file.js +0 -0
- 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 +0 -0
- package/dist/assets/types.js +0 -0
- package/dist/browser/Browser.d.ts +1 -0
- package/dist/browser/Browser.js +9 -10
- package/dist/browser/BrowserConnector.d.ts +0 -0
- package/dist/browser/BrowserConnector.js +0 -0
- package/dist/browser/BrowserFetcher.d.ts +0 -0
- package/dist/browser/BrowserFetcher.js +12 -10
- package/dist/browser/BrowserPage.d.ts +0 -0
- package/dist/browser/BrowserPage.js +0 -0
- package/dist/browser/BrowserRunner.d.ts +1 -4
- package/dist/browser/BrowserRunner.js +28 -71
- package/dist/browser/Connection.d.ts +0 -0
- package/dist/browser/Connection.js +1 -1
- package/dist/browser/ConsoleMessage.d.ts +0 -0
- package/dist/browser/ConsoleMessage.js +0 -0
- package/dist/browser/DOMWorld.d.ts +0 -0
- package/dist/browser/DOMWorld.js +0 -0
- package/dist/browser/Errors.d.ts +0 -0
- package/dist/browser/Errors.js +0 -0
- package/dist/browser/EvalTypes.d.ts +0 -0
- package/dist/browser/EvalTypes.js +0 -0
- package/dist/browser/EventEmitter.d.ts +0 -0
- package/dist/browser/EventEmitter.js +0 -0
- package/dist/browser/ExecutionContext.d.ts +0 -0
- package/dist/browser/ExecutionContext.js +0 -0
- package/dist/browser/FrameManager.d.ts +0 -0
- package/dist/browser/FrameManager.js +0 -0
- package/dist/browser/HTTPRequest.d.ts +0 -0
- package/dist/browser/HTTPRequest.js +0 -0
- package/dist/browser/HTTPResponse.d.ts +0 -0
- package/dist/browser/HTTPResponse.js +0 -0
- package/dist/browser/JSHandle.d.ts +0 -0
- package/dist/browser/JSHandle.js +0 -0
- package/dist/browser/LaunchOptions.d.ts +0 -4
- package/dist/browser/LaunchOptions.js +0 -0
- package/dist/browser/Launcher.d.ts +1 -1
- package/dist/browser/Launcher.js +5 -363
- package/dist/browser/LifecycleWatcher.d.ts +0 -0
- package/dist/browser/LifecycleWatcher.js +0 -0
- package/dist/browser/NetworkEventManager.d.ts +0 -0
- package/dist/browser/NetworkEventManager.js +0 -0
- package/dist/browser/NetworkManager.d.ts +0 -0
- package/dist/browser/NetworkManager.js +0 -0
- package/dist/browser/NodeWebSocketTransport.d.ts +0 -0
- package/dist/browser/NodeWebSocketTransport.js +1 -1
- package/dist/browser/Product.d.ts +0 -0
- package/dist/browser/Product.js +0 -0
- package/dist/browser/PuppeteerNode.d.ts +0 -0
- package/dist/browser/PuppeteerNode.js +1 -4
- package/dist/browser/PuppeteerViewport.d.ts +0 -0
- package/dist/browser/PuppeteerViewport.js +0 -0
- package/dist/browser/ScreenshotOptions.d.ts +0 -0
- package/dist/browser/ScreenshotOptions.js +0 -0
- package/dist/browser/Target.d.ts +0 -0
- package/dist/browser/Target.js +0 -0
- package/dist/browser/TaskQueue.d.ts +0 -0
- package/dist/browser/TaskQueue.js +0 -0
- package/dist/browser/TimeoutSettings.d.ts +0 -0
- package/dist/browser/TimeoutSettings.js +0 -0
- package/dist/browser/assert.d.ts +0 -0
- package/dist/browser/assert.js +0 -0
- package/dist/browser/create-browser-fetcher.d.ts +0 -0
- package/dist/browser/create-browser-fetcher.js +2 -44
- package/dist/browser/devtools-commands.d.ts +0 -0
- package/dist/browser/devtools-commands.js +0 -0
- package/dist/browser/devtools-types.d.ts +0 -0
- package/dist/browser/devtools-types.js +0 -0
- package/dist/browser/get-download-destination.d.ts +0 -0
- package/dist/browser/get-download-destination.js +0 -0
- package/dist/browser/mitt/index.d.ts +0 -0
- package/dist/browser/mitt/index.js +0 -0
- package/dist/browser/node.d.ts +0 -0
- package/dist/browser/node.js +0 -0
- package/dist/browser/revisions.d.ts +0 -1
- package/dist/browser/revisions.js +0 -1
- package/dist/browser/util.d.ts +0 -0
- package/dist/browser/util.js +0 -0
- package/dist/browser-executable.d.ts +0 -0
- package/dist/browser-executable.js +0 -0
- package/dist/browser-log.d.ts +0 -0
- package/dist/browser-log.js +0 -0
- package/dist/browser.d.ts +0 -0
- package/dist/browser.js +0 -0
- package/dist/calculate-ffmpeg-filters.d.ts +0 -0
- package/dist/calculate-ffmpeg-filters.js +0 -0
- package/dist/calculate-sar-dar-pixels.d.ts +0 -0
- package/dist/calculate-sar-dar-pixels.js +0 -0
- package/dist/can-use-parallel-encoding.d.ts +0 -0
- package/dist/can-use-parallel-encoding.js +0 -0
- 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/codec-supports-media.d.ts +1 -0
- package/dist/codec-supports-media.js +8 -1
- package/dist/codec.d.ts +0 -0
- package/dist/codec.js +0 -0
- package/dist/combine-videos.d.ts +0 -0
- package/dist/combine-videos.js +1 -1
- package/dist/compress-assets.d.ts +0 -0
- package/dist/compress-assets.js +0 -0
- package/dist/convert-number-of-gif-loops-to-ffmpeg.d.ts +0 -0
- package/dist/convert-number-of-gif-loops-to-ffmpeg.js +0 -0
- package/dist/convert-to-pcm.d.ts +0 -0
- package/dist/convert-to-pcm.js +0 -0
- 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 +0 -0
- package/dist/create-silent-audio.d.ts +0 -0
- package/dist/create-silent-audio.js +0 -0
- package/dist/crf.d.ts +5 -1
- package/dist/crf.js +33 -6
- package/dist/cycle-browser-tabs.d.ts +0 -0
- package/dist/cycle-browser-tabs.js +0 -0
- package/dist/delay-render-embedded-stack.d.ts +0 -0
- 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/ensure-frames-in-order.d.ts +0 -0
- package/dist/ensure-frames-in-order.js +0 -0
- package/dist/ensure-output-directory.d.ts +0 -0
- package/dist/ensure-output-directory.js +0 -0
- package/dist/ensure-presentation-timestamp.d.ts +2 -1
- package/dist/ensure-presentation-timestamp.js +7 -5
- package/dist/error-handling/handle-javascript-exception.d.ts +0 -0
- package/dist/error-handling/handle-javascript-exception.js +0 -0
- package/dist/error-handling/symbolicate-error.d.ts +0 -0
- package/dist/error-handling/symbolicate-error.js +0 -0
- package/dist/error-handling/symbolicateable-error.d.ts +0 -0
- package/dist/error-handling/symbolicateable-error.js +0 -0
- package/dist/extract-frame-from-video.d.ts +2 -0
- package/dist/extract-frame-from-video.js +42 -15
- package/dist/ffmpeg-executable.d.ts +0 -0
- package/dist/ffmpeg-executable.js +0 -0
- package/dist/ffmpeg-filter-file.d.ts +2 -1
- package/dist/ffmpeg-filter-file.js +4 -6
- package/dist/ffmpeg-flags.d.ts +5 -2
- package/dist/ffmpeg-flags.js +37 -7
- package/dist/ffmpeg-override.d.ts +4 -0
- package/dist/ffmpeg-override.js +2 -0
- package/dist/frame-range.d.ts +0 -0
- package/dist/frame-range.js +0 -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 +0 -0
- package/dist/get-audio-codec-name.js +0 -0
- package/dist/get-browser-instance.d.ts +0 -0
- package/dist/get-browser-instance.js +0 -0
- package/dist/get-codec-name.d.ts +0 -0
- package/dist/get-codec-name.js +0 -0
- package/dist/get-compositions.d.ts +5 -0
- package/dist/get-compositions.js +14 -6
- package/dist/get-concurrency.d.ts +0 -0
- package/dist/get-concurrency.js +0 -0
- package/dist/get-duration-from-frame-range.d.ts +0 -0
- package/dist/get-duration-from-frame-range.js +0 -0
- package/dist/get-extension-from-codec.d.ts +1 -1
- package/dist/get-extension-from-codec.js +0 -0
- package/dist/get-extension-of-filename.d.ts +0 -0
- package/dist/get-extension-of-filename.js +0 -0
- package/dist/get-frame-padded-index.d.ts +0 -0
- package/dist/get-frame-padded-index.js +0 -0
- package/dist/get-frame-to-render.d.ts +0 -0
- package/dist/get-frame-to-render.js +0 -0
- package/dist/get-local-browser-executable.d.ts +0 -0
- package/dist/get-local-browser-executable.js +1 -3
- package/dist/get-port.d.ts +0 -0
- package/dist/get-port.js +0 -0
- package/dist/get-prores-profile-name.d.ts +0 -0
- package/dist/get-prores-profile-name.js +0 -0
- package/dist/get-video-info.d.ts +2 -7
- package/dist/get-video-info.js +7 -8
- 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 +1 -1
- package/dist/guess-extension-for-media.js +1 -1
- package/dist/image-format.d.ts +1 -1
- package/dist/image-format.js +3 -0
- package/dist/index.d.ts +19 -28
- package/dist/index.js +16 -24
- package/dist/is-audio-codec.d.ts +0 -0
- package/dist/is-audio-codec.js +0 -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 +3 -2
- package/dist/last-frame-from-video-cache.js +17 -17
- package/dist/legacy-webpack-config.d.ts +0 -0
- package/dist/legacy-webpack-config.js +0 -0
- package/dist/log-level.d.ts +0 -0
- package/dist/log-level.js +0 -0
- package/dist/make-cancel-signal.d.ts +0 -0
- package/dist/make-cancel-signal.js +0 -0
- package/dist/merge-audio-track.d.ts +2 -0
- package/dist/merge-audio-track.js +6 -3
- package/dist/mime-db.d.ts +0 -0
- package/dist/mime-db.js +0 -0
- package/dist/mime-types.d.ts +1 -0
- package/dist/mime-types.js +6 -1
- package/dist/normalize-serve-url.d.ts +0 -0
- package/dist/normalize-serve-url.js +0 -0
- package/dist/offthread-video-server.d.ts +3 -2
- package/dist/offthread-video-server.js +14 -2
- package/dist/open-browser.d.ts +0 -0
- package/dist/open-browser.js +3 -12
- package/dist/overwrite.d.ts +0 -0
- package/dist/overwrite.js +0 -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 +0 -0
- package/dist/perf.js +0 -0
- package/dist/pixel-format.d.ts +1 -1
- package/dist/pixel-format.js +3 -0
- package/dist/pool.d.ts +0 -0
- package/dist/pool.js +0 -0
- package/dist/prepare-server.d.ts +3 -2
- package/dist/prepare-server.js +3 -3
- package/dist/preprocess-audio-track.d.ts +2 -0
- package/dist/preprocess-audio-track.js +3 -3
- package/dist/prespawn-ffmpeg.d.ts +3 -0
- package/dist/prespawn-ffmpeg.js +15 -11
- package/dist/prestitcher-memory-usage.d.ts +12 -0
- package/dist/prestitcher-memory-usage.js +30 -0
- package/dist/prores-profile.d.ts +4 -1
- package/dist/prores-profile.js +6 -6
- package/dist/provide-screenshot.d.ts +0 -0
- package/dist/provide-screenshot.js +0 -0
- package/dist/puppeteer-evaluate.d.ts +0 -0
- package/dist/puppeteer-evaluate.js +0 -0
- package/dist/puppeteer-screenshot.d.ts +0 -0
- package/dist/puppeteer-screenshot.js +0 -0
- package/dist/quality.d.ts +0 -0
- package/dist/quality.js +0 -0
- package/dist/render-frames.d.ts +16 -3
- package/dist/render-frames.js +98 -30
- package/dist/render-media.d.ts +30 -4
- package/dist/render-media.js +123 -20
- package/dist/render-still.d.ts +6 -1
- package/dist/render-still.js +37 -11
- 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 +0 -0
- package/dist/screenshot-dom-element.js +0 -0
- package/dist/screenshot-task.d.ts +0 -0
- package/dist/screenshot-task.js +30 -15
- package/dist/seek-to-frame.d.ts +0 -0
- package/dist/seek-to-frame.js +0 -0
- package/dist/serve-handler/index.d.ts +0 -0
- package/dist/serve-handler/index.js +0 -0
- 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 +2 -1
- package/dist/serve-static.js +14 -1
- package/dist/set-props-and-env.d.ts +3 -1
- package/dist/set-props-and-env.js +34 -8
- package/dist/stitch-frames-to-video.d.ts +7 -7
- package/dist/stitch-frames-to-video.js +68 -57
- package/dist/stringify-ffmpeg-filter.d.ts +0 -0
- package/dist/stringify-ffmpeg-filter.js +0 -0
- package/dist/symbolicate-stacktrace.d.ts +0 -0
- package/dist/symbolicate-stacktrace.js +0 -0
- package/dist/tmp-dir.d.ts +0 -0
- package/dist/tmp-dir.js +0 -0
- package/dist/truthy.d.ts +0 -0
- package/dist/truthy.js +0 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +0 -0
- package/dist/validate-concurrency.d.ts +0 -0
- package/dist/validate-concurrency.js +0 -0
- package/dist/validate-even-dimensions-with-codec.d.ts +0 -0
- package/dist/validate-even-dimensions-with-codec.js +0 -0
- package/dist/validate-every-nth-frame.d.ts +2 -1
- package/dist/validate-every-nth-frame.js +8 -1
- package/dist/validate-ffmpeg-override.d.ts +2 -0
- package/dist/validate-ffmpeg-override.js +12 -0
- package/dist/validate-ffmpeg.d.ts +4 -1
- package/dist/validate-ffmpeg.js +23 -7
- package/dist/validate-frame.d.ts +0 -0
- package/dist/validate-frame.js +3 -3
- 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 +0 -0
- package/dist/validate-opengl-renderer.js +0 -0
- package/dist/validate-output-filename.d.ts +0 -0
- package/dist/validate-output-filename.js +0 -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 +0 -0
- package/dist/wait-for-symbolication-error-to-be-done.js +0 -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 +0 -0
- package/dist/ws/ws-types.js +0 -0
- package/package.json +7 -7
- package/dist/make-assets-download-dir.d.ts +0 -1
- package/dist/make-assets-download-dir.js +0 -13
- package/vitest.config.ts +0 -8
package/LICENSE.md
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
# Remotion License
|
|
2
2
|
|
|
3
|
-
Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion create videos for free (even commercial), while a company license is required for for-profit
|
|
3
|
+
Depending on the type of your legal entity, you are granted permission to use Remotion for your project. Individuals and small companies are allowed to use Remotion to create videos for free (even commercial), while a company license is required for for-profit organizations of a certain size. This two-tier system was designed to ensure funding for this project while still allowing the source code to be available and the program to be free for most. Read below for the exact terms of use.
|
|
4
4
|
|
|
5
5
|
- [Free license](#free-license)
|
|
6
6
|
- [Company license](#company-license)
|
|
7
7
|
|
|
8
8
|
## Free license
|
|
9
9
|
|
|
10
|
-
Copyright © 2022 [
|
|
10
|
+
Copyright © 2022 [Remotion](https://www.remotion.dev/)
|
|
11
11
|
|
|
12
12
|
### Eligibility
|
|
13
13
|
|
|
14
14
|
You are eligible to use Remotion for free if you are:
|
|
15
15
|
|
|
16
16
|
- an individual
|
|
17
|
-
- a for-profit
|
|
18
|
-
- a non-profit or not-for-profit
|
|
17
|
+
- a for-profit organization with up to 3 employees
|
|
18
|
+
- a non-profit or not-for-profit organization
|
|
19
19
|
- evaluating whether Remotion is a good fit, and are not yet using it in a commercial way
|
|
20
20
|
|
|
21
21
|
### Allowed use cases
|
|
22
22
|
|
|
23
|
-
Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify
|
|
23
|
+
Permission is hereby granted, free of charge, to any person eligible for the "Free license", to use the software non-commercially or commercially for the purpose of creating videos and images and to modify the software to their own liking, for the purpose of fulfilling their custom use case or to contribute bug fixes or improvements back to Remotion.
|
|
24
24
|
|
|
25
25
|
### Disallowed use cases
|
|
26
26
|
|
|
27
|
-
It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, sublicensing your own derivate of Remotion.
|
|
27
|
+
It is not allowed to copy or modify Remotion code for the purpose of selling, renting, licensing, relicensing, or sublicensing your own derivate of Remotion.
|
|
28
28
|
|
|
29
29
|
### Warranty notice
|
|
30
30
|
|
|
31
|
-
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and
|
|
31
|
+
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and non-infringement. In no event shall the author or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
|
|
32
32
|
|
|
33
33
|
### Support
|
|
34
34
|
|
|
@@ -36,6 +36,6 @@ Support is provided on a best-we-can-do basis via GitHub Issues and Discord.
|
|
|
36
36
|
|
|
37
37
|
## Company license
|
|
38
38
|
|
|
39
|
-
You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support.
|
|
39
|
+
You are required to obtain a company license to use Remotion if you are not within the group of entities eligible for a free license. This license will enable you to use Remotion for the allowed use cases specified in the free license, and give you access to prioritized support (read the [Support Policy](/docs/support)).
|
|
40
40
|
|
|
41
41
|
Visit [companies.remotion.dev](https://companies.remotion.dev) for pricing and to buy a license.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { TAsset } from 'remotion';
|
|
2
2
|
import type { RenderMediaOnDownload } from './download-and-map-assets-to-file';
|
|
3
|
-
|
|
3
|
+
import type { DownloadMap } from './download-map';
|
|
4
|
+
export declare const convertAssetsToFileUrls: ({ assets, onDownload, downloadMap, }: {
|
|
4
5
|
assets: TAsset[][];
|
|
5
|
-
downloadDir: string;
|
|
6
6
|
onDownload: RenderMediaOnDownload;
|
|
7
|
+
downloadMap: DownloadMap;
|
|
7
8
|
}) => Promise<TAsset[][]>;
|
|
@@ -9,7 +9,7 @@ const chunk = (input, size) => {
|
|
|
9
9
|
: [...arr.slice(0, -1), [...arr.slice(-1)[0], item]];
|
|
10
10
|
}, []);
|
|
11
11
|
};
|
|
12
|
-
const convertAssetsToFileUrls = async ({ assets,
|
|
12
|
+
const convertAssetsToFileUrls = async ({ assets, onDownload, downloadMap, }) => {
|
|
13
13
|
const chunks = chunk(assets, 1000);
|
|
14
14
|
const results = [];
|
|
15
15
|
for (const ch of chunks) {
|
|
@@ -17,8 +17,8 @@ const convertAssetsToFileUrls = async ({ assets, downloadDir, onDownload, }) =>
|
|
|
17
17
|
return Promise.all(assetsForFrame.map((a) => {
|
|
18
18
|
return (0, download_and_map_assets_to_file_1.downloadAndMapAssetsToFileUrl)({
|
|
19
19
|
asset: a,
|
|
20
|
-
downloadDir,
|
|
21
20
|
onDownload,
|
|
21
|
+
downloadMap,
|
|
22
22
|
});
|
|
23
23
|
}));
|
|
24
24
|
}));
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import type { TAsset } from 'remotion';
|
|
2
|
+
import type { DownloadMap } from './download-map';
|
|
2
3
|
export declare type RenderMediaOnDownload = (src: string) => ((progress: {
|
|
3
4
|
percent: number | null;
|
|
4
5
|
downloaded: number;
|
|
5
6
|
totalSize: number | null;
|
|
6
7
|
}) => void) | undefined | void;
|
|
7
|
-
export declare const downloadAsset: ({ src, onDownload,
|
|
8
|
+
export declare const downloadAsset: ({ src, onDownload, downloadMap, }: {
|
|
8
9
|
src: string;
|
|
9
10
|
onDownload: RenderMediaOnDownload;
|
|
10
|
-
|
|
11
|
+
downloadMap: DownloadMap;
|
|
11
12
|
}) => Promise<string>;
|
|
12
|
-
export declare const markAllAssetsAsDownloaded: () => void;
|
|
13
|
-
export declare const getSanitizedFilenameForAssetUrl: ({ src, downloadDir, contentDisposition, }: {
|
|
13
|
+
export declare const markAllAssetsAsDownloaded: (downloadMap: DownloadMap) => void;
|
|
14
|
+
export declare const getSanitizedFilenameForAssetUrl: ({ src, downloadDir, contentDisposition, contentType, }: {
|
|
14
15
|
src: string;
|
|
15
16
|
downloadDir: string;
|
|
16
17
|
contentDisposition: string | null;
|
|
18
|
+
contentType: string | null;
|
|
17
19
|
}) => string;
|
|
18
|
-
export declare const downloadAndMapAssetsToFileUrl: ({ asset,
|
|
20
|
+
export declare const downloadAndMapAssetsToFileUrl: ({ asset, onDownload, downloadMap, }: {
|
|
19
21
|
asset: TAsset;
|
|
20
|
-
downloadDir: string;
|
|
21
22
|
onDownload: RenderMediaOnDownload;
|
|
23
|
+
downloadMap: DownloadMap;
|
|
22
24
|
}) => Promise<TAsset>;
|
|
@@ -1,33 +1,54 @@
|
|
|
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.downloadAndMapAssetsToFileUrl = exports.getSanitizedFilenameForAssetUrl = exports.markAllAssetsAsDownloaded = exports.downloadAsset = void 0;
|
|
7
30
|
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 =
|
|
31
|
+
const path_1 = __importStar(require("path"));
|
|
9
32
|
const remotion_1 = require("remotion");
|
|
10
33
|
const compress_assets_1 = require("../compress-assets");
|
|
11
34
|
const ensure_output_directory_1 = require("../ensure-output-directory");
|
|
35
|
+
const mime_types_1 = require("../mime-types");
|
|
12
36
|
const download_file_1 = require("./download-file");
|
|
13
37
|
const sanitize_filepath_1 = require("./sanitize-filepath");
|
|
14
|
-
const
|
|
15
|
-
const hasBeenDownloadedMap = {};
|
|
16
|
-
const listeners = {};
|
|
17
|
-
const waitForAssetToBeDownloaded = ({ src, downloadDir, }) => {
|
|
38
|
+
const waitForAssetToBeDownloaded = ({ src, downloadDir, downloadMap, }) => {
|
|
18
39
|
var _a, _b;
|
|
19
|
-
if ((_a = hasBeenDownloadedMap[src]) === null || _a === void 0 ? void 0 : _a[downloadDir]) {
|
|
20
|
-
return Promise.resolve((_b = hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir]);
|
|
40
|
+
if ((_a = downloadMap.hasBeenDownloadedMap[src]) === null || _a === void 0 ? void 0 : _a[downloadDir]) {
|
|
41
|
+
return Promise.resolve((_b = downloadMap.hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir]);
|
|
21
42
|
}
|
|
22
|
-
if (!listeners[src]) {
|
|
23
|
-
listeners[src] = {};
|
|
43
|
+
if (!downloadMap.listeners[src]) {
|
|
44
|
+
downloadMap.listeners[src] = {};
|
|
24
45
|
}
|
|
25
|
-
if (!listeners[src][downloadDir]) {
|
|
26
|
-
listeners[src][downloadDir] = [];
|
|
46
|
+
if (!downloadMap.listeners[src][downloadDir]) {
|
|
47
|
+
downloadMap.listeners[src][downloadDir] = [];
|
|
27
48
|
}
|
|
28
49
|
return new Promise((resolve) => {
|
|
29
|
-
listeners[src][downloadDir].push(() => {
|
|
30
|
-
const srcMap = hasBeenDownloadedMap[src];
|
|
50
|
+
downloadMap.listeners[src][downloadDir].push(() => {
|
|
51
|
+
const srcMap = downloadMap.hasBeenDownloadedMap[src];
|
|
31
52
|
if (!srcMap || !srcMap[downloadDir]) {
|
|
32
53
|
throw new Error('Expected file for ' + src + 'to be available in ' + downloadDir);
|
|
33
54
|
}
|
|
@@ -35,22 +56,22 @@ const waitForAssetToBeDownloaded = ({ src, downloadDir, }) => {
|
|
|
35
56
|
});
|
|
36
57
|
});
|
|
37
58
|
};
|
|
38
|
-
const notifyAssetIsDownloaded = ({ src, downloadDir, to, }) => {
|
|
39
|
-
if (!listeners[src]) {
|
|
40
|
-
listeners[src] = {};
|
|
59
|
+
const notifyAssetIsDownloaded = ({ src, downloadDir, to, downloadMap, }) => {
|
|
60
|
+
if (!downloadMap.listeners[src]) {
|
|
61
|
+
downloadMap.listeners[src] = {};
|
|
41
62
|
}
|
|
42
|
-
if (!listeners[src][downloadDir]) {
|
|
43
|
-
listeners[src][downloadDir] = [];
|
|
63
|
+
if (!downloadMap.listeners[src][downloadDir]) {
|
|
64
|
+
downloadMap.listeners[src][downloadDir] = [];
|
|
44
65
|
}
|
|
45
|
-
if (!isDownloadingMap[src]) {
|
|
46
|
-
isDownloadingMap[src] = {};
|
|
66
|
+
if (!downloadMap.isDownloadingMap[src]) {
|
|
67
|
+
downloadMap.isDownloadingMap[src] = {};
|
|
47
68
|
}
|
|
48
|
-
isDownloadingMap[src][downloadDir] =
|
|
49
|
-
if (!hasBeenDownloadedMap[src]) {
|
|
50
|
-
hasBeenDownloadedMap[src] = {};
|
|
69
|
+
downloadMap.isDownloadingMap[src][downloadDir] = false;
|
|
70
|
+
if (!downloadMap.hasBeenDownloadedMap[src]) {
|
|
71
|
+
downloadMap.hasBeenDownloadedMap[src] = {};
|
|
51
72
|
}
|
|
52
|
-
hasBeenDownloadedMap[src][downloadDir] = to;
|
|
53
|
-
listeners[src][downloadDir].forEach((fn) => fn());
|
|
73
|
+
downloadMap.hasBeenDownloadedMap[src][downloadDir] = to;
|
|
74
|
+
downloadMap.listeners[src][downloadDir].forEach((fn) => fn());
|
|
54
75
|
};
|
|
55
76
|
const validateMimeType = (mimeType, src) => {
|
|
56
77
|
if (!mimeType.includes('/')) {
|
|
@@ -91,38 +112,40 @@ function validateBufferEncoding(potentialEncoding, dataUrl) {
|
|
|
91
112
|
throw new TypeError(errMessage);
|
|
92
113
|
}
|
|
93
114
|
}
|
|
94
|
-
const downloadAsset = async ({ src, onDownload,
|
|
115
|
+
const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
|
|
95
116
|
var _a, _b, _c;
|
|
96
117
|
if ((0, compress_assets_1.isAssetCompressed)(src)) {
|
|
97
118
|
return src;
|
|
98
119
|
}
|
|
99
|
-
|
|
100
|
-
|
|
120
|
+
const { downloadDir } = downloadMap;
|
|
121
|
+
if ((_a = downloadMap.hasBeenDownloadedMap[src]) === null || _a === void 0 ? void 0 : _a[downloadDir]) {
|
|
122
|
+
const claimedDownloadLocation = (_b = downloadMap.hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir];
|
|
101
123
|
// The OS might have deleted the file since even though we marked it as downloaded. In that case we reset the state and download it again
|
|
102
124
|
if (fs_1.default.existsSync(claimedDownloadLocation)) {
|
|
103
125
|
return claimedDownloadLocation;
|
|
104
126
|
}
|
|
105
127
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
106
|
-
hasBeenDownloadedMap[src][downloadDir] = null;
|
|
107
|
-
if (!isDownloadingMap[src]) {
|
|
108
|
-
isDownloadingMap[src] = {};
|
|
128
|
+
downloadMap.hasBeenDownloadedMap[src][downloadDir] = null;
|
|
129
|
+
if (!downloadMap.isDownloadingMap[src]) {
|
|
130
|
+
downloadMap.isDownloadingMap[src] = {};
|
|
109
131
|
}
|
|
110
132
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
111
|
-
isDownloadingMap[src][downloadDir] = false;
|
|
133
|
+
downloadMap.isDownloadingMap[src][downloadDir] = false;
|
|
112
134
|
}
|
|
113
|
-
if ((_c = isDownloadingMap[src]) === null || _c === void 0 ? void 0 : _c[downloadDir]) {
|
|
114
|
-
return waitForAssetToBeDownloaded({ src, downloadDir });
|
|
135
|
+
if ((_c = downloadMap.isDownloadingMap[src]) === null || _c === void 0 ? void 0 : _c[downloadDir]) {
|
|
136
|
+
return waitForAssetToBeDownloaded({ downloadMap, src, downloadDir });
|
|
115
137
|
}
|
|
116
|
-
if (!isDownloadingMap[src]) {
|
|
117
|
-
isDownloadingMap[src] = {};
|
|
138
|
+
if (!downloadMap.isDownloadingMap[src]) {
|
|
139
|
+
downloadMap.isDownloadingMap[src] = {};
|
|
118
140
|
}
|
|
119
|
-
isDownloadingMap[src][downloadDir] = true;
|
|
141
|
+
downloadMap.isDownloadingMap[src][downloadDir] = true;
|
|
120
142
|
const onProgress = onDownload(src);
|
|
121
143
|
if (src.startsWith('data:')) {
|
|
122
144
|
const output = (0, exports.getSanitizedFilenameForAssetUrl)({
|
|
123
145
|
contentDisposition: null,
|
|
124
146
|
downloadDir,
|
|
125
147
|
src,
|
|
148
|
+
contentType: null,
|
|
126
149
|
});
|
|
127
150
|
(0, ensure_output_directory_1.ensureOutputDirectory)(output);
|
|
128
151
|
const [assetDetails, assetData] = src.substring('data:'.length).split(',');
|
|
@@ -140,7 +163,7 @@ const downloadAsset = async ({ src, onDownload, downloadDir, }) => {
|
|
|
140
163
|
validateBufferEncoding(encoding, src);
|
|
141
164
|
const buff = Buffer.from(assetData, encoding);
|
|
142
165
|
await fs_1.default.promises.writeFile(output, buff);
|
|
143
|
-
notifyAssetIsDownloaded({ src, downloadDir, to: output });
|
|
166
|
+
notifyAssetIsDownloaded({ src, downloadMap, downloadDir, to: output });
|
|
144
167
|
return output;
|
|
145
168
|
}
|
|
146
169
|
const { to } = await (0, download_file_1.downloadFile)({
|
|
@@ -148,22 +171,27 @@ const downloadAsset = async ({ src, onDownload, downloadDir, }) => {
|
|
|
148
171
|
onProgress: (progress) => {
|
|
149
172
|
onProgress === null || onProgress === void 0 ? void 0 : onProgress(progress);
|
|
150
173
|
},
|
|
151
|
-
to: (contentDisposition) => (0, exports.getSanitizedFilenameForAssetUrl)({
|
|
174
|
+
to: (contentDisposition, contentType) => (0, exports.getSanitizedFilenameForAssetUrl)({
|
|
175
|
+
contentDisposition,
|
|
176
|
+
downloadDir,
|
|
177
|
+
src,
|
|
178
|
+
contentType,
|
|
179
|
+
}),
|
|
152
180
|
});
|
|
153
|
-
notifyAssetIsDownloaded({ src, downloadDir, to });
|
|
181
|
+
notifyAssetIsDownloaded({ src, downloadMap, downloadDir, to });
|
|
154
182
|
return to;
|
|
155
183
|
};
|
|
156
184
|
exports.downloadAsset = downloadAsset;
|
|
157
|
-
const markAllAssetsAsDownloaded = () => {
|
|
158
|
-
Object.keys(hasBeenDownloadedMap).forEach((key) => {
|
|
159
|
-
delete hasBeenDownloadedMap[key];
|
|
185
|
+
const markAllAssetsAsDownloaded = (downloadMap) => {
|
|
186
|
+
Object.keys(downloadMap.hasBeenDownloadedMap).forEach((key) => {
|
|
187
|
+
delete downloadMap.hasBeenDownloadedMap[key];
|
|
160
188
|
});
|
|
161
|
-
Object.keys(isDownloadingMap).forEach((key) => {
|
|
162
|
-
delete isDownloadingMap[key];
|
|
189
|
+
Object.keys(downloadMap.isDownloadingMap).forEach((key) => {
|
|
190
|
+
delete downloadMap.isDownloadingMap[key];
|
|
163
191
|
});
|
|
164
192
|
};
|
|
165
193
|
exports.markAllAssetsAsDownloaded = markAllAssetsAsDownloaded;
|
|
166
|
-
const getFilename = ({ contentDisposition, src, }) => {
|
|
194
|
+
const getFilename = ({ contentDisposition, src, contentType, }) => {
|
|
167
195
|
const filenameProbe = 'filename=';
|
|
168
196
|
if (contentDisposition === null || contentDisposition === void 0 ? void 0 : contentDisposition.includes(filenameProbe)) {
|
|
169
197
|
const start = contentDisposition.indexOf(filenameProbe);
|
|
@@ -178,13 +206,26 @@ const getFilename = ({ contentDisposition, src, }) => {
|
|
|
178
206
|
};
|
|
179
207
|
}
|
|
180
208
|
const { pathname, search } = new URL(src);
|
|
209
|
+
const ext = (0, path_1.extname)(pathname);
|
|
210
|
+
// Has no file extension, check if we can derive it from contentType
|
|
211
|
+
if (!ext && contentType) {
|
|
212
|
+
const matchedExt = (0, mime_types_1.getExt)(contentType);
|
|
213
|
+
return {
|
|
214
|
+
pathname: `${pathname}.${matchedExt}`,
|
|
215
|
+
search,
|
|
216
|
+
};
|
|
217
|
+
}
|
|
181
218
|
return { pathname, search };
|
|
182
219
|
};
|
|
183
|
-
const getSanitizedFilenameForAssetUrl = ({ src, downloadDir, contentDisposition, }) => {
|
|
220
|
+
const getSanitizedFilenameForAssetUrl = ({ src, downloadDir, contentDisposition, contentType, }) => {
|
|
184
221
|
if ((0, compress_assets_1.isAssetCompressed)(src)) {
|
|
185
222
|
return src;
|
|
186
223
|
}
|
|
187
|
-
const { pathname, search } = getFilename({
|
|
224
|
+
const { pathname, search } = getFilename({
|
|
225
|
+
contentDisposition,
|
|
226
|
+
contentType,
|
|
227
|
+
src,
|
|
228
|
+
});
|
|
188
229
|
const split = pathname.split('.');
|
|
189
230
|
const fileExtension = split.length > 1 && split[split.length - 1]
|
|
190
231
|
? `.${split[split.length - 1]}`
|
|
@@ -194,11 +235,11 @@ const getSanitizedFilenameForAssetUrl = ({ src, downloadDir, contentDisposition,
|
|
|
194
235
|
return path_1.default.join(downloadDir, (0, sanitize_filepath_1.sanitizeFilePath)(filename));
|
|
195
236
|
};
|
|
196
237
|
exports.getSanitizedFilenameForAssetUrl = getSanitizedFilenameForAssetUrl;
|
|
197
|
-
const downloadAndMapAssetsToFileUrl = async ({ asset,
|
|
238
|
+
const downloadAndMapAssetsToFileUrl = async ({ asset, onDownload, downloadMap, }) => {
|
|
198
239
|
const newSrc = await (0, exports.downloadAsset)({
|
|
199
240
|
src: asset.src,
|
|
200
|
-
downloadDir,
|
|
201
241
|
onDownload,
|
|
242
|
+
downloadMap,
|
|
202
243
|
});
|
|
203
244
|
return {
|
|
204
245
|
...asset,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const downloadFile: ({ onProgress, url, to: toFn, }: {
|
|
2
2
|
url: string;
|
|
3
|
-
to: (contentDisposition: string | null) => string;
|
|
3
|
+
to: (contentDisposition: string | null, contentType: string | null) => string;
|
|
4
4
|
onProgress: ((progress: {
|
|
5
5
|
percent: number | null;
|
|
6
6
|
downloaded: number;
|
|
@@ -8,9 +8,10 @@ const downloadFile = ({ onProgress, url, to: toFn, }) => {
|
|
|
8
8
|
return new Promise((resolve, reject) => {
|
|
9
9
|
(0, read_file_1.readFile)(url)
|
|
10
10
|
.then((res) => {
|
|
11
|
-
var _a;
|
|
11
|
+
var _a, _b;
|
|
12
12
|
const contentDisposition = (_a = res.headers['content-disposition']) !== null && _a !== void 0 ? _a : null;
|
|
13
|
-
const
|
|
13
|
+
const contentType = (_b = res.headers['content-type']) !== null && _b !== void 0 ? _b : null;
|
|
14
|
+
const to = toFn(contentDisposition, contentType);
|
|
14
15
|
(0, ensure_output_directory_1.ensureOutputDirectory)(to);
|
|
15
16
|
const sizeHeader = res.headers['content-length'];
|
|
16
17
|
const totalSize = typeof sizeHeader === 'undefined' ? null : Number(sizeHeader);
|
|
@@ -28,6 +29,7 @@ const downloadFile = ({ onProgress, url, to: toFn, }) => {
|
|
|
28
29
|
return resolve({ sizeInBytes: downloaded, to });
|
|
29
30
|
});
|
|
30
31
|
writeStream.on('error', (err) => reject(err));
|
|
32
|
+
res.on('error', (err) => reject(err));
|
|
31
33
|
res.pipe(writeStream).on('error', (err) => reject(err));
|
|
32
34
|
res.on('data', (d) => {
|
|
33
35
|
downloaded += d.length;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { TAsset } from 'remotion';
|
|
3
|
+
declare type EncodingStatus = {
|
|
4
|
+
type: 'encoding';
|
|
5
|
+
} | {
|
|
6
|
+
type: 'done';
|
|
7
|
+
src: string;
|
|
8
|
+
} | undefined;
|
|
9
|
+
export declare type SpecialVCodecForTransparency = 'vp9' | 'vp8' | 'none';
|
|
10
|
+
export declare type Vp9Result = {
|
|
11
|
+
specialVcodec: SpecialVCodecForTransparency;
|
|
12
|
+
needsResize: [number, number] | null;
|
|
13
|
+
};
|
|
14
|
+
export declare type VideoDurationResult = {
|
|
15
|
+
duration: number | null;
|
|
16
|
+
fps: number | null;
|
|
17
|
+
};
|
|
18
|
+
export declare type AudioChannelsAndDurationResultCache = {
|
|
19
|
+
channels: number;
|
|
20
|
+
duration: number | null;
|
|
21
|
+
};
|
|
22
|
+
export declare type DownloadMap = {
|
|
23
|
+
id: string;
|
|
24
|
+
isDownloadingMap: {
|
|
25
|
+
[src: string]: {
|
|
26
|
+
[downloadDir: string]: boolean;
|
|
27
|
+
} | undefined;
|
|
28
|
+
};
|
|
29
|
+
hasBeenDownloadedMap: {
|
|
30
|
+
[src: string]: {
|
|
31
|
+
[downloadDir: string]: string | null;
|
|
32
|
+
} | undefined;
|
|
33
|
+
};
|
|
34
|
+
listeners: {
|
|
35
|
+
[key: string]: {
|
|
36
|
+
[downloadDir: string]: (() => void)[];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
lastFrameMap: Record<string, {
|
|
40
|
+
lastAccessed: number;
|
|
41
|
+
data: Buffer;
|
|
42
|
+
}>;
|
|
43
|
+
isBeyondLastFrameMap: Record<string, number>;
|
|
44
|
+
isVp9VideoCache: Record<string, Vp9Result>;
|
|
45
|
+
ensureFileHasPresentationTimestamp: Record<string, EncodingStatus>;
|
|
46
|
+
videoDurationResultCache: Record<string, VideoDurationResult>;
|
|
47
|
+
durationOfAssetCache: Record<string, AudioChannelsAndDurationResultCache>;
|
|
48
|
+
downloadDir: string;
|
|
49
|
+
preEncode: string;
|
|
50
|
+
audioMixing: string;
|
|
51
|
+
complexFilter: string;
|
|
52
|
+
audioPreprocessing: string;
|
|
53
|
+
stitchFrames: string;
|
|
54
|
+
assetDir: string;
|
|
55
|
+
};
|
|
56
|
+
export declare type RenderAssetInfo = {
|
|
57
|
+
assets: TAsset[][];
|
|
58
|
+
imageSequenceName: string;
|
|
59
|
+
firstFrameIndex: number;
|
|
60
|
+
downloadMap: DownloadMap;
|
|
61
|
+
};
|
|
62
|
+
export declare const makeDownloadMap: () => DownloadMap;
|
|
63
|
+
export declare const cleanDownloadMap: (downloadMap: DownloadMap) => Promise<void>;
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.cleanDownloadMap = exports.makeDownloadMap = void 0;
|
|
30
|
+
const fs_1 = __importStar(require("fs"));
|
|
31
|
+
const path_1 = __importDefault(require("path"));
|
|
32
|
+
const delete_directory_1 = require("../delete-directory");
|
|
33
|
+
const tmp_dir_1 = require("../tmp-dir");
|
|
34
|
+
const makeAndReturn = (dir, name) => {
|
|
35
|
+
const p = path_1.default.join(dir, name);
|
|
36
|
+
(0, fs_1.mkdirSync)(p);
|
|
37
|
+
return p;
|
|
38
|
+
};
|
|
39
|
+
const packageJsonPath = path_1.default.join(__dirname, '..', '..', 'package.json');
|
|
40
|
+
const packageJson = fs_1.default.existsSync(packageJsonPath)
|
|
41
|
+
? JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8'))
|
|
42
|
+
: null;
|
|
43
|
+
const makeDownloadMap = () => {
|
|
44
|
+
const dir = (0, tmp_dir_1.tmpDir)(packageJson
|
|
45
|
+
? `remotion-v${packageJson.version.replace(/\./g, '-')}-assets`
|
|
46
|
+
: 'remotion-assets');
|
|
47
|
+
return {
|
|
48
|
+
isDownloadingMap: {},
|
|
49
|
+
hasBeenDownloadedMap: {},
|
|
50
|
+
listeners: {},
|
|
51
|
+
lastFrameMap: {},
|
|
52
|
+
isBeyondLastFrameMap: {},
|
|
53
|
+
ensureFileHasPresentationTimestamp: {},
|
|
54
|
+
isVp9VideoCache: {},
|
|
55
|
+
videoDurationResultCache: {},
|
|
56
|
+
durationOfAssetCache: {},
|
|
57
|
+
id: String(Math.random()),
|
|
58
|
+
assetDir: dir,
|
|
59
|
+
downloadDir: makeAndReturn(dir, 'remotion-assets-dir'),
|
|
60
|
+
complexFilter: makeAndReturn(dir, 'remotion-complex-filter'),
|
|
61
|
+
preEncode: makeAndReturn(dir, 'pre-encode'),
|
|
62
|
+
audioMixing: makeAndReturn(dir, 'remotion-audio-mixing'),
|
|
63
|
+
audioPreprocessing: makeAndReturn(dir, 'remotion-audio-preprocessing'),
|
|
64
|
+
stitchFrames: makeAndReturn(dir, 'remotion-stitch-temp-dir'),
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
exports.makeDownloadMap = makeDownloadMap;
|
|
68
|
+
const cleanDownloadMap = async (downloadMap) => {
|
|
69
|
+
await (0, delete_directory_1.deleteDirectory)(downloadMap.downloadDir);
|
|
70
|
+
await (0, delete_directory_1.deleteDirectory)(downloadMap.complexFilter);
|
|
71
|
+
await (0, delete_directory_1.deleteDirectory)(downloadMap.assetDir);
|
|
72
|
+
};
|
|
73
|
+
exports.cleanDownloadMap = cleanDownloadMap;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import type { FfmpegExecutable } from '../ffmpeg-executable';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
duration: number | null;
|
|
5
|
-
};
|
|
6
|
-
export declare const getAudioChannelsAndDuration: (src: string, ffprobeExecutable: FfmpegExecutable) => Promise<Result>;
|
|
7
|
-
export {};
|
|
2
|
+
import type { AudioChannelsAndDurationResultCache, DownloadMap } from './download-map';
|
|
3
|
+
export declare const getAudioChannelsAndDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable) => Promise<AudioChannelsAndDurationResultCache>;
|
|
@@ -6,11 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getAudioChannelsAndDuration = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
8
|
const p_limit_1 = require("../p-limit");
|
|
9
|
-
const durationOfAssetCache = {};
|
|
10
9
|
const limit = (0, p_limit_1.pLimit)(1);
|
|
11
|
-
async function getAudioChannelsAndDurationUnlimited(src, ffprobeExecutable) {
|
|
12
|
-
if (durationOfAssetCache[src]) {
|
|
13
|
-
return durationOfAssetCache[src];
|
|
10
|
+
async function getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExecutable) {
|
|
11
|
+
if (downloadMap.durationOfAssetCache[src]) {
|
|
12
|
+
return downloadMap.durationOfAssetCache[src];
|
|
14
13
|
}
|
|
15
14
|
const args = [
|
|
16
15
|
['-v', 'error'],
|
|
@@ -27,10 +26,10 @@ async function getAudioChannelsAndDurationUnlimited(src, ffprobeExecutable) {
|
|
|
27
26
|
channels: channels ? parseInt(channels[1], 10) : 0,
|
|
28
27
|
duration: duration ? parseFloat(duration[1]) : null,
|
|
29
28
|
};
|
|
30
|
-
durationOfAssetCache[src] = result;
|
|
29
|
+
downloadMap.durationOfAssetCache[src] = result;
|
|
31
30
|
return result;
|
|
32
31
|
}
|
|
33
|
-
const getAudioChannelsAndDuration = (src, ffprobeExecutable) => {
|
|
34
|
-
return limit(() => getAudioChannelsAndDurationUnlimited(src, ffprobeExecutable));
|
|
32
|
+
const getAudioChannelsAndDuration = (downloadMap, src, ffprobeExecutable) => {
|
|
33
|
+
return limit(() => getAudioChannelsAndDurationUnlimited(downloadMap, src, ffprobeExecutable));
|
|
35
34
|
};
|
|
36
35
|
exports.getAudioChannelsAndDuration = getAudioChannelsAndDuration;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { FfmpegExecutable } from '../ffmpeg-executable';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare const getVideoStreamDuration: (src: string, ffprobeExecutable: FfmpegExecutable) => Promise<Result>;
|
|
6
|
-
export {};
|
|
2
|
+
import type { DownloadMap, VideoDurationResult } from './download-map';
|
|
3
|
+
export declare const parseVideoStreamDuration: (stdout: string) => VideoDurationResult;
|
|
4
|
+
export declare const getVideoStreamDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable) => Promise<VideoDurationResult>;
|