@remotion/renderer 4.0.534 → 4.0.536

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 (236) hide show
  1. package/dist/browser/BrowserPage.js +9 -4
  2. package/dist/client.d.ts +303 -7
  3. package/dist/combine-chunks.d.ts +2 -1
  4. package/dist/combine-chunks.js +81 -52
  5. package/dist/combine-video-streams.js +3 -0
  6. package/dist/compositor/get-executable-path.js +30 -15
  7. package/dist/ensure-browser.d.ts +3 -0
  8. package/dist/esm/client.mjs +727 -541
  9. package/dist/esm/index.mjs +409 -359
  10. package/dist/esm/pure.mjs +3 -1
  11. package/dist/get-video-threads-flag.js +5 -1
  12. package/dist/index.d.ts +47 -1
  13. package/dist/mime-db.js +5 -0
  14. package/dist/mux-video-and-audio.js +3 -0
  15. package/dist/options/allow-html-in-canvas.d.ts +1 -0
  16. package/dist/options/allow-html-in-canvas.js +1 -0
  17. package/dist/options/api-key.d.ts +1 -0
  18. package/dist/options/api-key.js +1 -0
  19. package/dist/options/ask-ai.d.ts +1 -0
  20. package/dist/options/ask-ai.js +1 -0
  21. package/dist/options/audio-bitrate.d.ts +1 -0
  22. package/dist/options/audio-bitrate.js +1 -0
  23. package/dist/options/audio-codec.d.ts +1 -0
  24. package/dist/options/audio-codec.js +1 -0
  25. package/dist/options/beep-on-finish.d.ts +1 -0
  26. package/dist/options/beep-on-finish.js +1 -0
  27. package/dist/options/benchmark-concurrencies.d.ts +1 -0
  28. package/dist/options/benchmark-concurrencies.js +1 -0
  29. package/dist/options/binaries-directory.d.ts +1 -0
  30. package/dist/options/binaries-directory.js +1 -0
  31. package/dist/options/browser-executable.d.ts +1 -0
  32. package/dist/options/browser-executable.js +1 -0
  33. package/dist/options/browser.d.ts +1 -0
  34. package/dist/options/browser.js +1 -0
  35. package/dist/options/bundle-cache.d.ts +1 -0
  36. package/dist/options/bundle-cache.js +1 -0
  37. package/dist/options/canvas-tabs.d.ts +1 -0
  38. package/dist/options/canvas-tabs.js +1 -0
  39. package/dist/options/chrome-mode.d.ts +1 -0
  40. package/dist/options/chrome-mode.js +1 -0
  41. package/dist/options/color-space.d.ts +1 -0
  42. package/dist/options/color-space.js +1 -0
  43. package/dist/options/concurrency.d.ts +1 -0
  44. package/dist/options/concurrency.js +1 -0
  45. package/dist/options/config.d.ts +1 -0
  46. package/dist/options/config.js +1 -0
  47. package/dist/options/crf.d.ts +1 -0
  48. package/dist/options/crf.js +1 -0
  49. package/dist/options/cross-site-isolation.d.ts +1 -0
  50. package/dist/options/cross-site-isolation.js +1 -0
  51. package/dist/options/dark-mode.d.ts +1 -0
  52. package/dist/options/dark-mode.js +1 -0
  53. package/dist/options/default-coding-agent.d.ts +1 -0
  54. package/dist/options/default-coding-agent.js +1 -0
  55. package/dist/options/default-editor.d.ts +1 -0
  56. package/dist/options/default-editor.js +1 -0
  57. package/dist/options/default-premount-in-seconds.d.ts +19 -0
  58. package/dist/options/default-premount-in-seconds.js +36 -0
  59. package/dist/options/delete-after.d.ts +1 -0
  60. package/dist/options/delete-after.js +1 -0
  61. package/dist/options/disable-git-source.d.ts +1 -0
  62. package/dist/options/disable-git-source.js +1 -0
  63. package/dist/options/disable-shared-memory-capture.d.ts +1 -0
  64. package/dist/options/disable-shared-memory-capture.js +1 -0
  65. package/dist/options/disable-web-security.d.ts +1 -0
  66. package/dist/options/disable-web-security.js +1 -0
  67. package/dist/options/disallow-parallel-encoding.d.ts +1 -0
  68. package/dist/options/disallow-parallel-encoding.js +1 -0
  69. package/dist/options/enable-cancellation.d.ts +1 -0
  70. package/dist/options/enable-cancellation.js +1 -0
  71. package/dist/options/enable-lambda-insights.d.ts +1 -0
  72. package/dist/options/enable-lambda-insights.js +1 -0
  73. package/dist/options/enable-multiprocess-on-linux.d.ts +1 -0
  74. package/dist/options/enable-multiprocess-on-linux.js +1 -0
  75. package/dist/options/encoding-buffer-size.d.ts +1 -0
  76. package/dist/options/encoding-buffer-size.js +1 -0
  77. package/dist/options/encoding-max-rate.d.ts +1 -0
  78. package/dist/options/encoding-max-rate.js +1 -0
  79. package/dist/options/enforce-audio.d.ts +1 -0
  80. package/dist/options/enforce-audio.js +1 -0
  81. package/dist/options/env-file.d.ts +1 -0
  82. package/dist/options/env-file.js +1 -0
  83. package/dist/options/every-nth-frame.d.ts +1 -0
  84. package/dist/options/every-nth-frame.js +1 -0
  85. package/dist/options/experimental-keep-audio-context-alive.d.ts +1 -0
  86. package/dist/options/experimental-keep-audio-context-alive.js +1 -0
  87. package/dist/options/experimental-sequence-activity-limit.d.ts +19 -0
  88. package/dist/options/experimental-sequence-activity-limit.js +40 -0
  89. package/dist/options/experimental-sequence-activity.d.ts +19 -0
  90. package/dist/options/experimental-sequence-activity.js +38 -0
  91. package/dist/options/experimental-tracks.d.ts +1 -0
  92. package/dist/options/experimental-tracks.js +1 -0
  93. package/dist/options/folder-expiry.d.ts +1 -0
  94. package/dist/options/folder-expiry.js +1 -0
  95. package/dist/options/for-seamless-aac-concatenation.d.ts +1 -0
  96. package/dist/options/for-seamless-aac-concatenation.js +1 -0
  97. package/dist/options/force-new-studio.d.ts +1 -0
  98. package/dist/options/force-new-studio.js +1 -0
  99. package/dist/options/frames.d.ts +1 -0
  100. package/dist/options/frames.js +1 -0
  101. package/dist/options/gl.d.ts +1 -0
  102. package/dist/options/gl.js +1 -0
  103. package/dist/options/gop-size.d.ts +1 -0
  104. package/dist/options/gop-size.js +1 -0
  105. package/dist/options/hardware-acceleration.d.ts +1 -0
  106. package/dist/options/hardware-acceleration.js +1 -0
  107. package/dist/options/headless.d.ts +1 -0
  108. package/dist/options/headless.js +1 -0
  109. package/dist/options/ignore-certificate-errors.d.ts +1 -0
  110. package/dist/options/ignore-certificate-errors.js +1 -0
  111. package/dist/options/image-sequence-pattern.d.ts +1 -0
  112. package/dist/options/image-sequence-pattern.js +1 -0
  113. package/dist/options/image-sequence.d.ts +1 -0
  114. package/dist/options/image-sequence.js +1 -0
  115. package/dist/options/index.d.ts +163 -7
  116. package/dist/options/index.js +8 -2
  117. package/dist/options/interactivity.d.ts +1 -0
  118. package/dist/options/interactivity.js +1 -0
  119. package/dist/options/ipv4.d.ts +1 -0
  120. package/dist/options/ipv4.js +1 -0
  121. package/dist/options/is-production.d.ts +1 -0
  122. package/dist/options/is-production.js +1 -0
  123. package/dist/options/jpeg-quality.d.ts +1 -0
  124. package/dist/options/jpeg-quality.js +1 -0
  125. package/dist/options/keyboard-shortcuts.d.ts +1 -0
  126. package/dist/options/keyboard-shortcuts.js +1 -0
  127. package/dist/options/latency-hint.d.ts +1 -0
  128. package/dist/options/latency-hint.js +1 -0
  129. package/dist/options/license-key.d.ts +1 -0
  130. package/dist/options/license-key.js +1 -0
  131. package/dist/options/log-level.d.ts +1 -0
  132. package/dist/options/log-level.js +1 -0
  133. package/dist/options/metadata.d.ts +1 -0
  134. package/dist/options/metadata.js +1 -0
  135. package/dist/options/mute.d.ts +1 -0
  136. package/dist/options/mute.js +1 -0
  137. package/dist/options/no-open.d.ts +1 -0
  138. package/dist/options/no-open.js +1 -0
  139. package/dist/options/number-of-gif-loops.d.ts +1 -0
  140. package/dist/options/number-of-gif-loops.js +1 -0
  141. package/dist/options/number-of-shared-audio-tags.d.ts +1 -0
  142. package/dist/options/number-of-shared-audio-tags.js +1 -0
  143. package/dist/options/offthreadvideo-cache-size.d.ts +1 -0
  144. package/dist/options/offthreadvideo-cache-size.js +1 -0
  145. package/dist/options/offthreadvideo-threads.d.ts +1 -0
  146. package/dist/options/offthreadvideo-threads.js +1 -0
  147. package/dist/options/on-browser-download.d.ts +1 -0
  148. package/dist/options/on-browser-download.js +1 -0
  149. package/dist/options/option.d.ts +1 -0
  150. package/dist/options/options-map.d.ts +140 -0
  151. package/dist/options/out-dir.d.ts +1 -0
  152. package/dist/options/out-dir.js +1 -0
  153. package/dist/options/override-duration.d.ts +1 -0
  154. package/dist/options/override-duration.js +1 -0
  155. package/dist/options/override-fps.d.ts +1 -0
  156. package/dist/options/override-fps.js +1 -0
  157. package/dist/options/override-height.d.ts +1 -0
  158. package/dist/options/override-height.js +1 -0
  159. package/dist/options/override-width.d.ts +1 -0
  160. package/dist/options/override-width.js +1 -0
  161. package/dist/options/overwrite.d.ts +1 -0
  162. package/dist/options/overwrite.js +1 -0
  163. package/dist/options/package-manager.d.ts +1 -0
  164. package/dist/options/package-manager.js +1 -0
  165. package/dist/options/pixel-format.d.ts +1 -0
  166. package/dist/options/pixel-format.js +1 -0
  167. package/dist/options/port.d.ts +1 -0
  168. package/dist/options/port.js +1 -0
  169. package/dist/options/prefer-lossless.d.ts +1 -0
  170. package/dist/options/prefer-lossless.js +1 -0
  171. package/dist/options/preview-sample-rate.d.ts +1 -0
  172. package/dist/options/preview-sample-rate.js +1 -0
  173. package/dist/options/props.d.ts +1 -0
  174. package/dist/options/props.js +1 -0
  175. package/dist/options/prores-profile.d.ts +1 -0
  176. package/dist/options/prores-profile.js +1 -0
  177. package/dist/options/public-dir.d.ts +1 -0
  178. package/dist/options/public-dir.js +1 -0
  179. package/dist/options/public-license-key.d.ts +1 -0
  180. package/dist/options/public-license-key.js +1 -0
  181. package/dist/options/public-path.d.ts +1 -0
  182. package/dist/options/public-path.js +1 -0
  183. package/dist/options/repro.d.ts +1 -0
  184. package/dist/options/repro.js +1 -0
  185. package/dist/options/rspack.d.ts +1 -0
  186. package/dist/options/rspack.js +1 -0
  187. package/dist/options/runs.d.ts +1 -0
  188. package/dist/options/runs.js +1 -0
  189. package/dist/options/sample-rate.d.ts +1 -0
  190. package/dist/options/sample-rate.js +1 -0
  191. package/dist/options/scale.d.ts +1 -0
  192. package/dist/options/scale.js +1 -0
  193. package/dist/options/separate-audio.d.ts +1 -0
  194. package/dist/options/separate-audio.js +2 -1
  195. package/dist/options/sequence-activity-limit.d.ts +19 -0
  196. package/dist/options/sequence-activity-limit.js +44 -0
  197. package/dist/options/show-layer-frame-numbers.d.ts +19 -0
  198. package/dist/options/show-layer-frame-numbers.js +34 -0
  199. package/dist/options/{experimental-client-side-rendering.d.ts → show-premounting.d.ts} +6 -3
  200. package/dist/options/show-premounting.js +33 -0
  201. package/dist/options/skip-skills.d.ts +1 -0
  202. package/dist/options/skip-skills.js +1 -0
  203. package/dist/options/still-frame.d.ts +1 -0
  204. package/dist/options/still-frame.js +1 -0
  205. package/dist/options/still-image-format.d.ts +1 -0
  206. package/dist/options/still-image-format.js +1 -0
  207. package/dist/options/throw-if-site-exists.d.ts +1 -0
  208. package/dist/options/throw-if-site-exists.js +1 -0
  209. package/dist/options/timeout.d.ts +1 -0
  210. package/dist/options/timeout.js +1 -0
  211. package/dist/options/user-agent.d.ts +1 -0
  212. package/dist/options/user-agent.js +1 -0
  213. package/dist/options/version-flag.d.ts +1 -0
  214. package/dist/options/version-flag.js +1 -0
  215. package/dist/options/video-bitrate.d.ts +1 -0
  216. package/dist/options/video-bitrate.js +1 -0
  217. package/dist/options/video-cache-size.d.ts +1 -0
  218. package/dist/options/video-cache-size.js +1 -0
  219. package/dist/options/video-codec.d.ts +1 -0
  220. package/dist/options/video-codec.js +1 -0
  221. package/dist/options/video-image-format.d.ts +1 -0
  222. package/dist/options/video-image-format.js +1 -0
  223. package/dist/options/webhook-custom-data.d.ts +1 -0
  224. package/dist/options/webhook-custom-data.js +1 -0
  225. package/dist/options/webpack-poll.d.ts +1 -0
  226. package/dist/options/webpack-poll.js +1 -0
  227. package/dist/options/x264-preset.d.ts +1 -0
  228. package/dist/options/x264-preset.js +1 -0
  229. package/dist/prespawn-ffmpeg.js +10 -5
  230. package/dist/stringify-ffmpeg-filter.js +8 -4
  231. package/package.json +16 -14
  232. package/dist/options/experimental-client-side-rendering.js +0 -30
  233. package/dist/prestitcher-memory-usage.d.ts +0 -13
  234. package/dist/prestitcher-memory-usage.js +0 -33
  235. package/dist/render-partitions.d.ts +0 -7
  236. package/dist/render-partitions.js +0 -50
@@ -1,19 +1,23 @@
1
1
  import { createRequire } from "node:module";
2
2
  var __defProp = Object.defineProperty;
3
3
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
4
+ var __returnValue = (v) => v;
5
+ function __exportSetter(name, newValue) {
6
+ this[name] = __returnValue.bind(null, newValue);
7
+ }
4
8
  var __export = (target, all) => {
5
9
  for (var name in all)
6
10
  __defProp(target, name, {
7
11
  get: all[name],
8
12
  enumerable: true,
9
13
  configurable: true,
10
- set: (newValue) => all[name] = () => newValue
14
+ set: __exportSetter.bind(all, name)
11
15
  });
12
16
  };
13
17
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
14
18
 
15
19
  // vendor/yauzl-patched/pend.js
16
- var require_pend = __commonJS((exports, module) => {
20
+ var require_pend = __commonJS(function(exports, module) {
17
21
  module.exports = Pend;
18
22
  function Pend() {
19
23
  this.pending = 0;
@@ -67,23 +71,23 @@ var require_pend = __commonJS((exports, module) => {
67
71
  });
68
72
 
69
73
  // vendor/yauzl-patched/fd-slicer.js
70
- var require_fd_slicer = __commonJS((exports) => {
71
- var fs6 = __require("fs");
74
+ var require_fd_slicer = __commonJS(function(exports) {
75
+ var fs = __require("fs");
72
76
  var util = __require("util");
73
77
  var stream = __require("stream");
74
78
  var Readable = stream.Readable;
75
79
  var Writable = stream.Writable;
76
80
  var PassThrough = stream.PassThrough;
77
81
  var Pend = require_pend();
78
- var EventEmitter2 = __require("events").EventEmitter;
82
+ var EventEmitter = __require("events").EventEmitter;
79
83
  exports.createFromBuffer = createFromBuffer;
80
84
  exports.createFromFd = createFromFd;
81
85
  exports.BufferSlicer = BufferSlicer;
82
86
  exports.FdSlicer = FdSlicer;
83
- util.inherits(FdSlicer, EventEmitter2);
87
+ util.inherits(FdSlicer, EventEmitter);
84
88
  function FdSlicer(fd, options2) {
85
89
  options2 = options2 || {};
86
- EventEmitter2.call(this);
90
+ EventEmitter.call(this);
87
91
  this.fd = fd;
88
92
  this.pend = new Pend;
89
93
  this.pend.max = 1;
@@ -93,18 +97,18 @@ var require_fd_slicer = __commonJS((exports) => {
93
97
  FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
94
98
  var self = this;
95
99
  self.pend.go(function(cb) {
96
- fs6.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
100
+ fs.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
97
101
  cb();
98
- callback(err, bytesRead, buffer2);
102
+ callback(err, bytesRead, buffer);
99
103
  });
100
104
  });
101
105
  };
102
106
  FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
103
107
  var self = this;
104
108
  self.pend.go(function(cb) {
105
- fs6.write(self.fd, buffer, offset, length, position, function(err, written, buffer2) {
109
+ fs.write(self.fd, buffer, offset, length, position, function(err, written, buffer) {
106
110
  cb();
107
- callback(err, written, buffer2);
111
+ callback(err, written, buffer);
108
112
  });
109
113
  });
110
114
  };
@@ -125,7 +129,7 @@ var require_fd_slicer = __commonJS((exports) => {
125
129
  if (self.refCount < 0)
126
130
  throw new Error("invalid unref");
127
131
  if (self.autoClose) {
128
- fs6.close(self.fd, onCloseDone);
132
+ fs.close(self.fd, onCloseDone);
129
133
  }
130
134
  function onCloseDone(err) {
131
135
  if (err) {
@@ -164,7 +168,7 @@ var require_fd_slicer = __commonJS((exports) => {
164
168
  if (self._destroyed)
165
169
  return cb();
166
170
  var buffer = Buffer.allocUnsafe(toRead);
167
- fs6.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
171
+ fs.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
168
172
  if (self._destroyed)
169
173
  return cb();
170
174
  if (err) {
@@ -221,11 +225,11 @@ var require_fd_slicer = __commonJS((exports) => {
221
225
  self.context.pend.go(function(cb) {
222
226
  if (self._destroyed)
223
227
  return cb();
224
- fs6.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err2, bytes) {
225
- if (err2) {
228
+ fs.write(self.context.fd, buffer, 0, buffer.length, self.pos, function(err, bytes) {
229
+ if (err) {
226
230
  self.destroy();
227
231
  cb();
228
- callback(err2);
232
+ callback(err);
229
233
  } else {
230
234
  self.bytesWritten += bytes;
231
235
  self.pos += bytes;
@@ -243,9 +247,9 @@ var require_fd_slicer = __commonJS((exports) => {
243
247
  }
244
248
  cb(err);
245
249
  };
246
- util.inherits(BufferSlicer, EventEmitter2);
250
+ util.inherits(BufferSlicer, EventEmitter);
247
251
  function BufferSlicer(buffer, options2) {
248
- EventEmitter2.call(this);
252
+ EventEmitter.call(this);
249
253
  options2 = options2 || {};
250
254
  this.refCount = 0;
251
255
  this.buffer = buffer;
@@ -356,7 +360,7 @@ var require_fd_slicer = __commonJS((exports) => {
356
360
  });
357
361
 
358
362
  // vendor/yauzl-patched/buffer-crc32.js
359
- var require_buffer_crc32 = __commonJS((exports, module) => {
363
+ var require_buffer_crc32 = __commonJS(function(exports, module) {
360
364
  var Buffer2 = __require("buffer").Buffer;
361
365
  var CRC_TABLE = [
362
366
  0,
@@ -660,6 +664,14 @@ var require_buffer_crc32 = __commonJS((exports, module) => {
660
664
  module.exports = crc32;
661
665
  });
662
666
 
667
+ // src/perf.ts
668
+ var exports_perf = {};
669
+ __export(exports_perf, {
670
+ getPerf: () => getPerf,
671
+ startPerfMeasure: () => startPerfMeasure,
672
+ stopPerfMeasure: () => stopPerfMeasure
673
+ });
674
+
663
675
  // src/index.ts
664
676
  import execa2 from "execa";
665
677
 
@@ -2320,7 +2332,7 @@ class ExecutionContext {
2320
2332
  returnByValue,
2321
2333
  awaitPromise: true,
2322
2334
  userGesture: true
2323
- }).catch(rewriteError2);
2335
+ }).catch(rewriteError);
2324
2336
  if (_details) {
2325
2337
  throw new Error("Evaluation failed: " + getExceptionMessage(_details));
2326
2338
  }
@@ -2364,7 +2376,7 @@ class ExecutionContext {
2364
2376
  }
2365
2377
  const {
2366
2378
  value: { exceptionDetails, result: remoteObject }
2367
- } = await callFunctionOnPromise.catch(rewriteError2);
2379
+ } = await callFunctionOnPromise.catch(rewriteError);
2368
2380
  if (exceptionDetails) {
2369
2381
  throw new Error("Evaluation failed: " + getExceptionMessage(exceptionDetails));
2370
2382
  }
@@ -2405,7 +2417,7 @@ class ExecutionContext {
2405
2417
  }
2406
2418
  return { value: arg };
2407
2419
  }
2408
- function rewriteError2(error) {
2420
+ function rewriteError(error) {
2409
2421
  if (error.message.includes("Object reference chain is too long")) {
2410
2422
  return { value: { result: { type: "undefined" } }, size: 1 };
2411
2423
  }
@@ -3503,6 +3515,9 @@ class Page extends EventEmitter {
3503
3515
  type: log.type
3504
3516
  });
3505
3517
  if (url?.endsWith(NoReactInternals2.bundleName) && lineNumber && this.sourceMapGetter()) {
3518
+ if (!isEqualOrBelowLogLevel(logLevel, log.logLevel)) {
3519
+ return;
3520
+ }
3506
3521
  const origPosition = this.sourceMapGetter()?.originalPositionFor({
3507
3522
  column: columnNumber ?? 0,
3508
3523
  line: lineNumber
@@ -3605,13 +3620,13 @@ class Page extends EventEmitter {
3605
3620
  mobile: false,
3606
3621
  width: viewport.width,
3607
3622
  height: viewport.height,
3608
- deviceScaleFactor: 1,
3623
+ deviceScaleFactor: viewport.deviceScaleFactor,
3609
3624
  screenHeight: viewport.height,
3610
3625
  screenWidth: viewport.width,
3611
- scale: viewport.deviceScaleFactor,
3626
+ scale: 1,
3612
3627
  viewport: {
3613
- height: viewport.height * viewport.deviceScaleFactor,
3614
- width: viewport.width * viewport.deviceScaleFactor,
3628
+ height: viewport.height,
3629
+ width: viewport.width,
3615
3630
  scale: 1,
3616
3631
  x: 0,
3617
3632
  y: 0
@@ -3797,11 +3812,11 @@ var resolveSetprivPathOnLinux = () => {
3797
3812
  return null;
3798
3813
  }
3799
3814
  try {
3800
- const path4 = execSync2("command -v setpriv 2>/dev/null", {
3815
+ const path = execSync2("command -v setpriv 2>/dev/null", {
3801
3816
  encoding: "utf8",
3802
3817
  stdio: ["ignore", "pipe", "ignore"]
3803
3818
  }).trim();
3804
- cachedSetprivPath = path4 ? path4 : null;
3819
+ cachedSetprivPath = path ? path : null;
3805
3820
  } catch {
3806
3821
  cachedSetprivPath = null;
3807
3822
  }
@@ -3855,8 +3870,8 @@ class NodeWebSocketTransport {
3855
3870
  websocket;
3856
3871
  onmessage;
3857
3872
  onclose;
3858
- constructor(ws2) {
3859
- this.websocket = ws2;
3873
+ constructor(ws) {
3874
+ this.websocket = ws;
3860
3875
  this.websocket.addEventListener("message", (event) => {
3861
3876
  if (this.onmessage) {
3862
3877
  this.onmessage.call(null, event.data);
@@ -3887,8 +3902,8 @@ class NodeWebSocketTransport {
3887
3902
 
3888
3903
  // src/browser/parse-browser-log-message.ts
3889
3904
  var parseBrowserLogMessage = (input) => {
3890
- const format2 = /^\[([0-9]{4})\/([0-9]{6})\.([0-9]{6}):([A-Z]+):(.*?)(?:\(([0-9]+)\)|:([0-9]+))\](.*)/;
3891
- const match = input.match(format2);
3905
+ const format = /^\[([0-9]{4})\/([0-9]{6})\.([0-9]{6}):([A-Z]+):(.*?)(?:\(([0-9]+)\)|:([0-9]+))\](.*)/;
3906
+ const match = input.match(format);
3892
3907
  if (!match) {
3893
3908
  return null;
3894
3909
  }
@@ -4550,28 +4565,39 @@ import execa from "execa";
4550
4565
 
4551
4566
  // src/compositor/get-executable-path.ts
4552
4567
  import path4 from "path";
4553
- var warned = false;
4568
+ var cachedIsMusl = null;
4554
4569
  function isMusl({
4555
4570
  indent,
4556
4571
  logLevel
4557
4572
  }) {
4573
+ if (cachedIsMusl !== null) {
4574
+ return cachedIsMusl;
4575
+ }
4558
4576
  if (!process.report && typeof Bun !== "undefined") {
4559
- if (!warned) {
4560
- Log.warn({ indent, logLevel }, "Bun limitation: Could not determine if your Linux is using musl or glibc. Assuming glibc.");
4561
- }
4562
- warned = true;
4563
- return false;
4577
+ Log.warn({ indent, logLevel }, "Bun limitation: Could not determine if your Linux is using musl or glibc. Assuming glibc.");
4578
+ cachedIsMusl = false;
4579
+ return cachedIsMusl;
4564
4580
  }
4565
- const report = process.report?.getReport();
4566
- if (report && typeof report === "string") {
4567
- if (!warned) {
4581
+ const processReport = process.report;
4582
+ const excludeNetwork = processReport && "excludeNetwork" in processReport ? processReport.excludeNetwork : null;
4583
+ try {
4584
+ if (processReport && "excludeNetwork" in processReport) {
4585
+ processReport.excludeNetwork = true;
4586
+ }
4587
+ const report = processReport?.getReport();
4588
+ if (report && typeof report === "string") {
4568
4589
  Log.warn({ indent, logLevel }, "Bun limitation: Could not determine if your Windows is using musl or glibc. Assuming glibc.");
4590
+ cachedIsMusl = false;
4591
+ return cachedIsMusl;
4592
+ }
4593
+ const { glibcVersionRuntime } = report.header;
4594
+ cachedIsMusl = !glibcVersionRuntime;
4595
+ return cachedIsMusl;
4596
+ } finally {
4597
+ if (processReport && "excludeNetwork" in processReport) {
4598
+ processReport.excludeNetwork = excludeNetwork;
4569
4599
  }
4570
- warned = true;
4571
- return false;
4572
4600
  }
4573
- const { glibcVersionRuntime } = report.header;
4574
- return !glibcVersionRuntime;
4575
4601
  }
4576
4602
  var getExecutablePath = ({
4577
4603
  indent,
@@ -4676,10 +4702,10 @@ var hasPermissions = (p) => {
4676
4702
  const canExecute = isOwner && ownerHasExecutePermission || isGroup && groupHasExecutePermission;
4677
4703
  return canExecute;
4678
4704
  };
4679
- var makeFileExecutableIfItIsNot = (path5) => {
4680
- const hasPermissionsResult = hasPermissions(path5);
4705
+ var makeFileExecutableIfItIsNot = (path) => {
4706
+ const hasPermissionsResult = hasPermissions(path);
4681
4707
  if (!hasPermissionsResult) {
4682
- chmodSync(path5, 493);
4708
+ chmodSync(path, 493);
4683
4709
  }
4684
4710
  };
4685
4711
 
@@ -5652,7 +5678,7 @@ var Transform = __require("stream").Transform;
5652
5678
  var PassThrough = __require("stream").PassThrough;
5653
5679
  var Writable = __require("stream").Writable;
5654
5680
  var $open = open;
5655
- function open(path7, options2, callback) {
5681
+ function open(path, options2, callback) {
5656
5682
  if (typeof options2 === "function") {
5657
5683
  callback = options2;
5658
5684
  options2 = null;
@@ -5671,13 +5697,13 @@ function open(path7, options2, callback) {
5671
5697
  options2.strictFileNames = false;
5672
5698
  if (callback == null)
5673
5699
  callback = defaultCallback;
5674
- fs6.open(path7, "r", function(err, fd) {
5700
+ fs6.open(path, "r", function(err, fd) {
5675
5701
  if (err)
5676
5702
  return callback(err);
5677
- fromFd(fd, options2, function(err2, zipfile) {
5678
- if (err2)
5703
+ fromFd(fd, options2, function(err, zipfile) {
5704
+ if (err)
5679
5705
  fs6.close(fd, defaultCallback);
5680
- callback(err2, zipfile);
5706
+ callback(err, zipfile);
5681
5707
  });
5682
5708
  });
5683
5709
  }
@@ -5759,9 +5785,9 @@ function fromRandomAccessReader(reader, totalSize, options2, callback) {
5759
5785
  var zip64EocdlBuffer = buffer.subarray(i - zip64EocdlSize, i - zip64EocdlSize + zip64EocdlSize);
5760
5786
  var zip64EocdrOffset = readUInt64LE(zip64EocdlBuffer, 8);
5761
5787
  var zip64EocdrBuffer = newBuffer(56);
5762
- return readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err2) {
5763
- if (err2)
5764
- return callback(err2);
5788
+ return readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err) {
5789
+ if (err)
5790
+ return callback(err);
5765
5791
  if (zip64EocdrBuffer.readUInt32LE(0) !== 101075792) {
5766
5792
  return callback(new Error("invalid zip64 end of central directory record signature"));
5767
5793
  }
@@ -5873,9 +5899,9 @@ ZipFile.prototype._readEntry = function() {
5873
5899
  return emitErrorAndAutoClose(self, new Error("strong encryption is not supported"));
5874
5900
  self.readEntryCursor += 46;
5875
5901
  buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
5876
- readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err2) {
5877
- if (err2)
5878
- return emitErrorAndAutoClose(self, err2);
5902
+ readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) {
5903
+ if (err)
5904
+ return emitErrorAndAutoClose(self, err);
5879
5905
  if (self.emittedError)
5880
5906
  return;
5881
5907
  entry.fileNameRaw = buffer.subarray(0, entry.fileNameLength);
@@ -5884,8 +5910,8 @@ ZipFile.prototype._readEntry = function() {
5884
5910
  entry.fileCommentRaw = buffer.subarray(fileCommentStart, fileCommentStart + entry.fileCommentLength);
5885
5911
  try {
5886
5912
  entry.extraFields = parseExtraFields(entry.extraFieldRaw);
5887
- } catch (err3) {
5888
- return emitErrorAndAutoClose(self, err3);
5913
+ } catch (err) {
5914
+ return emitErrorAndAutoClose(self, err);
5889
5915
  }
5890
5916
  if (self.decodeStrings) {
5891
5917
  var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
@@ -6109,10 +6135,10 @@ ZipFile.prototype.readLocalFileHeader = function(entry, options2, callback) {
6109
6135
  localFileHeader.extraFieldLength = extraFieldLength;
6110
6136
  buffer = newBuffer(fileNameLength + extraFieldLength);
6111
6137
  self.reader.ref();
6112
- readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader + 30, function(err2) {
6138
+ readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader + 30, function(err) {
6113
6139
  try {
6114
- if (err2)
6115
- return callback(err2);
6140
+ if (err)
6141
+ return callback(err);
6116
6142
  localFileHeader.fileName = buffer.subarray(0, fileNameLength);
6117
6143
  localFileHeader.extraField = buffer.subarray(fileNameLength);
6118
6144
  return callback(null, localFileHeader);
@@ -6564,13 +6590,13 @@ var getGlibcVersion = () => {
6564
6590
  }
6565
6591
  return [Number(split[0]), Number(split[1])];
6566
6592
  };
6567
- var isGlibcVersionAtLeast = (required2) => {
6593
+ var isGlibcVersionAtLeast = (required) => {
6568
6594
  const version = getGlibcVersion();
6569
6595
  if (version === null) {
6570
6596
  return false;
6571
6597
  }
6572
6598
  const [major, minor] = version;
6573
- const [reqMajor, reqMinor] = required2;
6599
+ const [reqMajor, reqMinor] = required;
6574
6600
  if (major > reqMajor) {
6575
6601
  return true;
6576
6602
  }
@@ -6586,20 +6612,20 @@ var canUseRemotionMediaBinaries = () => {
6586
6612
  return isGlibcVersionAtLeast(MINIMUM_GLIBC_FOR_REMOTION_MEDIA);
6587
6613
  };
6588
6614
  function getChromeDownloadUrl({
6589
- platform: platform2,
6615
+ platform,
6590
6616
  version,
6591
6617
  chromeMode
6592
6618
  }) {
6593
- if (platform2 === "linux-arm64" && version && /^\d+$/.test(version)) {
6594
- const archive2 = chromeMode === "chrome-for-testing" ? "chromium-linux-arm64" : "chromium-headless-shell-linux-arm64";
6595
- return `https://playwright.azureedge.net/builds/chromium/${version}/${archive2}.zip`;
6619
+ if (platform === "linux-arm64" && version && /^\d+$/.test(version)) {
6620
+ const archive = chromeMode === "chrome-for-testing" ? "chromium-linux-arm64" : "chromium-headless-shell-linux-arm64";
6621
+ return `https://playwright.azureedge.net/builds/chromium/${version}/${archive}.zip`;
6596
6622
  }
6597
6623
  if (chromeMode === "headless-shell" && version === null) {
6598
- if (platform2 === "mac-arm64") {
6624
+ if (platform === "mac-arm64") {
6599
6625
  return `https://remotion.media/chromium-headless-shell-mac-arm64-${TESTED_VERSION}.zip?clear`;
6600
6626
  }
6601
- if (platform2 === "linux64" || platform2 === "linux-arm64") {
6602
- const architecture = platform2 === "linux64" ? "x64" : "arm64";
6627
+ if (platform === "linux64" || platform === "linux-arm64") {
6628
+ const architecture = platform === "linux64" ? "x64" : "arm64";
6603
6629
  if (isAmazonLinux2023()) {
6604
6630
  return `https://remotion.media/chromium-headless-shell-amazon-linux-${architecture}-${TESTED_VERSION}.zip?clear`;
6605
6631
  }
@@ -6609,7 +6635,7 @@ function getChromeDownloadUrl({
6609
6635
  }
6610
6636
  }
6611
6637
  const archive = chromeMode === "headless-shell" ? "chrome-headless-shell" : "chrome";
6612
- return `https://storage.googleapis.com/chrome-for-testing-public/${version ?? TESTED_VERSION}/${platform2}/${archive}-${platform2}.zip`;
6638
+ return `https://storage.googleapis.com/chrome-for-testing-public/${version ?? TESTED_VERSION}/${platform}/${archive}-${platform}.zip`;
6613
6639
  }
6614
6640
  var logDownloadUrl = ({
6615
6641
  url,
@@ -6654,15 +6680,15 @@ var getDownloadsCacheDir = () => {
6654
6680
  var mkdirAsync = fs9.promises.mkdir;
6655
6681
  var unlinkAsync = promisify2(fs9.unlink.bind(fs9));
6656
6682
  function existsAsync(filePath) {
6657
- return new Promise((resolve2) => {
6683
+ return new Promise((resolve) => {
6658
6684
  fs9.access(filePath, (err) => {
6659
- return resolve2(!err);
6685
+ return resolve(!err);
6660
6686
  });
6661
6687
  });
6662
6688
  }
6663
6689
  var getPlatform = () => {
6664
- const platform3 = os5.platform();
6665
- switch (platform3) {
6690
+ const platform = os5.platform();
6691
+ switch (platform) {
6666
6692
  case "darwin":
6667
6693
  return os5.arch() === "arm64" ? "mac-arm64" : "mac-x64";
6668
6694
  case "linux":
@@ -6670,7 +6696,7 @@ var getPlatform = () => {
6670
6696
  case "win32":
6671
6697
  return "win64";
6672
6698
  default:
6673
- throw new Error("Unsupported platform: " + platform3);
6699
+ throw new Error("Unsupported platform: " + platform);
6674
6700
  }
6675
6701
  };
6676
6702
  var getDownloadsFolder = (chromeMode) => {
@@ -6684,13 +6710,13 @@ var getVersionFilePath = (chromeMode) => {
6684
6710
  var getExpectedVersion = ({
6685
6711
  version,
6686
6712
  chromeMode,
6687
- platform: platform3
6713
+ platform
6688
6714
  }) => {
6689
6715
  if (version) {
6690
6716
  return version;
6691
6717
  }
6692
6718
  const downloadUrl = getChromeDownloadUrl({
6693
- platform: platform3,
6719
+ platform,
6694
6720
  version: null,
6695
6721
  chromeMode
6696
6722
  });
@@ -6718,16 +6744,16 @@ var downloadBrowser = async ({
6718
6744
  version,
6719
6745
  chromeMode
6720
6746
  }) => {
6721
- const platform3 = getPlatform();
6722
- const downloadURL = getChromeDownloadUrl({ platform: platform3, version, chromeMode });
6747
+ const platform = getPlatform();
6748
+ const downloadURL = getChromeDownloadUrl({ platform, version, chromeMode });
6723
6749
  const fileName = downloadURL.split("/").pop();
6724
6750
  if (!fileName) {
6725
6751
  throw new Error(`A malformed download URL was found: ${downloadURL}.`);
6726
6752
  }
6727
6753
  const downloadsFolder = getDownloadsFolder(chromeMode);
6728
6754
  const archivePath = path9.join(downloadsFolder, fileName);
6729
- const outputPath = getFolderPath(downloadsFolder, platform3);
6730
- const expectedVersion = getExpectedVersion({ version, chromeMode, platform: platform3 });
6755
+ const outputPath = getFolderPath(downloadsFolder, platform);
6756
+ const expectedVersion = getExpectedVersion({ version, chromeMode, platform });
6731
6757
  if (await existsAsync(outputPath)) {
6732
6758
  const installedVersion = readVersionFile(chromeMode);
6733
6759
  if (installedVersion === expectedVersion) {
@@ -6789,7 +6815,7 @@ var downloadBrowser = async ({
6789
6815
  fs9.renameSync(chromePath, chromeHeadlessShellPath);
6790
6816
  }
6791
6817
  if (fs9.existsSync(chromeLinuxFolder)) {
6792
- const targetFolder = path9.join(outputPath, (chromeMode === "headless-shell" ? "chrome-headless-shell-" : "chrome-") + platform3);
6818
+ const targetFolder = path9.join(outputPath, (chromeMode === "headless-shell" ? "chrome-headless-shell-" : "chrome-") + platform);
6793
6819
  if (chromeLinuxFolder !== targetFolder) {
6794
6820
  fs9.renameSync(chromeLinuxFolder, targetFolder);
6795
6821
  }
@@ -6810,41 +6836,41 @@ var downloadBrowser = async ({
6810
6836
  await releaseLock();
6811
6837
  }
6812
6838
  };
6813
- var getFolderPath = (downloadsFolder, platform3) => {
6814
- return path9.resolve(downloadsFolder, platform3);
6839
+ var getFolderPath = (downloadsFolder, platform) => {
6840
+ return path9.resolve(downloadsFolder, platform);
6815
6841
  };
6816
6842
  var getExecutablePath2 = (chromeMode) => {
6817
6843
  const downloadsFolder = getDownloadsFolder(chromeMode);
6818
- const platform3 = getPlatform();
6819
- const folderPath = getFolderPath(downloadsFolder, platform3);
6844
+ const platform = getPlatform();
6845
+ const folderPath = getFolderPath(downloadsFolder, platform);
6820
6846
  if (chromeMode === "chrome-for-testing") {
6821
- if (platform3 === "mac-arm64" || platform3 === "mac-x64") {
6822
- return path9.join(folderPath, `chrome-${platform3}`, "Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing");
6847
+ if (platform === "mac-arm64" || platform === "mac-x64") {
6848
+ return path9.join(folderPath, `chrome-${platform}`, "Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing");
6823
6849
  }
6824
- if (platform3 === "win64") {
6850
+ if (platform === "win64") {
6825
6851
  return path9.join(folderPath, "chrome-win64", "chrome.exe");
6826
6852
  }
6827
- if (platform3 === "linux64" || platform3 === "linux-arm64") {
6828
- return path9.join(folderPath, `chrome-${platform3}`, "chrome");
6853
+ if (platform === "linux64" || platform === "linux-arm64") {
6854
+ return path9.join(folderPath, `chrome-${platform}`, "chrome");
6829
6855
  }
6830
- throw new Error("unsupported platform" + platform3);
6856
+ throw new Error("unsupported platform" + platform);
6831
6857
  }
6832
6858
  if (chromeMode === "headless-shell") {
6833
- const shellFolder = path9.join(folderPath, `chrome-headless-shell-${platform3}`);
6859
+ const shellFolder = path9.join(folderPath, `chrome-headless-shell-${platform}`);
6834
6860
  const remotionExecutable = path9.join(shellFolder, "headless_shell");
6835
6861
  if (fs9.existsSync(remotionExecutable)) {
6836
6862
  return remotionExecutable;
6837
6863
  }
6838
- return path9.join(shellFolder, platform3 === "win64" ? "chrome-headless-shell.exe" : "chrome-headless-shell");
6864
+ return path9.join(shellFolder, platform === "win64" ? "chrome-headless-shell.exe" : "chrome-headless-shell");
6839
6865
  }
6840
6866
  throw new Error("unsupported chrome mode" + chromeMode);
6841
6867
  };
6842
6868
  var getRevisionInfo = (chromeMode) => {
6843
6869
  const executablePath = getExecutablePath2(chromeMode);
6844
6870
  const downloadsFolder = getDownloadsFolder(chromeMode);
6845
- const platform3 = getPlatform();
6846
- const folderPath = getFolderPath(downloadsFolder, platform3);
6847
- const url = getChromeDownloadUrl({ platform: platform3, version: null, chromeMode });
6871
+ const platform = getPlatform();
6872
+ const folderPath = getFolderPath(downloadsFolder, platform);
6873
+ const url = getChromeDownloadUrl({ platform, version: null, chromeMode });
6848
6874
  const local = fs9.existsSync(folderPath);
6849
6875
  return {
6850
6876
  executablePath,
@@ -7196,18 +7222,18 @@ var getAvailableMemory = (logLevel) => {
7196
7222
  // src/get-video-threads-flag.ts
7197
7223
  var MEMORY_USAGE_PER_THREAD = 400000000;
7198
7224
  var RESERVED_MEMORY = 2000000000;
7225
+ var MAX_VIDEO_THREADS = 16;
7199
7226
  var getIdealVideoThreadsFlag = (logLevel) => {
7200
7227
  const freeMemory = getAvailableMemory(logLevel);
7201
7228
  const cpus = getCpuCount();
7202
7229
  const maxRecommendedBasedOnCpus = cpus * 2 / 3;
7203
7230
  const maxRecommendedBasedOnMemory = (freeMemory - RESERVED_MEMORY) / MEMORY_USAGE_PER_THREAD;
7204
- const maxRecommended = Math.min(maxRecommendedBasedOnCpus, maxRecommendedBasedOnMemory);
7231
+ const maxRecommended = Math.min(maxRecommendedBasedOnCpus, maxRecommendedBasedOnMemory, MAX_VIDEO_THREADS);
7205
7232
  return Math.max(1, Math.round(maxRecommended));
7206
7233
  };
7207
7234
 
7208
7235
  // src/options/gl.tsx
7209
7236
  import { NoReactInternals as NoReactInternals7 } from "remotion/no-react";
7210
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
7211
7237
  var validOpenGlRenderers = [
7212
7238
  "swangle",
7213
7239
  "angle",
@@ -7481,7 +7507,6 @@ var getPageAndCleanupFn = async ({
7481
7507
  };
7482
7508
 
7483
7509
  // src/options/offthreadvideo-threads.tsx
7484
- import { jsx as jsx2, jsxs as jsxs2, Fragment as Fragment2 } from "react/jsx-runtime";
7485
7510
  var DEFAULT_RENDER_FRAMES_OFFTHREAD_VIDEO_THREADS = 2;
7486
7511
 
7487
7512
  // src/prepare-server.ts
@@ -14737,6 +14762,11 @@ var mimeDb = {
14737
14762
  compressible: false,
14738
14763
  extensions: ["jpx", "jpf"]
14739
14764
  },
14765
+ "image/jxl": {
14766
+ source: "iana",
14767
+ compressible: false,
14768
+ extensions: ["jxl"]
14769
+ },
14740
14770
  "image/jxr": {
14741
14771
  source: "iana",
14742
14772
  extensions: ["jxr"]
@@ -16157,11 +16187,11 @@ populateMaps(extensions, {});
16157
16187
  var getExt = (contentType) => {
16158
16188
  return mimeDb[contentType.toLowerCase()]?.extensions?.[0] ?? null;
16159
16189
  };
16160
- function mimeLookup(path11) {
16161
- if (!path11 || typeof path11 !== "string") {
16190
+ function mimeLookup(path) {
16191
+ if (!path || typeof path !== "string") {
16162
16192
  return false;
16163
16193
  }
16164
- const ext = extname("." + path11).toLowerCase().substr(1);
16194
+ const ext = extname("." + path).toLowerCase().substr(1);
16165
16195
  if (!ext) {
16166
16196
  return false;
16167
16197
  }
@@ -16231,17 +16261,17 @@ var pLimit = (concurrency) => {
16231
16261
  queue.shift()?.();
16232
16262
  }
16233
16263
  };
16234
- const run = async (fn, resolve2, ...args) => {
16264
+ const run = async (fn, resolve, ...args) => {
16235
16265
  activeCount++;
16236
16266
  const result = (async () => fn(...args))();
16237
- resolve2(result);
16267
+ resolve(result);
16238
16268
  try {
16239
16269
  await result;
16240
16270
  } catch {}
16241
16271
  next();
16242
16272
  };
16243
- const enqueue = (fn, resolve2, ...args) => {
16244
- queue.push(() => run(fn, resolve2, ...args));
16273
+ const enqueue = (fn, resolve, ...args) => {
16274
+ queue.push(() => run(fn, resolve, ...args));
16245
16275
  (async () => {
16246
16276
  await Promise.resolve();
16247
16277
  if (activeCount < concurrency && queue.length > 0) {
@@ -16249,8 +16279,8 @@ var pLimit = (concurrency) => {
16249
16279
  }
16250
16280
  })();
16251
16281
  };
16252
- const generator = (fn, ...args) => new Promise((resolve2) => {
16253
- enqueue(fn, resolve2, ...args);
16282
+ const generator = (fn, ...args) => new Promise((resolve) => {
16283
+ enqueue(fn, resolve, ...args);
16254
16284
  });
16255
16285
  Object.defineProperties(generator, {
16256
16286
  activeCount: {
@@ -16439,13 +16469,13 @@ var waitForAssetToBeDownloaded = ({
16439
16469
  if (!downloadMap.listeners[src][downloadDir]) {
16440
16470
  downloadMap.listeners[src][downloadDir] = [];
16441
16471
  }
16442
- return new Promise((resolve2) => {
16472
+ return new Promise((resolve) => {
16443
16473
  downloadMap.listeners[src][downloadDir].push(() => {
16444
16474
  const srcMap = downloadMap.hasBeenDownloadedMap[src];
16445
16475
  if (!srcMap?.[downloadDir]) {
16446
16476
  throw new Error("Expected file for " + src + "to be available in " + downloadDir);
16447
16477
  }
16448
- resolve2(srcMap[downloadDir]);
16478
+ resolve(srcMap[downloadDir]);
16449
16479
  });
16450
16480
  });
16451
16481
  };
@@ -16867,13 +16897,13 @@ ${parsed.backtrace}`));
16867
16897
  child.stderr.on("data", (data) => {
16868
16898
  stderrChunks.push(data);
16869
16899
  });
16870
- let resolve2 = null;
16900
+ let resolve = null;
16871
16901
  let reject = null;
16872
16902
  child.on("close", (code, signal) => {
16873
16903
  const waitersToKill = Array.from(waiters.values());
16874
16904
  if (code === 0) {
16875
16905
  runningStatus = { type: "quit-without-error", signal };
16876
- resolve2?.();
16906
+ resolve?.();
16877
16907
  for (const waiter of waitersToKill) {
16878
16908
  waiter.reject(new Error(`Compositor quit${signal ? ` with signal ${signal}` : ""}`));
16879
16909
  }
@@ -16902,7 +16932,7 @@ ${parsed.backtrace}`));
16902
16932
  rej(new Error(`Compositor quit${runningStatus.signal ? ` with signal ${runningStatus.signal}` : ""}: ${runningStatus.error}`));
16903
16933
  return;
16904
16934
  }
16905
- resolve2 = res;
16935
+ resolve = res;
16906
16936
  reject = rej;
16907
16937
  });
16908
16938
  };
@@ -16982,7 +17012,6 @@ ${parsed.backtrace}`));
16982
17012
  };
16983
17013
 
16984
17014
  // src/options/offthreadvideo-cache-size.tsx
16985
- import { jsx as jsx3, jsxs as jsxs3, Fragment as Fragment3 } from "react/jsx-runtime";
16986
17015
  var validateOffthreadVideoCacheSizeInBytes = (option) => {
16987
17016
  if (option === undefined || option === null) {
16988
17017
  return;
@@ -17088,7 +17117,7 @@ var startOffthreadVideoServer = ({
17088
17117
  shouldAnalyzeAudioImmediately: true,
17089
17118
  audioStreamIndex: undefined
17090
17119
  }).then((to) => {
17091
- return new Promise((resolve2, reject) => {
17120
+ return new Promise((resolve, reject) => {
17092
17121
  if (closed) {
17093
17122
  reject(Error(REQUEST_CLOSED_TOKEN));
17094
17123
  return;
@@ -17100,10 +17129,10 @@ var startOffthreadVideoServer = ({
17100
17129
  time,
17101
17130
  transparent,
17102
17131
  tone_mapped: toneMapped
17103
- }).then(resolve2).catch(reject);
17132
+ }).then(resolve).catch(reject);
17104
17133
  });
17105
17134
  }).then((readable) => {
17106
- return new Promise((resolve2, reject) => {
17135
+ return new Promise((resolve, reject) => {
17107
17136
  if (closed) {
17108
17137
  reject(Error(REQUEST_CLOSED_TOKEN));
17109
17138
  return;
@@ -17138,7 +17167,7 @@ var startOffthreadVideoServer = ({
17138
17167
  if (err) {
17139
17168
  reject(err);
17140
17169
  } else {
17141
- resolve2();
17170
+ resolve();
17142
17171
  }
17143
17172
  });
17144
17173
  });
@@ -17519,9 +17548,9 @@ var createLock = ({ timeout }) => {
17519
17548
  }
17520
17549
  };
17521
17550
  const waitForAllToBeDone = () => {
17522
- const success = new Promise((resolve2) => {
17551
+ const success = new Promise((resolve) => {
17523
17552
  waiters.push(() => {
17524
- resolve2();
17553
+ resolve();
17525
17554
  });
17526
17555
  });
17527
17556
  resolveWaiters();
@@ -17531,9 +17560,9 @@ var createLock = ({ timeout }) => {
17531
17560
  if (timeout === null) {
17532
17561
  return success;
17533
17562
  }
17534
- const timeoutFn = new Promise((resolve2) => {
17563
+ const timeoutFn = new Promise((resolve) => {
17535
17564
  setTimeout(() => {
17536
- return resolve2();
17565
+ return resolve();
17537
17566
  }, timeout);
17538
17567
  });
17539
17568
  return Promise.race([success, timeoutFn]);
@@ -17550,15 +17579,15 @@ var isPortAvailableOnHost = ({
17550
17579
  portToTry,
17551
17580
  host
17552
17581
  }) => {
17553
- return new Promise((resolve2) => {
17582
+ return new Promise((resolve) => {
17554
17583
  const server = net.createServer();
17555
17584
  server.unref();
17556
17585
  server.on("error", () => {
17557
- resolve2("unavailable");
17586
+ resolve("unavailable");
17558
17587
  });
17559
17588
  server.listen({ port: portToTry, host }, () => {
17560
17589
  server.close(() => {
17561
- resolve2("available");
17590
+ resolve("available");
17562
17591
  });
17563
17592
  });
17564
17593
  });
@@ -17957,7 +17986,7 @@ var serveHandler = async (request, response, config) => {
17957
17986
  };
17958
17987
 
17959
17988
  // src/serve-static.ts
17960
- var serveStatic = async (path20, options2) => {
17989
+ var serveStatic = async (path, options2) => {
17961
17990
  const {
17962
17991
  listener: offthreadRequest,
17963
17992
  close: closeCompositor,
@@ -17975,13 +18004,13 @@ var serveStatic = async (path20, options2) => {
17975
18004
  if (request.url?.startsWith("/proxy")) {
17976
18005
  return offthreadRequest(request, response);
17977
18006
  }
17978
- if (path20 === null) {
18007
+ if (path === null) {
17979
18008
  response.writeHead(404);
17980
18009
  response.end("Server only supports /proxy");
17981
18010
  return;
17982
18011
  }
17983
18012
  serveHandler(request, response, {
17984
- public: path20
18013
+ public: path
17985
18014
  }).catch(() => {
17986
18015
  if (!response.headersSent) {
17987
18016
  response.writeHead(500);
@@ -18007,7 +18036,7 @@ var serveStatic = async (path20, options2) => {
18007
18036
  for (let i = 0;i < maxTries; i++) {
18008
18037
  let unlock = () => {};
18009
18038
  try {
18010
- selectedPort = await new Promise((resolve2, reject) => {
18039
+ selectedPort = await new Promise((resolve, reject) => {
18011
18040
  getDesiredPort({
18012
18041
  desiredPort: options2?.port ?? undefined,
18013
18042
  from: 3000,
@@ -18017,7 +18046,7 @@ var serveStatic = async (path20, options2) => {
18017
18046
  unlock = unlockPort;
18018
18047
  server.listen({ port, host: portConfig.host });
18019
18048
  server.on("listening", () => {
18020
- resolve2(port);
18049
+ resolve(port);
18021
18050
  return unlock();
18022
18051
  });
18023
18052
  server.on("error", (err) => {
@@ -18035,27 +18064,27 @@ var serveStatic = async (path20, options2) => {
18035
18064
  };
18036
18065
  const close = async () => {
18037
18066
  await Promise.all([
18038
- new Promise((resolve2, reject) => {
18067
+ new Promise((resolve, reject) => {
18039
18068
  closeCompositor().catch((err) => {
18040
18069
  if (err.message.includes("Compositor quit")) {
18041
- resolve2();
18070
+ resolve();
18042
18071
  return;
18043
18072
  }
18044
18073
  reject(err);
18045
18074
  }).finally(() => {
18046
- resolve2();
18075
+ resolve();
18047
18076
  });
18048
18077
  }),
18049
- new Promise((resolve2, reject) => {
18078
+ new Promise((resolve, reject) => {
18050
18079
  destroyConnections();
18051
18080
  server.close((err) => {
18052
18081
  if (err) {
18053
18082
  if (err.code === "ERR_SERVER_NOT_RUNNING") {
18054
- return resolve2();
18083
+ return resolve();
18055
18084
  }
18056
18085
  reject(err);
18057
18086
  } else {
18058
- resolve2();
18087
+ resolve();
18059
18088
  }
18060
18089
  });
18061
18090
  })
@@ -18396,7 +18425,7 @@ var waitForReady = ({
18396
18425
  });
18397
18426
  });
18398
18427
  };
18399
- const waitForReadyProm = new Promise((resolve2, reject) => {
18428
+ const waitForReadyProm = new Promise((resolve, reject) => {
18400
18429
  const waitTask = page.mainFrame()._mainWorld.waitForFunction({
18401
18430
  browser: page.browser,
18402
18431
  timeout: timeoutInMilliseconds + 3000,
@@ -18412,7 +18441,7 @@ var waitForReady = ({
18412
18441
  return retrieveCancelledErrorAndReject();
18413
18442
  }
18414
18443
  if (token === readyToken) {
18415
- return resolve2(a);
18444
+ return resolve(a);
18416
18445
  }
18417
18446
  reject(new Error("Unexpected token " + token));
18418
18447
  }).catch((err) => {
@@ -18611,9 +18640,9 @@ var innerSetPropsAndEnv = async ({
18611
18640
  };
18612
18641
  }, serializedInputPropsWithCustomSchema, initialFrame, proxyPort, audioEnabled, videoEnabled, logLevel);
18613
18642
  const retry = async () => {
18614
- await new Promise((resolve2) => {
18643
+ await new Promise((resolve) => {
18615
18644
  setTimeout(() => {
18616
- resolve2();
18645
+ resolve();
18617
18646
  }, 2000);
18618
18647
  });
18619
18648
  return innerSetPropsAndEnv({
@@ -19030,7 +19059,7 @@ var internalGetCompositionsRaw = async ({
19030
19059
  onLog
19031
19060
  });
19032
19061
  const cleanup = [cleanupPage];
19033
- return new Promise((resolve2, reject) => {
19062
+ return new Promise((resolve, reject) => {
19034
19063
  const onError = (err) => reject(err);
19035
19064
  cleanup.push(handleJavascriptException({
19036
19065
  page,
@@ -19075,7 +19104,7 @@ var internalGetCompositionsRaw = async ({
19075
19104
  darkMode: chromiumOptions.darkMode ?? false
19076
19105
  });
19077
19106
  }).then((comp) => {
19078
- return resolve2(comp);
19107
+ return resolve(comp);
19079
19108
  }).catch((err) => {
19080
19109
  reject(err);
19081
19110
  }).finally(() => {
@@ -19183,18 +19212,18 @@ var getFileExtensionFromCodec = (codec, audioCodec) => {
19183
19212
  if (!validCodecs.includes(codec)) {
19184
19213
  throw new Error(`Codec must be one of the following: ${validCodecs.join(", ")}, but got ${codec}`);
19185
19214
  }
19186
- const map2 = defaultFileExtensionMap[codec];
19215
+ const map = defaultFileExtensionMap[codec];
19187
19216
  if (audioCodec === null) {
19188
- return map2.default;
19217
+ return map.default;
19189
19218
  }
19190
19219
  const typedAudioCodec = audioCodec;
19191
- if (!(typedAudioCodec in map2.forAudioCodec)) {
19220
+ if (!(typedAudioCodec in map.forAudioCodec)) {
19192
19221
  throw new Error(`Audio codec ${typedAudioCodec} is not supported for codec ${codec}`);
19193
19222
  }
19194
- return map2.forAudioCodec[audioCodec].default;
19223
+ return map.forAudioCodec[audioCodec].default;
19195
19224
  };
19196
19225
  var makeFileExtensionMap = () => {
19197
- const map2 = {};
19226
+ const map = {};
19198
19227
  Object.keys(defaultFileExtensionMap).forEach((_codec) => {
19199
19228
  const codec = _codec;
19200
19229
  const fileExtMap = defaultFileExtensionMap[codec];
@@ -19205,15 +19234,15 @@ var makeFileExtensionMap = () => {
19205
19234
  ...possibleExtensionsForAudioCodec.flat(1)
19206
19235
  ];
19207
19236
  for (const extension of allPossibleExtensions) {
19208
- if (!map2[extension]) {
19209
- map2[extension] = [];
19237
+ if (!map[extension]) {
19238
+ map[extension] = [];
19210
19239
  }
19211
- if (!map2[extension].includes(codec)) {
19212
- map2[extension].push(codec);
19240
+ if (!map[extension].includes(codec)) {
19241
+ map[extension].push(codec);
19213
19242
  }
19214
19243
  }
19215
19244
  });
19216
- return map2;
19245
+ return map;
19217
19246
  };
19218
19247
  var defaultCodecsForFileExtension = {
19219
19248
  "3gp": "aac",
@@ -19237,21 +19266,21 @@ var defaultCodecsForFileExtension = {
19237
19266
  // src/path-normalize.ts
19238
19267
  var SLASH = 47;
19239
19268
  var DOT = 46;
19240
- var assertPath = (path21) => {
19241
- const t = typeof path21;
19269
+ var assertPath = (path) => {
19270
+ const t = typeof path;
19242
19271
  if (t !== "string") {
19243
19272
  throw new TypeError(`Expected a string, got a ${t}`);
19244
19273
  }
19245
19274
  };
19246
- var posixNormalize = (path21, allowAboveRoot) => {
19275
+ var posixNormalize = (path, allowAboveRoot) => {
19247
19276
  let res = "";
19248
19277
  let lastSegmentLength = 0;
19249
19278
  let lastSlash = -1;
19250
19279
  let dots = 0;
19251
19280
  let code;
19252
- for (let i = 0;i <= path21.length; ++i) {
19253
- if (i < path21.length) {
19254
- code = path21.charCodeAt(i);
19281
+ for (let i = 0;i <= path.length; ++i) {
19282
+ if (i < path.length) {
19283
+ code = path.charCodeAt(i);
19255
19284
  } else if (code === SLASH) {
19256
19285
  break;
19257
19286
  } else {
@@ -19292,9 +19321,9 @@ var posixNormalize = (path21, allowAboveRoot) => {
19292
19321
  }
19293
19322
  } else {
19294
19323
  if (res.length > 0) {
19295
- res += "/" + path21.slice(lastSlash + 1, i);
19324
+ res += "/" + path.slice(lastSlash + 1, i);
19296
19325
  } else {
19297
- res = path21.slice(lastSlash + 1, i);
19326
+ res = path.slice(lastSlash + 1, i);
19298
19327
  }
19299
19328
  lastSegmentLength = i - lastSlash - 1;
19300
19329
  }
@@ -19317,24 +19346,24 @@ var decode = (s) => {
19317
19346
  };
19318
19347
  var pathNormalize = (p) => {
19319
19348
  assertPath(p);
19320
- let path21 = p;
19321
- if (path21.length === 0) {
19349
+ let path = p;
19350
+ if (path.length === 0) {
19322
19351
  return ".";
19323
19352
  }
19324
- const isAbsolute2 = path21.charCodeAt(0) === SLASH;
19325
- const trailingSeparator = path21.charCodeAt(path21.length - 1) === SLASH;
19326
- path21 = decode(path21);
19327
- path21 = posixNormalize(path21, !isAbsolute2);
19328
- if (path21.length === 0 && !isAbsolute2) {
19329
- path21 = ".";
19353
+ const isAbsolute = path.charCodeAt(0) === SLASH;
19354
+ const trailingSeparator = path.charCodeAt(path.length - 1) === SLASH;
19355
+ path = decode(path);
19356
+ path = posixNormalize(path, !isAbsolute);
19357
+ if (path.length === 0 && !isAbsolute) {
19358
+ path = ".";
19330
19359
  }
19331
- if (path21.length > 0 && trailingSeparator) {
19332
- path21 += "/";
19360
+ if (path.length > 0 && trailingSeparator) {
19361
+ path += "/";
19333
19362
  }
19334
- if (isAbsolute2) {
19335
- return "/" + path21;
19363
+ if (isAbsolute) {
19364
+ return "/" + path;
19336
19365
  }
19337
- return path21;
19366
+ return path;
19338
19367
  };
19339
19368
 
19340
19369
  // src/get-extension-of-filename.ts
@@ -19451,12 +19480,6 @@ var validateJpegQuality = (q) => {
19451
19480
  };
19452
19481
 
19453
19482
  // src/perf.ts
19454
- var exports_perf = {};
19455
- __export(exports_perf, {
19456
- stopPerfMeasure: () => stopPerfMeasure,
19457
- startPerfMeasure: () => startPerfMeasure,
19458
- getPerf: () => getPerf
19459
- });
19460
19483
  var perf = {
19461
19484
  capture: [],
19462
19485
  "extract-frame": [],
@@ -19503,7 +19526,7 @@ var validPixelFormatsForCodec = (codec) => {
19503
19526
  if (codec === "vp8" || codec === "vp9") {
19504
19527
  return validPixelFormats;
19505
19528
  }
19506
- return validPixelFormats.filter((format2) => format2 !== "yuva420p");
19529
+ return validPixelFormats.filter((format) => format !== "yuva420p");
19507
19530
  };
19508
19531
  var validateSelectedPixelFormatAndCodecCombination = (pixelFormat, codec) => {
19509
19532
  if (typeof pixelFormat === "undefined") {
@@ -19763,14 +19786,12 @@ var getCodecName = ({
19763
19786
 
19764
19787
  // src/options/color-space.tsx
19765
19788
  import { NoReactInternals as NoReactInternals12 } from "remotion/no-react";
19766
- import { jsx as jsx4, jsxs as jsxs4, Fragment as Fragment4 } from "react/jsx-runtime";
19767
19789
  var validV4ColorSpaces = ["default", "bt601", "bt709", "bt2020-ncl"];
19768
19790
  var validV5ColorSpaces = ["bt601", "bt709", "bt2020-ncl"];
19769
19791
  var validColorSpaces = NoReactInternals12.ENABLE_V5_BREAKING_CHANGES ? validV5ColorSpaces : validV4ColorSpaces;
19770
19792
  var DEFAULT_COLOR_SPACE = NoReactInternals12.ENABLE_V5_BREAKING_CHANGES ? "bt709" : "default";
19771
19793
 
19772
19794
  // src/options/gop-size.tsx
19773
- import { jsx as jsx5, jsxs as jsxs5, Fragment as Fragment5 } from "react/jsx-runtime";
19774
19795
  var validateGopSize = (value) => {
19775
19796
  if (value === null) {
19776
19797
  return;
@@ -20035,7 +20056,7 @@ var writeWithBackpressure = ({
20035
20056
  if (writable.write(data)) {
20036
20057
  return Promise.resolve();
20037
20058
  }
20038
- return new Promise((resolve2, reject) => {
20059
+ return new Promise((resolve, reject) => {
20039
20060
  const cleanup = () => {
20040
20061
  writable.off("close", onClose);
20041
20062
  writable.off("drain", onDrain);
@@ -20047,7 +20068,7 @@ var writeWithBackpressure = ({
20047
20068
  };
20048
20069
  const onDrain = () => {
20049
20070
  cleanup();
20050
- resolve2();
20071
+ resolve();
20051
20072
  };
20052
20073
  const onError = (error) => {
20053
20074
  cleanup();
@@ -20169,7 +20190,7 @@ var createRemotionSharedMemoryFfmpegBridge = ({
20169
20190
  return;
20170
20191
  }
20171
20192
  if (pool.pendingCount > 0) {
20172
- await new Promise((resolve2) => pool.drainWaiters.push(resolve2));
20193
+ await new Promise((resolve) => pool.drainWaiters.push(resolve));
20173
20194
  }
20174
20195
  if (fatalError || finishing || controlEnded) {
20175
20196
  return;
@@ -20193,8 +20214,8 @@ var createRemotionSharedMemoryFfmpegBridge = ({
20193
20214
  };
20194
20215
  const createRegisteredPool = (frame) => {
20195
20216
  let resolveRegistration;
20196
- const registration = new Promise((resolve2) => {
20197
- resolveRegistration = resolve2;
20217
+ const registration = new Promise((resolve) => {
20218
+ resolveRegistration = resolve;
20198
20219
  });
20199
20220
  const pool = {
20200
20221
  poolId: frame.poolId,
@@ -20295,8 +20316,8 @@ var createRemotionSharedMemoryFfmpegBridge = ({
20295
20316
  }
20296
20317
  let resolveAck;
20297
20318
  let rejectAck;
20298
- const ack = new Promise((resolve2, reject) => {
20299
- resolveAck = resolve2;
20319
+ const ack = new Promise((resolve, reject) => {
20320
+ resolveAck = resolve;
20300
20321
  rejectAck = reject;
20301
20322
  });
20302
20323
  ack.catch(() => {
@@ -20339,12 +20360,12 @@ var createRemotionSharedMemoryFfmpegBridge = ({
20339
20360
  if (fatalError) {
20340
20361
  throw fatalError;
20341
20362
  }
20342
- await new Promise((resolve2, reject) => {
20363
+ await new Promise((resolve, reject) => {
20343
20364
  control.end((error) => {
20344
20365
  if (error) {
20345
20366
  reject(error);
20346
20367
  } else {
20347
- resolve2();
20368
+ resolve();
20348
20369
  }
20349
20370
  });
20350
20371
  });
@@ -20417,9 +20438,9 @@ var probeRemotionSharedMemoryFfmpegSupport = ({
20417
20438
  logLevel
20418
20439
  }) => {
20419
20440
  const key = binariesDirectory ?? "<bundled>";
20420
- const cached2 = remotionSharedMemorySupport.get(key);
20421
- if (cached2) {
20422
- return cached2;
20441
+ const cached = remotionSharedMemorySupport.get(key);
20442
+ if (cached) {
20443
+ return cached;
20423
20444
  }
20424
20445
  const result = (async () => {
20425
20446
  try {
@@ -20526,8 +20547,8 @@ var prespawnFfmpeg = (options2) => {
20526
20547
  ["-f", "remotionshm"],
20527
20548
  ["-video_size", `${options2.width}x${options2.height}`],
20528
20549
  ["-framerate", fpsAsFraction(options2.fps)],
20529
- ["-control_fd", "3"],
20530
- ["-ack_fd", "4"],
20550
+ ["-control_fd", "0"],
20551
+ ["-ack_fd", "1"],
20531
20552
  options2.remotionSharedMemoryPoolDirectory === null ? null : ["-pool_dir", options2.remotionSharedMemoryPoolDirectory],
20532
20553
  ["-i", "remotion"]
20533
20554
  ] : [
@@ -20561,11 +20582,14 @@ var prespawnFfmpeg = (options2) => {
20561
20582
  logLevel: options2.logLevel,
20562
20583
  binariesDirectory: options2.binariesDirectory,
20563
20584
  cancelSignal: options2.signal,
20564
- options: options2.inputMode === "remotion-shared-memory" ? { stdio: ["ignore", "pipe", "pipe", "pipe", "pipe"] } : undefined
20585
+ options: options2.inputMode === "remotion-shared-memory" ? {
20586
+ stdio: "pipe",
20587
+ buffer: false
20588
+ } : undefined
20565
20589
  });
20566
20590
  const remotionSharedMemory = options2.inputMode === "remotion-shared-memory" ? createRemotionSharedMemoryFfmpegBridge({
20567
- control: task.stdio[3],
20568
- acknowledgements: task.stdio[4]
20591
+ control: task.stdin,
20592
+ acknowledgements: task.stdout
20569
20593
  }) : null;
20570
20594
  let ffmpegOutput = "";
20571
20595
  task.stderr?.on("data", (data) => {
@@ -20739,7 +20763,7 @@ class RemotionSharedMemoryCapture {
20739
20763
  if (pool.forgotten) {
20740
20764
  throw new Error("The page owning this shared-memory pool was closed.");
20741
20765
  }
20742
- await new Promise((resolve2) => pool.waiters.push(resolve2));
20766
+ await new Promise((resolve) => pool.waiters.push(resolve));
20743
20767
  }
20744
20768
  const slot = pool.availableSlots.shift();
20745
20769
  if (slot === undefined) {
@@ -20829,7 +20853,7 @@ class RemotionSharedMemoryCapture {
20829
20853
  cleanupError = error;
20830
20854
  }
20831
20855
  if (pool.ownedSlots.size > 0) {
20832
- await new Promise((resolve2) => pool.drainWaiters.push(resolve2));
20856
+ await new Promise((resolve) => pool.drainWaiters.push(resolve));
20833
20857
  }
20834
20858
  try {
20835
20859
  await setScreenshotBackground(page, false);
@@ -20878,8 +20902,8 @@ class RemotionSharedMemoryCapture {
20878
20902
  let retired = false;
20879
20903
  let retirement = null;
20880
20904
  let notifyRetirement;
20881
- const retirementSignal = new Promise((resolve2) => {
20882
- notifyRetirement = resolve2;
20905
+ const retirementSignal = new Promise((resolve) => {
20906
+ notifyRetirement = resolve;
20883
20907
  });
20884
20908
  const retirementListeners = new Set;
20885
20909
  const poolLifetime = {
@@ -20993,9 +21017,9 @@ var probeSharedMemoryCapture = async ({
20993
21017
  binariesDirectory,
20994
21018
  backend: getPreferredRemotionSharedMemoryBackend()
20995
21019
  });
20996
- const cached2 = probes.get(key);
20997
- if (cached2) {
20998
- return cached2;
21020
+ const cached = probes.get(key);
21021
+ if (cached) {
21022
+ return cached;
20999
21023
  }
21000
21024
  const probe = (async () => {
21001
21025
  const support = await probeRemotionSharedMemoryFfmpegSupport({
@@ -21126,7 +21150,7 @@ var DEFAULT = null;
21126
21150
  var cliFlag = "separate-audio-to";
21127
21151
  var separateAudioOption = {
21128
21152
  cliFlag,
21129
- description: () => `If set, the audio will not be included in the main output but rendered as a separate file at the location you pass. If the render contains no audio, a silent audio file is produced even when enforceAudioTrack is false. The muted option still takes precedence. It is recommended to use an absolute path. If a relative path is passed, it is relative to the Remotion Root.`,
21153
+ description: () => `If set, the audio will not be included in the main output but rendered as a separate file at the location you pass. If the render contains no audio, a silent audio file is produced even when enforceAudioTrack is false. Audio-only renders, muted renders and codecs without audio support cannot use this option. For local renders, use an absolute path; relative paths are resolved against the Remotion Root. On Lambda, pass an output name or custom destination as described in renderMediaOnLambda().`,
21130
21154
  docLink: "https://www.remotion.dev/docs/options/separate-audio-to",
21131
21155
  getValue: ({ commandLine }) => {
21132
21156
  if (commandLine[cliFlag]) {
@@ -21141,6 +21165,7 @@ var separateAudioOption = {
21141
21165
  };
21142
21166
  },
21143
21167
  name: "Separate audio to",
21168
+ addedIn: "4.0.123",
21144
21169
  setConfig: () => {
21145
21170
  throw new Error("Not implemented");
21146
21171
  },
@@ -21330,6 +21355,7 @@ var audioCodecOption = {
21330
21355
  description: () => `Set the format of the audio that is embedded in the video. Not all codec and audio codec combinations are supported and certain combinations require a certain file extension and container format. See the table in the docs to see possible combinations.`,
21331
21356
  docLink: "https://www.remotion.dev/docs/options/audio-codec",
21332
21357
  name: "Audio Codec",
21358
+ addedIn: "3.3.41",
21333
21359
  ssrName,
21334
21360
  type: "aac",
21335
21361
  id: cliFlag2
@@ -21799,9 +21825,9 @@ class Pool {
21799
21825
  if (resource !== undefined) {
21800
21826
  return Promise.resolve(resource);
21801
21827
  }
21802
- return new Promise((resolve2) => {
21828
+ return new Promise((resolve) => {
21803
21829
  this.waiters.push((freeResource) => {
21804
- resolve2(freeResource);
21830
+ resolve(freeResource);
21805
21831
  });
21806
21832
  });
21807
21833
  }
@@ -21926,12 +21952,12 @@ import * as assert2 from "node:assert";
21926
21952
  // src/screenshot-task.ts
21927
21953
  import fs17 from "node:fs";
21928
21954
  var screenshotTask = async ({
21929
- format: format2,
21955
+ format,
21930
21956
  height,
21931
21957
  omitBackground,
21932
21958
  page,
21933
21959
  width,
21934
- path: path23,
21960
+ path,
21935
21961
  jpegQuality,
21936
21962
  scale,
21937
21963
  remotionSharedMemory
@@ -21945,7 +21971,7 @@ var screenshotTask = async ({
21945
21971
  const cap = startPerfMeasure("capture");
21946
21972
  try {
21947
21973
  let result;
21948
- if (format2 === "pdf") {
21974
+ if (format === "pdf") {
21949
21975
  const res = await client.send("Page.printToPDF", {
21950
21976
  paperWidth: width / 96,
21951
21977
  paperHeight: height / 96,
@@ -21964,7 +21990,7 @@ var screenshotTask = async ({
21964
21990
  let value;
21965
21991
  try {
21966
21992
  ({ value } = await client.send("Page.captureScreenshot", {
21967
- format: format2,
21993
+ format,
21968
21994
  quality: jpegQuality,
21969
21995
  clip: {
21970
21996
  x: 0,
@@ -21999,11 +22025,11 @@ var screenshotTask = async ({
21999
22025
  if (omitBackground) {
22000
22026
  await setScreenshotBackground(page, false);
22001
22027
  }
22002
- const buffer2 = Buffer.from(result.data, "base64");
22003
- if (path23) {
22004
- await fs17.promises.writeFile(path23, buffer2);
22028
+ const buffer = Buffer.from(result.data, "base64");
22029
+ if (path) {
22030
+ await fs17.promises.writeFile(path, buffer);
22005
22031
  }
22006
- return buffer2;
22032
+ return buffer;
22007
22033
  } catch (err) {
22008
22034
  if (err.message.includes("Unable to capture screenshot")) {
22009
22035
  const errMessage = [
@@ -22205,18 +22231,18 @@ var renderFrameWithOptionToReject = async ({
22205
22231
  if (captureResult.status === "rejected") {
22206
22232
  throw captureResult.reason;
22207
22233
  }
22208
- const buffer2 = captureResult.value;
22234
+ const buffer = captureResult.value;
22209
22235
  if (assetsResult.status === "rejected") {
22210
- if (buffer2 !== null && isRemotionRawFrame(buffer2)) {
22236
+ if (buffer !== null && isRemotionRawFrame(buffer)) {
22211
22237
  try {
22212
- await buffer2.release();
22238
+ await buffer.release();
22213
22239
  } catch {}
22214
22240
  }
22215
22241
  throw assetsResult.reason;
22216
22242
  }
22217
22243
  const collectedAssets = assetsResult.value;
22218
- let frameBufferForArtifacts = Buffer.isBuffer(buffer2) ? buffer2 : null;
22219
- if (buffer2 !== null && isRemotionRawFrame(buffer2) && collectedAssets.some((asset) => asset.type === "artifact" && asset.contentType === "thumbnail")) {
22244
+ let frameBufferForArtifacts = Buffer.isBuffer(buffer) ? buffer : null;
22245
+ if (buffer !== null && isRemotionRawFrame(buffer) && collectedAssets.some((asset) => asset.type === "artifact" && asset.contentType === "thumbnail")) {
22220
22246
  try {
22221
22247
  const thumbnail = await takeFrame({
22222
22248
  freePage: page,
@@ -22236,34 +22262,34 @@ var renderFrameWithOptionToReject = async ({
22236
22262
  frameBufferForArtifacts = thumbnail;
22237
22263
  } catch (error) {
22238
22264
  try {
22239
- await buffer2.release();
22265
+ await buffer.release();
22240
22266
  } catch {}
22241
22267
  throw error;
22242
22268
  }
22243
22269
  }
22244
22270
  cleanupPageListeners();
22245
22271
  if (pageError) {
22246
- if (buffer2 !== null && isRemotionRawFrame(buffer2)) {
22272
+ if (buffer !== null && isRemotionRawFrame(buffer)) {
22247
22273
  try {
22248
- await buffer2.release();
22274
+ await buffer.release();
22249
22275
  } catch {}
22250
22276
  }
22251
22277
  throw pageError;
22252
22278
  }
22253
22279
  if ((onFrameBuffer || onFrame) && !assetsOnly) {
22254
- if (!buffer2) {
22280
+ if (!buffer) {
22255
22281
  throw new Error("unexpected null buffer");
22256
22282
  }
22257
22283
  if (onFrame) {
22258
- await onFrame(buffer2, frame);
22284
+ await onFrame(buffer, frame);
22259
22285
  } else {
22260
- if (isRemotionRawFrame(buffer2)) {
22286
+ if (isRemotionRawFrame(buffer)) {
22261
22287
  try {
22262
- await buffer2.release();
22288
+ await buffer.release();
22263
22289
  } catch {}
22264
22290
  throw new Error("Raw shared-memory frames cannot be passed to renderFrames().");
22265
22291
  }
22266
- await onFrameBuffer?.(buffer2, frame);
22292
+ await onFrameBuffer?.(buffer, frame);
22267
22293
  }
22268
22294
  }
22269
22295
  const audioAndVideoAssets = onlyAudioAndVideoAssets(collectedAssets);
@@ -22374,7 +22400,7 @@ var renderFrame = ({
22374
22400
  trimRightOffset,
22375
22401
  allFramesAndExtraFrames
22376
22402
  }) => {
22377
- return new Promise((resolve2, reject) => {
22403
+ return new Promise((resolve, reject) => {
22378
22404
  renderFrameWithOptionToReject({
22379
22405
  reject,
22380
22406
  width: composition.width,
@@ -22414,7 +22440,7 @@ var renderFrame = ({
22414
22440
  trimRightOffset,
22415
22441
  allFramesAndExtraFrames
22416
22442
  }).then(() => {
22417
- resolve2();
22443
+ resolve();
22418
22444
  }).catch((err) => {
22419
22445
  reject(err);
22420
22446
  });
@@ -22651,9 +22677,9 @@ var handleBrowserCrash = (instance, logLevel, indent) => {
22651
22677
  getBrowser: () => _instance,
22652
22678
  replaceBrowser: async (make, makeNewPages) => {
22653
22679
  if (replacing) {
22654
- const waiter = new Promise((resolve2, reject) => {
22680
+ const waiter = new Promise((resolve, reject) => {
22655
22681
  waiters.push({
22656
- resolve: resolve2,
22682
+ resolve,
22657
22683
  reject
22658
22684
  });
22659
22685
  });
@@ -23015,7 +23041,7 @@ var internalRenderFramesRaw = ({
23015
23041
  const browserInstance = puppeteerInstance ?? makeBrowser();
23016
23042
  const resolvedConcurrency = resolveConcurrency(concurrency);
23017
23043
  const openedPages = [];
23018
- return new Promise((resolve2, reject) => {
23044
+ return new Promise((resolve, reject) => {
23019
23045
  const cleanup = [];
23020
23046
  const onError = (err) => {
23021
23047
  reject(err);
@@ -23107,14 +23133,14 @@ var internalRenderFramesRaw = ({
23107
23133
  })
23108
23134
  ]).then((res) => {
23109
23135
  if (!server || server.compositor.pid === null) {
23110
- return resolve2(res);
23136
+ return resolve(res);
23111
23137
  }
23112
23138
  server.compositor.executeCommand("CloseAllVideos", {}).then(() => {
23113
23139
  Log.verbose({ indent, logLevel, tag: "compositor" }, "Freed memory from compositor");
23114
23140
  }).catch((err) => {
23115
23141
  Log.verbose({ indent, logLevel }, "Could not close compositor", err);
23116
23142
  });
23117
- return resolve2(res);
23143
+ return resolve(res);
23118
23144
  }).catch((err) => reject(err)).finally(() => {
23119
23145
  if (puppeteerInstance) {
23120
23146
  Promise.all(openedPages.map((p) => p.close())).catch((err) => {
@@ -23332,11 +23358,11 @@ var ensureFramesInOrder = (framesToRender) => {
23332
23358
  }
23333
23359
  };
23334
23360
  const waitForRightTimeOfFrameToBeInserted = (frameToBe) => {
23335
- return new Promise((resolve2) => {
23361
+ return new Promise((resolve) => {
23336
23362
  waiters.push({
23337
23363
  id: String(Math.random()),
23338
23364
  forFrame: frameToBe,
23339
- resolve: resolve2
23365
+ resolve
23340
23366
  });
23341
23367
  resolveWaiters();
23342
23368
  });
@@ -23356,7 +23382,6 @@ var ensureFramesInOrder = (framesToRender) => {
23356
23382
  };
23357
23383
 
23358
23384
  // src/options/x264-preset.tsx
23359
- import { jsx as jsx6, jsxs as jsxs6, Fragment as Fragment6 } from "react/jsx-runtime";
23360
23385
  var x264PresetOptions = [
23361
23386
  "ultrafast",
23362
23387
  "superfast",
@@ -23707,8 +23732,8 @@ var makeFfmpegFilterFile = (complexFilter, downloadMap) => {
23707
23732
  return makeFfmpegFilterFileStr(complexFilter.filter, downloadMap);
23708
23733
  };
23709
23734
  var makeFfmpegFilterFileStr = async (complexFilter, downloadMap) => {
23710
- const random2 = Math.random().toString().replace(".", "");
23711
- const filterFile = path25.join(downloadMap.complexFilter, "complex-filter-" + random2 + ".txt");
23735
+ const random = Math.random().toString().replace(".", "");
23736
+ const filterFile = path25.join(downloadMap.complexFilter, "complex-filter-" + random + ".txt");
23712
23737
  if (!existsSync5(downloadMap.complexFilter)) {
23713
23738
  fs19.mkdirSync(downloadMap.complexFilter, { recursive: true });
23714
23739
  }
@@ -24184,10 +24209,12 @@ var stringifyFfmpegFilter = ({
24184
24209
  }
24185
24210
  const { toneFrequency, startInVideo } = asset;
24186
24211
  const startInVideoSeconds = startInVideo / fps;
24212
+ const assetTrimLeftOffset = startInVideo === 0 ? trimLeftOffset : 0;
24213
+ const startInChunkSeconds = startInVideo === 0 ? 0 : startInVideoSeconds - trimLeftOffset;
24187
24214
  const { trimLeft, maxTrim } = getActualTrimLeft({
24188
24215
  trimLeft: asset.trimLeft,
24189
24216
  fps,
24190
- trimLeftOffset,
24217
+ trimLeftOffset: assetTrimLeftOffset,
24191
24218
  seamless: forSeamlessAacConcatenation,
24192
24219
  assetDuration,
24193
24220
  audioStartFrame: asset.audioStartFrame,
@@ -24205,7 +24232,7 @@ var stringifyFfmpegFilter = ({
24205
24232
  filter: trimAndTempoFilter
24206
24233
  } = trimAndSetTempo({
24207
24234
  assetDuration,
24208
- trimLeftOffset,
24235
+ trimLeftOffset: assetTrimLeftOffset,
24209
24236
  trimRightOffset,
24210
24237
  asset,
24211
24238
  fps,
@@ -24217,8 +24244,8 @@ var stringifyFfmpegFilter = ({
24217
24244
  fps,
24218
24245
  trimLeft: actualTrimLeft
24219
24246
  });
24220
- const padAtEnd = chunkLengthInSeconds - audibleDuration - startInVideoSeconds;
24221
- const padStart = startInVideoSeconds + (asset.trimLeft === 0 ? presentationTimeOffsetInSeconds : 0);
24247
+ const padAtEnd = chunkLengthInSeconds - audibleDuration - startInChunkSeconds;
24248
+ const padStart = startInChunkSeconds + (asset.trimLeft === 0 ? presentationTimeOffsetInSeconds : 0);
24222
24249
  return {
24223
24250
  filter: "[0:a]" + [
24224
24251
  `aformat=sample_fmts=s16:sample_rates=${sampleRate}`,
@@ -24598,6 +24625,8 @@ var muxVideoAndAudio = async ({
24598
24625
  audioOutput ? "copy" : null,
24599
24626
  videoOutput ? "-r" : null,
24600
24627
  videoOutput ? String(fps) : null,
24628
+ videoOutput ? "-video_track_timescale" : null,
24629
+ videoOutput ? "90000" : null,
24601
24630
  numberOfGifLoops === null ? null : "-loop",
24602
24631
  numberOfGifLoops === null ? null : convertNumberOfGifLoopsToFfmpegSyntax(numberOfGifLoops),
24603
24632
  mp4Brand ? "-f" : null,
@@ -24868,13 +24897,13 @@ var innerStitchFramesToVideo = async ({
24868
24897
  cpSync2(audioOnlyFile, outputLocation ?? tempFile);
24869
24898
  onProgress?.(Math.round(assetsInfo.chunkLengthInSeconds * fps));
24870
24899
  deleteDirectory(path30.dirname(audio));
24871
- const file = await new Promise((resolve2, reject) => {
24900
+ const file = await new Promise((resolve, reject) => {
24872
24901
  if (tempFile) {
24873
24902
  promises5.readFile(tempFile).then((f) => {
24874
- return resolve2(f);
24903
+ return resolve(f);
24875
24904
  }).catch((e) => reject(e));
24876
24905
  } else {
24877
- resolve2(null);
24906
+ resolve(null);
24878
24907
  }
24879
24908
  });
24880
24909
  deleteDirectory(assetsInfo.downloadMap.stitchFrames);
@@ -24980,10 +25009,10 @@ var innerStitchFramesToVideo = async ({
24980
25009
  }
24981
25010
  }
24982
25011
  });
24983
- await new Promise((resolve2, reject) => {
25012
+ await new Promise((resolve, reject) => {
24984
25013
  task.once("close", (code, signal) => {
24985
25014
  if (code === 0) {
24986
- resolve2();
25015
+ resolve();
24987
25016
  } else {
24988
25017
  reject(new Error(`FFmpeg quit with code ${code} ${signal ? `(${signal})` : ""} The FFmpeg output was ${ffmpegStderr}`));
24989
25018
  }
@@ -25218,7 +25247,7 @@ var validateOutputFilename = ({
25218
25247
  if (NoReactInternals19.ENABLE_V5_BREAKING_CHANGES && codec === "aac" && (normalizedExtension === "mpg" || normalizedExtension === "mpeg")) {
25219
25248
  throw new Error("AAC output with .mpg or .mpeg extensions is not supported. Use .aac for raw ADTS AAC or .m4a for an MPEG-4 audio container.");
25220
25249
  }
25221
- const map3 = defaultFileExtensionMap[codec];
25250
+ const map = defaultFileExtensionMap[codec];
25222
25251
  const resolvedAudioCodec = resolveAudioCodec({
25223
25252
  codec,
25224
25253
  preferLossless,
@@ -25226,15 +25255,15 @@ var validateOutputFilename = ({
25226
25255
  separateAudioTo
25227
25256
  });
25228
25257
  if (resolvedAudioCodec === null) {
25229
- if (normalizedExtension !== map3.default) {
25230
- throw new TypeError(`When using the ${codec} codec, the output filename must end in .${map3.default}.`);
25258
+ if (normalizedExtension !== map.default) {
25259
+ throw new TypeError(`When using the ${codec} codec, the output filename must end in .${map.default}.`);
25231
25260
  }
25232
25261
  return;
25233
25262
  }
25234
- if (!(resolvedAudioCodec in map3.forAudioCodec)) {
25263
+ if (!(resolvedAudioCodec in map.forAudioCodec)) {
25235
25264
  throw new Error(`Audio codec ${resolvedAudioCodec} is not supported for codec ${codec}`);
25236
25265
  }
25237
- const acceptableExtensions = map3.forAudioCodec[resolvedAudioCodec].possible;
25266
+ const acceptableExtensions = map.forAudioCodec[resolvedAudioCodec].possible;
25238
25267
  if (!acceptableExtensions.includes(normalizedExtension) && !separateAudioTo) {
25239
25268
  throw new TypeError(`When using the ${codec} codec with the ${resolvedAudioCodec} audio codec, the output filename must end in one of the following: ${acceptableExtensions.join(", ")}.`);
25240
25269
  }
@@ -25408,12 +25437,12 @@ var internalRenderMediaRaw = async ({
25408
25437
  }
25409
25438
  const imageFormat = isAudioCodec(codec) ? "none" : provisionalImageFormat ?? compositionWithPossibleUnevenDimensions.defaultVideoImageFormat ?? DEFAULT_VIDEO_IMAGE_FORMAT;
25410
25439
  validateVideoImageFormat(imageFormat);
25411
- const remotionSharedMemorySupport2 = !parallelEncoding || disableSharedMemoryCapture ? null : await probeRemotionSharedMemoryFfmpegSupport({
25440
+ const remotionSharedMemorySupport = !parallelEncoding || disableSharedMemoryCapture ? null : await probeRemotionSharedMemoryFfmpegSupport({
25412
25441
  binariesDirectory,
25413
25442
  indent,
25414
25443
  logLevel
25415
25444
  });
25416
- if (!remotionSharedMemorySupport2?.sharedMemory) {
25445
+ if (!remotionSharedMemorySupport?.sharedMemory) {
25417
25446
  validateSelectedPixelFormatAndImageFormatCombination(pixelFormat, imageFormat);
25418
25447
  }
25419
25448
  const workingDir = fs20.mkdtempSync(path31.join(os11.tmpdir(), "react-motion-render"));
@@ -25435,8 +25464,8 @@ var internalRenderMediaRaw = async ({
25435
25464
  if (disableSharedMemoryCapture) {
25436
25465
  Log.verbose({ indent, logLevel, tag: "renderMedia()" }, "Shared-memory capture is disabled by configuration.");
25437
25466
  }
25438
- const remotionSharedMemoryPoolDirectory = remotionSharedMemorySupport2?.filePools ? fs20.mkdtempSync(path31.join(workingDir, "shm-pools-")) : null;
25439
- const remotionSharedMemory = remotionSharedMemorySupport2?.sharedMemory ? new RemotionSharedMemoryCapture({
25467
+ const remotionSharedMemoryPoolDirectory = remotionSharedMemorySupport?.filePools ? fs20.mkdtempSync(path31.join(workingDir, "shm-pools-")) : null;
25468
+ const remotionSharedMemory = remotionSharedMemorySupport?.sharedMemory ? new RemotionSharedMemoryCapture({
25440
25469
  width: Math.round(actualWidth),
25441
25470
  height: Math.round(actualHeight),
25442
25471
  indent,
@@ -25477,8 +25506,8 @@ var internalRenderMediaRaw = async ({
25477
25506
  validateFps(fps, 'in "renderMedia()"', codec === "gif");
25478
25507
  let preStitcherInputMode = null;
25479
25508
  let notifyPreStitcherStarted;
25480
- const preStitcherStarted = new Promise((resolve2) => {
25481
- notifyPreStitcherStarted = resolve2;
25509
+ const preStitcherStarted = new Promise((resolve) => {
25510
+ notifyPreStitcherStarted = resolve;
25482
25511
  });
25483
25512
  const createPrestitcherIfNecessary = (inputMode) => {
25484
25513
  if (preEncodedFileLocation && !preStitcher) {
@@ -25558,7 +25587,7 @@ var internalRenderMediaRaw = async ({
25558
25587
  minTime = slowestFrames[slowestFrames.length - 1]?.time ?? minTime;
25559
25588
  };
25560
25589
  let cleanupServerFn = () => Promise.resolve(undefined);
25561
- const happyPath = new Promise((resolve2, reject) => {
25590
+ const happyPath = new Promise((resolve, reject) => {
25562
25591
  Promise.resolve().then(() => {
25563
25592
  return makeOrReuseServer(reusedServer, {
25564
25593
  offthreadVideoThreads: offthreadVideoThreads ?? DEFAULT_RENDER_FRAMES_OFFTHREAD_VIDEO_THREADS,
@@ -25770,17 +25799,17 @@ var internalRenderMediaRaw = async ({
25770
25799
  onLog,
25771
25800
  sampleRate
25772
25801
  });
25773
- }).then((buffer2) => {
25802
+ }).then((buffer) => {
25774
25803
  Log.verbose({ indent, logLevel }, "Stitching done in", encodedDoneIn + "ms");
25775
25804
  slowestFrames.sort((a, b) => b.time - a.time);
25776
25805
  const result = {
25777
- buffer: buffer2,
25806
+ buffer,
25778
25807
  slowestFrames,
25779
25808
  contentType: mimeLookup("file." + getFileExtensionFromCodec(codec, audioCodec)) || "application/octet-stream"
25780
25809
  };
25781
25810
  const sendTelemetryAndResolve = () => {
25782
25811
  if (licenseKey === null) {
25783
- resolve2(result);
25812
+ resolve(result);
25784
25813
  return;
25785
25814
  }
25786
25815
  LicensingInternals.internalRegisterUsageEvent({
@@ -25796,7 +25825,7 @@ var internalRenderMediaRaw = async ({
25796
25825
  Log.error({ indent, logLevel }, "Failed to send usage event");
25797
25826
  Log.error({ indent: true, logLevel }, err);
25798
25827
  }).finally(() => {
25799
- resolve2(result);
25828
+ resolve(result);
25800
25829
  });
25801
25830
  };
25802
25831
  if (isReproEnabled()) {
@@ -26191,7 +26220,7 @@ var innerRenderStill = async ({
26191
26220
  logLevel,
26192
26221
  attempt: 0
26193
26222
  });
26194
- const [buffer2, collectedAssets] = await Promise.all([
26223
+ const [buffer, collectedAssets] = await Promise.all([
26195
26224
  takeFrame({
26196
26225
  freePage: page,
26197
26226
  height: composition.height,
@@ -26212,7 +26241,7 @@ var innerRenderStill = async ({
26212
26241
  ]);
26213
26242
  const artifactAssets = onlyArtifact({
26214
26243
  assets: collectedAssets,
26215
- frameBuffer: buffer2
26244
+ frameBuffer: buffer
26216
26245
  });
26217
26246
  const previousArtifactAssets = [];
26218
26247
  for (const artifact of artifactAssets) {
@@ -26226,13 +26255,13 @@ var innerRenderStill = async ({
26226
26255
  }
26227
26256
  await cleanup();
26228
26257
  return {
26229
- buffer: output ? null : buffer2,
26258
+ buffer: output ? null : buffer,
26230
26259
  contentType: mimeLookup("file." + imageFormat) || "application/octet-stream"
26231
26260
  };
26232
26261
  };
26233
26262
  var internalRenderStillRaw = (options2) => {
26234
26263
  const cleanup = [];
26235
- const happyPath = new Promise((resolve2, reject) => {
26264
+ const happyPath = new Promise((resolve, reject) => {
26236
26265
  const onError = (err) => reject(err);
26237
26266
  makeOrReuseServer(options2.server, {
26238
26267
  webpackConfigOrServeUrl: options2.serveUrl,
@@ -26259,7 +26288,7 @@ var internalRenderStillRaw = (options2) => {
26259
26288
  });
26260
26289
  }).then((res) => {
26261
26290
  if (options2.licenseKey === null) {
26262
- resolve2(res);
26291
+ resolve(res);
26263
26292
  return;
26264
26293
  }
26265
26294
  LicensingInternals2.internalRegisterUsageEvent({
@@ -26275,7 +26304,7 @@ var internalRenderStillRaw = (options2) => {
26275
26304
  Log.error(options2, "Failed to send usage event");
26276
26305
  Log.error(options2, err);
26277
26306
  }).finally(() => {
26278
- resolve2(res);
26307
+ resolve(res);
26279
26308
  });
26280
26309
  }).catch((err) => reject(err)).finally(() => {
26281
26310
  cleanup.forEach((c) => {
@@ -26556,7 +26585,7 @@ var internalSelectCompositionRaw = async (options2) => {
26556
26585
  })
26557
26586
  ]);
26558
26587
  cleanup.push(() => cleanupPage());
26559
- return new Promise((resolve2, reject) => {
26588
+ return new Promise((resolve, reject) => {
26560
26589
  const onError = (err) => reject(err);
26561
26590
  cleanup.push(handleJavascriptException({
26562
26591
  page,
@@ -26585,7 +26614,7 @@ var internalSelectCompositionRaw = async (options2) => {
26585
26614
  chromeMode,
26586
26615
  mediaCacheSizeInBytes
26587
26616
  }).then((data) => {
26588
- return resolve2(data);
26617
+ return resolve(data);
26589
26618
  }).catch((err) => {
26590
26619
  reject(err);
26591
26620
  }).finally(() => {
@@ -26739,7 +26768,7 @@ var getMaxConcurrency = () => {
26739
26768
  };
26740
26769
  var getMinConcurrency = () => 1;
26741
26770
  // src/combine-chunks.ts
26742
- import { rmSync as rmSync6 } from "node:fs";
26771
+ import { copyFileSync, rmSync as rmSync6 } from "node:fs";
26743
26772
  import { join as join6 } from "node:path";
26744
26773
 
26745
26774
  // src/can-concat-seamlessly.ts
@@ -26793,6 +26822,8 @@ var combineVideoStreams = async ({
26793
26822
  "-an",
26794
26823
  "-c:v",
26795
26824
  encoder,
26825
+ "-video_track_timescale",
26826
+ "90000",
26796
26827
  codec === "h265" ? "-tag:v" : null,
26797
26828
  codec === "h265" ? "hvc1" : null,
26798
26829
  addRemotionMetadata ? `-metadata` : null,
@@ -26858,23 +26889,27 @@ var internalCombineChunks = async ({
26858
26889
  everyNthFrame,
26859
26890
  frameRange,
26860
26891
  compositionDurationInFrames,
26861
- sampleRate
26892
+ sampleRate,
26893
+ separateAudioTo
26862
26894
  }) => {
26863
26895
  validateNumberOfGifLoops(numberOfGifLoops, codec);
26864
- const filelistDir = tmpDir(REMOTION_FILELIST_TOKEN);
26865
26896
  const shouldCreateVideo = !isAudioCodec(codec);
26866
26897
  const resolvedAudioCodec = resolveAudioCodec({
26867
26898
  setting: audioCodec,
26868
26899
  codec,
26869
26900
  preferLossless,
26870
- separateAudioTo: null
26901
+ separateAudioTo
26871
26902
  });
26872
26903
  const shouldCreateAudio = resolvedAudioCodec !== null && audioFiles.length > 0;
26904
+ if (separateAudioTo !== null && (!shouldCreateAudio || !shouldCreateVideo)) {
26905
+ throw new Error("Separate audio requires a video render with audio chunks.");
26906
+ }
26873
26907
  const seamlessVideo = canConcatVideoSeamlessly(codec);
26874
26908
  const realFrameRange = getRealFrameRange(compositionDurationInFrames, frameRange);
26875
26909
  const seamlessAudio = canConcatAudioSeamlessly(resolvedAudioCodec, framesPerChunk);
26876
26910
  const numberOfFrames = getFramesToRender(realFrameRange, everyNthFrame).length;
26877
- const videoOutput = shouldCreateVideo ? join6(filelistDir, `video.${getFileExtensionFromCodec(codec, resolvedAudioCodec)}`) : null;
26911
+ const filelistDir = tmpDir(REMOTION_FILELIST_TOKEN);
26912
+ const videoOutput = shouldCreateVideo ? join6(filelistDir, `video.${getFileExtensionFromCodec(codec, separateAudioTo === null ? resolvedAudioCodec : null)}`) : null;
26878
26913
  const audioOutput = shouldCreateAudio ? join6(filelistDir, `audio.${getExtensionFromAudioCodec(resolvedAudioCodec)}`) : null;
26879
26914
  const chunkDurationInSeconds = framesPerChunk / fps;
26880
26915
  let concatenatedAudio = 0;
@@ -26889,48 +26924,48 @@ var internalCombineChunks = async ({
26889
26924
  });
26890
26925
  };
26891
26926
  Log.verbose({ indent, logLevel }, `Combining chunks, audio = ${shouldCreateAudio === false ? "no" : seamlessAudio ? "seamlessly" : "normally"}, video = ${shouldCreateVideo === false ? "no" : seamlessVideo ? "seamlessly" : "normally"}`);
26892
- await Promise.all([
26893
- shouldCreateAudio && audioOutput ? createCombinedAudio({
26894
- audioBitrate,
26895
- filelistDir,
26896
- files: audioFiles,
26897
- indent,
26898
- logLevel,
26899
- output: audioOutput,
26900
- resolvedAudioCodec,
26901
- seamless: seamlessAudio,
26902
- chunkDurationInSeconds,
26903
- addRemotionMetadata: !shouldCreateVideo,
26904
- binariesDirectory,
26905
- fps,
26906
- cancelSignal,
26907
- onProgress: (frames) => {
26908
- concatenatedAudio = frames;
26909
- updateProgress();
26910
- },
26911
- sampleRate
26912
- }) : null,
26913
- shouldCreateVideo && !seamlessVideo && videoOutput ? combineVideoStreams({
26914
- codec,
26915
- filelistDir,
26916
- fps,
26917
- indent,
26918
- logLevel,
26919
- numberOfGifLoops,
26920
- output: videoOutput,
26921
- files: videoFiles,
26922
- addRemotionMetadata: !shouldCreateAudio,
26923
- binariesDirectory,
26924
- cancelSignal,
26925
- onProgress: (frames) => {
26926
- concatenatedVideo = frames;
26927
- updateProgress();
26928
- }
26929
- }) : null
26930
- ].filter(truthy));
26931
26927
  try {
26928
+ await Promise.all([
26929
+ shouldCreateAudio && audioOutput ? createCombinedAudio({
26930
+ audioBitrate,
26931
+ filelistDir,
26932
+ files: audioFiles,
26933
+ indent,
26934
+ logLevel,
26935
+ output: audioOutput,
26936
+ resolvedAudioCodec,
26937
+ seamless: seamlessAudio,
26938
+ chunkDurationInSeconds,
26939
+ addRemotionMetadata: !shouldCreateVideo,
26940
+ binariesDirectory,
26941
+ fps,
26942
+ cancelSignal,
26943
+ onProgress: (frames) => {
26944
+ concatenatedAudio = frames;
26945
+ updateProgress();
26946
+ },
26947
+ sampleRate
26948
+ }) : null,
26949
+ shouldCreateVideo && !seamlessVideo && videoOutput ? combineVideoStreams({
26950
+ codec,
26951
+ filelistDir,
26952
+ fps,
26953
+ indent,
26954
+ logLevel,
26955
+ numberOfGifLoops,
26956
+ output: videoOutput,
26957
+ files: videoFiles,
26958
+ addRemotionMetadata: !shouldCreateAudio,
26959
+ binariesDirectory,
26960
+ cancelSignal,
26961
+ onProgress: (frames) => {
26962
+ concatenatedVideo = frames;
26963
+ updateProgress();
26964
+ }
26965
+ }) : null
26966
+ ].filter(truthy));
26932
26967
  await muxVideoAndAudio({
26933
- audioOutput,
26968
+ audioOutput: separateAudioTo === null ? audioOutput : null,
26934
26969
  indent,
26935
26970
  logLevel,
26936
26971
  onProgress: (frames) => {
@@ -26947,11 +26982,33 @@ var internalCombineChunks = async ({
26947
26982
  audioCodec: resolvedAudioCodec,
26948
26983
  sampleRate
26949
26984
  });
26985
+ if (separateAudioTo !== null && audioOutput !== null) {
26986
+ const extension = getExtensionOfFilename(separateAudioTo)?.toLowerCase() ?? null;
26987
+ if (getMp4BrandForExtension(extension)) {
26988
+ await muxVideoAndAudio({
26989
+ videoOutput: null,
26990
+ audioOutput,
26991
+ output: separateAudioTo,
26992
+ indent,
26993
+ logLevel,
26994
+ onProgress: () => {
26995
+ return;
26996
+ },
26997
+ binariesDirectory,
26998
+ fps,
26999
+ cancelSignal,
27000
+ metadata: null,
27001
+ numberOfGifLoops: null,
27002
+ audioCodec: resolvedAudioCodec,
27003
+ sampleRate
27004
+ });
27005
+ } else {
27006
+ copyFileSync(audioOutput, separateAudioTo);
27007
+ }
27008
+ }
26950
27009
  onProgress({ totalProgress: 1, frames: numberOfFrames });
26951
- rmSync6(filelistDir, { recursive: true });
26952
- } catch (err) {
26953
- rmSync6(filelistDir, { recursive: true });
26954
- throw err;
27010
+ } finally {
27011
+ rmSync6(filelistDir, { recursive: true, force: true });
26955
27012
  }
26956
27013
  };
26957
27014
  var combineChunks = (options2) => {
@@ -26975,7 +27032,8 @@ var combineChunks = (options2) => {
26975
27032
  everyNthFrame: options2.everyNthFrame ?? 1,
26976
27033
  frameRange: options2.frameRange ?? null,
26977
27034
  compositionDurationInFrames: options2.compositionDurationInFrames,
26978
- sampleRate: options2.sampleRate ?? 48000
27035
+ sampleRate: options2.sampleRate ?? 48000,
27036
+ separateAudioTo: null
26979
27037
  });
26980
27038
  };
26981
27039
  // src/extract-audio.ts
@@ -27095,10 +27153,7 @@ var getVideoMetadata = async (videoSource, options2) => {
27095
27153
  await compositor.waitForDone();
27096
27154
  return JSON.parse(new TextDecoder("utf-8").decode(metadataResponse));
27097
27155
  };
27098
- // src/options/chrome-mode.tsx
27099
- import { jsx as jsx7, jsxs as jsxs7, Fragment as Fragment7 } from "react/jsx-runtime";
27100
27156
  // src/options/default-coding-agent.tsx
27101
- import { jsx as jsx8, jsxs as jsxs8, Fragment as Fragment8 } from "react/jsx-runtime";
27102
27157
  var defaultCodingAgentIds = [
27103
27158
  "codex",
27104
27159
  "cursor",
@@ -27106,7 +27161,6 @@ var defaultCodingAgentIds = [
27106
27161
  "claude-code"
27107
27162
  ];
27108
27163
  // src/options/default-editor.tsx
27109
- import { jsx as jsx9, jsxs as jsxs9, Fragment as Fragment9 } from "react/jsx-runtime";
27110
27164
  var defaultEditorIds = [
27111
27165
  "vscode",
27112
27166
  "cursor",
@@ -27119,10 +27173,6 @@ var defaultEditorIds = [
27119
27173
  var customEditorTargetPathPlaceholder = "%TARGET_PATH%";
27120
27174
  var customEditorLineNumberPlaceholder = "%LINE_NUMBER%";
27121
27175
  var customEditorColumnNumberPlaceholder = "%COLUMN_NUMBER%";
27122
- // src/options/number-of-gif-loops.tsx
27123
- import { jsx as jsx10, jsxs as jsxs10, Fragment as Fragment10 } from "react/jsx-runtime";
27124
- // src/options/on-browser-download.tsx
27125
- import { jsx as jsx11, jsxs as jsxs11, Fragment as Fragment11 } from "react/jsx-runtime";
27126
27176
  // src/index.ts
27127
27177
  var RenderInternals = {
27128
27178
  resolveConcurrency,
@@ -27222,26 +27272,26 @@ var RenderInternals = {
27222
27272
  };
27223
27273
  checkRuntimeVersion("info", false);
27224
27274
  export {
27225
- validateSelectedPixelFormatAndImageFormatCombination,
27226
- validateOutputFilename,
27227
- stitchFramesToVideo,
27228
- selectComposition,
27229
- renderStill,
27230
- renderMedia,
27231
- renderFrames,
27232
- openBrowser,
27233
- makeCancelSignal,
27234
- getVideoMetadata,
27235
- getSilentParts,
27236
- getCompositions,
27237
- extractAudio,
27238
- ensureBrowser,
27239
- defaultEditorIds,
27240
- defaultCodingAgentIds,
27241
- customEditorTargetPathPlaceholder,
27242
- customEditorLineNumberPlaceholder,
27243
- customEditorColumnNumberPlaceholder,
27244
- combineChunks,
27275
+ ErrorWithStackFrame,
27245
27276
  RenderInternals,
27246
- ErrorWithStackFrame
27277
+ combineChunks,
27278
+ customEditorColumnNumberPlaceholder,
27279
+ customEditorLineNumberPlaceholder,
27280
+ customEditorTargetPathPlaceholder,
27281
+ defaultCodingAgentIds,
27282
+ defaultEditorIds,
27283
+ ensureBrowser,
27284
+ extractAudio,
27285
+ getCompositions,
27286
+ getSilentParts,
27287
+ getVideoMetadata,
27288
+ makeCancelSignal,
27289
+ openBrowser,
27290
+ renderFrames,
27291
+ renderMedia,
27292
+ renderStill,
27293
+ selectComposition,
27294
+ stitchFramesToVideo,
27295
+ validateOutputFilename,
27296
+ validateSelectedPixelFormatAndImageFormatCombination
27247
27297
  };