@remotion/renderer 4.0.0-webhook.27 → 4.1.0-alpha1

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 (411) hide show
  1. package/LICENSE.md +8 -8
  2. package/README.md +9 -0
  3. package/client.d.ts +1 -0
  4. package/client.js +1 -0
  5. package/dist/assets/calculate-asset-positions.d.ts +0 -0
  6. package/dist/assets/calculate-asset-positions.js +1 -0
  7. package/dist/assets/calculate-atempo.d.ts +0 -0
  8. package/dist/assets/calculate-atempo.js +0 -0
  9. package/dist/assets/convert-assets-to-file-urls.d.ts +0 -0
  10. package/dist/assets/convert-assets-to-file-urls.js +0 -0
  11. package/dist/assets/download-and-map-assets-to-file.d.ts +6 -4
  12. package/dist/assets/download-and-map-assets-to-file.js +49 -19
  13. package/dist/assets/download-file.d.ts +8 -5
  14. package/dist/assets/download-file.js +71 -8
  15. package/dist/assets/download-map.d.ts +8 -29
  16. package/dist/assets/download-map.js +15 -16
  17. package/dist/assets/ffmpeg-volume-expression.d.ts +4 -3
  18. package/dist/assets/ffmpeg-volume-expression.js +5 -3
  19. package/dist/assets/flatten-volume-array.d.ts +0 -0
  20. package/dist/assets/flatten-volume-array.js +0 -0
  21. package/dist/assets/get-audio-channels.d.ts +2 -2
  22. package/dist/assets/get-audio-channels.js +14 -12
  23. package/dist/assets/read-file.d.ts +1 -1
  24. package/dist/assets/read-file.js +5 -7
  25. package/dist/assets/round-volume-to-avoid-stack-overflow.d.ts +0 -0
  26. package/dist/assets/round-volume-to-avoid-stack-overflow.js +0 -0
  27. package/dist/assets/sanitize-filename.d.ts +0 -0
  28. package/dist/assets/sanitize-filename.js +0 -0
  29. package/dist/assets/sanitize-filepath.d.ts +0 -0
  30. package/dist/assets/sanitize-filepath.js +2 -2
  31. package/dist/assets/truncate-utf8-bytes.d.ts +0 -0
  32. package/dist/assets/truncate-utf8-bytes.js +0 -0
  33. package/dist/assets/types.d.ts +5 -4
  34. package/dist/assets/types.js +0 -0
  35. package/dist/audio-codec.d.ts +28 -0
  36. package/dist/audio-codec.js +83 -0
  37. package/dist/browser/Browser.d.ts +16 -14
  38. package/dist/browser/Browser.js +69 -72
  39. package/dist/browser/BrowserConnector.d.ts +0 -0
  40. package/dist/browser/BrowserConnector.js +0 -0
  41. package/dist/browser/BrowserFetcher.d.ts +16 -64
  42. package/dist/browser/BrowserFetcher.js +147 -235
  43. package/dist/browser/BrowserPage.d.ts +21 -6
  44. package/dist/browser/BrowserPage.js +54 -22
  45. package/dist/browser/BrowserRunner.d.ts +1 -1
  46. package/dist/browser/BrowserRunner.js +32 -22
  47. package/dist/browser/Connection.d.ts +0 -0
  48. package/dist/browser/Connection.js +1 -1
  49. package/dist/browser/ConsoleMessage.d.ts +1 -1
  50. package/dist/browser/ConsoleMessage.js +0 -0
  51. package/dist/browser/DOMWorld.d.ts +5 -4
  52. package/dist/browser/DOMWorld.js +16 -9
  53. package/dist/browser/Errors.d.ts +0 -0
  54. package/dist/browser/Errors.js +0 -0
  55. package/dist/browser/EvalTypes.d.ts +7 -7
  56. package/dist/browser/EvalTypes.js +0 -0
  57. package/dist/browser/EventEmitter.d.ts +0 -0
  58. package/dist/browser/EventEmitter.js +0 -0
  59. package/dist/browser/ExecutionContext.d.ts +0 -0
  60. package/dist/browser/ExecutionContext.js +0 -0
  61. package/dist/browser/FrameManager.d.ts +0 -2
  62. package/dist/browser/FrameManager.js +13 -17
  63. package/dist/browser/HTTPRequest.d.ts +0 -0
  64. package/dist/browser/HTTPRequest.js +0 -0
  65. package/dist/browser/HTTPResponse.d.ts +0 -0
  66. package/dist/browser/HTTPResponse.js +0 -0
  67. package/dist/browser/JSHandle.d.ts +0 -0
  68. package/dist/browser/JSHandle.js +14 -14
  69. package/dist/browser/LaunchOptions.d.ts +2 -2
  70. package/dist/browser/LaunchOptions.js +0 -0
  71. package/dist/browser/Launcher.d.ts +9 -3
  72. package/dist/browser/Launcher.js +16 -29
  73. package/dist/browser/LifecycleWatcher.d.ts +1 -1
  74. package/dist/browser/LifecycleWatcher.js +0 -0
  75. package/dist/browser/NetworkEventManager.d.ts +4 -4
  76. package/dist/browser/NetworkEventManager.js +0 -0
  77. package/dist/browser/NetworkManager.d.ts +0 -0
  78. package/dist/browser/NetworkManager.js +0 -0
  79. package/dist/browser/NodeWebSocketTransport.d.ts +0 -0
  80. package/dist/browser/NodeWebSocketTransport.js +21 -21
  81. package/dist/browser/Product.d.ts +1 -1
  82. package/dist/browser/Product.js +0 -0
  83. package/dist/browser/PuppeteerNode.d.ts +2 -5
  84. package/dist/browser/PuppeteerNode.js +2 -11
  85. package/dist/browser/PuppeteerViewport.d.ts +0 -0
  86. package/dist/browser/PuppeteerViewport.js +0 -0
  87. package/dist/browser/ScreenshotOptions.d.ts +0 -14
  88. package/dist/browser/ScreenshotOptions.js +0 -1
  89. package/dist/browser/Target.d.ts +4 -3
  90. package/dist/browser/Target.js +8 -2
  91. package/dist/browser/TaskQueue.d.ts +0 -0
  92. package/dist/browser/TaskQueue.js +0 -0
  93. package/dist/browser/TimeoutSettings.d.ts +0 -0
  94. package/dist/browser/TimeoutSettings.js +0 -0
  95. package/dist/browser/assert.d.ts +0 -0
  96. package/dist/browser/assert.js +0 -0
  97. package/dist/browser/create-browser-fetcher.d.ts +0 -0
  98. package/dist/browser/create-browser-fetcher.js +34 -48
  99. package/dist/browser/devtools-commands.d.ts +5 -1
  100. package/dist/browser/devtools-commands.js +0 -0
  101. package/dist/browser/devtools-types.d.ts +92 -10
  102. package/dist/browser/devtools-types.js +0 -0
  103. package/dist/browser/get-download-destination.d.ts +0 -0
  104. package/dist/browser/get-download-destination.js +8 -8
  105. package/dist/browser/is-target-closed-err.d.ts +1 -0
  106. package/dist/browser/is-target-closed-err.js +9 -0
  107. package/dist/browser/mitt/index.d.ts +6 -6
  108. package/dist/browser/mitt/index.js +0 -0
  109. package/dist/browser/node.d.ts +0 -0
  110. package/dist/browser/node.js +0 -0
  111. package/dist/browser/revisions.d.ts +1 -1
  112. package/dist/browser/revisions.js +0 -0
  113. package/dist/browser/should-log-message.d.ts +24 -0
  114. package/dist/browser/should-log-message.js +72 -0
  115. package/dist/browser/util.d.ts +2 -2
  116. package/dist/browser/util.js +0 -0
  117. package/dist/browser-executable.d.ts +1 -1
  118. package/dist/browser-executable.js +0 -0
  119. package/dist/browser-log.d.ts +1 -1
  120. package/dist/browser-log.js +0 -0
  121. package/dist/browser.d.ts +1 -1
  122. package/dist/browser.js +0 -0
  123. package/dist/calculate-ffmpeg-filters.d.ts +2 -1
  124. package/dist/calculate-ffmpeg-filters.js +1 -0
  125. package/dist/call-ffmpeg.d.ts +14 -0
  126. package/dist/call-ffmpeg.js +42 -0
  127. package/dist/can-use-parallel-encoding.d.ts +0 -0
  128. package/dist/can-use-parallel-encoding.js +0 -0
  129. package/dist/chalk/index.d.ts +54 -0
  130. package/dist/chalk/index.js +135 -0
  131. package/dist/chalk/is-color-supported.d.ts +1 -0
  132. package/dist/chalk/is-color-supported.js +37 -0
  133. package/dist/check-apple-silicon.d.ts +1 -1
  134. package/dist/check-apple-silicon.js +8 -47
  135. package/dist/chunk.d.ts +0 -0
  136. package/dist/chunk.js +0 -0
  137. package/dist/client.d.ts +204 -0
  138. package/dist/client.js +49 -0
  139. package/dist/codec-supports-media.d.ts +3 -2
  140. package/dist/codec-supports-media.js +20 -5
  141. package/dist/codec.d.ts +2 -2
  142. package/dist/codec.js +0 -0
  143. package/dist/combine-videos.d.ts +6 -2
  144. package/dist/combine-videos.js +17 -17
  145. package/dist/compositor/compose.d.ts +26 -0
  146. package/dist/compositor/compose.js +82 -0
  147. package/dist/compositor/compositor.d.ts +11 -0
  148. package/dist/compositor/compositor.js +219 -0
  149. package/dist/compositor/get-executable-path.d.ts +1 -0
  150. package/dist/compositor/get-executable-path.js +57 -0
  151. package/dist/compositor/make-nonce.d.ts +1 -0
  152. package/dist/compositor/make-nonce.js +8 -0
  153. package/dist/compositor/payloads.d.ts +68 -0
  154. package/dist/{ffmpeg-executable.js → compositor/payloads.js} +0 -0
  155. package/dist/compress-assets.d.ts +0 -0
  156. package/dist/compress-assets.js +0 -0
  157. package/dist/convert-number-of-gif-loops-to-ffmpeg.d.ts +0 -0
  158. package/dist/convert-number-of-gif-loops-to-ffmpeg.js +0 -0
  159. package/dist/convert-to-positive-frame-index.d.ts +0 -0
  160. package/dist/convert-to-positive-frame-index.js +0 -0
  161. package/dist/create-ffmpeg-complex-filter.d.ts +5 -1
  162. package/dist/create-ffmpeg-complex-filter.js +6 -4
  163. package/dist/create-ffmpeg-merge-filter.d.ts +5 -1
  164. package/dist/create-ffmpeg-merge-filter.js +21 -13
  165. package/dist/create-silent-audio.d.ts +1 -3
  166. package/dist/create-silent-audio.js +3 -6
  167. package/dist/crf.d.ts +6 -2
  168. package/dist/crf.js +41 -8
  169. package/dist/cycle-browser-tabs.d.ts +2 -5
  170. package/dist/cycle-browser-tabs.js +5 -5
  171. package/dist/delay-render-embedded-stack.d.ts +0 -0
  172. package/dist/delay-render-embedded-stack.js +0 -0
  173. package/dist/delete-directory.d.ts +1 -1
  174. package/dist/delete-directory.js +43 -17
  175. package/dist/does-have-m2-bug.d.ts +3 -0
  176. package/dist/does-have-m2-bug.js +12 -0
  177. package/dist/ensure-frames-in-order.d.ts +0 -0
  178. package/dist/ensure-frames-in-order.js +0 -0
  179. package/dist/ensure-output-directory.d.ts +0 -0
  180. package/dist/ensure-output-directory.js +5 -5
  181. package/dist/error-handling/handle-javascript-exception.d.ts +0 -0
  182. package/dist/error-handling/handle-javascript-exception.js +10 -0
  183. package/dist/error-handling/symbolicate-error.d.ts +0 -0
  184. package/dist/error-handling/symbolicate-error.js +6 -3
  185. package/dist/error-handling/symbolicateable-error.d.ts +0 -0
  186. package/dist/error-handling/symbolicateable-error.js +0 -0
  187. package/dist/ffmpeg-filter-file.d.ts +6 -1
  188. package/dist/ffmpeg-filter-file.js +40 -8
  189. package/dist/ffmpeg-override.d.ts +1 -1
  190. package/dist/ffmpeg-override.js +0 -0
  191. package/dist/file-extensions.d.ts +14 -0
  192. package/dist/file-extensions.js +76 -0
  193. package/dist/find-closest-package-json.d.ts +2 -0
  194. package/dist/find-closest-package-json.js +31 -0
  195. package/dist/frame-range.d.ts +1 -1
  196. package/dist/frame-range.js +0 -0
  197. package/dist/get-browser-instance.d.ts +8 -3
  198. package/dist/get-browser-instance.js +10 -5
  199. package/dist/get-codec-name.d.ts +0 -0
  200. package/dist/get-codec-name.js +0 -0
  201. package/dist/get-compositions.d.ts +27 -14
  202. package/dist/get-compositions.js +72 -39
  203. package/dist/get-concurrency.d.ts +1 -1
  204. package/dist/get-concurrency.js +11 -4
  205. package/dist/get-duration-from-frame-range.d.ts +0 -0
  206. package/dist/get-duration-from-frame-range.js +0 -0
  207. package/dist/get-extension-from-codec.d.ts +5 -1
  208. package/dist/get-extension-from-codec.js +56 -32
  209. package/dist/get-extension-of-filename.d.ts +0 -0
  210. package/dist/get-extension-of-filename.js +5 -1
  211. package/dist/get-frame-padded-index.d.ts +3 -2
  212. package/dist/get-frame-padded-index.js +3 -2
  213. package/dist/get-frame-to-render.d.ts +0 -0
  214. package/dist/get-frame-to-render.js +1 -1
  215. package/dist/get-local-browser-executable.d.ts +0 -0
  216. package/dist/get-local-browser-executable.js +7 -15
  217. package/dist/get-port.d.ts +4 -1
  218. package/dist/get-port.js +8 -8
  219. package/dist/get-prores-profile-name.d.ts +0 -0
  220. package/dist/get-prores-profile-name.js +0 -0
  221. package/dist/get-video-threads-flag.d.ts +0 -0
  222. package/dist/get-video-threads-flag.js +3 -3
  223. package/dist/guess-extension-for-media.d.ts +3 -1
  224. package/dist/guess-extension-for-media.js +4 -7
  225. package/dist/image-format.d.ts +12 -6
  226. package/dist/image-format.js +19 -13
  227. package/dist/index.d.ts +368 -49
  228. package/dist/index.js +68 -46
  229. package/dist/is-audio-codec.d.ts +0 -0
  230. package/dist/is-audio-codec.js +0 -0
  231. package/dist/is-serve-url.d.ts +0 -0
  232. package/dist/is-serve-url.js +0 -0
  233. package/dist/jpeg-quality.d.ts +2 -0
  234. package/dist/jpeg-quality.js +22 -0
  235. package/dist/locks.d.ts +7 -0
  236. package/dist/locks.js +44 -0
  237. package/dist/log-level.d.ts +1 -1
  238. package/dist/log-level.js +0 -0
  239. package/dist/logger.d.ts +24 -0
  240. package/dist/logger.js +68 -0
  241. package/dist/make-cancel-signal.d.ts +13 -2
  242. package/dist/make-cancel-signal.js +24 -1
  243. package/dist/merge-audio-track.d.ts +4 -4
  244. package/dist/merge-audio-track.js +38 -33
  245. package/dist/mime-db.d.ts +0 -0
  246. package/dist/mime-db.js +0 -0
  247. package/dist/mime-types.d.ts +0 -0
  248. package/dist/mime-types.js +3 -3
  249. package/dist/normalize-serve-url.d.ts +0 -0
  250. package/dist/normalize-serve-url.js +0 -0
  251. package/dist/offthread-video-server.d.ts +47 -11
  252. package/dist/offthread-video-server.js +111 -58
  253. package/dist/open-browser.d.ts +21 -6
  254. package/dist/open-browser.js +37 -16
  255. package/dist/options/audio-bitrate.d.ts +2 -0
  256. package/dist/options/audio-bitrate.js +11 -0
  257. package/dist/options/crf.d.ts +2 -0
  258. package/dist/options/crf.js +11 -0
  259. package/dist/options/enforce-audio.d.ts +2 -0
  260. package/dist/options/enforce-audio.js +11 -0
  261. package/dist/options/jpeg-quality.d.ts +2 -0
  262. package/dist/options/jpeg-quality.js +11 -0
  263. package/dist/options/mute.d.ts +2 -0
  264. package/dist/options/mute.js +11 -0
  265. package/dist/options/option.d.ts +8 -0
  266. package/dist/options/option.js +2 -0
  267. package/dist/options/scale.d.ts +2 -0
  268. package/dist/options/scale.js +11 -0
  269. package/dist/options/video-bitrate.d.ts +2 -0
  270. package/dist/options/video-bitrate.js +11 -0
  271. package/dist/options/video-codec.d.ts +2 -0
  272. package/dist/options/video-codec.js +11 -0
  273. package/dist/overwrite.d.ts +0 -0
  274. package/dist/overwrite.js +0 -0
  275. package/dist/p-limit.d.ts +0 -0
  276. package/dist/p-limit.js +0 -0
  277. package/dist/parse-browser-error-stack.d.ts +1 -1
  278. package/dist/parse-browser-error-stack.js +0 -0
  279. package/dist/parse-ffmpeg-progress.d.ts +0 -0
  280. package/dist/parse-ffmpeg-progress.js +0 -0
  281. package/dist/perf.d.ts +2 -2
  282. package/dist/perf.js +9 -7
  283. package/dist/pixel-format.d.ts +2 -2
  284. package/dist/pixel-format.js +3 -0
  285. package/dist/pool.d.ts +0 -0
  286. package/dist/pool.js +0 -0
  287. package/dist/prepare-server.d.ts +25 -10
  288. package/dist/prepare-server.js +71 -18
  289. package/dist/preprocess-audio-track.d.ts +7 -5
  290. package/dist/preprocess-audio-track.js +7 -8
  291. package/dist/prespawn-ffmpeg.d.ts +20 -10
  292. package/dist/prespawn-ffmpeg.js +67 -29
  293. package/dist/prestitcher-memory-usage.d.ts +0 -4
  294. package/dist/prestitcher-memory-usage.js +4 -5
  295. package/dist/prores-profile.d.ts +6 -4
  296. package/dist/prores-profile.js +8 -8
  297. package/dist/provide-screenshot.d.ts +8 -4
  298. package/dist/provide-screenshot.js +5 -2
  299. package/dist/puppeteer-evaluate.d.ts +0 -0
  300. package/dist/puppeteer-evaluate.js +20 -12
  301. package/dist/puppeteer-screenshot.d.ts +12 -2
  302. package/dist/puppeteer-screenshot.js +18 -45
  303. package/dist/redirect-status-codes.d.ts +1 -0
  304. package/dist/redirect-status-codes.js +6 -0
  305. package/dist/render-frames.d.ts +52 -35
  306. package/dist/render-frames.js +248 -143
  307. package/dist/render-media.d.ts +76 -29
  308. package/dist/render-media.js +324 -195
  309. package/dist/render-still.d.ts +46 -19
  310. package/dist/render-still.js +128 -69
  311. package/dist/replace-browser.d.ts +6 -0
  312. package/dist/replace-browser.js +47 -0
  313. package/dist/resolve-asset-src.d.ts +0 -0
  314. package/dist/resolve-asset-src.js +2 -2
  315. package/dist/sample-rate.d.ts +0 -0
  316. package/dist/sample-rate.js +0 -0
  317. package/dist/screenshot-dom-element.d.ts +8 -4
  318. package/dist/screenshot-dom-element.js +15 -4
  319. package/dist/screenshot-task.d.ts +11 -2
  320. package/dist/screenshot-task.js +43 -13
  321. package/dist/seek-to-frame.d.ts +1 -0
  322. package/dist/seek-to-frame.js +49 -3
  323. package/dist/select-composition.d.ts +41 -0
  324. package/dist/select-composition.js +156 -0
  325. package/dist/serve-handler/index.d.ts +1 -1
  326. package/dist/serve-handler/index.js +21 -19
  327. package/dist/serve-handler/is-path-inside.d.ts +0 -0
  328. package/dist/serve-handler/is-path-inside.js +3 -3
  329. package/dist/serve-handler/range-parser.d.ts +0 -0
  330. package/dist/serve-handler/range-parser.js +0 -0
  331. package/dist/serve-static.d.ts +8 -6
  332. package/dist/serve-static.js +85 -59
  333. package/dist/set-props-and-env.d.ts +5 -3
  334. package/dist/set-props-and-env.js +18 -10
  335. package/dist/stitch-frames-to-video.d.ts +39 -16
  336. package/dist/stitch-frames-to-video.js +210 -121
  337. package/dist/stringify-ffmpeg-filter.d.ts +10 -2
  338. package/dist/stringify-ffmpeg-filter.js +37 -34
  339. package/dist/symbolicate-stacktrace.d.ts +16 -3
  340. package/dist/symbolicate-stacktrace.js +49 -24
  341. package/dist/take-frame-and-compose.d.ts +22 -0
  342. package/dist/take-frame-and-compose.js +103 -0
  343. package/dist/tmp-dir.d.ts +0 -0
  344. package/dist/tmp-dir.js +7 -8
  345. package/dist/truthy.d.ts +1 -1
  346. package/dist/truthy.js +0 -0
  347. package/dist/types.d.ts +2 -2
  348. package/dist/types.js +0 -0
  349. package/dist/validate-concurrency.d.ts +2 -0
  350. package/dist/validate-concurrency.js +21 -10
  351. package/dist/validate-even-dimensions-with-codec.d.ts +0 -0
  352. package/dist/validate-even-dimensions-with-codec.js +0 -0
  353. package/dist/validate-every-nth-frame.d.ts +2 -1
  354. package/dist/validate-every-nth-frame.js +8 -1
  355. package/dist/validate-ffmpeg-override.d.ts +0 -0
  356. package/dist/validate-ffmpeg-override.js +0 -0
  357. package/dist/validate-number-of-gif-loops.d.ts +2 -0
  358. package/dist/validate-number-of-gif-loops.js +24 -0
  359. package/dist/validate-opengl-renderer.d.ts +2 -3
  360. package/dist/validate-opengl-renderer.js +9 -4
  361. package/dist/validate-output-filename.d.ts +7 -2
  362. package/dist/validate-output-filename.js +20 -51
  363. package/dist/validate-puppeteer-timeout.d.ts +0 -0
  364. package/dist/validate-puppeteer-timeout.js +1 -0
  365. package/dist/validate-scale.d.ts +0 -0
  366. package/dist/validate-scale.js +0 -0
  367. package/dist/validate-videobitrate.d.ts +1 -0
  368. package/dist/validate-videobitrate.js +20 -0
  369. package/dist/wait-for-symbolication-error-to-be-done.d.ts +0 -0
  370. package/dist/wait-for-symbolication-error-to-be-done.js +5 -31
  371. package/dist/ws/ws-types.d.ts +0 -0
  372. package/dist/ws/ws-types.js +2 -1
  373. package/install-toolchain.mjs +36 -0
  374. package/package.json +70 -60
  375. package/types/ws/index.d.ts +5 -5
  376. package/.prettierrc.js +0 -14
  377. package/dist/assets/dl-browser.d.ts +0 -1
  378. package/dist/assets/dl-browser.js +0 -38
  379. package/dist/assets/get-video-stream-duration.d.ts +0 -4
  380. package/dist/assets/get-video-stream-duration.js +0 -59
  381. package/dist/calculate-sar-dar-pixels.d.ts +0 -9
  382. package/dist/calculate-sar-dar-pixels.js +0 -19
  383. package/dist/convert-to-pcm.d.ts +0 -6
  384. package/dist/convert-to-pcm.js +0 -20
  385. package/dist/ensure-presentation-timestamp.d.ts +0 -2
  386. package/dist/ensure-presentation-timestamp.js +0 -69
  387. package/dist/extract-frame-from-video.d.ts +0 -16
  388. package/dist/extract-frame-from-video.js +0 -277
  389. package/dist/ffmpeg-executable.d.ts +0 -1
  390. package/dist/ffmpeg-flags.d.ts +0 -12
  391. package/dist/ffmpeg-flags.js +0 -45
  392. package/dist/frame-to-ffmpeg-timestamp.d.ts +0 -1
  393. package/dist/frame-to-ffmpeg-timestamp.js +0 -8
  394. package/dist/get-audio-codec-name.d.ts +0 -2
  395. package/dist/get-audio-codec-name.js +0 -28
  396. package/dist/get-video-info.d.ts +0 -3
  397. package/dist/get-video-info.js +0 -49
  398. package/dist/is-beyond-last-frame.d.ts +0 -3
  399. package/dist/is-beyond-last-frame.js +0 -12
  400. package/dist/last-frame-from-video-cache.d.ts +0 -17
  401. package/dist/last-frame-from-video-cache.js +0 -55
  402. package/dist/legacy-webpack-config.d.ts +0 -9
  403. package/dist/legacy-webpack-config.js +0 -13
  404. package/dist/quality.d.ts +0 -1
  405. package/dist/quality.js +0 -21
  406. package/dist/validate-ffmpeg.d.ts +0 -2
  407. package/dist/validate-ffmpeg.js +0 -72
  408. package/dist/validate-frame.d.ts +0 -1
  409. package/dist/validate-frame.js +0 -24
  410. package/tsconfig.json +0 -10
  411. package/vitest.config.ts +0 -8
@@ -1,277 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.extractFrameFromVideo = exports.getLastFrameOfVideo = void 0;
7
- const execa_1 = __importDefault(require("execa"));
8
- const get_video_stream_duration_1 = require("./assets/get-video-stream-duration");
9
- const ensure_presentation_timestamp_1 = require("./ensure-presentation-timestamp");
10
- const frame_to_ffmpeg_timestamp_1 = require("./frame-to-ffmpeg-timestamp");
11
- const get_video_info_1 = require("./get-video-info");
12
- const is_beyond_last_frame_1 = require("./is-beyond-last-frame");
13
- const last_frame_from_video_cache_1 = require("./last-frame-from-video-cache");
14
- const p_limit_1 = require("./p-limit");
15
- const perf_1 = require("./perf");
16
- const truthy_1 = require("./truthy");
17
- const lastFrameLimit = (0, p_limit_1.pLimit)(1);
18
- const mainLimit = (0, p_limit_1.pLimit)(5);
19
- const determineVcodecFfmepgFlags = (vcodecFlag) => {
20
- return [
21
- vcodecFlag === 'vp9' ? '-vcodec' : null,
22
- vcodecFlag === 'vp9' ? 'libvpx-vp9' : null,
23
- vcodecFlag === 'vp8' ? '-vcodec' : null,
24
- vcodecFlag === 'vp8' ? 'libvpx' : null,
25
- ].filter(truthy_1.truthy);
26
- };
27
- const determineResizeParams = (needsResize) => {
28
- if (needsResize === null) {
29
- return [];
30
- }
31
- return ['-s', `${needsResize[0]}x${needsResize[1]}`];
32
- };
33
- // Uses no seeking, therefore the whole video has to be decoded. This is a last resort and should only happen
34
- // if the video is corrupted
35
- const getFrameOfVideoSlow = async ({ src, duration, ffmpegExecutable, imageFormat, specialVCodecForTransparency, needsResize, offset, fps, }) => {
36
- console.warn(`\nUsing a slow method to extract the frame at ${duration}ms of ${src}. See https://remotion.dev/docs/slow-method-to-extract-frame for advice`);
37
- const actualOffset = `-${duration * 1000 - offset}ms`;
38
- const command = [
39
- '-itsoffset',
40
- actualOffset,
41
- ...determineVcodecFfmepgFlags(specialVCodecForTransparency),
42
- '-i',
43
- src,
44
- '-frames:v',
45
- '1',
46
- '-c:v',
47
- imageFormat === 'jpeg' ? 'mjpeg' : 'png',
48
- '-f',
49
- 'image2pipe',
50
- ...determineResizeParams(needsResize),
51
- '-',
52
- ].filter(truthy_1.truthy);
53
- const { stdout, stderr } = (0, execa_1.default)(ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : 'ffmpeg', command);
54
- if (!stderr) {
55
- throw new Error('unexpectedly did not get stderr');
56
- }
57
- if (!stdout) {
58
- throw new Error('unexpectedly did not get stdout');
59
- }
60
- const stderrChunks = [];
61
- const stdoutChunks = [];
62
- const stdErrString = new Promise((resolve, reject) => {
63
- stderr.on('data', (d) => stderrChunks.push(d));
64
- stderr.on('error', (err) => reject(err));
65
- stderr.on('end', () => resolve(Buffer.concat(stderrChunks).toString('utf-8')));
66
- });
67
- const stdoutChunk = new Promise((resolve, reject) => {
68
- stdout.on('data', (d) => stdoutChunks.push(d));
69
- stdout.on('error', (err) => reject(err));
70
- stdout.on('end', () => resolve(Buffer.concat(stdoutChunks)));
71
- });
72
- const [stdErr, stdoutBuffer] = await Promise.all([stdErrString, stdoutChunk]);
73
- const isEmpty = stdErr.includes('Output file is empty');
74
- if (isEmpty) {
75
- if (offset > 70) {
76
- throw new Error(`Could not get last frame of ${src}. Tried to seek to the end using the command "ffmpeg ${command.join(' ')}" but got no frame. Most likely this video is corrupted.`);
77
- }
78
- return getFrameOfVideoSlow({
79
- ffmpegExecutable,
80
- duration,
81
- // Decrement in 10ms increments, or 1 frame (e.g. fps = 25 --> 40ms)
82
- offset: offset + (fps === null ? 10 : 1000 / fps),
83
- src,
84
- imageFormat,
85
- specialVCodecForTransparency,
86
- needsResize,
87
- fps,
88
- });
89
- }
90
- return stdoutBuffer;
91
- };
92
- const getLastFrameOfVideoFastUnlimited = async (options) => {
93
- const { ffmpegExecutable, ffprobeExecutable, offset, src, downloadMap } = options;
94
- const fromCache = (0, last_frame_from_video_cache_1.getLastFrameFromCache)({ ...options, offset: 0 });
95
- if (fromCache) {
96
- return fromCache;
97
- }
98
- const { duration, fps } = await (0, get_video_stream_duration_1.getVideoStreamDuration)(downloadMap, src, ffprobeExecutable);
99
- if (duration === null) {
100
- throw new Error(`Could not determine the duration of ${src} using FFMPEG. The file is not supported.`);
101
- }
102
- if (options.specialVCodecForTransparency === 'vp8' || offset > 40) {
103
- const last = await getFrameOfVideoSlow({
104
- duration,
105
- ffmpegExecutable,
106
- src,
107
- imageFormat: options.imageFormat,
108
- specialVCodecForTransparency: options.specialVCodecForTransparency,
109
- needsResize: options.needsResize,
110
- offset: offset - 1000 / (fps === null ? 10 : fps),
111
- fps,
112
- });
113
- return last;
114
- }
115
- const actualOffset = `${duration * 1000 - offset}ms`;
116
- const { stdout, stderr } = (0, execa_1.default)(ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : 'ffmpeg', [
117
- '-ss',
118
- actualOffset,
119
- ...determineVcodecFfmepgFlags(options.specialVCodecForTransparency),
120
- '-i',
121
- src,
122
- '-frames:v',
123
- '1',
124
- '-c:v',
125
- options.imageFormat === 'jpeg' ? 'mjpeg' : 'png',
126
- '-f',
127
- 'image2pipe',
128
- ...determineResizeParams(options.needsResize),
129
- '-',
130
- ].filter(truthy_1.truthy));
131
- if (!stderr) {
132
- throw new Error('unexpectedly did not get stderr');
133
- }
134
- if (!stdout) {
135
- throw new Error('unexpectedly did not get stdout');
136
- }
137
- const stderrChunks = [];
138
- const stdoutChunks = [];
139
- const stdErrString = new Promise((resolve, reject) => {
140
- stderr.on('data', (d) => stderrChunks.push(d));
141
- stderr.on('error', (err) => reject(err));
142
- stderr.on('end', () => resolve(Buffer.concat(stderrChunks).toString('utf-8')));
143
- });
144
- const stdoutChunk = new Promise((resolve, reject) => {
145
- stdout.on('data', (d) => {
146
- stdoutChunks.push(d);
147
- });
148
- stdout.on('error', (err) => {
149
- reject(err);
150
- });
151
- stdout.on('end', () => {
152
- resolve(Buffer.concat(stdoutChunks));
153
- });
154
- });
155
- const [stdErr, stdoutBuffer] = await Promise.all([stdErrString, stdoutChunk]);
156
- const isEmpty = stdErr.includes('Output file is empty');
157
- if (isEmpty) {
158
- const unlimited = await getLastFrameOfVideoFastUnlimited({
159
- ffmpegExecutable,
160
- // Decrement in 10ms increments, or 1 frame (e.g. fps = 25 --> 40ms)
161
- offset: offset + (fps === null ? 10 : 1000 / fps),
162
- src,
163
- ffprobeExecutable,
164
- imageFormat: options.imageFormat,
165
- specialVCodecForTransparency: options.specialVCodecForTransparency,
166
- needsResize: options.needsResize,
167
- downloadMap: options.downloadMap,
168
- });
169
- return unlimited;
170
- }
171
- return stdoutBuffer;
172
- };
173
- const getLastFrameOfVideo = async (options) => {
174
- const result = await lastFrameLimit(getLastFrameOfVideoFastUnlimited, options);
175
- (0, last_frame_from_video_cache_1.setLastFrameInCache)(options, result);
176
- return result;
177
- };
178
- exports.getLastFrameOfVideo = getLastFrameOfVideo;
179
- const extractFrameFromVideoFn = async ({ time, ffmpegExecutable, ffprobeExecutable, imageFormat, downloadMap, ...options }) => {
180
- // We make a new copy of the video only for video because the conversion may affect
181
- // audio rendering, so we work with 2 different files
182
- const src = await (0, ensure_presentation_timestamp_1.ensurePresentationTimestamps)(downloadMap, options.src);
183
- const { specialVcodec, needsResize } = await (0, get_video_info_1.getVideoInfo)(downloadMap, src, ffprobeExecutable);
184
- if (specialVcodec === 'vp8') {
185
- const { fps } = await (0, get_video_stream_duration_1.getVideoStreamDuration)(downloadMap, src, ffprobeExecutable);
186
- return getFrameOfVideoSlow({
187
- ffmpegExecutable,
188
- imageFormat,
189
- specialVCodecForTransparency: specialVcodec,
190
- src,
191
- duration: time,
192
- needsResize,
193
- offset: 0,
194
- fps,
195
- });
196
- }
197
- if ((0, is_beyond_last_frame_1.isBeyondLastFrame)(downloadMap, src, time)) {
198
- const lastFrame = await (0, exports.getLastFrameOfVideo)({
199
- ffmpegExecutable,
200
- ffprobeExecutable,
201
- offset: 0,
202
- src,
203
- imageFormat,
204
- specialVCodecForTransparency: specialVcodec,
205
- needsResize,
206
- downloadMap,
207
- });
208
- return lastFrame;
209
- }
210
- const ffmpegTimestamp = (0, frame_to_ffmpeg_timestamp_1.frameToFfmpegTimestamp)(time);
211
- const { stdout, stderr } = (0, execa_1.default)(ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : 'ffmpeg', [
212
- '-ss',
213
- ffmpegTimestamp,
214
- ...determineVcodecFfmepgFlags(specialVcodec),
215
- '-i',
216
- src,
217
- '-frames:v',
218
- '1',
219
- '-f',
220
- 'image2pipe',
221
- '-vcodec',
222
- imageFormat === 'jpeg' ? 'mjpeg' : 'png',
223
- ...determineResizeParams(needsResize),
224
- '-',
225
- ].filter(truthy_1.truthy), {
226
- buffer: false,
227
- });
228
- if (!stderr) {
229
- throw new Error('unexpectedly did not get stderr');
230
- }
231
- if (!stdout) {
232
- throw new Error('unexpectedly did not get stdout');
233
- }
234
- const stdoutChunks = [];
235
- const stderrChunks = [];
236
- const stderrStringProm = new Promise((resolve, reject) => {
237
- stderr.on('data', (d) => stderrChunks.push(d));
238
- stderr.on('error', (err) => reject(err));
239
- stderr.on('end', () => resolve(Buffer.concat(stderrChunks).toString('utf8')));
240
- });
241
- const stdoutBuffer = new Promise((resolve, reject) => {
242
- stdout.on('data', (d) => stdoutChunks.push(d));
243
- stdout.on('error', (err) => reject(err));
244
- stdout.on('end', () => resolve(Buffer.concat(stdoutChunks)));
245
- });
246
- const [stderrStr, stdOut] = await Promise.all([
247
- stderrStringProm,
248
- stdoutBuffer,
249
- ]);
250
- if (stderrStr.includes('Output file is empty')) {
251
- (0, is_beyond_last_frame_1.markAsBeyondLastFrame)(downloadMap, src, time);
252
- const last = await (0, exports.getLastFrameOfVideo)({
253
- ffmpegExecutable,
254
- ffprobeExecutable,
255
- offset: 0,
256
- src,
257
- imageFormat,
258
- specialVCodecForTransparency: specialVcodec,
259
- needsResize,
260
- downloadMap,
261
- });
262
- return last;
263
- }
264
- if (stdOut.length === 0) {
265
- console.log('FFMPEG Logs:');
266
- console.log(stderrStr);
267
- throw new Error("Couldn't extract frame from video - FFMPEG did not return any data. Check logs to see more information");
268
- }
269
- return stdOut;
270
- };
271
- const extractFrameFromVideo = async (options) => {
272
- const perf = (0, perf_1.startPerfMeasure)('extract-frame');
273
- const res = await mainLimit(extractFrameFromVideoFn, options);
274
- (0, perf_1.stopPerfMeasure)(perf);
275
- return res;
276
- };
277
- exports.extractFrameFromVideo = extractFrameFromVideo;
@@ -1 +0,0 @@
1
- export declare type FfmpegExecutable = string | null;
@@ -1,12 +0,0 @@
1
- export declare type FfmpegVersion = [number, number, number] | null;
2
- export declare const getFfmpegBuildInfo: (options: {
3
- ffmpegExecutable: string | null;
4
- }) => Promise<string>;
5
- export declare const ffmpegHasFeature: ({ ffmpegExecutable, feature, }: {
6
- ffmpegExecutable: string | null;
7
- feature: 'enable-gpl' | 'enable-libx265' | 'enable-libvpx';
8
- }) => Promise<boolean>;
9
- export declare const parseFfmpegVersion: (buildconf: string) => FfmpegVersion;
10
- export declare const getFfmpegVersion: (options: {
11
- ffmpegExecutable: string | null;
12
- }) => Promise<FfmpegVersion>;
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getFfmpegVersion = exports.parseFfmpegVersion = exports.ffmpegHasFeature = exports.getFfmpegBuildInfo = void 0;
7
- const execa_1 = __importDefault(require("execa"));
8
- const validate_ffmpeg_1 = require("./validate-ffmpeg");
9
- let buildConfig = null;
10
- const getFfmpegBuildInfo = async (options) => {
11
- var _a;
12
- if (buildConfig !== null) {
13
- return buildConfig;
14
- }
15
- const data = await (0, execa_1.default)((_a = options.ffmpegExecutable) !== null && _a !== void 0 ? _a : 'ffmpeg', ['-buildconf'], {
16
- reject: false,
17
- });
18
- buildConfig = data.stderr;
19
- return buildConfig;
20
- };
21
- exports.getFfmpegBuildInfo = getFfmpegBuildInfo;
22
- const ffmpegHasFeature = async ({ ffmpegExecutable, feature, }) => {
23
- if (!(await (0, validate_ffmpeg_1.binaryExists)('ffmpeg', ffmpegExecutable))) {
24
- return false;
25
- }
26
- const config = await (0, exports.getFfmpegBuildInfo)({ ffmpegExecutable });
27
- return config.includes(feature);
28
- };
29
- exports.ffmpegHasFeature = ffmpegHasFeature;
30
- const parseFfmpegVersion = (buildconf) => {
31
- var _a;
32
- const match = buildconf.match(/ffmpeg version ([0-9]+).([0-9]+)(?:.([0-9]+))?/);
33
- if (!match) {
34
- return null;
35
- }
36
- return [Number(match[1]), Number(match[2]), Number((_a = match[3]) !== null && _a !== void 0 ? _a : 0)];
37
- };
38
- exports.parseFfmpegVersion = parseFfmpegVersion;
39
- const getFfmpegVersion = async (options) => {
40
- const buildInfo = await (0, exports.getFfmpegBuildInfo)({
41
- ffmpegExecutable: options.ffmpegExecutable,
42
- });
43
- return (0, exports.parseFfmpegVersion)(buildInfo);
44
- };
45
- exports.getFfmpegVersion = getFfmpegVersion;
@@ -1 +0,0 @@
1
- export declare const frameToFfmpegTimestamp: (time: number) => string;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.frameToFfmpegTimestamp = void 0;
4
- const frameToFfmpegTimestamp = (time) => {
5
- // We ceil because FFMPEG seeks to the closest frame BEFORE the position
6
- return (Math.ceil(time * 1000000) / 1000).toFixed(3) + 'ms';
7
- };
8
- exports.frameToFfmpegTimestamp = frameToFfmpegTimestamp;
@@ -1,2 +0,0 @@
1
- import type { Codec } from './codec';
2
- export declare const getAudioCodecName: (codec: Codec) => string | null;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAudioCodecName = void 0;
4
- const is_audio_codec_1 = require("./is-audio-codec");
5
- const getAudioCodecName = (codec) => {
6
- if (!(0, is_audio_codec_1.isAudioCodec)(codec)) {
7
- // The mkv container supports WAV, but MP4 does only support
8
- // AAC. Choose MKV codec for better quality because we can put in lossless audio
9
- if (codec === 'h264-mkv') {
10
- return 'pcm_s16le';
11
- }
12
- if (codec === 'vp8' || codec === 'vp9') {
13
- return 'libopus';
14
- }
15
- return 'aac';
16
- }
17
- if (codec === 'aac') {
18
- return 'aac';
19
- }
20
- if (codec === 'mp3') {
21
- return 'libmp3lame';
22
- }
23
- if (codec === 'wav') {
24
- return 'pcm_s16le';
25
- }
26
- return null;
27
- };
28
- exports.getAudioCodecName = getAudioCodecName;
@@ -1,3 +0,0 @@
1
- import type { DownloadMap, Vp9Result } from './assets/download-map';
2
- import type { FfmpegExecutable } from './ffmpeg-executable';
3
- export declare const getVideoInfo: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable) => Promise<Vp9Result>;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getVideoInfo = void 0;
7
- const execa_1 = __importDefault(require("execa"));
8
- const calculate_sar_dar_pixels_1 = require("./calculate-sar-dar-pixels");
9
- const p_limit_1 = require("./p-limit");
10
- const limit = (0, p_limit_1.pLimit)(1);
11
- async function getVideoInfoUnlimited(downloadMap, src, ffprobeExecutable) {
12
- var _a;
13
- if (typeof downloadMap.isVp9VideoCache[src] !== 'undefined') {
14
- return downloadMap.isVp9VideoCache[src];
15
- }
16
- const task = await (0, execa_1.default)(ffprobeExecutable !== null && ffprobeExecutable !== void 0 ? ffprobeExecutable : 'ffprobe', [src]);
17
- const isVp9 = task.stderr.includes('Video: vp9');
18
- const isVp8 = task.stderr.includes('Video: vp8');
19
- const dimensions = (_a = task.stderr
20
- .split('\n')
21
- .find((n) => n.trim().startsWith('Stream #'))) === null || _a === void 0 ? void 0 : _a.match(/([0-9]{2,6})x([0-9]{2,6})/);
22
- const dar = task.stderr.match(/DAR\s([0-9]+):([0-9]+)/);
23
- let needsResize = null;
24
- if (dimensions && dar) {
25
- const width = parseInt(dimensions[1], 10);
26
- const height = parseInt(dimensions[2], 10);
27
- const darWidth = parseInt(dar[1], 10);
28
- const darHeight = parseInt(dar[2], 10);
29
- const { width: actualWidth, height: actualHeight } = (0, calculate_sar_dar_pixels_1.calculateDisplayVideoSize)({
30
- darX: darWidth,
31
- darY: darHeight,
32
- x: width,
33
- y: height,
34
- });
35
- if (actualWidth !== width || actualHeight !== height) {
36
- needsResize = [actualWidth, actualHeight];
37
- }
38
- }
39
- const result = {
40
- specialVcodec: isVp9 ? 'vp9' : isVp8 ? 'vp8' : 'none',
41
- needsResize,
42
- };
43
- downloadMap.isVp9VideoCache[src] = result;
44
- return downloadMap.isVp9VideoCache[src];
45
- }
46
- const getVideoInfo = (downloadMap, src, ffprobeExecutable) => {
47
- return limit(() => getVideoInfoUnlimited(downloadMap, src, ffprobeExecutable));
48
- };
49
- exports.getVideoInfo = getVideoInfo;
@@ -1,3 +0,0 @@
1
- import type { DownloadMap } from './assets/download-map';
2
- export declare const isBeyondLastFrame: (downloadMap: DownloadMap, src: string, time: number) => boolean | 0;
3
- export declare const markAsBeyondLastFrame: (downloadMap: DownloadMap, src: string, time: number) => void;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.markAsBeyondLastFrame = exports.isBeyondLastFrame = void 0;
4
- const isBeyondLastFrame = (downloadMap, src, time) => {
5
- return (downloadMap.isBeyondLastFrameMap[src] &&
6
- time >= downloadMap.isBeyondLastFrameMap[src]);
7
- };
8
- exports.isBeyondLastFrame = isBeyondLastFrame;
9
- const markAsBeyondLastFrame = (downloadMap, src, time) => {
10
- downloadMap.isBeyondLastFrameMap[src] = time;
11
- };
12
- exports.markAsBeyondLastFrame = markAsBeyondLastFrame;
@@ -1,17 +0,0 @@
1
- /// <reference types="node" />
2
- import type { OffthreadVideoImageFormat } from 'remotion';
3
- import type { DownloadMap, SpecialVCodecForTransparency } from './assets/download-map';
4
- import type { FfmpegExecutable } from './ffmpeg-executable';
5
- export declare type LastFrameOptions = {
6
- ffmpegExecutable: FfmpegExecutable;
7
- ffprobeExecutable: FfmpegExecutable;
8
- offset: number;
9
- src: string;
10
- specialVCodecForTransparency: SpecialVCodecForTransparency;
11
- imageFormat: OffthreadVideoImageFormat;
12
- needsResize: [number, number] | null;
13
- downloadMap: DownloadMap;
14
- };
15
- export declare const setLastFrameInCache: (options: LastFrameOptions, data: Buffer) => void;
16
- export declare const getLastFrameFromCache: (options: LastFrameOptions) => Buffer | null;
17
- export declare const clearLastFileCache: (downloadMap: DownloadMap) => void;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- // OffthreadVideo requires sometimes that the last frame of a video gets extracted, however, this can be slow. We allocate a cache for it but that can be garbage collected
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearLastFileCache = exports.getLastFrameFromCache = exports.setLastFrameInCache = void 0;
5
- const MAX_CACHE_SIZE = 50 * 1024 * 1024; // 50MB
6
- let bufferSize = 0;
7
- const makeLastFrameCacheKey = (options) => {
8
- return [
9
- options.ffmpegExecutable,
10
- options.offset,
11
- options.src,
12
- options.imageFormat,
13
- options.downloadMap.id,
14
- ].join('-');
15
- };
16
- const setLastFrameInCache = (options, data) => {
17
- const key = makeLastFrameCacheKey(options);
18
- if (options.downloadMap.lastFrameMap[key]) {
19
- bufferSize -= options.downloadMap.lastFrameMap[key].data.byteLength;
20
- }
21
- options.downloadMap.lastFrameMap[key] = { data, lastAccessed: Date.now() };
22
- bufferSize += data.byteLength;
23
- ensureMaxSize(options.downloadMap);
24
- };
25
- exports.setLastFrameInCache = setLastFrameInCache;
26
- const getLastFrameFromCache = (options) => {
27
- var _a;
28
- const key = makeLastFrameCacheKey(options);
29
- if (!options.downloadMap.lastFrameMap[key]) {
30
- return null;
31
- }
32
- options.downloadMap.lastFrameMap[key].lastAccessed = Date.now();
33
- return (_a = options.downloadMap.lastFrameMap[key].data) !== null && _a !== void 0 ? _a : null;
34
- };
35
- exports.getLastFrameFromCache = getLastFrameFromCache;
36
- const removedLastFrameFromCache = (key, downloadMap) => {
37
- if (!downloadMap.lastFrameMap[key]) {
38
- return;
39
- }
40
- bufferSize -= downloadMap.lastFrameMap[key].data.byteLength;
41
- delete downloadMap.lastFrameMap[key];
42
- };
43
- const ensureMaxSize = (downloadMap) => {
44
- // eslint-disable-next-line no-unmodified-loop-condition
45
- while (bufferSize > MAX_CACHE_SIZE) {
46
- const earliest = Object.entries(downloadMap.lastFrameMap).sort((a, b) => {
47
- return a[1].lastAccessed - b[1].lastAccessed;
48
- })[0];
49
- removedLastFrameFromCache(earliest[0], downloadMap);
50
- }
51
- };
52
- const clearLastFileCache = (downloadMap) => {
53
- downloadMap.lastFrameMap = {};
54
- };
55
- exports.clearLastFileCache = clearLastFileCache;
@@ -1,9 +0,0 @@
1
- export declare type ServeUrlOrWebpackBundle = {
2
- serveUrl: string;
3
- } | {
4
- /**
5
- * @deprecated Renamed to `serveUrl`
6
- */
7
- webpackBundle: string;
8
- };
9
- export declare const getServeUrlWithFallback: (serve: ServeUrlOrWebpackBundle) => string;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getServeUrlWithFallback = void 0;
4
- const getServeUrlWithFallback = (serve) => {
5
- if ('webpackBundle' in serve) {
6
- return serve.webpackBundle;
7
- }
8
- if ('serveUrl' in serve) {
9
- return serve.serveUrl;
10
- }
11
- throw new Error('You must pass the `serveUrl` parameter');
12
- };
13
- exports.getServeUrlWithFallback = getServeUrlWithFallback;
package/dist/quality.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const validateQuality: (q: number | undefined) => void;
package/dist/quality.js DELETED
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateQuality = void 0;
4
- const validateQuality = (q) => {
5
- if (typeof q !== 'undefined' && typeof q !== 'number') {
6
- throw new Error(`Quality option must be a number or undefined. Got ${typeof q} (${JSON.stringify(q)})`);
7
- }
8
- if (typeof q === 'undefined') {
9
- return;
10
- }
11
- if (!Number.isFinite(q)) {
12
- throw new RangeError(`Quality must be a finite number, but is ${q}`);
13
- }
14
- if (Number.isNaN(q)) {
15
- throw new RangeError(`Quality is NaN, but must be a real number`);
16
- }
17
- if (q > 100 || q < 0) {
18
- throw new RangeError('Quality option must be between 0 and 100.');
19
- }
20
- };
21
- exports.validateQuality = validateQuality;
@@ -1,2 +0,0 @@
1
- export declare const binaryExists: (name: 'ffmpeg' | 'brew', localFFmpeg: string | null) => Promise<boolean>;
2
- export declare const validateFfmpeg: (customFfmpegBinary: string | null) => Promise<void>;
@@ -1,72 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.validateFfmpeg = exports.binaryExists = void 0;
7
- const execa_1 = __importDefault(require("execa"));
8
- const fs_1 = require("fs");
9
- const os_1 = __importDefault(require("os"));
10
- const existsMap = {};
11
- const binaryExists = async (name, localFFmpeg) => {
12
- if (typeof existsMap[name] !== 'undefined') {
13
- return existsMap[name];
14
- }
15
- if (name === 'ffmpeg' && localFFmpeg) {
16
- try {
17
- (0, fs_1.statSync)(localFFmpeg);
18
- existsMap[name] = true;
19
- }
20
- catch (err) {
21
- existsMap[name] = false;
22
- }
23
- return existsMap[name];
24
- }
25
- const isWin = os_1.default.platform() === 'win32';
26
- const where = isWin ? 'where' : 'which';
27
- try {
28
- await (0, execa_1.default)(where, [name]);
29
- existsMap[name] = true;
30
- return true;
31
- }
32
- catch (err) {
33
- existsMap[name] = false;
34
- return false;
35
- }
36
- };
37
- exports.binaryExists = binaryExists;
38
- const isHomebrewInstalled = () => {
39
- return (0, exports.binaryExists)('brew', null);
40
- };
41
- const validateFfmpeg = async (customFfmpegBinary) => {
42
- const ffmpegExists = await (0, exports.binaryExists)('ffmpeg', customFfmpegBinary);
43
- if (!ffmpegExists) {
44
- if (customFfmpegBinary) {
45
- console.error('FFmpeg executable not found:');
46
- console.error(customFfmpegBinary);
47
- process.exit(1);
48
- }
49
- console.error('It looks like FFMPEG is not installed');
50
- if (os_1.default.platform() === 'darwin' && (await isHomebrewInstalled())) {
51
- console.error('Run `brew install ffmpeg` to install ffmpeg');
52
- }
53
- else if (os_1.default.platform() === 'win32') {
54
- console.error('1. Install FFMPEG for Windows here:');
55
- console.error('https://github.com/adaptlearning/adapt_authoring/wiki/Installing-FFmpeg#installing-ffmpeg-in-windows');
56
- console.error('2. Add FFMPEG to your PATH');
57
- console.error(' a. Go to the settings app.');
58
- console.error(' b. Click System.');
59
- console.error(' c. Click About.');
60
- console.error(' d. Click Advanced system settings.');
61
- console.error(' e. Click Environment variables.');
62
- console.error(' f. Search for PATH environemnt variable, click edit and the folder where you installed FFMPEG.');
63
- console.error(' g. Important: Restart your terminal completely to apply the new PATH.');
64
- console.error('3. Re-run this command.');
65
- }
66
- else {
67
- console.error('See https://github.com/adaptlearning/adapt_authoring/wiki/Installing-FFmpeg on how to install FFMPEG.');
68
- }
69
- process.exit(1);
70
- }
71
- };
72
- exports.validateFfmpeg = validateFfmpeg;
@@ -1 +0,0 @@
1
- export declare const validateFrame: (frame: number, durationInFrames: number) => void;