@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.
Files changed (345) hide show
  1. package/LICENSE.md +8 -8
  2. package/dist/assets/calculate-asset-positions.d.ts +0 -0
  3. package/dist/assets/calculate-asset-positions.js +0 -0
  4. package/dist/assets/calculate-atempo.d.ts +0 -0
  5. package/dist/assets/calculate-atempo.js +0 -0
  6. package/dist/assets/convert-assets-to-file-urls.d.ts +3 -2
  7. package/dist/assets/convert-assets-to-file-urls.js +2 -2
  8. package/dist/assets/download-and-map-assets-to-file.d.ts +8 -6
  9. package/dist/assets/download-and-map-assets-to-file.js +91 -50
  10. package/dist/assets/download-file.d.ts +1 -1
  11. package/dist/assets/download-file.js +4 -2
  12. package/dist/assets/download-map.d.ts +64 -0
  13. package/dist/assets/download-map.js +73 -0
  14. package/dist/assets/ffmpeg-volume-expression.d.ts +0 -0
  15. package/dist/assets/ffmpeg-volume-expression.js +0 -0
  16. package/dist/assets/flatten-volume-array.d.ts +0 -0
  17. package/dist/assets/flatten-volume-array.js +0 -0
  18. package/dist/assets/get-audio-channels.d.ts +2 -6
  19. package/dist/assets/get-audio-channels.js +6 -7
  20. package/dist/assets/get-video-stream-duration.d.ts +3 -5
  21. package/dist/assets/get-video-stream-duration.js +39 -14
  22. package/dist/assets/read-file.d.ts +0 -0
  23. package/dist/assets/read-file.js +0 -0
  24. package/dist/assets/round-volume-to-avoid-stack-overflow.d.ts +0 -0
  25. package/dist/assets/round-volume-to-avoid-stack-overflow.js +0 -0
  26. package/dist/assets/sanitize-filename.d.ts +0 -0
  27. package/dist/assets/sanitize-filename.js +0 -0
  28. package/dist/assets/sanitize-filepath.d.ts +0 -0
  29. package/dist/assets/sanitize-filepath.js +0 -0
  30. package/dist/assets/truncate-utf8-bytes.d.ts +0 -0
  31. package/dist/assets/truncate-utf8-bytes.js +0 -0
  32. package/dist/assets/types.d.ts +0 -0
  33. package/dist/assets/types.js +0 -0
  34. package/dist/browser/Browser.d.ts +1 -0
  35. package/dist/browser/Browser.js +9 -10
  36. package/dist/browser/BrowserConnector.d.ts +0 -0
  37. package/dist/browser/BrowserConnector.js +0 -0
  38. package/dist/browser/BrowserFetcher.d.ts +0 -0
  39. package/dist/browser/BrowserFetcher.js +12 -10
  40. package/dist/browser/BrowserPage.d.ts +0 -0
  41. package/dist/browser/BrowserPage.js +0 -0
  42. package/dist/browser/BrowserRunner.d.ts +1 -4
  43. package/dist/browser/BrowserRunner.js +28 -71
  44. package/dist/browser/Connection.d.ts +0 -0
  45. package/dist/browser/Connection.js +1 -1
  46. package/dist/browser/ConsoleMessage.d.ts +0 -0
  47. package/dist/browser/ConsoleMessage.js +0 -0
  48. package/dist/browser/DOMWorld.d.ts +0 -0
  49. package/dist/browser/DOMWorld.js +0 -0
  50. package/dist/browser/Errors.d.ts +0 -0
  51. package/dist/browser/Errors.js +0 -0
  52. package/dist/browser/EvalTypes.d.ts +0 -0
  53. package/dist/browser/EvalTypes.js +0 -0
  54. package/dist/browser/EventEmitter.d.ts +0 -0
  55. package/dist/browser/EventEmitter.js +0 -0
  56. package/dist/browser/ExecutionContext.d.ts +0 -0
  57. package/dist/browser/ExecutionContext.js +0 -0
  58. package/dist/browser/FrameManager.d.ts +0 -0
  59. package/dist/browser/FrameManager.js +0 -0
  60. package/dist/browser/HTTPRequest.d.ts +0 -0
  61. package/dist/browser/HTTPRequest.js +0 -0
  62. package/dist/browser/HTTPResponse.d.ts +0 -0
  63. package/dist/browser/HTTPResponse.js +0 -0
  64. package/dist/browser/JSHandle.d.ts +0 -0
  65. package/dist/browser/JSHandle.js +0 -0
  66. package/dist/browser/LaunchOptions.d.ts +0 -4
  67. package/dist/browser/LaunchOptions.js +0 -0
  68. package/dist/browser/Launcher.d.ts +1 -1
  69. package/dist/browser/Launcher.js +5 -363
  70. package/dist/browser/LifecycleWatcher.d.ts +0 -0
  71. package/dist/browser/LifecycleWatcher.js +0 -0
  72. package/dist/browser/NetworkEventManager.d.ts +0 -0
  73. package/dist/browser/NetworkEventManager.js +0 -0
  74. package/dist/browser/NetworkManager.d.ts +0 -0
  75. package/dist/browser/NetworkManager.js +0 -0
  76. package/dist/browser/NodeWebSocketTransport.d.ts +0 -0
  77. package/dist/browser/NodeWebSocketTransport.js +1 -1
  78. package/dist/browser/Product.d.ts +0 -0
  79. package/dist/browser/Product.js +0 -0
  80. package/dist/browser/PuppeteerNode.d.ts +0 -0
  81. package/dist/browser/PuppeteerNode.js +1 -4
  82. package/dist/browser/PuppeteerViewport.d.ts +0 -0
  83. package/dist/browser/PuppeteerViewport.js +0 -0
  84. package/dist/browser/ScreenshotOptions.d.ts +0 -0
  85. package/dist/browser/ScreenshotOptions.js +0 -0
  86. package/dist/browser/Target.d.ts +0 -0
  87. package/dist/browser/Target.js +0 -0
  88. package/dist/browser/TaskQueue.d.ts +0 -0
  89. package/dist/browser/TaskQueue.js +0 -0
  90. package/dist/browser/TimeoutSettings.d.ts +0 -0
  91. package/dist/browser/TimeoutSettings.js +0 -0
  92. package/dist/browser/assert.d.ts +0 -0
  93. package/dist/browser/assert.js +0 -0
  94. package/dist/browser/create-browser-fetcher.d.ts +0 -0
  95. package/dist/browser/create-browser-fetcher.js +2 -44
  96. package/dist/browser/devtools-commands.d.ts +0 -0
  97. package/dist/browser/devtools-commands.js +0 -0
  98. package/dist/browser/devtools-types.d.ts +0 -0
  99. package/dist/browser/devtools-types.js +0 -0
  100. package/dist/browser/get-download-destination.d.ts +0 -0
  101. package/dist/browser/get-download-destination.js +0 -0
  102. package/dist/browser/mitt/index.d.ts +0 -0
  103. package/dist/browser/mitt/index.js +0 -0
  104. package/dist/browser/node.d.ts +0 -0
  105. package/dist/browser/node.js +0 -0
  106. package/dist/browser/revisions.d.ts +0 -1
  107. package/dist/browser/revisions.js +0 -1
  108. package/dist/browser/util.d.ts +0 -0
  109. package/dist/browser/util.js +0 -0
  110. package/dist/browser-executable.d.ts +0 -0
  111. package/dist/browser-executable.js +0 -0
  112. package/dist/browser-log.d.ts +0 -0
  113. package/dist/browser-log.js +0 -0
  114. package/dist/browser.d.ts +0 -0
  115. package/dist/browser.js +0 -0
  116. package/dist/calculate-ffmpeg-filters.d.ts +0 -0
  117. package/dist/calculate-ffmpeg-filters.js +0 -0
  118. package/dist/calculate-sar-dar-pixels.d.ts +0 -0
  119. package/dist/calculate-sar-dar-pixels.js +0 -0
  120. package/dist/can-use-parallel-encoding.d.ts +0 -0
  121. package/dist/can-use-parallel-encoding.js +0 -0
  122. package/dist/check-apple-silicon.d.ts +1 -0
  123. package/dist/check-apple-silicon.js +55 -0
  124. package/dist/chunk.d.ts +0 -0
  125. package/dist/chunk.js +0 -0
  126. package/dist/codec-supports-media.d.ts +1 -0
  127. package/dist/codec-supports-media.js +8 -1
  128. package/dist/codec.d.ts +0 -0
  129. package/dist/codec.js +0 -0
  130. package/dist/combine-videos.d.ts +0 -0
  131. package/dist/combine-videos.js +1 -1
  132. package/dist/compress-assets.d.ts +0 -0
  133. package/dist/compress-assets.js +0 -0
  134. package/dist/convert-number-of-gif-loops-to-ffmpeg.d.ts +0 -0
  135. package/dist/convert-number-of-gif-loops-to-ffmpeg.js +0 -0
  136. package/dist/convert-to-pcm.d.ts +0 -0
  137. package/dist/convert-to-pcm.js +0 -0
  138. package/dist/convert-to-positive-frame-index.d.ts +4 -0
  139. package/dist/convert-to-positive-frame-index.js +8 -0
  140. package/dist/create-ffmpeg-complex-filter.d.ts +2 -1
  141. package/dist/create-ffmpeg-complex-filter.js +2 -11
  142. package/dist/create-ffmpeg-merge-filter.d.ts +0 -0
  143. package/dist/create-ffmpeg-merge-filter.js +0 -0
  144. package/dist/create-silent-audio.d.ts +0 -0
  145. package/dist/create-silent-audio.js +0 -0
  146. package/dist/crf.d.ts +5 -1
  147. package/dist/crf.js +33 -6
  148. package/dist/cycle-browser-tabs.d.ts +0 -0
  149. package/dist/cycle-browser-tabs.js +0 -0
  150. package/dist/delay-render-embedded-stack.d.ts +0 -0
  151. package/dist/delay-render-embedded-stack.js +0 -0
  152. package/dist/delete-directory.d.ts +0 -0
  153. package/dist/delete-directory.js +0 -0
  154. package/dist/ensure-frames-in-order.d.ts +0 -0
  155. package/dist/ensure-frames-in-order.js +0 -0
  156. package/dist/ensure-output-directory.d.ts +0 -0
  157. package/dist/ensure-output-directory.js +0 -0
  158. package/dist/ensure-presentation-timestamp.d.ts +2 -1
  159. package/dist/ensure-presentation-timestamp.js +7 -5
  160. package/dist/error-handling/handle-javascript-exception.d.ts +0 -0
  161. package/dist/error-handling/handle-javascript-exception.js +0 -0
  162. package/dist/error-handling/symbolicate-error.d.ts +0 -0
  163. package/dist/error-handling/symbolicate-error.js +0 -0
  164. package/dist/error-handling/symbolicateable-error.d.ts +0 -0
  165. package/dist/error-handling/symbolicateable-error.js +0 -0
  166. package/dist/extract-frame-from-video.d.ts +2 -0
  167. package/dist/extract-frame-from-video.js +42 -15
  168. package/dist/ffmpeg-executable.d.ts +0 -0
  169. package/dist/ffmpeg-executable.js +0 -0
  170. package/dist/ffmpeg-filter-file.d.ts +2 -1
  171. package/dist/ffmpeg-filter-file.js +4 -6
  172. package/dist/ffmpeg-flags.d.ts +5 -2
  173. package/dist/ffmpeg-flags.js +37 -7
  174. package/dist/ffmpeg-override.d.ts +4 -0
  175. package/dist/ffmpeg-override.js +2 -0
  176. package/dist/frame-range.d.ts +0 -0
  177. package/dist/frame-range.js +0 -0
  178. package/dist/frame-to-ffmpeg-timestamp.d.ts +0 -0
  179. package/dist/frame-to-ffmpeg-timestamp.js +0 -0
  180. package/dist/get-audio-codec-name.d.ts +0 -0
  181. package/dist/get-audio-codec-name.js +0 -0
  182. package/dist/get-browser-instance.d.ts +0 -0
  183. package/dist/get-browser-instance.js +0 -0
  184. package/dist/get-codec-name.d.ts +0 -0
  185. package/dist/get-codec-name.js +0 -0
  186. package/dist/get-compositions.d.ts +5 -0
  187. package/dist/get-compositions.js +14 -6
  188. package/dist/get-concurrency.d.ts +0 -0
  189. package/dist/get-concurrency.js +0 -0
  190. package/dist/get-duration-from-frame-range.d.ts +0 -0
  191. package/dist/get-duration-from-frame-range.js +0 -0
  192. package/dist/get-extension-from-codec.d.ts +1 -1
  193. package/dist/get-extension-from-codec.js +0 -0
  194. package/dist/get-extension-of-filename.d.ts +0 -0
  195. package/dist/get-extension-of-filename.js +0 -0
  196. package/dist/get-frame-padded-index.d.ts +0 -0
  197. package/dist/get-frame-padded-index.js +0 -0
  198. package/dist/get-frame-to-render.d.ts +0 -0
  199. package/dist/get-frame-to-render.js +0 -0
  200. package/dist/get-local-browser-executable.d.ts +0 -0
  201. package/dist/get-local-browser-executable.js +1 -3
  202. package/dist/get-port.d.ts +0 -0
  203. package/dist/get-port.js +0 -0
  204. package/dist/get-prores-profile-name.d.ts +0 -0
  205. package/dist/get-prores-profile-name.js +0 -0
  206. package/dist/get-video-info.d.ts +2 -7
  207. package/dist/get-video-info.js +7 -8
  208. package/dist/get-video-threads-flag.d.ts +1 -0
  209. package/dist/get-video-threads-flag.js +18 -0
  210. package/dist/guess-extension-for-media.d.ts +1 -1
  211. package/dist/guess-extension-for-media.js +1 -1
  212. package/dist/image-format.d.ts +1 -1
  213. package/dist/image-format.js +3 -0
  214. package/dist/index.d.ts +19 -28
  215. package/dist/index.js +16 -24
  216. package/dist/is-audio-codec.d.ts +0 -0
  217. package/dist/is-audio-codec.js +0 -0
  218. package/dist/is-beyond-last-frame.d.ts +3 -2
  219. package/dist/is-beyond-last-frame.js +5 -5
  220. package/dist/is-serve-url.d.ts +0 -0
  221. package/dist/is-serve-url.js +0 -0
  222. package/dist/last-frame-from-video-cache.d.ts +3 -2
  223. package/dist/last-frame-from-video-cache.js +17 -17
  224. package/dist/legacy-webpack-config.d.ts +0 -0
  225. package/dist/legacy-webpack-config.js +0 -0
  226. package/dist/log-level.d.ts +0 -0
  227. package/dist/log-level.js +0 -0
  228. package/dist/make-cancel-signal.d.ts +0 -0
  229. package/dist/make-cancel-signal.js +0 -0
  230. package/dist/merge-audio-track.d.ts +2 -0
  231. package/dist/merge-audio-track.js +6 -3
  232. package/dist/mime-db.d.ts +0 -0
  233. package/dist/mime-db.js +0 -0
  234. package/dist/mime-types.d.ts +1 -0
  235. package/dist/mime-types.js +6 -1
  236. package/dist/normalize-serve-url.d.ts +0 -0
  237. package/dist/normalize-serve-url.js +0 -0
  238. package/dist/offthread-video-server.d.ts +3 -2
  239. package/dist/offthread-video-server.js +14 -2
  240. package/dist/open-browser.d.ts +0 -0
  241. package/dist/open-browser.js +3 -12
  242. package/dist/overwrite.d.ts +0 -0
  243. package/dist/overwrite.js +0 -0
  244. package/dist/p-limit.d.ts +0 -0
  245. package/dist/p-limit.js +0 -0
  246. package/dist/parse-browser-error-stack.d.ts +0 -0
  247. package/dist/parse-browser-error-stack.js +0 -0
  248. package/dist/parse-ffmpeg-progress.d.ts +0 -0
  249. package/dist/parse-ffmpeg-progress.js +0 -0
  250. package/dist/perf.d.ts +0 -0
  251. package/dist/perf.js +0 -0
  252. package/dist/pixel-format.d.ts +1 -1
  253. package/dist/pixel-format.js +3 -0
  254. package/dist/pool.d.ts +0 -0
  255. package/dist/pool.js +0 -0
  256. package/dist/prepare-server.d.ts +3 -2
  257. package/dist/prepare-server.js +3 -3
  258. package/dist/preprocess-audio-track.d.ts +2 -0
  259. package/dist/preprocess-audio-track.js +3 -3
  260. package/dist/prespawn-ffmpeg.d.ts +3 -0
  261. package/dist/prespawn-ffmpeg.js +15 -11
  262. package/dist/prestitcher-memory-usage.d.ts +12 -0
  263. package/dist/prestitcher-memory-usage.js +30 -0
  264. package/dist/prores-profile.d.ts +4 -1
  265. package/dist/prores-profile.js +6 -6
  266. package/dist/provide-screenshot.d.ts +0 -0
  267. package/dist/provide-screenshot.js +0 -0
  268. package/dist/puppeteer-evaluate.d.ts +0 -0
  269. package/dist/puppeteer-evaluate.js +0 -0
  270. package/dist/puppeteer-screenshot.d.ts +0 -0
  271. package/dist/puppeteer-screenshot.js +0 -0
  272. package/dist/quality.d.ts +0 -0
  273. package/dist/quality.js +0 -0
  274. package/dist/render-frames.d.ts +16 -3
  275. package/dist/render-frames.js +98 -30
  276. package/dist/render-media.d.ts +30 -4
  277. package/dist/render-media.js +123 -20
  278. package/dist/render-still.d.ts +6 -1
  279. package/dist/render-still.js +37 -11
  280. package/dist/resolve-asset-src.d.ts +0 -0
  281. package/dist/resolve-asset-src.js +0 -0
  282. package/dist/sample-rate.d.ts +0 -0
  283. package/dist/sample-rate.js +0 -0
  284. package/dist/screenshot-dom-element.d.ts +0 -0
  285. package/dist/screenshot-dom-element.js +0 -0
  286. package/dist/screenshot-task.d.ts +0 -0
  287. package/dist/screenshot-task.js +30 -15
  288. package/dist/seek-to-frame.d.ts +0 -0
  289. package/dist/seek-to-frame.js +0 -0
  290. package/dist/serve-handler/index.d.ts +0 -0
  291. package/dist/serve-handler/index.js +0 -0
  292. package/dist/serve-handler/is-path-inside.d.ts +0 -0
  293. package/dist/serve-handler/is-path-inside.js +0 -0
  294. package/dist/serve-handler/range-parser.d.ts +0 -0
  295. package/dist/serve-handler/range-parser.js +0 -0
  296. package/dist/serve-static.d.ts +2 -1
  297. package/dist/serve-static.js +14 -1
  298. package/dist/set-props-and-env.d.ts +3 -1
  299. package/dist/set-props-and-env.js +34 -8
  300. package/dist/stitch-frames-to-video.d.ts +7 -7
  301. package/dist/stitch-frames-to-video.js +68 -57
  302. package/dist/stringify-ffmpeg-filter.d.ts +0 -0
  303. package/dist/stringify-ffmpeg-filter.js +0 -0
  304. package/dist/symbolicate-stacktrace.d.ts +0 -0
  305. package/dist/symbolicate-stacktrace.js +0 -0
  306. package/dist/tmp-dir.d.ts +0 -0
  307. package/dist/tmp-dir.js +0 -0
  308. package/dist/truthy.d.ts +0 -0
  309. package/dist/truthy.js +0 -0
  310. package/dist/types.d.ts +1 -1
  311. package/dist/types.js +0 -0
  312. package/dist/validate-concurrency.d.ts +0 -0
  313. package/dist/validate-concurrency.js +0 -0
  314. package/dist/validate-even-dimensions-with-codec.d.ts +0 -0
  315. package/dist/validate-even-dimensions-with-codec.js +0 -0
  316. package/dist/validate-every-nth-frame.d.ts +2 -1
  317. package/dist/validate-every-nth-frame.js +8 -1
  318. package/dist/validate-ffmpeg-override.d.ts +2 -0
  319. package/dist/validate-ffmpeg-override.js +12 -0
  320. package/dist/validate-ffmpeg.d.ts +4 -1
  321. package/dist/validate-ffmpeg.js +23 -7
  322. package/dist/validate-frame.d.ts +0 -0
  323. package/dist/validate-frame.js +3 -3
  324. package/dist/validate-number-of-gif-loops.d.ts +2 -0
  325. package/dist/validate-number-of-gif-loops.js +24 -0
  326. package/dist/validate-opengl-renderer.d.ts +0 -0
  327. package/dist/validate-opengl-renderer.js +0 -0
  328. package/dist/validate-output-filename.d.ts +0 -0
  329. package/dist/validate-output-filename.js +0 -0
  330. package/dist/validate-puppeteer-timeout.d.ts +0 -0
  331. package/dist/validate-puppeteer-timeout.js +1 -1
  332. package/dist/validate-scale.d.ts +0 -0
  333. package/dist/validate-scale.js +0 -0
  334. package/dist/validate-videobitrate.d.ts +1 -0
  335. package/dist/validate-videobitrate.js +20 -0
  336. package/dist/wait-for-symbolication-error-to-be-done.d.ts +0 -0
  337. package/dist/wait-for-symbolication-error-to-be-done.js +0 -0
  338. package/dist/warn-about-ffmpeg-version.d.ts +5 -0
  339. package/dist/warn-about-ffmpeg-version.js +37 -0
  340. package/dist/ws/ws-types.d.ts +0 -0
  341. package/dist/ws/ws-types.js +0 -0
  342. package/package.json +7 -7
  343. package/dist/make-assets-download-dir.d.ts +0 -1
  344. package/dist/make-assets-download-dir.js +0 -13
  345. 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 organisations 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.
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 [Jonny Burger](https://jonny.io)
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 organisation with up to 3 employees
18
- - a non-profit or not-for-profit organisation
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 and 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.
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 noninfringement. 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.
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
- export declare const convertAssetsToFileUrls: ({ assets, downloadDir, onDownload, }: {
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, downloadDir, onDownload, }) => {
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, downloadDir, }: {
8
+ export declare const downloadAsset: ({ src, onDownload, downloadMap, }: {
8
9
  src: string;
9
10
  onDownload: RenderMediaOnDownload;
10
- downloadDir: string;
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, downloadDir, onDownload, }: {
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 = __importDefault(require("path"));
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 isDownloadingMap = {};
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] = true;
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, downloadDir, }) => {
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
- if ((_a = hasBeenDownloadedMap[src]) === null || _a === void 0 ? void 0 : _a[downloadDir]) {
100
- const claimedDownloadLocation = (_b = hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir];
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)({ contentDisposition, downloadDir, src }),
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({ contentDisposition, src });
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, downloadDir, onDownload, }) => {
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 to = toFn(contentDisposition);
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
- declare type Result = {
3
- channels: number;
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
- declare type Result = {
3
- duration: number | null;
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>;