@remotion/renderer 3.1.5 → 3.1.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 (347) hide show
  1. package/dist/assets/convert-assets-to-file-urls.d.ts +3 -2
  2. package/dist/assets/convert-assets-to-file-urls.js +2 -2
  3. package/dist/assets/download-and-map-assets-to-file.d.ts +6 -5
  4. package/dist/assets/download-and-map-assets-to-file.js +47 -48
  5. package/dist/assets/download-map.d.ts +64 -0
  6. package/dist/assets/download-map.js +73 -0
  7. package/dist/assets/get-audio-channels.d.ts +3 -7
  8. package/dist/assets/get-audio-channels.js +6 -7
  9. package/dist/assets/get-video-stream-duration.d.ts +3 -0
  10. package/dist/assets/get-video-stream-duration.js +35 -0
  11. package/dist/browser/TimeoutSettings.d.ts +1 -0
  12. package/dist/browser/TimeoutSettings.js +4 -4
  13. package/dist/browser-executable.d.ts +1 -0
  14. package/dist/{assets/cleanup-assets.js → browser-executable.js} +0 -0
  15. package/dist/browser.d.ts +2 -0
  16. package/dist/browser.js +4 -0
  17. package/dist/can-use-parallel-encoding.d.ts +1 -1
  18. package/dist/can-use-parallel-encoding.js +2 -2
  19. package/dist/codec-supports-media.d.ts +1 -1
  20. package/dist/codec.d.ts +4 -0
  21. package/dist/codec.js +16 -0
  22. package/dist/combine-videos.d.ts +1 -1
  23. package/dist/combine-videos.js +7 -6
  24. package/dist/compress-assets.d.ts +7 -0
  25. package/dist/compress-assets.js +25 -0
  26. package/dist/convert-to-pcm.d.ts +1 -1
  27. package/dist/create-ffmpeg-complex-filter.d.ts +6 -2
  28. package/dist/create-ffmpeg-complex-filter.js +2 -11
  29. package/dist/create-ffmpeg-merge-filter.js +3 -3
  30. package/dist/create-silent-audio.d.ts +1 -1
  31. package/dist/crf.d.ts +5 -0
  32. package/dist/crf.js +64 -0
  33. package/dist/ensure-presentation-timestamp.d.ts +2 -1
  34. package/dist/ensure-presentation-timestamp.js +9 -7
  35. package/dist/extract-frame-from-video.d.ts +4 -2
  36. package/dist/extract-frame-from-video.js +22 -17
  37. package/dist/ffmpeg-executable.d.ts +1 -0
  38. package/dist/ffmpeg-executable.js +2 -0
  39. package/dist/ffmpeg-filter-file.d.ts +2 -1
  40. package/dist/ffmpeg-filter-file.js +4 -6
  41. package/dist/frame-range.d.ts +2 -0
  42. package/dist/frame-range.js +49 -0
  43. package/dist/get-audio-codec-name.d.ts +1 -1
  44. package/dist/get-audio-codec-name.js +2 -2
  45. package/dist/get-browser-instance.d.ts +1 -1
  46. package/dist/get-browser-instance.js +2 -2
  47. package/dist/get-codec-name.d.ts +1 -1
  48. package/dist/get-codec-name.js +2 -2
  49. package/dist/get-compositions.d.ts +8 -1
  50. package/dist/get-compositions.js +10 -6
  51. package/dist/get-extension-from-codec.d.ts +2 -2
  52. package/dist/get-extension-of-filename.d.ts +1 -1
  53. package/dist/get-extension-of-filename.js +3 -0
  54. package/dist/get-frame-to-render.d.ts +1 -1
  55. package/dist/get-local-browser-executable.d.ts +2 -1
  56. package/dist/get-prores-profile-name.d.ts +2 -1
  57. package/dist/get-video-info.d.ts +3 -8
  58. package/dist/get-video-info.js +7 -8
  59. package/dist/guess-extension-for-media.d.ts +1 -1
  60. package/dist/image-format.d.ts +6 -1
  61. package/dist/image-format.js +25 -1
  62. package/dist/index.d.ts +49 -10
  63. package/dist/index.js +71 -1
  64. package/dist/is-audio-codec.d.ts +2 -0
  65. package/dist/is-audio-codec.js +7 -0
  66. package/dist/is-beyond-last-frame.d.ts +3 -2
  67. package/dist/is-beyond-last-frame.js +5 -5
  68. package/dist/last-frame-from-video-cache.d.ts +5 -4
  69. package/dist/last-frame-from-video-cache.js +17 -17
  70. package/dist/log-level.d.ts +4 -0
  71. package/dist/log-level.js +15 -0
  72. package/dist/merge-audio-track.d.ts +3 -1
  73. package/dist/merge-audio-track.js +6 -4
  74. package/dist/offthread-video-server.d.ts +5 -3
  75. package/dist/offthread-video-server.js +3 -2
  76. package/dist/open-browser.d.ts +1 -1
  77. package/dist/open-browser.js +4 -4
  78. package/dist/overwrite.d.ts +1 -0
  79. package/dist/overwrite.js +4 -0
  80. package/dist/perf.d.ts +5 -0
  81. package/dist/perf.js +35 -0
  82. package/dist/pixel-format.d.ts +5 -0
  83. package/dist/pixel-format.js +26 -0
  84. package/dist/prepare-server.d.ts +4 -3
  85. package/dist/prepare-server.js +3 -3
  86. package/dist/preprocess-audio-track.d.ts +3 -1
  87. package/dist/preprocess-audio-track.js +3 -3
  88. package/dist/prespawn-ffmpeg.d.ts +5 -1
  89. package/dist/prespawn-ffmpeg.js +9 -6
  90. package/dist/prores-profile.d.ts +5 -0
  91. package/dist/prores-profile.js +23 -0
  92. package/dist/provide-screenshot.d.ts +1 -1
  93. package/dist/quality.d.ts +1 -0
  94. package/dist/quality.js +21 -0
  95. package/dist/render-frames.d.ts +10 -1
  96. package/dist/render-frames.js +22 -16
  97. package/dist/render-media.d.ts +13 -2
  98. package/dist/render-media.js +24 -13
  99. package/dist/render-still.d.ts +9 -1
  100. package/dist/render-still.js +21 -11
  101. package/dist/screenshot-dom-element.d.ts +1 -1
  102. package/dist/screenshot-task.d.ts +1 -1
  103. package/dist/screenshot-task.js +7 -7
  104. package/dist/serve-static.d.ts +3 -2
  105. package/dist/serve-static.js +3 -4
  106. package/dist/set-props-and-env.js +2 -2
  107. package/dist/stitch-frames-to-video.d.ts +6 -1
  108. package/dist/stitch-frames-to-video.js +30 -43
  109. package/dist/stringify-ffmpeg-filter.js +2 -2
  110. package/dist/symbolicate-stacktrace.js +3 -3
  111. package/dist/truthy.d.ts +3 -0
  112. package/dist/truthy.js +7 -0
  113. package/dist/types.d.ts +1 -1
  114. package/dist/validate-even-dimensions-with-codec.d.ts +1 -1
  115. package/dist/validate-even-dimensions-with-codec.js +2 -2
  116. package/dist/validate-every-nth-frame.d.ts +1 -0
  117. package/dist/validate-every-nth-frame.js +21 -0
  118. package/dist/validate-ffmpeg.js +2 -3
  119. package/dist/validate-frame.d.ts +1 -0
  120. package/dist/validate-frame.js +24 -0
  121. package/dist/validate-opengl-renderer.d.ts +5 -0
  122. package/dist/validate-opengl-renderer.js +15 -0
  123. package/dist/validate-output-filename.d.ts +1 -1
  124. package/package.json +3 -3
  125. package/dist/assets/calculate-asset-positions.d.ts.map +0 -1
  126. package/dist/assets/calculate-asset-positions.js.map +0 -1
  127. package/dist/assets/calculate-atempo.d.ts.map +0 -1
  128. package/dist/assets/calculate-atempo.js.map +0 -1
  129. package/dist/assets/cleanup-assets.d.ts +0 -2
  130. package/dist/assets/convert-assets-to-file-urls.d.ts.map +0 -1
  131. package/dist/assets/convert-assets-to-file-urls.js.map +0 -1
  132. package/dist/assets/download-and-map-assets-to-file.d.ts.map +0 -1
  133. package/dist/assets/download-and-map-assets-to-file.js.map +0 -1
  134. package/dist/assets/download-file.d.ts.map +0 -1
  135. package/dist/assets/download-file.js.map +0 -1
  136. package/dist/assets/ffmpeg-volume-expression.d.ts.map +0 -1
  137. package/dist/assets/ffmpeg-volume-expression.js.map +0 -1
  138. package/dist/assets/flatten-volume-array.d.ts.map +0 -1
  139. package/dist/assets/flatten-volume-array.js.map +0 -1
  140. package/dist/assets/get-audio-channels.d.ts.map +0 -1
  141. package/dist/assets/get-audio-channels.js.map +0 -1
  142. package/dist/assets/read-file.d.ts.map +0 -1
  143. package/dist/assets/read-file.js.map +0 -1
  144. package/dist/assets/round-volume-to-avoid-stack-overflow.d.ts.map +0 -1
  145. package/dist/assets/round-volume-to-avoid-stack-overflow.js.map +0 -1
  146. package/dist/assets/sanitize-filename.d.ts.map +0 -1
  147. package/dist/assets/sanitize-filename.js.map +0 -1
  148. package/dist/assets/sanitize-filepath.d.ts.map +0 -1
  149. package/dist/assets/sanitize-filepath.js.map +0 -1
  150. package/dist/assets/truncate-utf8-bytes.d.ts.map +0 -1
  151. package/dist/assets/truncate-utf8-bytes.js.map +0 -1
  152. package/dist/assets/types.d.ts.map +0 -1
  153. package/dist/assets/types.js.map +0 -1
  154. package/dist/browser/Accessibility.d.ts +0 -175
  155. package/dist/browser/Accessibility.js +0 -423
  156. package/dist/browser/AriaQueryHandler.d.ts +0 -20
  157. package/dist/browser/AriaQueryHandler.js +0 -108
  158. package/dist/browser/ConnectionTransport.d.ts +0 -21
  159. package/dist/browser/ConnectionTransport.js +0 -17
  160. package/dist/browser/Coverage.d.ts +0 -180
  161. package/dist/browser/Coverage.js +0 -371
  162. package/dist/browser/Debug.d.ts +0 -19
  163. package/dist/browser/Debug.js +0 -42
  164. package/dist/browser/DeviceDescriptors.d.ts +0 -40
  165. package/dist/browser/DeviceDescriptors.js +0 -1407
  166. package/dist/browser/EmulationManager.d.ts +0 -7
  167. package/dist/browser/EmulationManager.js +0 -40
  168. package/dist/browser/FileChooser.d.ts +0 -56
  169. package/dist/browser/FileChooser.js +0 -86
  170. package/dist/browser/Input.d.ts +0 -355
  171. package/dist/browser/Input.js +0 -592
  172. package/dist/browser/NetworkConditions.d.ts +0 -26
  173. package/dist/browser/NetworkConditions.js +0 -33
  174. package/dist/browser/PDFOptions.d.ts +0 -165
  175. package/dist/browser/PDFOptions.js +0 -34
  176. package/dist/browser/PipeTransport.d.ts +0 -10
  177. package/dist/browser/PipeTransport.js +0 -86
  178. package/dist/browser/Puppeteer.d.ts +0 -35
  179. package/dist/browser/Puppeteer.js +0 -17
  180. package/dist/browser/QueryHandler.d.ts +0 -64
  181. package/dist/browser/QueryHandler.js +0 -183
  182. package/dist/browser/SecurityDetails.d.ts +0 -55
  183. package/dist/browser/SecurityDetails.js +0 -95
  184. package/dist/browser/Tracing.d.ts +0 -45
  185. package/dist/browser/Tracing.js +0 -136
  186. package/dist/browser/USKeyboardLayout.d.ts +0 -39
  187. package/dist/browser/USKeyboardLayout.js +0 -406
  188. package/dist/browser/WebWorker.d.ts +0 -96
  189. package/dist/browser/WebWorker.js +0 -122
  190. package/dist/browser/compat.d.ts +0 -2
  191. package/dist/browser/compat.js +0 -17
  192. package/dist/browser/dialog.d.ts +0 -70
  193. package/dist/browser/dialog.js +0 -114
  194. package/dist/browser/environment.d.ts +0 -16
  195. package/dist/browser/environment.js +0 -19
  196. package/dist/browser/fetch.d.ts +0 -16
  197. package/dist/browser/fetch.js +0 -46
  198. package/dist/browser/find-up.d.ts +0 -4
  199. package/dist/browser/find-up.js +0 -85
  200. package/dist/browser/page.d.ts +0 -74
  201. package/dist/browser/page.js +0 -283
  202. package/dist/browser/pkg-dir.d.ts +0 -3
  203. package/dist/browser/pkg-dir.js +0 -13
  204. package/dist/browser-log.d.ts.map +0 -1
  205. package/dist/browser-log.js.map +0 -1
  206. package/dist/calculate-ffmpeg-filters.d.ts.map +0 -1
  207. package/dist/calculate-ffmpeg-filters.js.map +0 -1
  208. package/dist/can-use-parallel-encoding.d.ts.map +0 -1
  209. package/dist/can-use-parallel-encoding.js.map +0 -1
  210. package/dist/chunk.d.ts.map +0 -1
  211. package/dist/chunk.js.map +0 -1
  212. package/dist/combine-videos.d.ts.map +0 -1
  213. package/dist/combine-videos.js.map +0 -1
  214. package/dist/convert-to-pcm.d.ts.map +0 -1
  215. package/dist/convert-to-pcm.js.map +0 -1
  216. package/dist/create-ffmpeg-complex-filter.d.ts.map +0 -1
  217. package/dist/create-ffmpeg-complex-filter.js.map +0 -1
  218. package/dist/create-ffmpeg-merge-filter.d.ts.map +0 -1
  219. package/dist/create-ffmpeg-merge-filter.js.map +0 -1
  220. package/dist/create-silent-audio.d.ts.map +0 -1
  221. package/dist/create-silent-audio.js.map +0 -1
  222. package/dist/cycle-browser-tabs.d.ts.map +0 -1
  223. package/dist/cycle-browser-tabs.js.map +0 -1
  224. package/dist/delay-render-embedded-stack.d.ts.map +0 -1
  225. package/dist/delay-render-embedded-stack.js.map +0 -1
  226. package/dist/delete-directory.d.ts.map +0 -1
  227. package/dist/delete-directory.js.map +0 -1
  228. package/dist/ensure-frames-in-order.d.ts.map +0 -1
  229. package/dist/ensure-frames-in-order.js.map +0 -1
  230. package/dist/ensure-output-directory.d.ts.map +0 -1
  231. package/dist/ensure-output-directory.js.map +0 -1
  232. package/dist/error-handling/handle-javascript-exception.d.ts.map +0 -1
  233. package/dist/error-handling/handle-javascript-exception.js.map +0 -1
  234. package/dist/error-handling/symbolicate-error.d.ts.map +0 -1
  235. package/dist/error-handling/symbolicate-error.js.map +0 -1
  236. package/dist/error-handling/symbolicateable-error.d.ts.map +0 -1
  237. package/dist/error-handling/symbolicateable-error.js.map +0 -1
  238. package/dist/ffmpeg-filter-file.d.ts.map +0 -1
  239. package/dist/ffmpeg-filter-file.js.map +0 -1
  240. package/dist/ffmpeg-flags.d.ts.map +0 -1
  241. package/dist/ffmpeg-flags.js.map +0 -1
  242. package/dist/get-audio-codec-name.d.ts.map +0 -1
  243. package/dist/get-audio-codec-name.js.map +0 -1
  244. package/dist/get-browser-instance.d.ts.map +0 -1
  245. package/dist/get-browser-instance.js.map +0 -1
  246. package/dist/get-codec-name.d.ts.map +0 -1
  247. package/dist/get-codec-name.js.map +0 -1
  248. package/dist/get-compositions.d.ts.map +0 -1
  249. package/dist/get-compositions.js.map +0 -1
  250. package/dist/get-concurrency.d.ts.map +0 -1
  251. package/dist/get-concurrency.js.map +0 -1
  252. package/dist/get-duration-from-frame-range.d.ts.map +0 -1
  253. package/dist/get-duration-from-frame-range.js.map +0 -1
  254. package/dist/get-duration-of-asset.d.ts +0 -7
  255. package/dist/get-duration-of-asset.js +0 -36
  256. package/dist/get-extension-from-codec.d.ts.map +0 -1
  257. package/dist/get-extension-from-codec.js.map +0 -1
  258. package/dist/get-format-for-codec.d.ts +0 -2
  259. package/dist/get-format-for-codec.js +0 -34
  260. package/dist/get-frame-to-render.d.ts.map +0 -1
  261. package/dist/get-frame-to-render.js.map +0 -1
  262. package/dist/get-local-browser-executable.d.ts.map +0 -1
  263. package/dist/get-local-browser-executable.js.map +0 -1
  264. package/dist/get-port.d.ts.map +0 -1
  265. package/dist/get-port.js.map +0 -1
  266. package/dist/get-prores-profile-name.d.ts.map +0 -1
  267. package/dist/get-prores-profile-name.js.map +0 -1
  268. package/dist/image-format.d.ts.map +0 -1
  269. package/dist/image-format.js.map +0 -1
  270. package/dist/index.d.ts.map +0 -1
  271. package/dist/index.js.map +0 -1
  272. package/dist/is-serve-url.d.ts.map +0 -1
  273. package/dist/is-serve-url.js.map +0 -1
  274. package/dist/is-vp9-video.d.ts +0 -3
  275. package/dist/is-vp9-video.js +0 -24
  276. package/dist/legacy-webpack-config.d.ts.map +0 -1
  277. package/dist/legacy-webpack-config.js.map +0 -1
  278. package/dist/make-assets-download-dir.d.ts.map +0 -1
  279. package/dist/make-assets-download-dir.js.map +0 -1
  280. package/dist/merge-audio-track.d.ts.map +0 -1
  281. package/dist/merge-audio-track.js.map +0 -1
  282. package/dist/normalize-serve-url.d.ts.map +0 -1
  283. package/dist/normalize-serve-url.js.map +0 -1
  284. package/dist/open-browser.d.ts.map +0 -1
  285. package/dist/open-browser.js.map +0 -1
  286. package/dist/p-limit.d.ts.map +0 -1
  287. package/dist/p-limit.js.map +0 -1
  288. package/dist/parse-browser-error-stack.d.ts.map +0 -1
  289. package/dist/parse-browser-error-stack.js.map +0 -1
  290. package/dist/parse-ffmpeg-progress.d.ts.map +0 -1
  291. package/dist/parse-ffmpeg-progress.js.map +0 -1
  292. package/dist/pool.d.ts.map +0 -1
  293. package/dist/pool.js.map +0 -1
  294. package/dist/prepare-server.d.ts.map +0 -1
  295. package/dist/prepare-server.js.map +0 -1
  296. package/dist/preprocess-audio-track.d.ts.map +0 -1
  297. package/dist/preprocess-audio-track.js.map +0 -1
  298. package/dist/prespawn-ffmpeg.d.ts.map +0 -1
  299. package/dist/prespawn-ffmpeg.js.map +0 -1
  300. package/dist/provide-screenshot.d.ts.map +0 -1
  301. package/dist/provide-screenshot.js.map +0 -1
  302. package/dist/puppeteer-evaluate.d.ts.map +0 -1
  303. package/dist/puppeteer-evaluate.js.map +0 -1
  304. package/dist/puppeteer-screenshot.d.ts.map +0 -1
  305. package/dist/puppeteer-screenshot.js.map +0 -1
  306. package/dist/render-frames.d.ts.map +0 -1
  307. package/dist/render-frames.js.map +0 -1
  308. package/dist/render-media.d.ts.map +0 -1
  309. package/dist/render-media.js.map +0 -1
  310. package/dist/render-still.d.ts.map +0 -1
  311. package/dist/render-still.js.map +0 -1
  312. package/dist/resolve-asset-src.d.ts.map +0 -1
  313. package/dist/resolve-asset-src.js.map +0 -1
  314. package/dist/sample-rate.d.ts.map +0 -1
  315. package/dist/sample-rate.js.map +0 -1
  316. package/dist/screenshot-dom-element.d.ts.map +0 -1
  317. package/dist/screenshot-dom-element.js.map +0 -1
  318. package/dist/screenshot-task.d.ts.map +0 -1
  319. package/dist/screenshot-task.js.map +0 -1
  320. package/dist/seek-to-frame.d.ts.map +0 -1
  321. package/dist/seek-to-frame.js.map +0 -1
  322. package/dist/serve-handler/glob-slash.d.ts +0 -1
  323. package/dist/serve-handler/glob-slash.js +0 -12
  324. package/dist/serve-static.d.ts.map +0 -1
  325. package/dist/serve-static.js.map +0 -1
  326. package/dist/set-props-and-env.d.ts.map +0 -1
  327. package/dist/set-props-and-env.js.map +0 -1
  328. package/dist/stitch-frames-to-video.d.ts.map +0 -1
  329. package/dist/stitch-frames-to-video.js.map +0 -1
  330. package/dist/stringify-ffmpeg-filter.d.ts.map +0 -1
  331. package/dist/stringify-ffmpeg-filter.js.map +0 -1
  332. package/dist/symbolicate-stacktrace.d.ts.map +0 -1
  333. package/dist/symbolicate-stacktrace.js.map +0 -1
  334. package/dist/tmp-dir.d.ts.map +0 -1
  335. package/dist/tmp-dir.js.map +0 -1
  336. package/dist/types.d.ts.map +0 -1
  337. package/dist/types.js.map +0 -1
  338. package/dist/validate-even-dimensions-with-codec.d.ts.map +0 -1
  339. package/dist/validate-even-dimensions-with-codec.js.map +0 -1
  340. package/dist/validate-ffmpeg.d.ts.map +0 -1
  341. package/dist/validate-ffmpeg.js.map +0 -1
  342. package/dist/validate-fps-for-gif.d.ts +0 -2
  343. package/dist/validate-fps-for-gif.js +0 -9
  344. package/dist/validate-puppeteer-timeout.d.ts.map +0 -1
  345. package/dist/validate-puppeteer-timeout.js.map +0 -1
  346. package/dist/validate-scale.d.ts.map +0 -1
  347. package/dist/validate-scale.js.map +0 -1
@@ -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,23 @@
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 markAllAssetsAsDownloaded: (downloadMap: DownloadMap) => void;
13
14
  export declare const getSanitizedFilenameForAssetUrl: ({ src, downloadDir, contentDisposition, }: {
14
15
  src: string;
15
16
  downloadDir: string;
16
17
  contentDisposition: string | null;
17
18
  }) => string;
18
- export declare const downloadAndMapAssetsToFileUrl: ({ asset, downloadDir, onDownload, }: {
19
+ export declare const downloadAndMapAssetsToFileUrl: ({ asset, onDownload, downloadMap, }: {
19
20
  asset: TAsset;
20
- downloadDir: string;
21
21
  onDownload: RenderMediaOnDownload;
22
+ downloadMap: DownloadMap;
22
23
  }) => Promise<TAsset>;
@@ -7,26 +7,24 @@ exports.downloadAndMapAssetsToFileUrl = exports.getSanitizedFilenameForAssetUrl
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const remotion_1 = require("remotion");
10
+ const compress_assets_1 = require("../compress-assets");
10
11
  const ensure_output_directory_1 = require("../ensure-output-directory");
11
12
  const download_file_1 = require("./download-file");
12
13
  const sanitize_filepath_1 = require("./sanitize-filepath");
13
- const isDownloadingMap = {};
14
- const hasBeenDownloadedMap = {};
15
- const listeners = {};
16
- const waitForAssetToBeDownloaded = ({ src, downloadDir, }) => {
14
+ const waitForAssetToBeDownloaded = ({ src, downloadDir, downloadMap, }) => {
17
15
  var _a, _b;
18
- if ((_a = hasBeenDownloadedMap[src]) === null || _a === void 0 ? void 0 : _a[downloadDir]) {
19
- return Promise.resolve((_b = hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir]);
16
+ if ((_a = downloadMap.hasBeenDownloadedMap[src]) === null || _a === void 0 ? void 0 : _a[downloadDir]) {
17
+ return Promise.resolve((_b = downloadMap.hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir]);
20
18
  }
21
- if (!listeners[src]) {
22
- listeners[src] = {};
19
+ if (!downloadMap.listeners[src]) {
20
+ downloadMap.listeners[src] = {};
23
21
  }
24
- if (!listeners[src][downloadDir]) {
25
- listeners[src][downloadDir] = [];
22
+ if (!downloadMap.listeners[src][downloadDir]) {
23
+ downloadMap.listeners[src][downloadDir] = [];
26
24
  }
27
25
  return new Promise((resolve) => {
28
- listeners[src][downloadDir].push(() => {
29
- const srcMap = hasBeenDownloadedMap[src];
26
+ downloadMap.listeners[src][downloadDir].push(() => {
27
+ const srcMap = downloadMap.hasBeenDownloadedMap[src];
30
28
  if (!srcMap || !srcMap[downloadDir]) {
31
29
  throw new Error('Expected file for ' + src + 'to be available in ' + downloadDir);
32
30
  }
@@ -34,22 +32,22 @@ const waitForAssetToBeDownloaded = ({ src, downloadDir, }) => {
34
32
  });
35
33
  });
36
34
  };
37
- const notifyAssetIsDownloaded = ({ src, downloadDir, to, }) => {
38
- if (!listeners[src]) {
39
- listeners[src] = {};
35
+ const notifyAssetIsDownloaded = ({ src, downloadDir, to, downloadMap, }) => {
36
+ if (!downloadMap.listeners[src]) {
37
+ downloadMap.listeners[src] = {};
40
38
  }
41
- if (!listeners[src][downloadDir]) {
42
- listeners[src][downloadDir] = [];
39
+ if (!downloadMap.listeners[src][downloadDir]) {
40
+ downloadMap.listeners[src][downloadDir] = [];
43
41
  }
44
- if (!isDownloadingMap[src]) {
45
- isDownloadingMap[src] = {};
42
+ if (!downloadMap.isDownloadingMap[src]) {
43
+ downloadMap.isDownloadingMap[src] = {};
46
44
  }
47
- isDownloadingMap[src][downloadDir] = true;
48
- if (!hasBeenDownloadedMap[src]) {
49
- hasBeenDownloadedMap[src] = {};
45
+ downloadMap.isDownloadingMap[src][downloadDir] = false;
46
+ if (!downloadMap.hasBeenDownloadedMap[src]) {
47
+ downloadMap.hasBeenDownloadedMap[src] = {};
50
48
  }
51
- hasBeenDownloadedMap[src][downloadDir] = to;
52
- listeners[src][downloadDir].forEach((fn) => fn());
49
+ downloadMap.hasBeenDownloadedMap[src][downloadDir] = to;
50
+ downloadMap.listeners[src][downloadDir].forEach((fn) => fn());
53
51
  };
54
52
  const validateMimeType = (mimeType, src) => {
55
53
  if (!mimeType.includes('/')) {
@@ -90,32 +88,33 @@ function validateBufferEncoding(potentialEncoding, dataUrl) {
90
88
  throw new TypeError(errMessage);
91
89
  }
92
90
  }
93
- const downloadAsset = async ({ src, onDownload, downloadDir, }) => {
91
+ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
94
92
  var _a, _b, _c;
95
- if (remotion_1.Internals.AssetCompression.isAssetCompressed(src)) {
93
+ if ((0, compress_assets_1.isAssetCompressed)(src)) {
96
94
  return src;
97
95
  }
98
- if ((_a = hasBeenDownloadedMap[src]) === null || _a === void 0 ? void 0 : _a[downloadDir]) {
99
- const claimedDownloadLocation = (_b = hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir];
96
+ const { downloadDir } = downloadMap;
97
+ if ((_a = downloadMap.hasBeenDownloadedMap[src]) === null || _a === void 0 ? void 0 : _a[downloadDir]) {
98
+ const claimedDownloadLocation = (_b = downloadMap.hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir];
100
99
  // 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
101
- if (!fs_1.default.existsSync(claimedDownloadLocation)) {
100
+ if (fs_1.default.existsSync(claimedDownloadLocation)) {
102
101
  return claimedDownloadLocation;
103
102
  }
104
103
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
105
- hasBeenDownloadedMap[src][downloadDir] = null;
106
- if (!isDownloadingMap[src]) {
107
- isDownloadingMap[src] = {};
104
+ downloadMap.hasBeenDownloadedMap[src][downloadDir] = null;
105
+ if (!downloadMap.isDownloadingMap[src]) {
106
+ downloadMap.isDownloadingMap[src] = {};
108
107
  }
109
108
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
110
- isDownloadingMap[src][downloadDir] = false;
109
+ downloadMap.isDownloadingMap[src][downloadDir] = false;
111
110
  }
112
- if ((_c = isDownloadingMap[src]) === null || _c === void 0 ? void 0 : _c[downloadDir]) {
113
- return waitForAssetToBeDownloaded({ src, downloadDir });
111
+ if ((_c = downloadMap.isDownloadingMap[src]) === null || _c === void 0 ? void 0 : _c[downloadDir]) {
112
+ return waitForAssetToBeDownloaded({ downloadMap, src, downloadDir });
114
113
  }
115
- if (!isDownloadingMap[src]) {
116
- isDownloadingMap[src] = {};
114
+ if (!downloadMap.isDownloadingMap[src]) {
115
+ downloadMap.isDownloadingMap[src] = {};
117
116
  }
118
- isDownloadingMap[src][downloadDir] = true;
117
+ downloadMap.isDownloadingMap[src][downloadDir] = true;
119
118
  const onProgress = onDownload(src);
120
119
  if (src.startsWith('data:')) {
121
120
  const output = (0, exports.getSanitizedFilenameForAssetUrl)({
@@ -139,7 +138,7 @@ const downloadAsset = async ({ src, onDownload, downloadDir, }) => {
139
138
  validateBufferEncoding(encoding, src);
140
139
  const buff = Buffer.from(assetData, encoding);
141
140
  await fs_1.default.promises.writeFile(output, buff);
142
- notifyAssetIsDownloaded({ src, downloadDir, to: output });
141
+ notifyAssetIsDownloaded({ src, downloadMap, downloadDir, to: output });
143
142
  return output;
144
143
  }
145
144
  const { to } = await (0, download_file_1.downloadFile)({
@@ -149,16 +148,16 @@ const downloadAsset = async ({ src, onDownload, downloadDir, }) => {
149
148
  },
150
149
  to: (contentDisposition) => (0, exports.getSanitizedFilenameForAssetUrl)({ contentDisposition, downloadDir, src }),
151
150
  });
152
- notifyAssetIsDownloaded({ src, downloadDir, to });
151
+ notifyAssetIsDownloaded({ src, downloadMap, downloadDir, to });
153
152
  return to;
154
153
  };
155
154
  exports.downloadAsset = downloadAsset;
156
- const markAllAssetsAsDownloaded = () => {
157
- Object.keys(hasBeenDownloadedMap).forEach((key) => {
158
- delete hasBeenDownloadedMap[key];
155
+ const markAllAssetsAsDownloaded = (downloadMap) => {
156
+ Object.keys(downloadMap.hasBeenDownloadedMap).forEach((key) => {
157
+ delete downloadMap.hasBeenDownloadedMap[key];
159
158
  });
160
- Object.keys(isDownloadingMap).forEach((key) => {
161
- delete isDownloadingMap[key];
159
+ Object.keys(downloadMap.isDownloadingMap).forEach((key) => {
160
+ delete downloadMap.isDownloadingMap[key];
162
161
  });
163
162
  };
164
163
  exports.markAllAssetsAsDownloaded = markAllAssetsAsDownloaded;
@@ -180,7 +179,7 @@ const getFilename = ({ contentDisposition, src, }) => {
180
179
  return { pathname, search };
181
180
  };
182
181
  const getSanitizedFilenameForAssetUrl = ({ src, downloadDir, contentDisposition, }) => {
183
- if (remotion_1.Internals.AssetCompression.isAssetCompressed(src)) {
182
+ if ((0, compress_assets_1.isAssetCompressed)(src)) {
184
183
  return src;
185
184
  }
186
185
  const { pathname, search } = getFilename({ contentDisposition, src });
@@ -193,11 +192,11 @@ const getSanitizedFilenameForAssetUrl = ({ src, downloadDir, contentDisposition,
193
192
  return path_1.default.join(downloadDir, (0, sanitize_filepath_1.sanitizeFilePath)(filename));
194
193
  };
195
194
  exports.getSanitizedFilenameForAssetUrl = getSanitizedFilenameForAssetUrl;
196
- const downloadAndMapAssetsToFileUrl = async ({ asset, downloadDir, onDownload, }) => {
195
+ const downloadAndMapAssetsToFileUrl = async ({ asset, onDownload, downloadMap, }) => {
197
196
  const newSrc = await (0, exports.downloadAsset)({
198
197
  src: asset.src,
199
- downloadDir,
200
198
  onDownload,
199
+ downloadMap,
201
200
  });
202
201
  return {
203
202
  ...asset,
@@ -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;
@@ -1,7 +1,3 @@
1
- import type { FfmpegExecutable } from 'remotion';
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 {};
1
+ import type { FfmpegExecutable } from '../ffmpeg-executable';
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;
@@ -0,0 +1,3 @@
1
+ import type { FfmpegExecutable } from '../ffmpeg-executable';
2
+ import type { DownloadMap, VideoDurationResult } from './download-map';
3
+ export declare const getVideoStreamDuration: (downloadMap: DownloadMap, src: string, ffprobeExecutable: FfmpegExecutable) => Promise<VideoDurationResult>;
@@ -0,0 +1,35 @@
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.getVideoStreamDuration = void 0;
7
+ const execa_1 = __importDefault(require("execa"));
8
+ const p_limit_1 = require("../p-limit");
9
+ const limit = (0, p_limit_1.pLimit)(1);
10
+ async function getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable) {
11
+ if (downloadMap.videoDurationResultCache[src]) {
12
+ return downloadMap.videoDurationResultCache[src];
13
+ }
14
+ const args = [
15
+ ['-v', 'error'],
16
+ ['-select_streams', 'v:0'],
17
+ ['-show_entries', 'stream=duration,r_frame_rate'],
18
+ [src],
19
+ ]
20
+ .reduce((acc, val) => acc.concat(val), [])
21
+ .filter(Boolean);
22
+ const task = await (0, execa_1.default)(ffprobeExecutable !== null && ffprobeExecutable !== void 0 ? ffprobeExecutable : 'ffprobe', args);
23
+ const duration = task.stdout.match(/duration=([0-9.]+)/);
24
+ const fps = task.stdout.match(/r_frame_rate=([0-9.]+)\/([0-9.]+)/);
25
+ const result = {
26
+ duration: duration ? parseFloat(duration[1]) : null,
27
+ fps: fps ? parseInt(fps[1], 10) / parseInt(fps[2], 10) : null,
28
+ };
29
+ downloadMap.videoDurationResultCache[src] = result;
30
+ return result;
31
+ }
32
+ const getVideoStreamDuration = (downloadMap, src, ffprobeExecutable) => {
33
+ return limit(() => getVideoStreamDurationUnlimited(downloadMap, src, ffprobeExecutable));
34
+ };
35
+ exports.getVideoStreamDuration = getVideoStreamDuration;
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ export declare const DEFAULT_TIMEOUT = 30000;
16
17
  export declare class TimeoutSettings {
17
18
  #private;
18
19
  constructor();
@@ -27,8 +27,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
27
27
  };
28
28
  var _TimeoutSettings_defaultTimeout, _TimeoutSettings_defaultNavigationTimeout;
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.TimeoutSettings = void 0;
31
- const DEFAULT_TIMEOUT = 30000;
30
+ exports.TimeoutSettings = exports.DEFAULT_TIMEOUT = void 0;
31
+ exports.DEFAULT_TIMEOUT = 30000;
32
32
  class TimeoutSettings {
33
33
  constructor() {
34
34
  _TimeoutSettings_defaultTimeout.set(this, void 0);
@@ -49,13 +49,13 @@ class TimeoutSettings {
49
49
  if (__classPrivateFieldGet(this, _TimeoutSettings_defaultTimeout, "f") !== null) {
50
50
  return __classPrivateFieldGet(this, _TimeoutSettings_defaultTimeout, "f");
51
51
  }
52
- return DEFAULT_TIMEOUT;
52
+ return exports.DEFAULT_TIMEOUT;
53
53
  }
54
54
  timeout() {
55
55
  if (__classPrivateFieldGet(this, _TimeoutSettings_defaultTimeout, "f") !== null) {
56
56
  return __classPrivateFieldGet(this, _TimeoutSettings_defaultTimeout, "f");
57
57
  }
58
- return DEFAULT_TIMEOUT;
58
+ return exports.DEFAULT_TIMEOUT;
59
59
  }
60
60
  }
61
61
  exports.TimeoutSettings = TimeoutSettings;
@@ -0,0 +1 @@
1
+ export declare type BrowserExecutable = string | null;
@@ -0,0 +1,2 @@
1
+ export declare type Browser = 'chrome' | 'firefox';
2
+ export declare const DEFAULT_BROWSER: Browser;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_BROWSER = void 0;
4
+ exports.DEFAULT_BROWSER = 'chrome';
@@ -1,2 +1,2 @@
1
- import type { Codec } from 'remotion';
1
+ import type { Codec } from './codec';
2
2
  export declare const canUseParallelEncoding: (codec: Codec) => boolean;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.canUseParallelEncoding = void 0;
4
- const remotion_1 = require("remotion");
4
+ const is_audio_codec_1 = require("./is-audio-codec");
5
5
  const canUseParallelEncoding = (codec) => {
6
- if (remotion_1.Internals.isAudioCodec(codec)) {
6
+ if ((0, is_audio_codec_1.isAudioCodec)(codec)) {
7
7
  return false;
8
8
  }
9
9
  return codec === 'h264' || codec === 'h264-mkv' || codec === 'h265';
@@ -1,4 +1,4 @@
1
- import type { Codec } from 'remotion';
1
+ import type { Codec } from './codec';
2
2
  declare type MediaSupport = {
3
3
  video: boolean;
4
4
  audio: boolean;
@@ -0,0 +1,4 @@
1
+ export declare const validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
2
+ export declare type Codec = typeof validCodecs[number];
3
+ export declare type CodecOrUndefined = Codec | undefined;
4
+ export declare const DEFAULT_CODEC: Codec;
package/dist/codec.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_CODEC = exports.validCodecs = void 0;
4
+ exports.validCodecs = [
5
+ 'h264',
6
+ 'h265',
7
+ 'vp8',
8
+ 'vp9',
9
+ 'mp3',
10
+ 'aac',
11
+ 'wav',
12
+ 'prores',
13
+ 'h264-mkv',
14
+ 'gif',
15
+ ];
16
+ exports.DEFAULT_CODEC = 'h264';
@@ -1,4 +1,4 @@
1
- import type { Codec } from 'remotion';
1
+ import type { Codec } from './codec';
2
2
  export declare const combineVideos: ({ files, filelistDir, output, onProgress, numberOfFrames, codec, fps, numberOfGifLoops, }: {
3
3
  files: string[];
4
4
  filelistDir: string;
@@ -8,9 +8,10 @@ exports.combineVideos = void 0;
8
8
  const execa_1 = __importDefault(require("execa"));
9
9
  const fs_1 = require("fs");
10
10
  const path_1 = require("path");
11
- const remotion_1 = require("remotion");
12
11
  const get_audio_codec_name_1 = require("./get-audio-codec-name");
12
+ const is_audio_codec_1 = require("./is-audio-codec");
13
13
  const parse_ffmpeg_progress_1 = require("./parse-ffmpeg-progress");
14
+ const truthy_1 = require("./truthy");
14
15
  const combineVideos = async ({ files, filelistDir, output, onProgress, numberOfFrames, codec, fps, numberOfGifLoops, }) => {
15
16
  var _a;
16
17
  const fileList = files.map((p) => `file '${p}'`).join('\n');
@@ -18,8 +19,8 @@ const combineVideos = async ({ files, filelistDir, output, onProgress, numberOfF
18
19
  (0, fs_1.writeFileSync)(fileListTxt, fileList);
19
20
  try {
20
21
  const task = (0, execa_1.default)('ffmpeg', [
21
- remotion_1.Internals.isAudioCodec(codec) ? null : '-r',
22
- remotion_1.Internals.isAudioCodec(codec) ? null : String(fps),
22
+ (0, is_audio_codec_1.isAudioCodec)(codec) ? null : '-r',
23
+ (0, is_audio_codec_1.isAudioCodec)(codec) ? null : String(fps),
23
24
  '-f',
24
25
  'concat',
25
26
  '-safe',
@@ -32,8 +33,8 @@ const combineVideos = async ({ files, filelistDir, output, onProgress, numberOfF
32
33
  : typeof numberOfGifLoops === 'number'
33
34
  ? String(numberOfGifLoops)
34
35
  : '-1',
35
- remotion_1.Internals.isAudioCodec(codec) ? null : '-c:v',
36
- remotion_1.Internals.isAudioCodec(codec) ? null : codec === 'gif' ? 'gif' : 'copy',
36
+ (0, is_audio_codec_1.isAudioCodec)(codec) ? null : '-c:v',
37
+ (0, is_audio_codec_1.isAudioCodec)(codec) ? null : codec === 'gif' ? 'gif' : 'copy',
37
38
  '-c:a',
38
39
  (0, get_audio_codec_name_1.getAudioCodecName)(codec),
39
40
  // Set max bitrate up to 1024kbps, will choose lower if that's too much
@@ -44,7 +45,7 @@ const combineVideos = async ({ files, filelistDir, output, onProgress, numberOfF
44
45
  '-shortest',
45
46
  '-y',
46
47
  output,
47
- ].filter(remotion_1.Internals.truthy));
48
+ ].filter(truthy_1.truthy));
48
49
  (_a = task.stderr) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
49
50
  if (onProgress) {
50
51
  const parsed = (0, parse_ffmpeg_progress_1.parseFfmpegProgress)(data.toString());
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Since audio or video can be base64-encoded, those can be really long strings.
3
+ * Since we track the `src` property for every frame, Node.JS can run out of memory easily. Instead of duplicating the src for every frame, we save memory by replacing the full base 64 encoded data with a string `same-as-[asset-id]-[frame]` referencing a previous asset with the same src.
4
+ */
5
+ import type { TAsset } from 'remotion';
6
+ export declare const compressAsset: (previousAssets: TAsset[], newAsset: TAsset) => TAsset;
7
+ export declare const isAssetCompressed: (src: string) => boolean;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /**
3
+ * Since audio or video can be base64-encoded, those can be really long strings.
4
+ * Since we track the `src` property for every frame, Node.JS can run out of memory easily. Instead of duplicating the src for every frame, we save memory by replacing the full base 64 encoded data with a string `same-as-[asset-id]-[frame]` referencing a previous asset with the same src.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.isAssetCompressed = exports.compressAsset = void 0;
8
+ const compressAsset = (previousAssets, newAsset) => {
9
+ if (newAsset.src.length < 400) {
10
+ return newAsset;
11
+ }
12
+ const assetWithSameSrc = previousAssets.find((a) => a.src === newAsset.src);
13
+ if (!assetWithSameSrc) {
14
+ return newAsset;
15
+ }
16
+ return {
17
+ ...newAsset,
18
+ src: `same-as-${assetWithSameSrc.id}-${assetWithSameSrc.frame}`,
19
+ };
20
+ };
21
+ exports.compressAsset = compressAsset;
22
+ const isAssetCompressed = (src) => {
23
+ return src.startsWith('same-as');
24
+ };
25
+ exports.isAssetCompressed = isAssetCompressed;
@@ -1,4 +1,4 @@
1
- import type { FfmpegExecutable } from 'remotion';
1
+ import type { FfmpegExecutable } from './ffmpeg-executable';
2
2
  export declare const convertToPcm: ({ ffmpegExecutable, input, outName, }: {
3
3
  ffmpegExecutable: FfmpegExecutable;
4
4
  input: string;