@remotion/renderer 4.0.0-reorg.8 → 4.0.0-retry.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/LICENSE.md +8 -8
  2. package/dist/assets/calculate-asset-positions.d.ts +0 -0
  3. package/dist/assets/calculate-asset-positions.js +0 -0
  4. package/dist/assets/calculate-atempo.d.ts +0 -0
  5. package/dist/assets/calculate-atempo.js +0 -0
  6. package/dist/assets/convert-assets-to-file-urls.d.ts +3 -2
  7. package/dist/assets/convert-assets-to-file-urls.js +2 -2
  8. package/dist/assets/download-and-map-assets-to-file.d.ts +8 -6
  9. package/dist/assets/download-and-map-assets-to-file.js +91 -50
  10. package/dist/assets/download-file.d.ts +1 -1
  11. package/dist/assets/download-file.js +4 -2
  12. package/dist/assets/download-map.d.ts +64 -0
  13. package/dist/assets/download-map.js +73 -0
  14. package/dist/assets/ffmpeg-volume-expression.d.ts +0 -0
  15. package/dist/assets/ffmpeg-volume-expression.js +0 -0
  16. package/dist/assets/flatten-volume-array.d.ts +0 -0
  17. package/dist/assets/flatten-volume-array.js +0 -0
  18. package/dist/assets/get-audio-channels.d.ts +2 -6
  19. package/dist/assets/get-audio-channels.js +6 -7
  20. package/dist/assets/get-video-stream-duration.d.ts +3 -5
  21. package/dist/assets/get-video-stream-duration.js +39 -14
  22. package/dist/assets/read-file.d.ts +0 -0
  23. package/dist/assets/read-file.js +0 -0
  24. package/dist/assets/round-volume-to-avoid-stack-overflow.d.ts +0 -0
  25. package/dist/assets/round-volume-to-avoid-stack-overflow.js +0 -0
  26. package/dist/assets/sanitize-filename.d.ts +0 -0
  27. package/dist/assets/sanitize-filename.js +0 -0
  28. package/dist/assets/sanitize-filepath.d.ts +0 -0
  29. package/dist/assets/sanitize-filepath.js +0 -0
  30. package/dist/assets/truncate-utf8-bytes.d.ts +0 -0
  31. package/dist/assets/truncate-utf8-bytes.js +0 -0
  32. package/dist/assets/types.d.ts +0 -0
  33. package/dist/assets/types.js +0 -0
  34. package/dist/browser/Browser.d.ts +1 -0
  35. package/dist/browser/Browser.js +9 -10
  36. package/dist/browser/BrowserConnector.d.ts +0 -0
  37. package/dist/browser/BrowserConnector.js +0 -0
  38. package/dist/browser/BrowserFetcher.d.ts +0 -0
  39. package/dist/browser/BrowserFetcher.js +12 -10
  40. package/dist/browser/BrowserPage.d.ts +0 -0
  41. package/dist/browser/BrowserPage.js +0 -0
  42. package/dist/browser/BrowserRunner.d.ts +1 -4
  43. package/dist/browser/BrowserRunner.js +28 -71
  44. package/dist/browser/Connection.d.ts +0 -0
  45. package/dist/browser/Connection.js +1 -1
  46. package/dist/browser/ConsoleMessage.d.ts +0 -0
  47. package/dist/browser/ConsoleMessage.js +0 -0
  48. package/dist/browser/DOMWorld.d.ts +0 -0
  49. package/dist/browser/DOMWorld.js +0 -0
  50. package/dist/browser/Errors.d.ts +0 -0
  51. package/dist/browser/Errors.js +0 -0
  52. package/dist/browser/EvalTypes.d.ts +0 -0
  53. package/dist/browser/EvalTypes.js +0 -0
  54. package/dist/browser/EventEmitter.d.ts +0 -0
  55. package/dist/browser/EventEmitter.js +0 -0
  56. package/dist/browser/ExecutionContext.d.ts +0 -0
  57. package/dist/browser/ExecutionContext.js +0 -0
  58. package/dist/browser/FrameManager.d.ts +0 -0
  59. package/dist/browser/FrameManager.js +0 -0
  60. package/dist/browser/HTTPRequest.d.ts +0 -0
  61. package/dist/browser/HTTPRequest.js +0 -0
  62. package/dist/browser/HTTPResponse.d.ts +0 -0
  63. package/dist/browser/HTTPResponse.js +0 -0
  64. package/dist/browser/JSHandle.d.ts +0 -0
  65. package/dist/browser/JSHandle.js +0 -0
  66. package/dist/browser/LaunchOptions.d.ts +0 -4
  67. package/dist/browser/LaunchOptions.js +0 -0
  68. package/dist/browser/Launcher.d.ts +1 -1
  69. package/dist/browser/Launcher.js +5 -363
  70. package/dist/browser/LifecycleWatcher.d.ts +0 -0
  71. package/dist/browser/LifecycleWatcher.js +0 -0
  72. package/dist/browser/NetworkEventManager.d.ts +0 -0
  73. package/dist/browser/NetworkEventManager.js +0 -0
  74. package/dist/browser/NetworkManager.d.ts +0 -0
  75. package/dist/browser/NetworkManager.js +0 -0
  76. package/dist/browser/NodeWebSocketTransport.d.ts +0 -0
  77. package/dist/browser/NodeWebSocketTransport.js +1 -1
  78. package/dist/browser/Product.d.ts +0 -0
  79. package/dist/browser/Product.js +0 -0
  80. package/dist/browser/PuppeteerNode.d.ts +0 -0
  81. package/dist/browser/PuppeteerNode.js +1 -4
  82. package/dist/browser/PuppeteerViewport.d.ts +0 -0
  83. package/dist/browser/PuppeteerViewport.js +0 -0
  84. package/dist/browser/ScreenshotOptions.d.ts +0 -0
  85. package/dist/browser/ScreenshotOptions.js +0 -0
  86. package/dist/browser/Target.d.ts +0 -0
  87. package/dist/browser/Target.js +0 -0
  88. package/dist/browser/TaskQueue.d.ts +0 -0
  89. package/dist/browser/TaskQueue.js +0 -0
  90. package/dist/browser/TimeoutSettings.d.ts +0 -0
  91. package/dist/browser/TimeoutSettings.js +0 -0
  92. package/dist/browser/assert.d.ts +0 -0
  93. package/dist/browser/assert.js +0 -0
  94. package/dist/browser/create-browser-fetcher.d.ts +0 -0
  95. package/dist/browser/create-browser-fetcher.js +2 -44
  96. package/dist/browser/devtools-commands.d.ts +0 -0
  97. package/dist/browser/devtools-commands.js +0 -0
  98. package/dist/browser/devtools-types.d.ts +0 -0
  99. package/dist/browser/devtools-types.js +0 -0
  100. package/dist/browser/get-download-destination.d.ts +0 -0
  101. package/dist/browser/get-download-destination.js +0 -0
  102. package/dist/browser/mitt/index.d.ts +0 -0
  103. package/dist/browser/mitt/index.js +0 -0
  104. package/dist/browser/node.d.ts +0 -0
  105. package/dist/browser/node.js +0 -0
  106. package/dist/browser/revisions.d.ts +0 -1
  107. package/dist/browser/revisions.js +0 -1
  108. package/dist/browser/util.d.ts +0 -0
  109. package/dist/browser/util.js +0 -0
  110. package/dist/browser-executable.d.ts +0 -0
  111. package/dist/browser-executable.js +0 -0
  112. package/dist/browser-log.d.ts +0 -0
  113. package/dist/browser-log.js +0 -0
  114. package/dist/browser.d.ts +0 -0
  115. package/dist/browser.js +0 -0
  116. package/dist/calculate-ffmpeg-filters.d.ts +0 -0
  117. package/dist/calculate-ffmpeg-filters.js +0 -0
  118. package/dist/calculate-sar-dar-pixels.d.ts +0 -0
  119. package/dist/calculate-sar-dar-pixels.js +0 -0
  120. package/dist/can-use-parallel-encoding.d.ts +0 -0
  121. package/dist/can-use-parallel-encoding.js +0 -0
  122. package/dist/check-apple-silicon.d.ts +1 -0
  123. package/dist/check-apple-silicon.js +55 -0
  124. package/dist/chunk.d.ts +0 -0
  125. package/dist/chunk.js +0 -0
  126. package/dist/codec-supports-media.d.ts +1 -0
  127. package/dist/codec-supports-media.js +8 -1
  128. package/dist/codec.d.ts +0 -0
  129. package/dist/codec.js +0 -0
  130. package/dist/combine-videos.d.ts +0 -0
  131. package/dist/combine-videos.js +1 -1
  132. package/dist/compress-assets.d.ts +0 -0
  133. package/dist/compress-assets.js +0 -0
  134. package/dist/convert-number-of-gif-loops-to-ffmpeg.d.ts +0 -0
  135. package/dist/convert-number-of-gif-loops-to-ffmpeg.js +0 -0
  136. package/dist/convert-to-pcm.d.ts +0 -0
  137. package/dist/convert-to-pcm.js +0 -0
  138. package/dist/convert-to-positive-frame-index.d.ts +4 -0
  139. package/dist/convert-to-positive-frame-index.js +8 -0
  140. package/dist/create-ffmpeg-complex-filter.d.ts +2 -1
  141. package/dist/create-ffmpeg-complex-filter.js +2 -11
  142. package/dist/create-ffmpeg-merge-filter.d.ts +0 -0
  143. package/dist/create-ffmpeg-merge-filter.js +0 -0
  144. package/dist/create-silent-audio.d.ts +0 -0
  145. package/dist/create-silent-audio.js +0 -0
  146. package/dist/crf.d.ts +5 -1
  147. package/dist/crf.js +33 -6
  148. package/dist/cycle-browser-tabs.d.ts +0 -0
  149. package/dist/cycle-browser-tabs.js +0 -0
  150. package/dist/delay-render-embedded-stack.d.ts +0 -0
  151. package/dist/delay-render-embedded-stack.js +0 -0
  152. package/dist/delete-directory.d.ts +0 -0
  153. package/dist/delete-directory.js +0 -0
  154. package/dist/ensure-frames-in-order.d.ts +0 -0
  155. package/dist/ensure-frames-in-order.js +0 -0
  156. package/dist/ensure-output-directory.d.ts +0 -0
  157. package/dist/ensure-output-directory.js +0 -0
  158. package/dist/ensure-presentation-timestamp.d.ts +2 -1
  159. package/dist/ensure-presentation-timestamp.js +7 -5
  160. package/dist/error-handling/handle-javascript-exception.d.ts +0 -0
  161. package/dist/error-handling/handle-javascript-exception.js +0 -0
  162. package/dist/error-handling/symbolicate-error.d.ts +0 -0
  163. package/dist/error-handling/symbolicate-error.js +0 -0
  164. package/dist/error-handling/symbolicateable-error.d.ts +0 -0
  165. package/dist/error-handling/symbolicateable-error.js +0 -0
  166. package/dist/extract-frame-from-video.d.ts +2 -0
  167. package/dist/extract-frame-from-video.js +42 -15
  168. package/dist/ffmpeg-executable.d.ts +0 -0
  169. package/dist/ffmpeg-executable.js +0 -0
  170. package/dist/ffmpeg-filter-file.d.ts +2 -1
  171. package/dist/ffmpeg-filter-file.js +4 -6
  172. package/dist/ffmpeg-flags.d.ts +5 -2
  173. package/dist/ffmpeg-flags.js +37 -7
  174. package/dist/ffmpeg-override.d.ts +4 -0
  175. package/dist/ffmpeg-override.js +2 -0
  176. package/dist/frame-range.d.ts +0 -0
  177. package/dist/frame-range.js +0 -0
  178. package/dist/frame-to-ffmpeg-timestamp.d.ts +0 -0
  179. package/dist/frame-to-ffmpeg-timestamp.js +0 -0
  180. package/dist/get-audio-codec-name.d.ts +0 -0
  181. package/dist/get-audio-codec-name.js +0 -0
  182. package/dist/get-browser-instance.d.ts +0 -0
  183. package/dist/get-browser-instance.js +0 -0
  184. package/dist/get-codec-name.d.ts +0 -0
  185. package/dist/get-codec-name.js +0 -0
  186. package/dist/get-compositions.d.ts +5 -0
  187. package/dist/get-compositions.js +14 -6
  188. package/dist/get-concurrency.d.ts +0 -0
  189. package/dist/get-concurrency.js +0 -0
  190. package/dist/get-duration-from-frame-range.d.ts +0 -0
  191. package/dist/get-duration-from-frame-range.js +0 -0
  192. package/dist/get-extension-from-codec.d.ts +1 -1
  193. package/dist/get-extension-from-codec.js +0 -0
  194. package/dist/get-extension-of-filename.d.ts +0 -0
  195. package/dist/get-extension-of-filename.js +0 -0
  196. package/dist/get-frame-padded-index.d.ts +0 -0
  197. package/dist/get-frame-padded-index.js +0 -0
  198. package/dist/get-frame-to-render.d.ts +0 -0
  199. package/dist/get-frame-to-render.js +0 -0
  200. package/dist/get-local-browser-executable.d.ts +0 -0
  201. package/dist/get-local-browser-executable.js +1 -3
  202. package/dist/get-port.d.ts +0 -0
  203. package/dist/get-port.js +0 -0
  204. package/dist/get-prores-profile-name.d.ts +0 -0
  205. package/dist/get-prores-profile-name.js +0 -0
  206. package/dist/get-video-info.d.ts +2 -7
  207. package/dist/get-video-info.js +7 -8
  208. package/dist/get-video-threads-flag.d.ts +1 -0
  209. package/dist/get-video-threads-flag.js +18 -0
  210. package/dist/guess-extension-for-media.d.ts +1 -1
  211. package/dist/guess-extension-for-media.js +1 -1
  212. package/dist/image-format.d.ts +1 -1
  213. package/dist/image-format.js +3 -0
  214. package/dist/index.d.ts +19 -28
  215. package/dist/index.js +16 -24
  216. package/dist/is-audio-codec.d.ts +0 -0
  217. package/dist/is-audio-codec.js +0 -0
  218. package/dist/is-beyond-last-frame.d.ts +3 -2
  219. package/dist/is-beyond-last-frame.js +5 -5
  220. package/dist/is-serve-url.d.ts +0 -0
  221. package/dist/is-serve-url.js +0 -0
  222. package/dist/last-frame-from-video-cache.d.ts +3 -2
  223. package/dist/last-frame-from-video-cache.js +17 -17
  224. package/dist/legacy-webpack-config.d.ts +0 -0
  225. package/dist/legacy-webpack-config.js +0 -0
  226. package/dist/log-level.d.ts +0 -0
  227. package/dist/log-level.js +0 -0
  228. package/dist/make-cancel-signal.d.ts +0 -0
  229. package/dist/make-cancel-signal.js +0 -0
  230. package/dist/merge-audio-track.d.ts +2 -0
  231. package/dist/merge-audio-track.js +6 -3
  232. package/dist/mime-db.d.ts +0 -0
  233. package/dist/mime-db.js +0 -0
  234. package/dist/mime-types.d.ts +1 -0
  235. package/dist/mime-types.js +6 -1
  236. package/dist/normalize-serve-url.d.ts +0 -0
  237. package/dist/normalize-serve-url.js +0 -0
  238. package/dist/offthread-video-server.d.ts +3 -2
  239. package/dist/offthread-video-server.js +14 -2
  240. package/dist/open-browser.d.ts +0 -0
  241. package/dist/open-browser.js +3 -12
  242. package/dist/overwrite.d.ts +0 -0
  243. package/dist/overwrite.js +0 -0
  244. package/dist/p-limit.d.ts +0 -0
  245. package/dist/p-limit.js +0 -0
  246. package/dist/parse-browser-error-stack.d.ts +0 -0
  247. package/dist/parse-browser-error-stack.js +0 -0
  248. package/dist/parse-ffmpeg-progress.d.ts +0 -0
  249. package/dist/parse-ffmpeg-progress.js +0 -0
  250. package/dist/perf.d.ts +0 -0
  251. package/dist/perf.js +0 -0
  252. package/dist/pixel-format.d.ts +1 -1
  253. package/dist/pixel-format.js +3 -0
  254. package/dist/pool.d.ts +0 -0
  255. package/dist/pool.js +0 -0
  256. package/dist/prepare-server.d.ts +3 -2
  257. package/dist/prepare-server.js +3 -3
  258. package/dist/preprocess-audio-track.d.ts +2 -0
  259. package/dist/preprocess-audio-track.js +3 -3
  260. package/dist/prespawn-ffmpeg.d.ts +3 -0
  261. package/dist/prespawn-ffmpeg.js +15 -11
  262. package/dist/prestitcher-memory-usage.d.ts +12 -0
  263. package/dist/prestitcher-memory-usage.js +30 -0
  264. package/dist/prores-profile.d.ts +4 -1
  265. package/dist/prores-profile.js +6 -6
  266. package/dist/provide-screenshot.d.ts +0 -0
  267. package/dist/provide-screenshot.js +0 -0
  268. package/dist/puppeteer-evaluate.d.ts +0 -0
  269. package/dist/puppeteer-evaluate.js +0 -0
  270. package/dist/puppeteer-screenshot.d.ts +0 -0
  271. package/dist/puppeteer-screenshot.js +0 -0
  272. package/dist/quality.d.ts +0 -0
  273. package/dist/quality.js +0 -0
  274. package/dist/render-frames.d.ts +16 -3
  275. package/dist/render-frames.js +98 -30
  276. package/dist/render-media.d.ts +30 -4
  277. package/dist/render-media.js +123 -20
  278. package/dist/render-still.d.ts +6 -1
  279. package/dist/render-still.js +37 -11
  280. package/dist/resolve-asset-src.d.ts +0 -0
  281. package/dist/resolve-asset-src.js +0 -0
  282. package/dist/sample-rate.d.ts +0 -0
  283. package/dist/sample-rate.js +0 -0
  284. package/dist/screenshot-dom-element.d.ts +0 -0
  285. package/dist/screenshot-dom-element.js +0 -0
  286. package/dist/screenshot-task.d.ts +0 -0
  287. package/dist/screenshot-task.js +30 -15
  288. package/dist/seek-to-frame.d.ts +0 -0
  289. package/dist/seek-to-frame.js +0 -0
  290. package/dist/serve-handler/index.d.ts +0 -0
  291. package/dist/serve-handler/index.js +0 -0
  292. package/dist/serve-handler/is-path-inside.d.ts +0 -0
  293. package/dist/serve-handler/is-path-inside.js +0 -0
  294. package/dist/serve-handler/range-parser.d.ts +0 -0
  295. package/dist/serve-handler/range-parser.js +0 -0
  296. package/dist/serve-static.d.ts +2 -1
  297. package/dist/serve-static.js +14 -1
  298. package/dist/set-props-and-env.d.ts +3 -1
  299. package/dist/set-props-and-env.js +34 -8
  300. package/dist/stitch-frames-to-video.d.ts +7 -7
  301. package/dist/stitch-frames-to-video.js +68 -57
  302. package/dist/stringify-ffmpeg-filter.d.ts +0 -0
  303. package/dist/stringify-ffmpeg-filter.js +0 -0
  304. package/dist/symbolicate-stacktrace.d.ts +0 -0
  305. package/dist/symbolicate-stacktrace.js +0 -0
  306. package/dist/tmp-dir.d.ts +0 -0
  307. package/dist/tmp-dir.js +0 -0
  308. package/dist/truthy.d.ts +0 -0
  309. package/dist/truthy.js +0 -0
  310. package/dist/types.d.ts +1 -1
  311. package/dist/types.js +0 -0
  312. package/dist/validate-concurrency.d.ts +0 -0
  313. package/dist/validate-concurrency.js +0 -0
  314. package/dist/validate-even-dimensions-with-codec.d.ts +0 -0
  315. package/dist/validate-even-dimensions-with-codec.js +0 -0
  316. package/dist/validate-every-nth-frame.d.ts +2 -1
  317. package/dist/validate-every-nth-frame.js +8 -1
  318. package/dist/validate-ffmpeg-override.d.ts +2 -0
  319. package/dist/validate-ffmpeg-override.js +12 -0
  320. package/dist/validate-ffmpeg.d.ts +4 -1
  321. package/dist/validate-ffmpeg.js +23 -7
  322. package/dist/validate-frame.d.ts +0 -0
  323. package/dist/validate-frame.js +3 -3
  324. package/dist/validate-number-of-gif-loops.d.ts +2 -0
  325. package/dist/validate-number-of-gif-loops.js +24 -0
  326. package/dist/validate-opengl-renderer.d.ts +0 -0
  327. package/dist/validate-opengl-renderer.js +0 -0
  328. package/dist/validate-output-filename.d.ts +0 -0
  329. package/dist/validate-output-filename.js +0 -0
  330. package/dist/validate-puppeteer-timeout.d.ts +0 -0
  331. package/dist/validate-puppeteer-timeout.js +1 -1
  332. package/dist/validate-scale.d.ts +0 -0
  333. package/dist/validate-scale.js +0 -0
  334. package/dist/validate-videobitrate.d.ts +1 -0
  335. package/dist/validate-videobitrate.js +20 -0
  336. package/dist/wait-for-symbolication-error-to-be-done.d.ts +0 -0
  337. package/dist/wait-for-symbolication-error-to-be-done.js +0 -0
  338. package/dist/warn-about-ffmpeg-version.d.ts +5 -0
  339. package/dist/warn-about-ffmpeg-version.js +37 -0
  340. package/dist/ws/ws-types.d.ts +0 -0
  341. package/dist/ws/ws-types.js +0 -0
  342. package/package.json +7 -7
  343. package/dist/make-assets-download-dir.d.ts +0 -1
  344. package/dist/make-assets-download-dir.js +0 -13
  345. package/vitest.config.ts +0 -8
@@ -0,0 +1,55 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.checkNodeVersionAndWarnAboutRosetta = void 0;
27
+ const os = __importStar(require("os"));
28
+ const checkNodeVersionAndWarnAboutRosetta = () => {
29
+ // see https://github.com/nodejs/node/issues/41900#issuecomment-1113511254
30
+ const cpus = os.cpus();
31
+ const isAppleSilicon = cpus[0].model.includes('Apple');
32
+ const isArm64 = os.arch() === 'arm64';
33
+ const version = process.version.replace('v', '').split('.');
34
+ const majorVersion = Number(version[0]);
35
+ const requiredNodeVersion = 14;
36
+ if (majorVersion < 13) {
37
+ throw new Error(`Remotion requires at least Node ${requiredNodeVersion}. You currently have ${process.version}. Update your node version to ${requiredNodeVersion} to use Remotion.`);
38
+ }
39
+ if (isAppleSilicon && !isArm64) {
40
+ const recommendedNodeVersion = 16;
41
+ const recommendNodeUpgrade = majorVersion < recommendedNodeVersion;
42
+ console.warn([
43
+ `⚠️ Apple Silicon detected but Node.JS running under Rosetta. This will cause performance issues.\n`,
44
+ `Recommended actions:\n`,
45
+ recommendNodeUpgrade
46
+ ? ` - Upgrade to Node ${recommendedNodeVersion} or later\n`
47
+ : ' - Run Node using `arch -arm64` architecture\n',
48
+ 'See https://remotion.dev/docs/troubleshooting/rosetta for more information.',
49
+ '---',
50
+ ]
51
+ .filter(Boolean)
52
+ .join('\n'));
53
+ }
54
+ };
55
+ exports.checkNodeVersionAndWarnAboutRosetta = checkNodeVersionAndWarnAboutRosetta;
package/dist/chunk.d.ts CHANGED
File without changes
package/dist/chunk.js CHANGED
File without changes
@@ -4,4 +4,5 @@ declare type MediaSupport = {
4
4
  audio: boolean;
5
5
  };
6
6
  export declare const codecSupportsMedia: (codec: Codec) => MediaSupport;
7
+ export declare const codecSupportsCrf: (codec: Codec) => boolean | "" | null;
7
8
  export {};
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.codecSupportsMedia = void 0;
3
+ exports.codecSupportsCrf = exports.codecSupportsMedia = void 0;
4
+ const get_codec_name_1 = require("./get-codec-name");
4
5
  const support = {
5
6
  'h264-mkv': {
6
7
  audio: true,
@@ -47,3 +48,9 @@ const codecSupportsMedia = (codec) => {
47
48
  return support[codec];
48
49
  };
49
50
  exports.codecSupportsMedia = codecSupportsMedia;
51
+ const codecSupportsCrf = (codec) => {
52
+ const encoderName = (0, get_codec_name_1.getCodecName)(codec);
53
+ const supportsCrf = encoderName && codec !== 'prores';
54
+ return supportsCrf;
55
+ };
56
+ exports.codecSupportsCrf = codecSupportsCrf;
package/dist/codec.d.ts CHANGED
File without changes
package/dist/codec.js CHANGED
File without changes
File without changes
@@ -37,7 +37,7 @@ const combineVideos = async ({ files, filelistDir, output, onProgress, numberOfF
37
37
  (0, is_audio_codec_1.isAudioCodec)(codec) ? null : codec === 'gif' ? 'gif' : 'copy',
38
38
  '-c:a',
39
39
  (0, get_audio_codec_name_1.getAudioCodecName)(codec),
40
- // Set max bitrate up to 1024kbps, will choose lower if that's too much
40
+ // Set max bitrate up to 512kbps, will choose lower if that's too much
41
41
  '-b:a',
42
42
  '512K',
43
43
  codec === 'h264' ? '-movflags' : null,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,4 @@
1
+ export declare const convertToPositiveFrameIndex: ({ frame, durationInFrames, }: {
2
+ frame: number;
3
+ durationInFrames: number;
4
+ }) => number;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertToPositiveFrameIndex = void 0;
4
+ // Handle negative indices (e.g. -1 being the last frame)
5
+ const convertToPositiveFrameIndex = ({ frame, durationInFrames, }) => {
6
+ return frame < 0 ? durationInFrames - frame : frame;
7
+ };
8
+ exports.convertToPositiveFrameIndex = convertToPositiveFrameIndex;
@@ -1,4 +1,5 @@
1
- export declare const createFfmpegComplexFilter: (filters: number) => Promise<{
1
+ import type { DownloadMap } from './assets/download-map';
2
+ export declare const createFfmpegComplexFilter: (filters: number, downloadMap: DownloadMap) => Promise<{
2
3
  complexFilterFlag: [string, string] | null;
3
4
  cleanup: () => void;
4
5
  }>;
@@ -1,23 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.createFfmpegComplexFilter = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
4
  const create_ffmpeg_merge_filter_1 = require("./create-ffmpeg-merge-filter");
10
5
  const ffmpeg_filter_file_1 = require("./ffmpeg-filter-file");
11
- const tmp_dir_1 = require("./tmp-dir");
12
- const createFfmpegComplexFilter = async (filters) => {
6
+ const createFfmpegComplexFilter = async (filters, downloadMap) => {
13
7
  if (filters === 0) {
14
8
  return { complexFilterFlag: null, cleanup: () => undefined };
15
9
  }
16
10
  const complexFilter = (0, create_ffmpeg_merge_filter_1.createFfmpegMergeFilter)(filters);
17
- const { file, cleanup } = await (0, ffmpeg_filter_file_1.makeFfmpegFilterFile)(complexFilter);
18
- const tempPath = (0, tmp_dir_1.tmpDir)('remotion-complex-filter-script');
19
- const filterFile = path_1.default.join(tempPath, 'complex-filter.txt');
20
- await fs_1.default.promises.writeFile(filterFile, complexFilter);
11
+ const { file, cleanup } = await (0, ffmpeg_filter_file_1.makeFfmpegFilterFile)(complexFilter, downloadMap);
21
12
  return {
22
13
  complexFilterFlag: ['-filter_complex_script', file],
23
14
  cleanup,
File without changes
File without changes
File without changes
File without changes
package/dist/crf.d.ts CHANGED
@@ -2,4 +2,8 @@ import type { Codec } from './codec';
2
2
  export declare type Crf = number | undefined;
3
3
  export declare const getDefaultCrfForCodec: (codec: Codec) => number;
4
4
  export declare const getValidCrfRanges: (codec: Codec) => [number, number];
5
- export declare const validateSelectedCrfAndCodecCombination: (crf: unknown, codec: Codec) => void;
5
+ export declare const validateQualitySettings: ({ codec, crf, videoBitrate, }: {
6
+ crf: unknown;
7
+ codec: Codec;
8
+ videoBitrate: string | null | undefined;
9
+ }) => string[];
package/dist/crf.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateSelectedCrfAndCodecCombination = exports.getValidCrfRanges = exports.getDefaultCrfForCodec = void 0;
3
+ exports.validateQualitySettings = exports.getValidCrfRanges = exports.getDefaultCrfForCodec = void 0;
4
4
  const is_audio_codec_1 = require("./is-audio-codec");
5
5
  const getDefaultCrfForCodec = (codec) => {
6
6
  if ((0, is_audio_codec_1.isAudioCodec)(codec)) {
@@ -46,19 +46,46 @@ const getValidCrfRanges = (codec) => {
46
46
  throw new TypeError(`Got unexpected codec "${codec}"`);
47
47
  };
48
48
  exports.getValidCrfRanges = getValidCrfRanges;
49
- const validateSelectedCrfAndCodecCombination = (crf, codec) => {
50
- if (crf === null) {
51
- return;
49
+ const validateQualitySettings = ({ codec, crf, videoBitrate, }) => {
50
+ if (crf && videoBitrate) {
51
+ throw new Error('"crf" and "videoBitrate" can not both be set. Choose one of either.');
52
+ }
53
+ if (videoBitrate) {
54
+ if (codec === 'prores') {
55
+ console.warn('ProRes does not support videoBitrate. Ignoring.');
56
+ return [];
57
+ }
58
+ if ((0, is_audio_codec_1.isAudioCodec)(codec)) {
59
+ console.warn(`${codec} does not support videoBitrate. Ignoring.`);
60
+ return [];
61
+ }
62
+ return ['-b:v', videoBitrate];
63
+ }
64
+ if (crf === null || typeof crf === 'undefined') {
65
+ const actualCrf = (0, exports.getDefaultCrfForCodec)(codec);
66
+ return ['-crf', String(actualCrf)];
52
67
  }
53
68
  if (typeof crf !== 'number') {
54
69
  throw new TypeError('Expected CRF to be a number, but is ' + JSON.stringify(crf));
55
70
  }
56
71
  const range = (0, exports.getValidCrfRanges)(codec);
57
72
  if (crf === 0 && (codec === 'h264' || codec === 'h264-mkv')) {
58
- throw new TypeError("Setting the CRF to 0 with a H264 codec is not supported anymore because of it's inconsistencies between platforms. Videos with CRF 0 cannot be played on iOS/macOS. 0 is a extreme value with inefficient settings which you probably want. Set CRF to a higher value to fix this error.");
73
+ throw new TypeError("Setting the CRF to 0 with a H264 codec is not supported anymore because of it's inconsistencies between platforms. Videos with CRF 0 cannot be played on iOS/macOS. 0 is a extreme value with inefficient settings which you probably do not want. Set CRF to a higher value to fix this error.");
59
74
  }
60
75
  if (crf < range[0] || crf > range[1]) {
76
+ if (range[0] === 0 && range[1] === 0) {
77
+ throw new TypeError(`The "${codec}" codec does not support the --crf option.`);
78
+ }
61
79
  throw new TypeError(`CRF must be between ${range[0]} and ${range[1]} for codec ${codec}. Passed: ${crf}`);
62
80
  }
81
+ if (codec === 'prores') {
82
+ console.warn('ProRes does not support the "crf" option. Ignoring.');
83
+ return [];
84
+ }
85
+ if ((0, is_audio_codec_1.isAudioCodec)(codec)) {
86
+ console.warn(`${codec} does not support the "crf" option. Ignoring.`);
87
+ return [];
88
+ }
89
+ return ['-crf', String(crf)];
63
90
  };
64
- exports.validateSelectedCrfAndCodecCombination = validateSelectedCrfAndCodecCombination;
91
+ exports.validateQualitySettings = validateQualitySettings;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1 +1,2 @@
1
- export declare const ensurePresentationTimestamps: (src: string) => Promise<string>;
1
+ import type { DownloadMap } from './assets/download-map';
2
+ export declare const ensurePresentationTimestamps: (downloadMap: DownloadMap, src: string) => Promise<string>;
@@ -8,7 +8,6 @@ const execa_1 = __importDefault(require("execa"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const guess_extension_for_media_1 = require("./guess-extension-for-media");
10
10
  const truthy_1 = require("./truthy");
11
- const ensureFileHasPresentationTimestamp = {};
12
11
  let callbacks = [];
13
12
  const getTemporaryOutputName = async (src) => {
14
13
  const parts = src.split(path_1.default.sep);
@@ -26,8 +25,8 @@ const getTemporaryOutputName = async (src) => {
26
25
  })
27
26
  .join(path_1.default.sep);
28
27
  };
29
- const ensurePresentationTimestamps = async (src) => {
30
- const elem = ensureFileHasPresentationTimestamp[src];
28
+ const ensurePresentationTimestamps = async (downloadMap, src) => {
29
+ const elem = downloadMap.ensureFileHasPresentationTimestamp[src];
31
30
  if ((elem === null || elem === void 0 ? void 0 : elem.type) === 'encoding') {
32
31
  return new Promise((resolve) => {
33
32
  callbacks.push({
@@ -39,7 +38,7 @@ const ensurePresentationTimestamps = async (src) => {
39
38
  if ((elem === null || elem === void 0 ? void 0 : elem.type) === 'done') {
40
39
  return elem.src;
41
40
  }
42
- ensureFileHasPresentationTimestamp[src] = { type: 'encoding' };
41
+ downloadMap.ensureFileHasPresentationTimestamp[src] = { type: 'encoding' };
43
42
  // If there is no file extension for the video, then we need to tempoa
44
43
  const output = await getTemporaryOutputName(src);
45
44
  await (0, execa_1.default)('ffmpeg', [
@@ -61,7 +60,10 @@ const ensurePresentationTimestamps = async (src) => {
61
60
  }
62
61
  return true;
63
62
  });
64
- ensureFileHasPresentationTimestamp[src] = { type: 'done', src: output };
63
+ downloadMap.ensureFileHasPresentationTimestamp[src] = {
64
+ type: 'done',
65
+ src: output,
66
+ };
65
67
  return output;
66
68
  };
67
69
  exports.ensurePresentationTimestamps = ensurePresentationTimestamps;
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import type { OffthreadVideoImageFormat } from 'remotion';
3
+ import type { DownloadMap } from './assets/download-map';
3
4
  import type { FfmpegExecutable } from './ffmpeg-executable';
4
5
  import type { LastFrameOptions } from './last-frame-from-video-cache';
5
6
  export declare const getLastFrameOfVideo: (options: LastFrameOptions) => Promise<Buffer>;
@@ -9,6 +10,7 @@ declare type Options = {
9
10
  ffmpegExecutable: FfmpegExecutable;
10
11
  ffprobeExecutable: FfmpegExecutable;
11
12
  imageFormat: OffthreadVideoImageFormat;
13
+ downloadMap: DownloadMap;
12
14
  };
13
15
  export declare const extractFrameFromVideo: (options: Options) => Promise<Buffer>;
14
16
  export {};
@@ -32,9 +32,9 @@ const determineResizeParams = (needsResize) => {
32
32
  };
33
33
  // Uses no seeking, therefore the whole video has to be decoded. This is a last resort and should only happen
34
34
  // if the video is corrupted
35
- const getFrameOfVideoSlow = async ({ src, timestamp, ffmpegExecutable, imageFormat, specialVCodecForTransparency, needsResize, }) => {
36
- console.warn(`\nUsing a slow method to extract the frame at ${timestamp}ms of ${src}. See https://remotion.dev/docs/slow-method-to-extract-frame for advice`);
37
- const actualOffset = `-${timestamp * 1000}ms`;
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
38
  const command = [
39
39
  '-itsoffset',
40
40
  actualOffset,
@@ -72,32 +72,47 @@ const getFrameOfVideoSlow = async ({ src, timestamp, ffmpegExecutable, imageForm
72
72
  const [stdErr, stdoutBuffer] = await Promise.all([stdErrString, stdoutChunk]);
73
73
  const isEmpty = stdErr.includes('Output file is empty');
74
74
  if (isEmpty) {
75
- 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.`);
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
+ });
76
89
  }
77
90
  return stdoutBuffer;
78
91
  };
79
92
  const getLastFrameOfVideoFastUnlimited = async (options) => {
80
- const { ffmpegExecutable, ffprobeExecutable, offset, src } = options;
93
+ const { ffmpegExecutable, ffprobeExecutable, offset, src, downloadMap } = options;
81
94
  const fromCache = (0, last_frame_from_video_cache_1.getLastFrameFromCache)({ ...options, offset: 0 });
82
95
  if (fromCache) {
83
96
  return fromCache;
84
97
  }
85
- const { duration } = await (0, get_video_stream_duration_1.getVideoStreamDuration)(src, ffprobeExecutable);
98
+ const { duration, fps } = await (0, get_video_stream_duration_1.getVideoStreamDuration)(downloadMap, src, ffprobeExecutable);
86
99
  if (duration === null) {
87
100
  throw new Error(`Could not determine the duration of ${src} using FFMPEG. The file is not supported.`);
88
101
  }
89
102
  if (options.specialVCodecForTransparency === 'vp8' || offset > 40) {
90
103
  const last = await getFrameOfVideoSlow({
91
- timestamp: duration,
104
+ duration,
92
105
  ffmpegExecutable,
93
106
  src,
94
107
  imageFormat: options.imageFormat,
95
108
  specialVCodecForTransparency: options.specialVCodecForTransparency,
96
109
  needsResize: options.needsResize,
110
+ offset: offset - 1000 / (fps === null ? 10 : fps),
111
+ fps,
97
112
  });
98
113
  return last;
99
114
  }
100
- const actualOffset = `${duration * 1000 - offset - 10}ms`;
115
+ const actualOffset = `${duration * 1000 - offset}ms`;
101
116
  const { stdout, stderr } = (0, execa_1.default)(ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : 'ffmpeg', [
102
117
  '-ss',
103
118
  actualOffset,
@@ -142,12 +157,14 @@ const getLastFrameOfVideoFastUnlimited = async (options) => {
142
157
  if (isEmpty) {
143
158
  const unlimited = await getLastFrameOfVideoFastUnlimited({
144
159
  ffmpegExecutable,
145
- offset: offset + 10,
160
+ // Decrement in 10ms increments, or 1 frame (e.g. fps = 25 --> 40ms)
161
+ offset: offset + (fps === null ? 10 : 1000 / fps),
146
162
  src,
147
163
  ffprobeExecutable,
148
164
  imageFormat: options.imageFormat,
149
165
  specialVCodecForTransparency: options.specialVCodecForTransparency,
150
166
  needsResize: options.needsResize,
167
+ downloadMap: options.downloadMap,
151
168
  });
152
169
  return unlimited;
153
170
  }
@@ -159,22 +176,25 @@ const getLastFrameOfVideo = async (options) => {
159
176
  return result;
160
177
  };
161
178
  exports.getLastFrameOfVideo = getLastFrameOfVideo;
162
- const extractFrameFromVideoFn = async ({ time, ffmpegExecutable, ffprobeExecutable, imageFormat, ...options }) => {
179
+ const extractFrameFromVideoFn = async ({ time, ffmpegExecutable, ffprobeExecutable, imageFormat, downloadMap, ...options }) => {
163
180
  // We make a new copy of the video only for video because the conversion may affect
164
181
  // audio rendering, so we work with 2 different files
165
- const src = await (0, ensure_presentation_timestamp_1.ensurePresentationTimestamps)(options.src);
166
- const { specialVcodec, needsResize } = await (0, get_video_info_1.getVideoInfo)(src, ffprobeExecutable);
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);
167
184
  if (specialVcodec === 'vp8') {
185
+ const { fps } = await (0, get_video_stream_duration_1.getVideoStreamDuration)(downloadMap, src, ffprobeExecutable);
168
186
  return getFrameOfVideoSlow({
169
187
  ffmpegExecutable,
170
188
  imageFormat,
171
189
  specialVCodecForTransparency: specialVcodec,
172
190
  src,
173
- timestamp: time,
191
+ duration: time,
174
192
  needsResize,
193
+ offset: 0,
194
+ fps,
175
195
  });
176
196
  }
177
- if ((0, is_beyond_last_frame_1.isBeyondLastFrame)(src, time)) {
197
+ if ((0, is_beyond_last_frame_1.isBeyondLastFrame)(downloadMap, src, time)) {
178
198
  const lastFrame = await (0, exports.getLastFrameOfVideo)({
179
199
  ffmpegExecutable,
180
200
  ffprobeExecutable,
@@ -183,6 +203,7 @@ const extractFrameFromVideoFn = async ({ time, ffmpegExecutable, ffprobeExecutab
183
203
  imageFormat,
184
204
  specialVCodecForTransparency: specialVcodec,
185
205
  needsResize,
206
+ downloadMap,
186
207
  });
187
208
  return lastFrame;
188
209
  }
@@ -227,7 +248,7 @@ const extractFrameFromVideoFn = async ({ time, ffmpegExecutable, ffprobeExecutab
227
248
  stdoutBuffer,
228
249
  ]);
229
250
  if (stderrStr.includes('Output file is empty')) {
230
- (0, is_beyond_last_frame_1.markAsBeyondLastFrame)(src, time);
251
+ (0, is_beyond_last_frame_1.markAsBeyondLastFrame)(downloadMap, src, time);
231
252
  const last = await (0, exports.getLastFrameOfVideo)({
232
253
  ffmpegExecutable,
233
254
  ffprobeExecutable,
@@ -236,9 +257,15 @@ const extractFrameFromVideoFn = async ({ time, ffmpegExecutable, ffprobeExecutab
236
257
  imageFormat,
237
258
  specialVCodecForTransparency: specialVcodec,
238
259
  needsResize,
260
+ downloadMap,
239
261
  });
240
262
  return last;
241
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
+ }
242
269
  return stdOut;
243
270
  };
244
271
  const extractFrameFromVideo = async (options) => {
File without changes
File without changes
@@ -1,4 +1,5 @@
1
- export declare const makeFfmpegFilterFile: (complexFilter: string) => Promise<{
1
+ import type { DownloadMap } from './assets/download-map';
2
+ export declare const makeFfmpegFilterFile: (complexFilter: string, downloadMap: DownloadMap) => Promise<{
2
3
  file: string;
3
4
  cleanup: () => void;
4
5
  }>;
@@ -8,16 +8,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.makeFfmpegFilterFile = void 0;
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  const path_1 = __importDefault(require("path"));
11
- const delete_directory_1 = require("./delete-directory");
12
- const tmp_dir_1 = require("./tmp-dir");
13
- const makeFfmpegFilterFile = async (complexFilter) => {
14
- const tempPath = (0, tmp_dir_1.tmpDir)('remotion-complex-filter');
15
- const filterFile = path_1.default.join(tempPath, 'complex-filter.txt');
11
+ const makeFfmpegFilterFile = async (complexFilter, downloadMap) => {
12
+ const random = Math.random().toString().replace('.', '');
13
+ const filterFile = path_1.default.join(downloadMap.complexFilter, 'complex-filter-' + random + '.txt');
16
14
  await fs_1.default.promises.writeFile(filterFile, complexFilter);
17
15
  return {
18
16
  file: filterFile,
19
17
  cleanup: () => {
20
- (0, delete_directory_1.deleteDirectory)(filterFile);
18
+ fs_1.default.unlinkSync(filterFile);
21
19
  },
22
20
  };
23
21
  };
@@ -2,12 +2,15 @@ export declare type FfmpegVersion = [number, number, number] | null;
2
2
  export declare const getFfmpegBuildInfo: (options: {
3
3
  ffmpegExecutable: string | null;
4
4
  }) => Promise<string>;
5
- export declare const ffmpegHasFeature: ({ ffmpegExecutable, feature, isLambda, }: {
5
+ export declare const ffmpegHasFeature: ({ ffmpegExecutable, feature, }: {
6
6
  ffmpegExecutable: string | null;
7
7
  feature: 'enable-gpl' | 'enable-libx265' | 'enable-libvpx';
8
- isLambda: boolean;
9
8
  }) => Promise<boolean>;
10
9
  export declare const parseFfmpegVersion: (buildconf: string) => FfmpegVersion;
11
10
  export declare const getFfmpegVersion: (options: {
12
11
  ffmpegExecutable: string | null;
13
12
  }) => Promise<FfmpegVersion>;
13
+ export declare const warnAboutFfmpegVersion: ({ ffmpegVersion, buildConf, }: {
14
+ ffmpegVersion: FfmpegVersion;
15
+ buildConf: string | null;
16
+ }) => null | undefined;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getFfmpegVersion = exports.parseFfmpegVersion = exports.ffmpegHasFeature = exports.getFfmpegBuildInfo = void 0;
6
+ exports.warnAboutFfmpegVersion = exports.getFfmpegVersion = exports.parseFfmpegVersion = exports.ffmpegHasFeature = exports.getFfmpegBuildInfo = void 0;
7
7
  const execa_1 = __importDefault(require("execa"));
8
8
  const validate_ffmpeg_1 = require("./validate-ffmpeg");
9
9
  let buildConfig = null;
@@ -19,12 +19,8 @@ const getFfmpegBuildInfo = async (options) => {
19
19
  return buildConfig;
20
20
  };
21
21
  exports.getFfmpegBuildInfo = getFfmpegBuildInfo;
22
- const ffmpegHasFeature = async ({ ffmpegExecutable, feature, isLambda, }) => {
23
- if (isLambda) {
24
- // When rendering in the cloud, we don't need a local binary
25
- return true;
26
- }
27
- if (!(await (0, validate_ffmpeg_1.binaryExists)('ffmpeg', ffmpegExecutable))) {
22
+ const ffmpegHasFeature = async ({ ffmpegExecutable, feature, }) => {
23
+ if (!(0, validate_ffmpeg_1.binaryExists)('ffmpeg', ffmpegExecutable)) {
28
24
  return false;
29
25
  }
30
26
  const config = await (0, exports.getFfmpegBuildInfo)({ ffmpegExecutable });
@@ -47,3 +43,37 @@ const getFfmpegVersion = async (options) => {
47
43
  return (0, exports.parseFfmpegVersion)(buildInfo);
48
44
  };
49
45
  exports.getFfmpegVersion = getFfmpegVersion;
46
+ const printMessage = (ffmpegVersion) => {
47
+ console.warn('⚠️Old FFMPEG version detected: ' + ffmpegVersion.join('.'));
48
+ console.warn(' For audio support, you need at least version 4.1.0.');
49
+ console.warn(' Upgrade FFMPEG to get rid of this warning.');
50
+ };
51
+ const printBuildConfMessage = () => {
52
+ console.error('⚠️ Unsupported FFMPEG version detected.');
53
+ console.error(" Your version doesn't support the -buildconf flag");
54
+ console.error(' Audio will not be supported and you may experience other issues.');
55
+ console.error(' Upgrade FFMPEG to at least v4.1.0 to get rid of this warning.');
56
+ };
57
+ const warnAboutFfmpegVersion = ({ ffmpegVersion, buildConf, }) => {
58
+ if (buildConf === null) {
59
+ printBuildConfMessage();
60
+ return;
61
+ }
62
+ if (ffmpegVersion === null) {
63
+ return null;
64
+ }
65
+ const [major, minor] = ffmpegVersion;
66
+ // 3.x and below definitely is too old
67
+ if (major < 4) {
68
+ printMessage(ffmpegVersion);
69
+ return;
70
+ }
71
+ // 5.x will be all good
72
+ if (major > 4) {
73
+ return;
74
+ }
75
+ if (minor < 1) {
76
+ printMessage(ffmpegVersion);
77
+ }
78
+ };
79
+ exports.warnAboutFfmpegVersion = warnAboutFfmpegVersion;
@@ -0,0 +1,4 @@
1
+ export declare type FfmpegOverrideFn = (info: {
2
+ type: 'pre-stitcher' | 'stitcher';
3
+ args: string[];
4
+ }) => string[];
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
File without changes
File without changes
File without changes
File without changes
File without changes