@remotion/renderer 4.0.538 → 4.0.540

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 (151) hide show
  1. package/dist/assets/download-and-map-assets-to-file.js +16 -3
  2. package/dist/assets/download-file.js +9 -2
  3. package/dist/assets/download-map.d.ts +1 -1
  4. package/dist/assets/read-file.d.ts +1 -1
  5. package/dist/assets/read-file.js +7 -7
  6. package/dist/browser/BrowserFetcher.js +4 -1
  7. package/dist/browser/BrowserPage.js +27 -8
  8. package/dist/browser/NetworkManager.js +6 -1
  9. package/dist/browser/devtools-commands.d.ts +6 -1
  10. package/dist/browser/get-chrome-download-url.d.ts +1 -1
  11. package/dist/browser/get-chrome-download-url.js +4 -1
  12. package/dist/check-version-requirements.js +6 -6
  13. package/dist/client.d.ts +459 -238
  14. package/dist/esm/client.mjs +372 -314
  15. package/dist/esm/index.mjs +393 -349
  16. package/dist/get-compositions.js +6 -3
  17. package/dist/index.d.ts +113 -41
  18. package/dist/index.js +4 -2
  19. package/dist/make-page.d.ts +3 -1
  20. package/dist/make-page.js +2 -1
  21. package/dist/merge-audio-track.d.ts +1 -1
  22. package/dist/merge-audio-track.js +24 -23
  23. package/dist/options/allow-html-in-canvas.d.ts +1 -1
  24. package/dist/options/api-key.d.ts +1 -1
  25. package/dist/options/ask-ai.d.ts +1 -1
  26. package/dist/options/ask-ai.js +1 -1
  27. package/dist/options/audio-bitrate.d.ts +1 -1
  28. package/dist/options/beep-on-finish.d.ts +1 -1
  29. package/dist/options/benchmark-concurrencies.d.ts +1 -1
  30. package/dist/options/binaries-directory.d.ts +1 -1
  31. package/dist/options/browser-executable.d.ts +1 -1
  32. package/dist/options/browser-executable.js +1 -1
  33. package/dist/options/browser.d.ts +1 -1
  34. package/dist/options/bundle-cache.d.ts +1 -1
  35. package/dist/options/canvas-tabs.d.ts +1 -1
  36. package/dist/options/chrome-mode.d.ts +1 -1
  37. package/dist/options/color-space.d.ts +1 -1
  38. package/dist/options/concurrency.d.ts +1 -1
  39. package/dist/options/config.d.ts +1 -1
  40. package/dist/options/crf.d.ts +1 -1
  41. package/dist/options/crf.js +1 -1
  42. package/dist/options/cross-site-isolation.d.ts +1 -1
  43. package/dist/options/cross-site-isolation.js +2 -2
  44. package/dist/options/dark-mode.d.ts +1 -1
  45. package/dist/options/default-coding-agent.d.ts +1 -1
  46. package/dist/options/default-editor.d.ts +1 -1
  47. package/dist/options/default-premount-in-seconds.d.ts +1 -1
  48. package/dist/options/delete-after.d.ts +1 -1
  49. package/dist/options/disable-git-source.d.ts +2 -2
  50. package/dist/options/disable-shared-memory-capture.d.ts +1 -1
  51. package/dist/options/disable-web-security.d.ts +1 -1
  52. package/dist/options/disallow-parallel-encoding.d.ts +1 -1
  53. package/dist/options/enable-cancellation.d.ts +1 -1
  54. package/dist/options/enable-lambda-insights.d.ts +1 -1
  55. package/dist/options/enable-lambda-insights.js +2 -2
  56. package/dist/options/enable-multiprocess-on-linux.d.ts +1 -1
  57. package/dist/options/enable-multiprocess-on-linux.js +2 -2
  58. package/dist/options/encoding-buffer-size.d.ts +1 -1
  59. package/dist/options/encoding-max-rate.d.ts +1 -1
  60. package/dist/options/enforce-audio.d.ts +1 -1
  61. package/dist/options/env-file.d.ts +1 -1
  62. package/dist/options/every-nth-frame.d.ts +1 -1
  63. package/dist/options/experimental-keep-audio-context-alive.d.ts +1 -1
  64. package/dist/options/folder-expiry.d.ts +1 -1
  65. package/dist/options/folder-expiry.js +1 -1
  66. package/dist/options/for-seamless-aac-concatenation.d.ts +1 -1
  67. package/dist/options/force-new-studio.d.ts +1 -1
  68. package/dist/options/frames.d.ts +1 -1
  69. package/dist/options/gl.d.ts +1 -1
  70. package/dist/options/gop-size.d.ts +1 -1
  71. package/dist/options/headless.d.ts +1 -1
  72. package/dist/options/ignore-certificate-errors.d.ts +1 -1
  73. package/dist/options/image-sequence-pattern.d.ts +1 -1
  74. package/dist/options/image-sequence.d.ts +1 -1
  75. package/dist/options/index.d.ts +119 -102
  76. package/dist/options/index.js +2 -0
  77. package/dist/options/interactivity.d.ts +1 -1
  78. package/dist/options/ipv4.d.ts +1 -1
  79. package/dist/options/is-production.d.ts +1 -1
  80. package/dist/options/is-production.js +1 -1
  81. package/dist/options/jpeg-quality.d.ts +1 -1
  82. package/dist/options/keyboard-shortcuts.d.ts +1 -1
  83. package/dist/options/latency-hint.d.ts +1 -1
  84. package/dist/options/license-key.d.ts +1 -1
  85. package/dist/options/license-key.js +1 -1
  86. package/dist/options/log-level.d.ts +1 -1
  87. package/dist/options/metadata.d.ts +1 -1
  88. package/dist/options/mute.d.ts +1 -1
  89. package/dist/options/no-open.d.ts +1 -1
  90. package/dist/options/number-of-gif-loops.d.ts +1 -1
  91. package/dist/options/number-of-shared-audio-tags.d.ts +1 -1
  92. package/dist/options/offthreadvideo-cache-size.d.ts +1 -1
  93. package/dist/options/offthreadvideo-threads.d.ts +1 -1
  94. package/dist/options/on-browser-download.d.ts +1 -1
  95. package/dist/options/options-map.d.ts +340 -136
  96. package/dist/options/options-map.js +13 -0
  97. package/dist/options/out-dir.d.ts +1 -1
  98. package/dist/options/override-duration.d.ts +1 -1
  99. package/dist/options/override-fps.d.ts +1 -1
  100. package/dist/options/override-height.d.ts +1 -1
  101. package/dist/options/override-width.d.ts +1 -1
  102. package/dist/options/overwrite.d.ts +1 -1
  103. package/dist/options/package-manager.d.ts +1 -1
  104. package/dist/options/pixel-format.d.ts +1 -1
  105. package/dist/options/port.d.ts +1 -1
  106. package/dist/options/prefer-lossless.d.ts +1 -1
  107. package/dist/options/preferred-effect-backend.d.ts +18 -0
  108. package/dist/options/preferred-effect-backend.js +28 -0
  109. package/dist/options/preserve-pitch-on-playback.d.ts +1 -1
  110. package/dist/options/preview-sample-rate.d.ts +1 -1
  111. package/dist/options/props.d.ts +1 -1
  112. package/dist/options/prores-profile.d.ts +1 -1
  113. package/dist/options/public-dir.d.ts +1 -1
  114. package/dist/options/public-license-key.d.ts +1 -1
  115. package/dist/options/public-path.d.ts +1 -1
  116. package/dist/options/repro.d.ts +1 -1
  117. package/dist/options/rspack.d.ts +1 -1
  118. package/dist/options/runs.d.ts +1 -1
  119. package/dist/options/sample-rate.d.ts +1 -1
  120. package/dist/options/scale.d.ts +1 -1
  121. package/dist/options/sequence-activity-limit.d.ts +1 -1
  122. package/dist/options/show-layer-frame-numbers.d.ts +1 -1
  123. package/dist/options/show-premounting.d.ts +1 -1
  124. package/dist/options/skip-skills.d.ts +1 -1
  125. package/dist/options/still-frame.d.ts +1 -1
  126. package/dist/options/still-image-format.d.ts +1 -1
  127. package/dist/options/throw-if-site-exists.d.ts +2 -2
  128. package/dist/options/timeout.d.ts +1 -1
  129. package/dist/options/user-agent.d.ts +1 -1
  130. package/dist/options/version-flag.d.ts +1 -1
  131. package/dist/options/video-bitrate.d.ts +1 -1
  132. package/dist/options/video-cache-size.d.ts +1 -1
  133. package/dist/options/video-codec.d.ts +1 -1
  134. package/dist/options/video-image-format.d.ts +1 -1
  135. package/dist/options/webhook-custom-data.d.ts +1 -1
  136. package/dist/options/webpack-poll.d.ts +1 -1
  137. package/dist/options/x264-preset.d.ts +1 -1
  138. package/dist/render-frames.js +6 -3
  139. package/dist/render-media.d.ts +1 -1
  140. package/dist/render-media.js +4 -2
  141. package/dist/render-still.js +6 -2
  142. package/dist/select-composition.js +6 -3
  143. package/dist/serve-handler/range-parser.js +1 -1
  144. package/dist/serve-static.js +4 -1
  145. package/dist/set-props-and-env.d.ts +2 -0
  146. package/dist/set-props-and-env.js +8 -3
  147. package/dist/stringify-ffmpeg-filter.js +6 -2
  148. package/dist/symbolicate-stacktrace.js +1 -1
  149. package/dist/validate-selected-frames.d.ts +4 -4
  150. package/dist/validate-selected-frames.js +2 -31
  151. package/package.json +15 -15
@@ -1130,14 +1130,15 @@ var getClient = (url) => {
1130
1130
  }
1131
1131
  throw new Error(`Can only download URLs starting with http:// or https://, got "${url}"`);
1132
1132
  };
1133
- var readFileWithoutRedirect = (url) => {
1133
+ var readFileWithoutRedirect = (url, signal) => {
1134
1134
  return new Promise((resolve, reject) => {
1135
1135
  const client = getClient(url);
1136
1136
  const req = client(url, typeof Bun === "undefined" ? {
1137
1137
  headers: {
1138
1138
  "user-agent": "Mozilla/5.0 (@remotion/renderer - https://remotion.dev)"
1139
- }
1140
- } : {}, (res) => {
1139
+ },
1140
+ signal: signal ?? undefined
1141
+ } : { signal: signal ?? undefined }, (res) => {
1141
1142
  resolve({ request: req, response: res });
1142
1143
  });
1143
1144
  req.on("error", (err) => {
@@ -1146,20 +1147,19 @@ var readFileWithoutRedirect = (url) => {
1146
1147
  });
1147
1148
  });
1148
1149
  };
1149
- var readFile = async (url, redirectsSoFar = 0) => {
1150
+ var readFile = async (url, signal, redirectsSoFar = 0) => {
1150
1151
  if (redirectsSoFar > 10) {
1151
1152
  throw new Error(`Too many redirects while downloading ${url}`);
1152
1153
  }
1153
- const { request, response } = await readFileWithoutRedirect(url);
1154
+ const { request, response } = await readFileWithoutRedirect(url, signal);
1154
1155
  if (redirectStatusCodes.includes(response.statusCode)) {
1155
1156
  if (!response.headers.location) {
1156
1157
  throw new Error(`Received a status code ${response.statusCode} but no "Location" header while calling ${response.headers.location}`);
1157
1158
  }
1158
- const { origin } = new URL(url);
1159
- const redirectUrl = new URL(response.headers.location, origin).toString();
1159
+ const redirectUrl = new URL(response.headers.location, url).toString();
1160
1160
  request.destroy();
1161
1161
  response.destroy();
1162
- return readFile(redirectUrl, redirectsSoFar + 1);
1162
+ return readFile(redirectUrl, signal, redirectsSoFar + 1);
1163
1163
  }
1164
1164
  if (response.statusCode >= 400) {
1165
1165
  const body = await tryToObtainBody(response);
@@ -1241,23 +1241,27 @@ var downloadFileWithoutRetries = ({
1241
1241
  return;
1242
1242
  }
1243
1243
  rejectAndFlag(new Error(`Tried to download file ${url}, ${noDataSentToken} 20 seconds`));
1244
+ closeConnection();
1244
1245
  }, 20000);
1245
1246
  };
1246
1247
  refreshTimeout();
1247
1248
  let finishEventSent = false;
1248
- let closeConnection = () => {
1249
- return;
1250
- };
1249
+ const requestController = new AbortController;
1250
+ let closeConnection = () => requestController.abort();
1251
1251
  const onAbort = () => {
1252
1252
  rejectAndFlag(new Error(CANCELLED_ERROR));
1253
1253
  closeConnection();
1254
1254
  };
1255
1255
  abortSignal.addEventListener("abort", onAbort);
1256
- readFile(url).then(({ response, request }) => {
1256
+ readFile(url, requestController.signal).then(({ response, request }) => {
1257
1257
  closeConnection = () => {
1258
1258
  request.destroy();
1259
1259
  response.destroy();
1260
1260
  };
1261
+ if (rejected) {
1262
+ closeConnection();
1263
+ return;
1264
+ }
1261
1265
  if (abortSignal.aborted) {
1262
1266
  onAbort();
1263
1267
  return;
@@ -2596,7 +2600,10 @@ class NetworkManager extends EventEmitter {
2596
2600
  this.#client.on("Network.responseReceivedExtraInfo", this.#onResponseReceivedExtraInfo.bind(this));
2597
2601
  }
2598
2602
  async initialize() {
2599
- await this.#client.send("Network.enable");
2603
+ await this.#client.send("Network.enable", {
2604
+ maxTotalBufferSize: 0,
2605
+ maxResourceBufferSize: 0
2606
+ });
2600
2607
  }
2601
2608
  #onRequestWillBeSent(event) {
2602
2609
  this.#onRequest(event, undefined);
@@ -3491,6 +3498,19 @@ class Page extends EventEmitter {
3491
3498
  client.on("Runtime.consoleAPICalled", (event) => {
3492
3499
  return this.#onConsoleAPI(event);
3493
3500
  });
3501
+ client.on("Runtime.exceptionThrown", (event) => {
3502
+ const { exception, text, stackTrace, url, lineNumber, columnNumber } = event.exceptionDetails;
3503
+ const description = exception ? exception.description ?? String(exception.unserializableValue ?? exception.value) : null;
3504
+ this.onBrowserLog?.({
3505
+ type: "error",
3506
+ text: description === null ? text : `${text} ${description}`,
3507
+ stackTrace: stackTrace?.callFrames.length ? stackTrace.callFrames.map((frame) => ({
3508
+ url: frame.url,
3509
+ lineNumber: frame.lineNumber,
3510
+ columnNumber: frame.columnNumber
3511
+ })) : [{ url, lineNumber, columnNumber }]
3512
+ });
3513
+ });
3494
3514
  client.on("Runtime.bindingCalled", (event) => {
3495
3515
  return this.#onBindingCalled(event);
3496
3516
  });
@@ -3577,7 +3597,7 @@ class Page extends EventEmitter {
3577
3597
  this.emit("error", new Error("Page crashed!"));
3578
3598
  }
3579
3599
  #onLogEntryAdded(event) {
3580
- const { level, text, args, source, url, lineNumber } = event.entry;
3600
+ const { level, text, args, source, url, lineNumber, stackTrace } = event.entry;
3581
3601
  if (args) {
3582
3602
  args.map((arg) => {
3583
3603
  return releaseObject(this.#client, arg);
@@ -3589,16 +3609,15 @@ class Page extends EventEmitter {
3589
3609
  type: level,
3590
3610
  text,
3591
3611
  args: [],
3592
- stackTraceLocations: [{ url, lineNumber }],
3612
+ stackTraceLocations: stackTrace?.callFrames.length ? stackTrace.callFrames.map((frame) => ({
3613
+ url: frame.url,
3614
+ lineNumber: frame.lineNumber,
3615
+ columnNumber: frame.columnNumber
3616
+ })) : [{ url, lineNumber }],
3593
3617
  previewString,
3594
3618
  logLevel: logLevelFromRemotionLog ?? logLevelFromEvent,
3595
3619
  tag
3596
3620
  });
3597
- this.onBrowserLog?.({
3598
- stackTrace: message.stackTrace(),
3599
- text: message.text,
3600
- type: message.type
3601
- });
3602
3621
  this.#onConsole(message);
3603
3622
  }
3604
3623
  }
@@ -4779,8 +4798,106 @@ var canUseParallelEncoding = (codec) => {
4779
4798
  };
4780
4799
 
4781
4800
  // src/check-version-requirements.ts
4782
- import os2 from "node:os";
4801
+ import os3 from "node:os";
4783
4802
  import { NoReactInternals as NoReactInternals3 } from "remotion/no-react";
4803
+
4804
+ // src/browser/get-chrome-download-url.ts
4805
+ import * as fs5 from "node:fs";
4806
+ import * as os2 from "node:os";
4807
+ var TESTED_VERSION = "158.0.8127.2";
4808
+ var isAmazonLinux2023 = () => {
4809
+ if (os2.platform() !== "linux") {
4810
+ return false;
4811
+ }
4812
+ try {
4813
+ const osRelease = fs5.readFileSync("/etc/os-release", "utf-8");
4814
+ return osRelease.includes("Amazon Linux") && osRelease.includes('VERSION="2023"');
4815
+ } catch {
4816
+ return false;
4817
+ }
4818
+ };
4819
+ var MINIMUM_GLIBC_FOR_REMOTION_MEDIA = [2, 35];
4820
+ var getGlibcVersion = () => {
4821
+ if (process.platform !== "linux") {
4822
+ return null;
4823
+ }
4824
+ const { report } = process;
4825
+ if (!report) {
4826
+ return null;
4827
+ }
4828
+ const rep = report.getReport();
4829
+ if (typeof rep === "string") {
4830
+ return null;
4831
+ }
4832
+ const { glibcVersionRuntime } = rep.header;
4833
+ if (!glibcVersionRuntime) {
4834
+ return null;
4835
+ }
4836
+ const split = glibcVersionRuntime.split(".");
4837
+ if (split.length !== 2) {
4838
+ return null;
4839
+ }
4840
+ return [Number(split[0]), Number(split[1])];
4841
+ };
4842
+ var isGlibcVersionAtLeast = (required) => {
4843
+ const version = getGlibcVersion();
4844
+ if (version === null) {
4845
+ return false;
4846
+ }
4847
+ const [major, minor] = version;
4848
+ const [reqMajor, reqMinor] = required;
4849
+ if (major > reqMajor) {
4850
+ return true;
4851
+ }
4852
+ if (major === reqMajor && minor >= reqMinor) {
4853
+ return true;
4854
+ }
4855
+ return false;
4856
+ };
4857
+ var canUseRemotionMediaBinaries = () => {
4858
+ if (process.platform !== "linux") {
4859
+ return false;
4860
+ }
4861
+ return isGlibcVersionAtLeast(MINIMUM_GLIBC_FOR_REMOTION_MEDIA);
4862
+ };
4863
+ function getChromeDownloadUrl({
4864
+ platform,
4865
+ version,
4866
+ chromeMode
4867
+ }) {
4868
+ if (platform === "linux-arm64" && version && /^\d+$/.test(version)) {
4869
+ const archive = chromeMode === "chrome-for-testing" ? "chromium-linux-arm64" : "chromium-headless-shell-linux-arm64";
4870
+ return `https://playwright.azureedge.net/builds/chromium/${version}/${archive}.zip`;
4871
+ }
4872
+ if (chromeMode === "headless-shell" && version === null) {
4873
+ if (platform === "mac-arm64") {
4874
+ return `https://remotion.media/chromium-headless-shell-mac-arm64-${TESTED_VERSION}.zip?clear`;
4875
+ }
4876
+ if (platform === "win64") {
4877
+ return `https://remotion.media/chromium-headless-shell-win-x64-${TESTED_VERSION}.zip?clear`;
4878
+ }
4879
+ if (platform === "linux64" || platform === "linux-arm64") {
4880
+ const architecture = platform === "linux64" ? "x64" : "arm64";
4881
+ if (isAmazonLinux2023()) {
4882
+ return `https://remotion.media/chromium-headless-shell-amazon-linux-${architecture}-${TESTED_VERSION}.zip?clear`;
4883
+ }
4884
+ if (canUseRemotionMediaBinaries()) {
4885
+ return `https://remotion.media/chromium-headless-shell-linux-${architecture}-${TESTED_VERSION}.zip?clear`;
4886
+ }
4887
+ }
4888
+ }
4889
+ const archive = chromeMode === "headless-shell" ? "chrome-headless-shell" : "chrome";
4890
+ return `https://storage.googleapis.com/chrome-for-testing-public/${version ?? TESTED_VERSION}/${platform}/${archive}-${platform}.zip`;
4891
+ }
4892
+ var logDownloadUrl = ({
4893
+ url,
4894
+ logLevel,
4895
+ indent
4896
+ }) => {
4897
+ Log.info({ indent, logLevel }, `Downloading from: ${url}`);
4898
+ };
4899
+
4900
+ // src/check-version-requirements.ts
4784
4901
  var getRequiredLibCVersion = () => {
4785
4902
  if (process.platform !== "linux") {
4786
4903
  return null;
@@ -4788,10 +4905,10 @@ var getRequiredLibCVersion = () => {
4788
4905
  if (isMusl({ indent: false, logLevel: "warn" })) {
4789
4906
  return null;
4790
4907
  }
4791
- if (process.arch === "arm64") {
4792
- return [2, 26];
4908
+ if (process.arch === "arm64" && isAmazonLinux2023()) {
4909
+ return [2, 34];
4793
4910
  }
4794
- return [2, 31];
4911
+ return [2, 35];
4795
4912
  };
4796
4913
  var required = getRequiredLibCVersion();
4797
4914
  var gLibCErrorMessage = (libCString) => {
@@ -4808,7 +4925,7 @@ var gLibCErrorMessage = (libCString) => {
4808
4925
  if (Number(split[0]) > required[0]) {
4809
4926
  return null;
4810
4927
  }
4811
- return `Rendering videos requires glibc ${required.join(".")} on your or higher on your OS. Your system has glibc ${libCString}.`;
4928
+ return `Rendering videos requires glibc ${required.join(".")} or higher on your OS. Your system has glibc ${libCString}.`;
4812
4929
  };
4813
4930
  var checkLibCRequirement = (logLevel, indent) => {
4814
4931
  if (process.platform === "win32" || process.platform === "darwin") {
@@ -4849,7 +4966,7 @@ var checkMacOSVersion = (logLevel, indent) => {
4849
4966
  if (process.platform !== "darwin") {
4850
4967
  return;
4851
4968
  }
4852
- const majorVersion = Number(os2.release().split(".")[0]);
4969
+ const majorVersion = Number(os3.release().split(".")[0]);
4853
4970
  if (Number.isNaN(majorVersion) || majorVersion >= MIN_DARWIN_VERSION) {
4854
4971
  return;
4855
4972
  }
@@ -4923,7 +5040,7 @@ var formatStackFrameLocationLine = (frame) => {
4923
5040
  };
4924
5041
 
4925
5042
  // src/symbolicate-stacktrace.ts
4926
- import { readFileSync } from "fs";
5043
+ import { readFileSync as readFileSync2 } from "fs";
4927
5044
  import path6 from "path";
4928
5045
  import { SourceMapConsumer } from "source-map";
4929
5046
  function extractSourceMapUrl(fileContents) {
@@ -4969,14 +5086,14 @@ var getSourceMap = (filePath, fileContents, type) => {
4969
5086
  }
4970
5087
  if (type === "local") {
4971
5088
  const newFilePath = path6.join(path6.dirname(filePath), sm);
4972
- return Promise.resolve(new SourceMapConsumer(readFileSync(newFilePath, "utf8")));
5089
+ return Promise.resolve(new SourceMapConsumer(readFileSync2(newFilePath, "utf8")));
4973
5090
  }
4974
5091
  const index = filePath.lastIndexOf("/");
4975
5092
  const url = filePath.substring(0, index + 1) + sm;
4976
5093
  return getSourceMapFromRemoteUrl(url);
4977
5094
  };
4978
5095
  var fetchUrl = async (url) => {
4979
- const { request, response } = await readFile(url);
5096
+ const { request, response } = await readFile(url, null);
4980
5097
  return new Promise((resolve, reject) => {
4981
5098
  let downloaded = "";
4982
5099
  response.on("data", (d) => {
@@ -5052,7 +5169,7 @@ var getSourceMapFromRemoteFile = async (fileName) => {
5052
5169
  return getSourceMap(fileName, fileContents, "remote");
5053
5170
  };
5054
5171
  var getSourceMapFromLocalFile = (fileName) => {
5055
- const fileContents = readFileSync(fileName, "utf8");
5172
+ const fileContents = readFileSync2(fileName, "utf8");
5056
5173
  return getSourceMap(fileName, fileContents, "local");
5057
5174
  };
5058
5175
 
@@ -5466,7 +5583,7 @@ var validateFrameRange = (frameRange) => {
5466
5583
  };
5467
5584
 
5468
5585
  // src/get-compositions.ts
5469
- import { NoReactInternals as NoReactInternals11 } from "remotion/no-react";
5586
+ import { NoReactInternals as NoReactInternals12 } from "remotion/no-react";
5470
5587
 
5471
5588
  // src/to-megabytes.ts
5472
5589
  function toMegabytes(bytes) {
@@ -5554,8 +5671,8 @@ import { promisify as promisify2 } from "node:util";
5554
5671
 
5555
5672
  // src/browser/browser-download-lock.ts
5556
5673
  import { randomUUID } from "node:crypto";
5557
- import * as fs5 from "node:fs";
5558
- import os3 from "node:os";
5674
+ import * as fs6 from "node:fs";
5675
+ import os4 from "node:os";
5559
5676
  var RETRY_INTERVAL_IN_MS = 100;
5560
5677
  var STALE_LOCK_IN_MS = 30000;
5561
5678
  var HEARTBEAT_INTERVAL_IN_MS = 5000;
@@ -5569,7 +5686,7 @@ var isErrorWithCode = (error, code) => {
5569
5686
  };
5570
5687
  var readLock = async (lockPath) => {
5571
5688
  try {
5572
- const parsed = JSON.parse(await fs5.promises.readFile(lockPath, "utf8"));
5689
+ const parsed = JSON.parse(await fs6.promises.readFile(lockPath, "utf8"));
5573
5690
  if (typeof parsed.hostname !== "string" || typeof parsed.pid !== "number" || typeof parsed.token !== "string") {
5574
5691
  return null;
5575
5692
  }
@@ -5589,7 +5706,7 @@ var isProcessRunning = (pid) => {
5589
5706
  var removeStaleLock = async (lockPath) => {
5590
5707
  let stats;
5591
5708
  try {
5592
- stats = await fs5.promises.stat(lockPath);
5709
+ stats = await fs6.promises.stat(lockPath);
5593
5710
  } catch (error) {
5594
5711
  if (isErrorWithCode(error, "ENOENT")) {
5595
5712
  return;
@@ -5597,7 +5714,7 @@ var removeStaleLock = async (lockPath) => {
5597
5714
  throw error;
5598
5715
  }
5599
5716
  const lock = await readLock(lockPath);
5600
- if (lock?.hostname === os3.hostname()) {
5717
+ if (lock?.hostname === os4.hostname()) {
5601
5718
  if (isProcessRunning(lock.pid)) {
5602
5719
  return;
5603
5720
  }
@@ -5605,7 +5722,7 @@ var removeStaleLock = async (lockPath) => {
5605
5722
  return;
5606
5723
  }
5607
5724
  try {
5608
- await fs5.promises.unlink(lockPath);
5725
+ await fs6.promises.unlink(lockPath);
5609
5726
  } catch (error) {
5610
5727
  if (!isErrorWithCode(error, "ENOENT")) {
5611
5728
  throw error;
@@ -5617,7 +5734,7 @@ var acquireBrowserDownloadLock = async (lockPath) => {
5617
5734
  const token = randomUUID();
5618
5735
  let lockFile;
5619
5736
  try {
5620
- lockFile = await fs5.promises.open(lockPath, "wx");
5737
+ lockFile = await fs6.promises.open(lockPath, "wx");
5621
5738
  } catch (error) {
5622
5739
  if (!isErrorWithCode(error, "EEXIST")) {
5623
5740
  throw error;
@@ -5628,13 +5745,13 @@ var acquireBrowserDownloadLock = async (lockPath) => {
5628
5745
  }
5629
5746
  try {
5630
5747
  await lockFile.writeFile(JSON.stringify({
5631
- hostname: os3.hostname(),
5748
+ hostname: os4.hostname(),
5632
5749
  pid: process.pid,
5633
5750
  token
5634
5751
  }));
5635
5752
  } catch (error) {
5636
5753
  await lockFile.close();
5637
- await fs5.promises.rm(lockPath, { force: true });
5754
+ await fs6.promises.rm(lockPath, { force: true });
5638
5755
  throw error;
5639
5756
  }
5640
5757
  const heartbeat = setInterval(async () => {
@@ -5644,7 +5761,7 @@ var acquireBrowserDownloadLock = async (lockPath) => {
5644
5761
  }
5645
5762
  const now = new Date;
5646
5763
  try {
5647
- await fs5.promises.utimes(lockPath, now, now);
5764
+ await fs6.promises.utimes(lockPath, now, now);
5648
5765
  } catch {}
5649
5766
  }, HEARTBEAT_INTERVAL_IN_MS);
5650
5767
  heartbeat.unref();
@@ -5653,7 +5770,7 @@ var acquireBrowserDownloadLock = async (lockPath) => {
5653
5770
  const currentLock = await readLock(lockPath);
5654
5771
  await lockFile.close();
5655
5772
  if (currentLock?.token === token) {
5656
- await fs5.promises.rm(lockPath, { force: true });
5773
+ await fs6.promises.rm(lockPath, { force: true });
5657
5774
  }
5658
5775
  };
5659
5776
  }
@@ -5668,7 +5785,7 @@ import { pipeline } from "node:stream/promises";
5668
5785
  import { promisify } from "node:util";
5669
5786
 
5670
5787
  // vendor/yauzl-patched/index.js
5671
- var fs6 = __require("fs");
5788
+ var fs7 = __require("fs");
5672
5789
  var zlib = __require("zlib");
5673
5790
  var fd_slicer = require_fd_slicer();
5674
5791
  var crc32 = require_buffer_crc32();
@@ -5697,12 +5814,12 @@ function open(path, options2, callback) {
5697
5814
  options2.strictFileNames = false;
5698
5815
  if (callback == null)
5699
5816
  callback = defaultCallback;
5700
- fs6.open(path, "r", function(err, fd) {
5817
+ fs7.open(path, "r", function(err, fd) {
5701
5818
  if (err)
5702
5819
  return callback(err);
5703
5820
  fromFd(fd, options2, function(err, zipfile) {
5704
5821
  if (err)
5705
- fs6.close(fd, defaultCallback);
5822
+ fs7.close(fd, defaultCallback);
5706
5823
  callback(err, zipfile);
5707
5824
  });
5708
5825
  });
@@ -5726,7 +5843,7 @@ function fromFd(fd, options2, callback) {
5726
5843
  options2.strictFileNames = false;
5727
5844
  if (callback == null)
5728
5845
  callback = defaultCallback;
5729
- fs6.fstat(fd, function(err, stats) {
5846
+ fs7.fstat(fd, function(err, stats) {
5730
5847
  if (err)
5731
5848
  return callback(err);
5732
5849
  var reader = fd_slicer.createFromFd(fd, { autoClose: true });
@@ -6552,99 +6669,6 @@ var extractZipArchive = async (archivePath, dir) => {
6552
6669
  });
6553
6670
  };
6554
6671
 
6555
- // src/browser/get-chrome-download-url.ts
6556
- import * as fs7 from "node:fs";
6557
- import * as os4 from "node:os";
6558
- var TESTED_VERSION = "157.0.8080.0";
6559
- var isAmazonLinux2023 = () => {
6560
- if (os4.platform() !== "linux") {
6561
- return false;
6562
- }
6563
- try {
6564
- const osRelease = fs7.readFileSync("/etc/os-release", "utf-8");
6565
- return osRelease.includes("Amazon Linux") && osRelease.includes('VERSION="2023"');
6566
- } catch {
6567
- return false;
6568
- }
6569
- };
6570
- var MINIMUM_GLIBC_FOR_REMOTION_MEDIA = [2, 35];
6571
- var getGlibcVersion = () => {
6572
- if (process.platform !== "linux") {
6573
- return null;
6574
- }
6575
- const { report } = process;
6576
- if (!report) {
6577
- return null;
6578
- }
6579
- const rep = report.getReport();
6580
- if (typeof rep === "string") {
6581
- return null;
6582
- }
6583
- const { glibcVersionRuntime } = rep.header;
6584
- if (!glibcVersionRuntime) {
6585
- return null;
6586
- }
6587
- const split = glibcVersionRuntime.split(".");
6588
- if (split.length !== 2) {
6589
- return null;
6590
- }
6591
- return [Number(split[0]), Number(split[1])];
6592
- };
6593
- var isGlibcVersionAtLeast = (required) => {
6594
- const version = getGlibcVersion();
6595
- if (version === null) {
6596
- return false;
6597
- }
6598
- const [major, minor] = version;
6599
- const [reqMajor, reqMinor] = required;
6600
- if (major > reqMajor) {
6601
- return true;
6602
- }
6603
- if (major === reqMajor && minor >= reqMinor) {
6604
- return true;
6605
- }
6606
- return false;
6607
- };
6608
- var canUseRemotionMediaBinaries = () => {
6609
- if (process.platform !== "linux") {
6610
- return false;
6611
- }
6612
- return isGlibcVersionAtLeast(MINIMUM_GLIBC_FOR_REMOTION_MEDIA);
6613
- };
6614
- function getChromeDownloadUrl({
6615
- platform,
6616
- version,
6617
- chromeMode
6618
- }) {
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`;
6622
- }
6623
- if (chromeMode === "headless-shell" && version === null) {
6624
- if (platform === "mac-arm64") {
6625
- return `https://remotion.media/chromium-headless-shell-mac-arm64-${TESTED_VERSION}.zip?clear`;
6626
- }
6627
- if (platform === "linux64" || platform === "linux-arm64") {
6628
- const architecture = platform === "linux64" ? "x64" : "arm64";
6629
- if (isAmazonLinux2023()) {
6630
- return `https://remotion.media/chromium-headless-shell-amazon-linux-${architecture}-${TESTED_VERSION}.zip?clear`;
6631
- }
6632
- if (canUseRemotionMediaBinaries()) {
6633
- return `https://remotion.media/chromium-headless-shell-linux-${architecture}-${TESTED_VERSION}.zip?clear`;
6634
- }
6635
- }
6636
- }
6637
- const archive = chromeMode === "headless-shell" ? "chrome-headless-shell" : "chrome";
6638
- return `https://storage.googleapis.com/chrome-for-testing-public/${version ?? TESTED_VERSION}/${platform}/${archive}-${platform}.zip`;
6639
- }
6640
- var logDownloadUrl = ({
6641
- url,
6642
- logLevel,
6643
- indent
6644
- }) => {
6645
- Log.info({ indent, logLevel }, `Downloading from: ${url}`);
6646
- };
6647
-
6648
6672
  // src/browser/get-download-destination.ts
6649
6673
  import fs8 from "node:fs";
6650
6674
  import path8 from "node:path";
@@ -6746,7 +6770,7 @@ var downloadBrowser = async ({
6746
6770
  }) => {
6747
6771
  const platform = getPlatform();
6748
6772
  const downloadURL = getChromeDownloadUrl({ platform, version, chromeMode });
6749
- const fileName = downloadURL.split("/").pop();
6773
+ const fileName = downloadURL.split("/").pop()?.split("?")[0];
6750
6774
  if (!fileName) {
6751
6775
  throw new Error(`A malformed download URL was found: ${downloadURL}.`);
6752
6776
  }
@@ -16469,8 +16493,12 @@ var waitForAssetToBeDownloaded = ({
16469
16493
  if (!downloadMap.listeners[src][downloadDir]) {
16470
16494
  downloadMap.listeners[src][downloadDir] = [];
16471
16495
  }
16472
- return new Promise((resolve) => {
16473
- downloadMap.listeners[src][downloadDir].push(() => {
16496
+ return new Promise((resolve, reject) => {
16497
+ downloadMap.listeners[src][downloadDir].push((err) => {
16498
+ if (err) {
16499
+ reject(err);
16500
+ return;
16501
+ }
16474
16502
  const srcMap = downloadMap.hasBeenDownloadedMap[src];
16475
16503
  if (!srcMap?.[downloadDir]) {
16476
16504
  throw new Error("Expected file for " + src + "to be available in " + downloadDir);
@@ -16499,7 +16527,7 @@ var notifyAssetIsDownloaded = ({
16499
16527
  downloadMap.hasBeenDownloadedMap[src] = {};
16500
16528
  }
16501
16529
  downloadMap.hasBeenDownloadedMap[src][downloadDir] = to;
16502
- downloadMap.listeners[src][downloadDir].forEach((fn) => fn());
16530
+ downloadMap.listeners[src][downloadDir].forEach((fn) => fn(null));
16503
16531
  };
16504
16532
  var validateMimeType = (mimeType, src) => {
16505
16533
  if (!mimeType.includes("/")) {
@@ -16613,6 +16641,12 @@ var downloadAsset = async ({
16613
16641
  indent,
16614
16642
  logLevel,
16615
16643
  abortSignal: downloadMap.cleanupController.signal
16644
+ }).catch((err) => {
16645
+ delete downloadMap.isDownloadingMap[src]?.[downloadDir];
16646
+ const listeners = downloadMap.listeners[src]?.[downloadDir] ?? [];
16647
+ delete downloadMap.listeners[src]?.[downloadDir];
16648
+ listeners.forEach((fn) => fn(err));
16649
+ throw err;
16616
16650
  });
16617
16651
  notifyAssetIsDownloaded({ src, downloadMap, downloadDir, to });
16618
16652
  if (shouldAnalyzeAudioImmediately) {
@@ -17698,6 +17732,69 @@ var makeRange = (from, to) => {
17698
17732
  });
17699
17733
  };
17700
17734
 
17735
+ // src/port-config.ts
17736
+ import os9 from "os";
17737
+ var cached = null;
17738
+ var getPortConfig = (preferIpv4) => {
17739
+ if (cached) {
17740
+ return cached;
17741
+ }
17742
+ const networkInterfaces = os9.networkInterfaces();
17743
+ const flattened = flattenNetworkInterfaces(networkInterfaces);
17744
+ const host = getHostToBind(flattened, preferIpv4);
17745
+ const hostsToTry = getHostsToTry(flattened);
17746
+ const response = { host, hostsToTry };
17747
+ cached = response;
17748
+ return response;
17749
+ };
17750
+ var getHostToBind = (flattened, preferIpv4) => {
17751
+ if (preferIpv4 || !isIpV6Supported(flattened)) {
17752
+ return "0.0.0.0";
17753
+ }
17754
+ return "::";
17755
+ };
17756
+ var getHostsToTry = (flattened) => {
17757
+ return [
17758
+ hasIPv6LoopbackAddress(flattened) ? "::1" : null,
17759
+ hasIpv4LoopbackAddress(flattened) ? "127.0.0.1" : null,
17760
+ isIpV6Supported(flattened) ? "::" : null,
17761
+ "0.0.0.0"
17762
+ ].filter(truthy);
17763
+ };
17764
+ var flattenNetworkInterfaces = (networkInterfaces) => {
17765
+ const result = [];
17766
+ for (const iface in networkInterfaces) {
17767
+ for (const configuration of networkInterfaces[iface]) {
17768
+ result.push(configuration);
17769
+ }
17770
+ }
17771
+ return result;
17772
+ };
17773
+ var isIpV6Supported = (flattened) => {
17774
+ for (const configuration of flattened) {
17775
+ if (configuration.family === "IPv6" && !configuration.internal) {
17776
+ return true;
17777
+ }
17778
+ }
17779
+ return false;
17780
+ };
17781
+ var hasIPv6LoopbackAddress = (flattened) => {
17782
+ for (const configuration of flattened) {
17783
+ if (configuration.family === "IPv6" && configuration.internal && configuration.address === "::1") {
17784
+ return true;
17785
+ }
17786
+ }
17787
+ return false;
17788
+ };
17789
+ var hasIpv4LoopbackAddress = (flattened) => {
17790
+ for (const configuration of flattened) {
17791
+ if (configuration.family === "IPv4" && configuration.internal && configuration.address === "127.0.0.1") {
17792
+ return true;
17793
+ }
17794
+ }
17795
+ return false;
17796
+ };
17797
+
17701
17798
  // src/serve-handler/index.ts
17702
17799
  import { createReadStream, promises as promises3 } from "node:fs";
17703
17800
  import path19 from "node:path";
@@ -17743,7 +17840,7 @@ var rangeParser = (size, str) => {
17743
17840
  let start = parseInt(range[0], 10);
17744
17841
  let end = parseInt(range[1], 10);
17745
17842
  if (isNaN(start)) {
17746
- start = size - end;
17843
+ start = Math.max(size - end, 0);
17747
17844
  end = size - 1;
17748
17845
  } else if (isNaN(end)) {
17749
17846
  end = size - 1;
@@ -17985,6 +18082,7 @@ var serveStatic = async (path, options2) => {
17985
18082
  let selectedPort = null;
17986
18083
  const maxTries = 10;
17987
18084
  const host = "127.0.0.1";
18085
+ const { hostsToTry } = getPortConfig(options2.forceIPv4);
17988
18086
  for (let i = 0;i < maxTries; i++) {
17989
18087
  let unlock = () => {};
17990
18088
  try {
@@ -17993,7 +18091,7 @@ var serveStatic = async (path, options2) => {
17993
18091
  desiredPort: options2?.port ?? undefined,
17994
18092
  from: 3000,
17995
18093
  to: 3100,
17996
- hostsToTry: [host]
18094
+ hostsToTry
17997
18095
  }).then(({ port, unlockPort }) => {
17998
18096
  unlock = unlockPort;
17999
18097
  server.listen({ port, host });
@@ -18481,6 +18579,7 @@ var seekToFrame = async ({
18481
18579
  };
18482
18580
 
18483
18581
  // src/set-props-and-env.ts
18582
+ import { NoReactInternals as NoReactInternals11 } from "remotion/no-react";
18484
18583
  import { VERSION as VERSION3 } from "remotion/version";
18485
18584
 
18486
18585
  // src/goto-page-or-throw.ts
@@ -18535,19 +18634,23 @@ var innerSetPropsAndEnv = async ({
18535
18634
  onServeUrlVisited,
18536
18635
  isMainTab,
18537
18636
  mediaCacheSizeInBytes,
18637
+ preferredEffectBackend,
18538
18638
  initialMemoryAvailable,
18539
18639
  darkMode,
18540
18640
  sampleRate
18541
18641
  }) => {
18642
+ NoReactInternals11.validatePreferredEffectBackend(preferredEffectBackend);
18542
18643
  validatePuppeteerTimeout(timeoutInMilliseconds);
18543
18644
  const actualTimeout = timeoutInMilliseconds ?? DEFAULT_TIMEOUT;
18544
18645
  page.setDefaultTimeout(actualTimeout);
18545
18646
  page.setDefaultNavigationTimeout(actualTimeout);
18546
18647
  const urlToVisit = normalizeServeUrl(serveUrl);
18547
- await page.evaluateOnNewDocument((timeout, mainTab, cacheSizeInBytes, initMemoryAvailable, sRate) => {
18648
+ await page.evaluateOnNewDocument((timeout, mainTab, cacheSizeInBytes, effectBackend, disableWebGpuEffects, initMemoryAvailable, sRate) => {
18548
18649
  window.remotion_puppeteerTimeout = timeout;
18549
18650
  window.remotion_isMainTab = mainTab;
18550
18651
  window.remotion_mediaCacheSizeInBytes = cacheSizeInBytes;
18652
+ window.remotion_preferredEffectBackend = effectBackend;
18653
+ window.remotion_disableWebGpuEffects = disableWebGpuEffects;
18551
18654
  window.remotion_initialMemoryAvailable = initMemoryAvailable;
18552
18655
  window.remotion_sampleRate = sRate;
18553
18656
  if (window.process === undefined) {
@@ -18557,7 +18660,7 @@ var innerSetPropsAndEnv = async ({
18557
18660
  window.process.env = {};
18558
18661
  }
18559
18662
  window.process.env.NODE_ENV = "production";
18560
- }, actualTimeout, isMainTab, mediaCacheSizeInBytes, initialMemoryAvailable, sampleRate);
18663
+ }, actualTimeout, isMainTab, mediaCacheSizeInBytes, preferredEffectBackend, Boolean(process.env.AWS_LAMBDA_FUNCTION_NAME), initialMemoryAvailable, sampleRate);
18561
18664
  await page.evaluateOnNewDocument('window.remotion_broadcastChannel = new BroadcastChannel("remotion-video-frame-extraction")');
18562
18665
  if (envVariables) {
18563
18666
  await page.evaluateOnNewDocument((input) => {
@@ -18613,6 +18716,7 @@ var innerSetPropsAndEnv = async ({
18613
18716
  onServeUrlVisited,
18614
18717
  isMainTab,
18615
18718
  mediaCacheSizeInBytes,
18719
+ preferredEffectBackend,
18616
18720
  initialMemoryAvailable,
18617
18721
  darkMode,
18618
18722
  sampleRate
@@ -18892,6 +18996,7 @@ var innerGetCompositions = async ({
18892
18996
  indent,
18893
18997
  logLevel,
18894
18998
  mediaCacheSizeInBytes,
18999
+ preferredEffectBackend,
18895
19000
  darkMode
18896
19001
  }) => {
18897
19002
  validatePuppeteerTimeout(timeoutInMilliseconds);
@@ -18913,6 +19018,7 @@ var innerGetCompositions = async ({
18913
19018
  },
18914
19019
  isMainTab: true,
18915
19020
  mediaCacheSizeInBytes,
19021
+ preferredEffectBackend,
18916
19022
  initialMemoryAvailable: getAvailableMemory(logLevel),
18917
19023
  darkMode,
18918
19024
  sampleRate: 48000
@@ -18965,8 +19071,8 @@ var innerGetCompositions = async ({
18965
19071
  height,
18966
19072
  fps,
18967
19073
  durationInFrames,
18968
- props: NoReactInternals11.deserializeJSONWithSpecialTypes(r.serializedResolvedPropsWithCustomSchema),
18969
- defaultProps: NoReactInternals11.deserializeJSONWithSpecialTypes(r.serializedDefaultPropsWithCustomSchema),
19074
+ props: NoReactInternals12.deserializeJSONWithSpecialTypes(r.serializedResolvedPropsWithCustomSchema),
19075
+ defaultProps: NoReactInternals12.deserializeJSONWithSpecialTypes(r.serializedDefaultPropsWithCustomSchema),
18970
19076
  defaultCodec,
18971
19077
  defaultOutName,
18972
19078
  defaultVideoImageFormat,
@@ -18995,6 +19101,7 @@ var internalGetCompositionsRaw = async ({
18995
19101
  chromeMode,
18996
19102
  offthreadVideoThreads,
18997
19103
  mediaCacheSizeInBytes,
19104
+ preferredEffectBackend,
18998
19105
  onLog
18999
19106
  }) => {
19000
19107
  const { page, cleanupPage } = await getPageAndCleanupFn({
@@ -19053,6 +19160,7 @@ var internalGetCompositionsRaw = async ({
19053
19160
  chromeMode,
19054
19161
  offthreadVideoThreads,
19055
19162
  mediaCacheSizeInBytes,
19163
+ preferredEffectBackend,
19056
19164
  darkMode: chromiumOptions.darkMode ?? false
19057
19165
  });
19058
19166
  }).then((comp) => {
@@ -19068,7 +19176,7 @@ var internalGetCompositionsRaw = async ({
19068
19176
  };
19069
19177
  var internalGetCompositions = wrapWithErrorHandling(internalGetCompositionsRaw);
19070
19178
  var getCompositions = (...args) => {
19071
- const options2 = convertGetCompositionsArgumentsToOptions(args, NoReactInternals11.ENABLE_V5_BREAKING_CHANGES);
19179
+ const options2 = convertGetCompositionsArgumentsToOptions(args, NoReactInternals12.ENABLE_V5_BREAKING_CHANGES);
19072
19180
  if (typeof options2?.serveUrl !== "string" || !options2.serveUrl) {
19073
19181
  throw new Error("No serve URL or webpack bundle directory was passed to getCompositions().");
19074
19182
  }
@@ -19088,6 +19196,7 @@ var getCompositions = (...args) => {
19088
19196
  chromeMode,
19089
19197
  offthreadVideoThreads,
19090
19198
  mediaCacheSizeInBytes,
19199
+ preferredEffectBackend,
19091
19200
  serveUrl
19092
19201
  } = options2;
19093
19202
  const indent = false;
@@ -19096,7 +19205,7 @@ var getCompositions = (...args) => {
19096
19205
  browserExecutable: browserExecutable ?? null,
19097
19206
  chromiumOptions: chromiumOptions ?? {},
19098
19207
  envVariables: envVariables ?? {},
19099
- serializedInputPropsWithCustomSchema: NoReactInternals11.serializeJSONWithSpecialTypes({
19208
+ serializedInputPropsWithCustomSchema: NoReactInternals12.serializeJSONWithSpecialTypes({
19100
19209
  data: inputProps ?? {},
19101
19210
  indent: undefined,
19102
19211
  staticBase: null
@@ -19119,6 +19228,7 @@ var getCompositions = (...args) => {
19119
19228
  chromeMode: chromeMode ?? "headless-shell",
19120
19229
  offthreadVideoThreads: offthreadVideoThreads ?? null,
19121
19230
  mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
19231
+ preferredEffectBackend: preferredEffectBackend ?? "auto",
19122
19232
  onLog: defaultOnLog
19123
19233
  });
19124
19234
  };
@@ -19431,6 +19541,41 @@ var validateJpegQuality = (q) => {
19431
19541
  }
19432
19542
  };
19433
19543
 
19544
+ // src/make-cancel-signal.ts
19545
+ var makeCancelSignal = () => {
19546
+ const callbacks = [];
19547
+ let cancelled = false;
19548
+ return {
19549
+ cancelSignal: (callback) => {
19550
+ callbacks.push(callback);
19551
+ if (cancelled) {
19552
+ callback();
19553
+ }
19554
+ },
19555
+ cancel: () => {
19556
+ if (cancelled) {
19557
+ return;
19558
+ }
19559
+ callbacks.forEach((cb) => {
19560
+ cb();
19561
+ });
19562
+ cancelled = true;
19563
+ }
19564
+ };
19565
+ };
19566
+ var cancelErrorMessages = {
19567
+ renderMedia: "renderMedia() got cancelled",
19568
+ renderFrames: "renderFrames() got cancelled",
19569
+ renderStill: "renderStill() got cancelled",
19570
+ stitchFramesToVideo: "stitchFramesToVideo() got cancelled"
19571
+ };
19572
+ var isUserCancelledRender = (err) => {
19573
+ if (typeof err === "object" && err !== null && "message" in err && typeof err.message === "string") {
19574
+ return err.message.includes(cancelErrorMessages.renderMedia) || err.message.includes(cancelErrorMessages.renderFrames) || err.message.includes(cancelErrorMessages.renderStill) || err.message.includes(cancelErrorMessages.stitchFramesToVideo);
19575
+ }
19576
+ return false;
19577
+ };
19578
+
19434
19579
  // src/perf.ts
19435
19580
  var perf = {
19436
19581
  capture: [],
@@ -19496,69 +19641,6 @@ var validateSelectedPixelFormatAndCodecCombination = (pixelFormat, codec) => {
19496
19641
  }
19497
19642
  };
19498
19643
 
19499
- // src/port-config.ts
19500
- import os9 from "os";
19501
- var cached = null;
19502
- var getPortConfig = (preferIpv4) => {
19503
- if (cached) {
19504
- return cached;
19505
- }
19506
- const networkInterfaces = os9.networkInterfaces();
19507
- const flattened = flattenNetworkInterfaces(networkInterfaces);
19508
- const host = getHostToBind(flattened, preferIpv4);
19509
- const hostsToTry = getHostsToTry(flattened);
19510
- const response = { host, hostsToTry };
19511
- cached = response;
19512
- return response;
19513
- };
19514
- var getHostToBind = (flattened, preferIpv4) => {
19515
- if (preferIpv4 || !isIpV6Supported(flattened)) {
19516
- return "0.0.0.0";
19517
- }
19518
- return "::";
19519
- };
19520
- var getHostsToTry = (flattened) => {
19521
- return [
19522
- hasIPv6LoopbackAddress(flattened) ? "::1" : null,
19523
- hasIpv4LoopbackAddress(flattened) ? "127.0.0.1" : null,
19524
- isIpV6Supported(flattened) ? "::" : null,
19525
- "0.0.0.0"
19526
- ].filter(truthy);
19527
- };
19528
- var flattenNetworkInterfaces = (networkInterfaces) => {
19529
- const result = [];
19530
- for (const iface in networkInterfaces) {
19531
- for (const configuration of networkInterfaces[iface]) {
19532
- result.push(configuration);
19533
- }
19534
- }
19535
- return result;
19536
- };
19537
- var isIpV6Supported = (flattened) => {
19538
- for (const configuration of flattened) {
19539
- if (configuration.family === "IPv6" && !configuration.internal) {
19540
- return true;
19541
- }
19542
- }
19543
- return false;
19544
- };
19545
- var hasIPv6LoopbackAddress = (flattened) => {
19546
- for (const configuration of flattened) {
19547
- if (configuration.family === "IPv6" && configuration.internal && configuration.address === "::1") {
19548
- return true;
19549
- }
19550
- }
19551
- return false;
19552
- };
19553
- var hasIpv4LoopbackAddress = (flattened) => {
19554
- for (const configuration of flattened) {
19555
- if (configuration.family === "IPv4" && configuration.internal && configuration.address === "127.0.0.1") {
19556
- return true;
19557
- }
19558
- }
19559
- return false;
19560
- };
19561
-
19562
19644
  // src/probe-shared-memory-capture.ts
19563
19645
  import fs16 from "node:fs";
19564
19646
  import os10 from "node:os";
@@ -19800,11 +19882,11 @@ var getCodecName = ({
19800
19882
  };
19801
19883
 
19802
19884
  // src/options/color-space.tsx
19803
- import { NoReactInternals as NoReactInternals12 } from "remotion/no-react";
19885
+ import { NoReactInternals as NoReactInternals13 } from "remotion/no-react";
19804
19886
  var validV4ColorSpaces = ["default", "bt601", "bt709", "bt2020-ncl"];
19805
19887
  var validV5ColorSpaces = ["bt601", "bt709", "bt2020-ncl"];
19806
- var validColorSpaces = NoReactInternals12.ENABLE_V5_BREAKING_CHANGES ? validV5ColorSpaces : validV4ColorSpaces;
19807
- var DEFAULT_COLOR_SPACE = NoReactInternals12.ENABLE_V5_BREAKING_CHANGES ? "bt709" : "default";
19888
+ var validColorSpaces = NoReactInternals13.ENABLE_V5_BREAKING_CHANGES ? validV5ColorSpaces : validV4ColorSpaces;
19889
+ var DEFAULT_COLOR_SPACE = NoReactInternals13.ENABLE_V5_BREAKING_CHANGES ? "bt709" : "default";
19808
19890
 
19809
19891
  // src/options/gop-size.tsx
19810
19892
  var validateGopSize = (value) => {
@@ -20398,10 +20480,10 @@ var createRemotionSharedMemoryFfmpegBridge = ({
20398
20480
  };
20399
20481
 
20400
20482
  // src/validate.ts
20401
- import { NoReactInternals as NoReactInternals13 } from "remotion/no-react";
20402
- var validateFps = NoReactInternals13.validateFps;
20403
- var validateDimension = NoReactInternals13.validateDimension;
20404
- var validateDurationInFrames = NoReactInternals13.validateDurationInFrames;
20483
+ import { NoReactInternals as NoReactInternals14 } from "remotion/no-react";
20484
+ var validateFps = NoReactInternals14.validateFps;
20485
+ var validateDimension = NoReactInternals14.validateDimension;
20486
+ var validateDurationInFrames = NoReactInternals14.validateDurationInFrames;
20405
20487
 
20406
20488
  // src/validate-even-dimensions-with-codec.ts
20407
20489
  var validateEvenDimensionsWithCodec = ({
@@ -21101,7 +21183,7 @@ var probeSharedMemoryCapture = async ({
21101
21183
  // src/render-frames.ts
21102
21184
  import fs18 from "node:fs";
21103
21185
  import path24 from "node:path";
21104
- import { NoReactInternals as NoReactInternals16 } from "remotion/no-react";
21186
+ import { NoReactInternals as NoReactInternals18 } from "remotion/no-react";
21105
21187
 
21106
21188
  // src/cycle-browser-tabs.ts
21107
21189
  var cycleBrowserTabs = ({
@@ -21676,41 +21758,6 @@ var getFilePadLength = ({
21676
21758
  throw new Error("Unknown file type");
21677
21759
  };
21678
21760
 
21679
- // src/make-cancel-signal.ts
21680
- var makeCancelSignal = () => {
21681
- const callbacks = [];
21682
- let cancelled = false;
21683
- return {
21684
- cancelSignal: (callback) => {
21685
- callbacks.push(callback);
21686
- if (cancelled) {
21687
- callback();
21688
- }
21689
- },
21690
- cancel: () => {
21691
- if (cancelled) {
21692
- return;
21693
- }
21694
- callbacks.forEach((cb) => {
21695
- cb();
21696
- });
21697
- cancelled = true;
21698
- }
21699
- };
21700
- };
21701
- var cancelErrorMessages = {
21702
- renderMedia: "renderMedia() got cancelled",
21703
- renderFrames: "renderFrames() got cancelled",
21704
- renderStill: "renderStill() got cancelled",
21705
- stitchFramesToVideo: "stitchFramesToVideo() got cancelled"
21706
- };
21707
- var isUserCancelledRender = (err) => {
21708
- if (typeof err === "object" && err !== null && "message" in err && typeof err.message === "string") {
21709
- return err.message.includes(cancelErrorMessages.renderMedia) || err.message.includes(cancelErrorMessages.renderFrames) || err.message.includes(cancelErrorMessages.renderStill) || err.message.includes(cancelErrorMessages.stitchFramesToVideo);
21710
- }
21711
- return false;
21712
- };
21713
-
21714
21761
  // src/make-page.ts
21715
21762
  var makePage = async ({
21716
21763
  context,
@@ -21733,6 +21780,7 @@ var makePage = async ({
21733
21780
  pageIndex,
21734
21781
  isMainTab,
21735
21782
  mediaCacheSizeInBytes,
21783
+ preferredEffectBackend,
21736
21784
  onLog,
21737
21785
  darkMode,
21738
21786
  sampleRate
@@ -21762,6 +21810,7 @@ var makePage = async ({
21762
21810
  },
21763
21811
  isMainTab,
21764
21812
  mediaCacheSizeInBytes,
21813
+ preferredEffectBackend,
21765
21814
  initialMemoryAvailable: getAvailableMemory(logLevel),
21766
21815
  darkMode,
21767
21816
  sampleRate
@@ -21857,10 +21906,10 @@ class Pool {
21857
21906
  }
21858
21907
 
21859
21908
  // src/render-frame-and-retry-target-close.ts
21860
- import { NoReactInternals as NoReactInternals15 } from "remotion/no-react";
21909
+ import { NoReactInternals as NoReactInternals16 } from "remotion/no-react";
21861
21910
 
21862
21911
  // src/is-delay-render-error-with-retry.ts
21863
- import { NoReactInternals as NoReactInternals14 } from "remotion/no-react";
21912
+ import { NoReactInternals as NoReactInternals15 } from "remotion/no-react";
21864
21913
  var getRetriesLeftFromError = (error) => {
21865
21914
  if (!error) {
21866
21915
  throw new Error("Expected stack");
@@ -21869,15 +21918,15 @@ var getRetriesLeftFromError = (error) => {
21869
21918
  if (!stack) {
21870
21919
  throw new Error("Expected stack: " + JSON.stringify(error));
21871
21920
  }
21872
- const beforeIndex = stack.indexOf(NoReactInternals14.DELAY_RENDER_ATTEMPT_TOKEN);
21921
+ const beforeIndex = stack.indexOf(NoReactInternals15.DELAY_RENDER_ATTEMPT_TOKEN);
21873
21922
  if (beforeIndex === -1) {
21874
21923
  throw new Error("Expected to find attempt token in stack");
21875
21924
  }
21876
- const afterIndex = stack.indexOf(NoReactInternals14.DELAY_RENDER_RETRY_TOKEN);
21925
+ const afterIndex = stack.indexOf(NoReactInternals15.DELAY_RENDER_RETRY_TOKEN);
21877
21926
  if (afterIndex === -1) {
21878
21927
  throw new Error("Expected to find retry token in stack");
21879
21928
  }
21880
- const inbetween = stack.substring(beforeIndex + NoReactInternals14.DELAY_RENDER_ATTEMPT_TOKEN.length, afterIndex);
21929
+ const inbetween = stack.substring(beforeIndex + NoReactInternals15.DELAY_RENDER_ATTEMPT_TOKEN.length, afterIndex);
21881
21930
  const parsed = Number(inbetween);
21882
21931
  if (Number.isNaN(parsed)) {
21883
21932
  throw new Error(`Expected to find a number in the stack ${stack}`);
@@ -22551,7 +22600,7 @@ var renderFrameAndRetryTargetClose = async ({
22551
22600
  currentPool.release(freePage);
22552
22601
  } catch (err) {
22553
22602
  const isTargetClosedError = isTargetClosedErr(err);
22554
- const shouldRetryError = err.stack?.includes(NoReactInternals15.DELAY_RENDER_RETRY_TOKEN);
22603
+ const shouldRetryError = err.stack?.includes(NoReactInternals16.DELAY_RENDER_RETRY_TOKEN);
22555
22604
  const flakyNetworkError = isFlakyNetworkError(err);
22556
22605
  if (isUserCancelledRender(err) && !shouldRetryError) {
22557
22606
  throw err;
@@ -22740,39 +22789,10 @@ var validateScale = (scale) => {
22740
22789
  };
22741
22790
 
22742
22791
  // src/validate-selected-frames.ts
22743
- var validateSelectedFrames = ({
22744
- frames,
22745
- durationInFrames
22746
- }) => {
22747
- if (!Array.isArray(frames)) {
22748
- throw new TypeError("The `frames` option must be an array of frame numbers.");
22749
- }
22750
- if (frames.length === 0) {
22751
- throw new TypeError("The `frames` option must contain at least one frame.");
22752
- }
22753
- for (const frame of frames) {
22754
- if (typeof frame !== "number") {
22755
- throw new TypeError(`The \`frames\` option must contain only numbers, but got ${typeof frame}.`);
22756
- }
22757
- if (!Number.isFinite(frame)) {
22758
- throw new TypeError(`The \`frames\` option must contain only finite numbers, but got ${frame}.`);
22759
- }
22760
- if (!Number.isInteger(frame)) {
22761
- throw new TypeError(`The \`frames\` option must contain only integers, but got ${frame}.`);
22762
- }
22763
- if (frame < 0) {
22764
- throw new TypeError(`The \`frames\` option must contain only non-negative numbers, but got ${frame}.`);
22765
- }
22766
- if (durationInFrames !== null && frame >= durationInFrames) {
22767
- throw new RangeError(`Frame ${frame} is out of range, must be between 0 and ${durationInFrames - 1}.`);
22768
- }
22769
- }
22770
- const uniqueFrames = new Set(frames);
22771
- if (uniqueFrames.size !== frames.length) {
22772
- throw new TypeError("The `frames` option must not contain duplicate frames.");
22773
- }
22774
- return [...frames].sort((a, b) => a - b);
22775
- };
22792
+ import { NoReactInternals as NoReactInternals17 } from "remotion/no-react";
22793
+ var {
22794
+ validateSelectedFrames
22795
+ } = NoReactInternals17;
22776
22796
 
22777
22797
  // src/render-frames.ts
22778
22798
  var MAX_RETRIES_PER_FRAME = 1;
@@ -22817,6 +22837,7 @@ var innerRenderFrames = async ({
22817
22837
  binariesDirectory,
22818
22838
  imageSequencePattern,
22819
22839
  mediaCacheSizeInBytes,
22840
+ preferredEffectBackend,
22820
22841
  onLog,
22821
22842
  darkMode,
22822
22843
  sampleRate
@@ -22875,6 +22896,7 @@ var innerRenderFrames = async ({
22875
22896
  pageIndex,
22876
22897
  isMainTab: pageIndex === 0,
22877
22898
  mediaCacheSizeInBytes,
22899
+ preferredEffectBackend,
22878
22900
  onLog,
22879
22901
  darkMode,
22880
22902
  sampleRate
@@ -23026,6 +23048,7 @@ var internalRenderFramesRaw = ({
23026
23048
  offthreadVideoThreads,
23027
23049
  imageSequencePattern,
23028
23050
  mediaCacheSizeInBytes,
23051
+ preferredEffectBackend,
23029
23052
  onLog,
23030
23053
  sampleRate
23031
23054
  }) => {
@@ -23137,6 +23160,7 @@ var internalRenderFramesRaw = ({
23137
23160
  offthreadVideoThreads,
23138
23161
  imageSequencePattern,
23139
23162
  mediaCacheSizeInBytes,
23163
+ preferredEffectBackend,
23140
23164
  onLog,
23141
23165
  darkMode: chromiumOptions.darkMode ?? false,
23142
23166
  sampleRate
@@ -23214,6 +23238,7 @@ var renderFrames = (options2) => {
23214
23238
  offthreadVideoThreads,
23215
23239
  imageSequencePattern,
23216
23240
  mediaCacheSizeInBytes,
23241
+ preferredEffectBackend,
23217
23242
  sampleRate
23218
23243
  } = options2;
23219
23244
  if (!composition) {
@@ -23252,12 +23277,12 @@ var renderFrames = (options2) => {
23252
23277
  indent,
23253
23278
  jpegQuality: jpegQuality ?? DEFAULT_JPEG_QUALITY,
23254
23279
  onDownload: onDownload ?? null,
23255
- serializedInputPropsWithCustomSchema: NoReactInternals16.serializeJSONWithSpecialTypes({
23280
+ serializedInputPropsWithCustomSchema: NoReactInternals18.serializeJSONWithSpecialTypes({
23256
23281
  indent: undefined,
23257
23282
  staticBase: null,
23258
23283
  data: inputProps ?? {}
23259
23284
  }).serializedString,
23260
- serializedResolvedPropsWithCustomSchema: NoReactInternals16.serializeJSONWithSpecialTypes({
23285
+ serializedResolvedPropsWithCustomSchema: NoReactInternals18.serializeJSONWithSpecialTypes({
23261
23286
  indent: undefined,
23262
23287
  staticBase: null,
23263
23288
  data: composition.props
@@ -23288,6 +23313,7 @@ var renderFrames = (options2) => {
23288
23313
  offthreadVideoThreads: offthreadVideoThreads ?? null,
23289
23314
  imageSequencePattern: imageSequencePattern ?? null,
23290
23315
  mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
23316
+ preferredEffectBackend: preferredEffectBackend ?? "auto",
23291
23317
  onLog: defaultOnLog,
23292
23318
  sampleRate: sampleRate ?? composition.defaultSampleRate ?? 48000
23293
23319
  });
@@ -23298,7 +23324,7 @@ import fs20 from "node:fs";
23298
23324
  import os11 from "node:os";
23299
23325
  import path31 from "node:path";
23300
23326
  import { LicensingInternals } from "@remotion/licensing";
23301
- import { NoReactInternals as NoReactInternals20 } from "remotion/no-react";
23327
+ import { NoReactInternals as NoReactInternals22 } from "remotion/no-react";
23302
23328
 
23303
23329
  // src/codec-supports-media.ts
23304
23330
  var support = {
@@ -23421,7 +23447,7 @@ var validateSelectedCodecAndPresetCombination = ({
23421
23447
  var DEFAULT_OVERWRITE = true;
23422
23448
 
23423
23449
  // src/prores-profile.ts
23424
- import { NoReactInternals as NoReactInternals17 } from "remotion/no-react";
23450
+ import { NoReactInternals as NoReactInternals19 } from "remotion/no-react";
23425
23451
  var validateSelectedCodecAndProResCombination = ({
23426
23452
  codec,
23427
23453
  proResProfile
@@ -23429,15 +23455,15 @@ var validateSelectedCodecAndProResCombination = ({
23429
23455
  if (typeof proResProfile !== "undefined" && codec !== "prores") {
23430
23456
  throw new TypeError(`You have set a ProRes profile but the codec is "${codec}". Set the codec to "prores" or remove the ProRes profile.`);
23431
23457
  }
23432
- if (proResProfile !== undefined && !NoReactInternals17.proResProfileOptions.includes(proResProfile)) {
23433
- throw new TypeError(`The ProRes profile "${proResProfile}" is not valid. Valid options are ${NoReactInternals17.proResProfileOptions.map((p) => `"${p}"`).join(", ")}`);
23458
+ if (proResProfile !== undefined && !NoReactInternals19.proResProfileOptions.includes(proResProfile)) {
23459
+ throw new TypeError(`The ProRes profile "${proResProfile}" is not valid. Valid options are ${NoReactInternals19.proResProfileOptions.map((p) => `"${p}"`).join(", ")}`);
23434
23460
  }
23435
23461
  };
23436
23462
 
23437
23463
  // src/stitch-frames-to-video.ts
23438
23464
  import { cpSync as cpSync2, promises as promises5, rmSync as rmSync4 } from "node:fs";
23439
23465
  import path30 from "node:path";
23440
- import { NoReactInternals as NoReactInternals18 } from "remotion/no-react";
23466
+ import { NoReactInternals as NoReactInternals20 } from "remotion/no-react";
23441
23467
 
23442
23468
  // src/aac-priming.ts
23443
23469
  var LIBFDK_AAC_LC_ENCODER_DELAY_IN_SAMPLES = 2048;
@@ -23816,7 +23842,8 @@ var createSilentAudio = async ({
23816
23842
  };
23817
23843
 
23818
23844
  // src/merge-audio-track.ts
23819
- var mergeAudioTrackUnlimited = async ({
23845
+ var limit2 = pLimit(3);
23846
+ var mergeAudioTrack = async ({
23820
23847
  outName,
23821
23848
  files,
23822
23849
  downloadMap,
@@ -23831,7 +23858,7 @@ var mergeAudioTrackUnlimited = async ({
23831
23858
  sampleRate
23832
23859
  }) => {
23833
23860
  if (files.length === 0) {
23834
- await createSilentAudio({
23861
+ await limit2(createSilentAudio, {
23835
23862
  outName,
23836
23863
  chunkLengthInSeconds,
23837
23864
  indent,
@@ -23920,29 +23947,27 @@ var mergeAudioTrackUnlimited = async ({
23920
23947
  ["-y", outName]
23921
23948
  ].filter(truthy).flat(2);
23922
23949
  Log.verbose({ indent, logLevel }, `Merging audio tracks`, "Command:", `ffmpeg ${args.join(" ")}`, "Complex filter script:", complexFilter);
23923
- const task = callFf({
23924
- bin: "ffmpeg",
23925
- args,
23926
- indent,
23927
- logLevel,
23928
- binariesDirectory,
23929
- cancelSignal
23930
- });
23931
- task.stderr?.on("data", (data) => {
23932
- const utf8 = data.toString("utf8");
23933
- const parsed = parseFfmpegProgress(utf8, fps);
23934
- if (parsed !== undefined) {
23935
- onProgress(parsed / (chunkLengthInSeconds * fps));
23936
- }
23950
+ await limit2(async () => {
23951
+ const task = callFf({
23952
+ bin: "ffmpeg",
23953
+ args,
23954
+ indent,
23955
+ logLevel,
23956
+ binariesDirectory,
23957
+ cancelSignal
23958
+ });
23959
+ task.stderr?.on("data", (data) => {
23960
+ const utf8 = data.toString("utf8");
23961
+ const parsed = parseFfmpegProgress(utf8, fps);
23962
+ if (parsed !== undefined) {
23963
+ onProgress(parsed / (chunkLengthInSeconds * fps));
23964
+ }
23965
+ });
23966
+ await task;
23937
23967
  });
23938
- await task;
23939
23968
  onProgress(1);
23940
23969
  cleanup();
23941
23970
  };
23942
- var limit2 = pLimit(3);
23943
- var mergeAudioTrack = (options2) => {
23944
- return limit2(mergeAudioTrackUnlimited, options2);
23945
- };
23946
23971
 
23947
23972
  // src/merge-inline-audio-tracks.ts
23948
23973
  import path27 from "node:path";
@@ -24230,6 +24255,8 @@ var stringifyFfmpegFilter = ({
24230
24255
  const startInVideoSeconds = startInVideo / fps;
24231
24256
  const assetTrimLeftOffset = startInVideo === 0 ? trimLeftOffset : 0;
24232
24257
  const startInChunkSeconds = startInVideo === 0 ? 0 : startInVideoSeconds - trimLeftOffset;
24258
+ const capturedFrameCount = Math.round((chunkLengthInSeconds + trimLeftOffset - trimRightOffset) * fps);
24259
+ const assetTrimRightOffset = startInVideo + asset.duration >= capturedFrameCount ? trimRightOffset : 0;
24233
24260
  const { trimLeft, maxTrim } = getActualTrimLeft({
24234
24261
  trimLeft: asset.trimLeft,
24235
24262
  fps,
@@ -24252,7 +24279,7 @@ var stringifyFfmpegFilter = ({
24252
24279
  } = trimAndSetTempo({
24253
24280
  assetDuration,
24254
24281
  trimLeftOffset: assetTrimLeftOffset,
24255
- trimRightOffset,
24282
+ trimRightOffset: assetTrimRightOffset,
24256
24283
  asset,
24257
24284
  fps,
24258
24285
  indent,
@@ -24274,7 +24301,7 @@ var stringifyFfmpegFilter = ({
24274
24301
  toneFrequency && toneFrequency !== 1 ? `asetrate=${sampleRate}*${toneFrequency},aresample=${sampleRate},atempo=1/${toneFrequency}` : null
24275
24302
  ].filter(truthy).join(",") + `[a0]`,
24276
24303
  pad_end: padAtEnd > 0.0000001 ? "apad=pad_len=" + Math.round(padAtEnd * sampleRate) : null,
24277
- pad_start: padStart === 0 ? null : `adelay=${new Array(channels + 1).fill((padStart * 1000).toFixed(0)).join("|")}`,
24304
+ pad_start: padStart === 0 ? null : `adelay=${new Array(channels + 1).fill(`${Math.round(padStart * sampleRate)}S`).join("|")}`,
24278
24305
  actualTrimLeft
24279
24306
  };
24280
24307
  };
@@ -24812,7 +24839,7 @@ var innerStitchFramesToVideo = async ({
24812
24839
  const outputExtension = (getExtensionOfFilename(outputLocation) ?? getFileExtensionFromCodec(codec, resolvedAudioCodec)).toLowerCase();
24813
24840
  if (codec === "aac" && (outputExtension === "mpg" || outputExtension === "mpeg")) {
24814
24841
  const message = "AAC output with .mpg or .mpeg extensions is not supported. Use .aac for raw ADTS AAC or .m4a for an MPEG-4 audio container.";
24815
- if (NoReactInternals18.ENABLE_V5_BREAKING_CHANGES) {
24842
+ if (NoReactInternals20.ENABLE_V5_BREAKING_CHANGES) {
24816
24843
  throw new Error(message);
24817
24844
  }
24818
24845
  Log.warn({ indent, logLevel }, `${message} Falling back to raw ADTS AAC while keeping the requested filename. This will throw an error in Remotion 5.0.`);
@@ -25252,7 +25279,7 @@ var validateNumberOfGifLoops = (numberOfGifLoops, codec) => {
25252
25279
  };
25253
25280
 
25254
25281
  // src/validate-output-filename.ts
25255
- import { NoReactInternals as NoReactInternals19 } from "remotion/no-react";
25282
+ import { NoReactInternals as NoReactInternals21 } from "remotion/no-react";
25256
25283
  var validateOutputFilename = ({
25257
25284
  codec,
25258
25285
  audioCodecSetting,
@@ -25264,7 +25291,7 @@ var validateOutputFilename = ({
25264
25291
  throw new TypeError(`The codec "${codec}" is not supported. Supported codecs are: ${Object.keys(defaultFileExtensionMap).join(", ")}`);
25265
25292
  }
25266
25293
  const normalizedExtension = extension === null ? null : extension.toLowerCase();
25267
- if (NoReactInternals19.ENABLE_V5_BREAKING_CHANGES && codec === "aac" && (normalizedExtension === "mpg" || normalizedExtension === "mpeg")) {
25294
+ if (NoReactInternals21.ENABLE_V5_BREAKING_CHANGES && codec === "aac" && (normalizedExtension === "mpg" || normalizedExtension === "mpeg")) {
25268
25295
  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.");
25269
25296
  }
25270
25297
  const map = defaultFileExtensionMap[codec];
@@ -25352,6 +25379,7 @@ var internalRenderMediaRaw = async ({
25352
25379
  chromeMode,
25353
25380
  offthreadVideoThreads,
25354
25381
  mediaCacheSizeInBytes,
25382
+ preferredEffectBackend,
25355
25383
  onLog,
25356
25384
  licenseKey,
25357
25385
  isProduction,
@@ -25751,6 +25779,7 @@ var internalRenderMediaRaw = async ({
25751
25779
  chromeMode,
25752
25780
  imageSequencePattern: null,
25753
25781
  mediaCacheSizeInBytes,
25782
+ preferredEffectBackend,
25754
25783
  onLog,
25755
25784
  sampleRate
25756
25785
  });
@@ -25958,6 +25987,7 @@ var renderMedia = ({
25958
25987
  offthreadVideoThreads,
25959
25988
  compositionStart,
25960
25989
  mediaCacheSizeInBytes,
25990
+ preferredEffectBackend,
25961
25991
  isProduction,
25962
25992
  sampleRate,
25963
25993
  ...apiKeyOrLicenseKey
@@ -25969,8 +25999,8 @@ var renderMedia = ({
25969
25999
  }
25970
26000
  const licenseKey = "licenseKey" in apiKeyOrLicenseKey && typeof apiKeyOrLicenseKey.licenseKey === "string" ? apiKeyOrLicenseKey.licenseKey : null;
25971
26001
  const apiKey = "apiKey" in apiKeyOrLicenseKey && typeof apiKeyOrLicenseKey.apiKey === "string" ? apiKeyOrLicenseKey.apiKey : null;
25972
- const effectiveLicenseKey = (NoReactInternals20.ENABLE_V5_BREAKING_CHANGES ? licenseKey : licenseKey ?? apiKey) ?? null;
25973
- if (NoReactInternals20.ENABLE_V5_BREAKING_CHANGES && effectiveLicenseKey === null) {
26002
+ const effectiveLicenseKey = (NoReactInternals22.ENABLE_V5_BREAKING_CHANGES ? licenseKey : licenseKey ?? apiKey) ?? null;
26003
+ if (NoReactInternals22.ENABLE_V5_BREAKING_CHANGES && effectiveLicenseKey === null) {
25974
26004
  Log.warn({ indent, logLevel }, 'Pass "licenseKey" to renderMedia(). If you qualify for the Free License (https://remotion.dev/license), pass "free-license" instead.');
25975
26005
  }
25976
26006
  return internalRenderMedia({
@@ -25995,7 +26025,7 @@ var renderMedia = ({
25995
26025
  ffmpegOverride: ffmpegOverride ?? undefined,
25996
26026
  frameRange: frameRange ?? null,
25997
26027
  imageFormat: imageFormat ?? null,
25998
- serializedInputPropsWithCustomSchema: NoReactInternals20.serializeJSONWithSpecialTypes({
26028
+ serializedInputPropsWithCustomSchema: NoReactInternals22.serializeJSONWithSpecialTypes({
25999
26029
  indent: undefined,
26000
26030
  staticBase: null,
26001
26031
  data: inputProps ?? {}
@@ -26030,7 +26060,7 @@ var renderMedia = ({
26030
26060
  return;
26031
26061
  },
26032
26062
  server: undefined,
26033
- serializedResolvedPropsWithCustomSchema: NoReactInternals20.serializeJSONWithSpecialTypes({
26063
+ serializedResolvedPropsWithCustomSchema: NoReactInternals22.serializeJSONWithSpecialTypes({
26034
26064
  indent: undefined,
26035
26065
  staticBase: null,
26036
26066
  data: composition.props ?? {}
@@ -26053,6 +26083,7 @@ var renderMedia = ({
26053
26083
  hardwareAcceleration: hardwareAcceleration ?? "disable",
26054
26084
  chromeMode: chromeMode ?? "headless-shell",
26055
26085
  mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
26086
+ preferredEffectBackend: preferredEffectBackend ?? "auto",
26056
26087
  licenseKey: effectiveLicenseKey,
26057
26088
  onLog: defaultOnLog,
26058
26089
  isProduction: isProduction ?? null,
@@ -26064,7 +26095,7 @@ var renderMedia = ({
26064
26095
  import fs21, { statSync as statSync2 } from "node:fs";
26065
26096
  import path32 from "node:path";
26066
26097
  import { LicensingInternals as LicensingInternals2 } from "@remotion/licensing";
26067
- import { NoReactInternals as NoReactInternals21 } from "remotion/no-react";
26098
+ import { NoReactInternals as NoReactInternals23 } from "remotion/no-react";
26068
26099
  var innerRenderStill = async ({
26069
26100
  composition,
26070
26101
  imageFormat = DEFAULT_STILL_IMAGE_FORMAT,
@@ -26092,6 +26123,7 @@ var innerRenderStill = async ({
26092
26123
  onArtifact,
26093
26124
  chromeMode,
26094
26125
  mediaCacheSizeInBytes,
26126
+ preferredEffectBackend,
26095
26127
  onLog
26096
26128
  }) => {
26097
26129
  validateDimension(composition.height, "height", "in the `config` object passed to `renderStill()`");
@@ -26102,7 +26134,7 @@ var innerRenderStill = async ({
26102
26134
  allowFloats: false
26103
26135
  });
26104
26136
  validateStillImageFormat(imageFormat);
26105
- NoReactInternals21.validateFrame({
26137
+ NoReactInternals23.validateFrame({
26106
26138
  frame,
26107
26139
  durationInFrames: composition.durationInFrames,
26108
26140
  allowFloats: false
@@ -26160,8 +26192,10 @@ var innerRenderStill = async ({
26160
26192
  onError: errorCallback,
26161
26193
  frame: null
26162
26194
  });
26195
+ page.on("error", errorCallback);
26163
26196
  const cleanup = async () => {
26164
26197
  cleanUpJSException();
26198
+ page.off("error", errorCallback);
26165
26199
  if (puppeteerInstance) {
26166
26200
  await page.close();
26167
26201
  } else {
@@ -26191,6 +26225,7 @@ var innerRenderStill = async ({
26191
26225
  },
26192
26226
  isMainTab: true,
26193
26227
  mediaCacheSizeInBytes,
26228
+ preferredEffectBackend,
26194
26229
  initialMemoryAvailable: getAvailableMemory(logLevel),
26195
26230
  darkMode: chromiumOptions.darkMode ?? false,
26196
26231
  sampleRate: 48000
@@ -26375,6 +26410,7 @@ var renderStill = (options2) => {
26375
26410
  chromeMode,
26376
26411
  offthreadVideoThreads,
26377
26412
  mediaCacheSizeInBytes,
26413
+ preferredEffectBackend,
26378
26414
  isProduction,
26379
26415
  ...apiKeyOrLicenseKey
26380
26416
  } = options2;
@@ -26388,8 +26424,8 @@ var renderStill = (options2) => {
26388
26424
  }
26389
26425
  const licenseKey = "licenseKey" in apiKeyOrLicenseKey && typeof apiKeyOrLicenseKey.licenseKey === "string" ? apiKeyOrLicenseKey.licenseKey : null;
26390
26426
  const apiKey = "apiKey" in apiKeyOrLicenseKey && typeof apiKeyOrLicenseKey.apiKey === "string" ? apiKeyOrLicenseKey.apiKey : null;
26391
- const effectiveLicenseKey = (NoReactInternals21.ENABLE_V5_BREAKING_CHANGES ? licenseKey : licenseKey ?? apiKey) ?? null;
26392
- if (NoReactInternals21.ENABLE_V5_BREAKING_CHANGES && effectiveLicenseKey === null) {
26427
+ const effectiveLicenseKey = (NoReactInternals23.ENABLE_V5_BREAKING_CHANGES ? licenseKey : licenseKey ?? apiKey) ?? null;
26428
+ if (NoReactInternals23.ENABLE_V5_BREAKING_CHANGES && effectiveLicenseKey === null) {
26393
26429
  Log.warn({ indent, logLevel }, 'Pass "licenseKey" to renderStill(). If you qualify for the Free License (https://remotion.dev/license), pass "free-license" instead.');
26394
26430
  }
26395
26431
  return internalRenderStill({
@@ -26401,7 +26437,7 @@ var renderStill = (options2) => {
26401
26437
  frame: frame ?? 0,
26402
26438
  imageFormat: imageFormat ?? DEFAULT_STILL_IMAGE_FORMAT,
26403
26439
  indent,
26404
- serializedInputPropsWithCustomSchema: NoReactInternals21.serializeJSONWithSpecialTypes({
26440
+ serializedInputPropsWithCustomSchema: NoReactInternals23.serializeJSONWithSpecialTypes({
26405
26441
  staticBase: null,
26406
26442
  indent: undefined,
26407
26443
  data: inputProps ?? {}
@@ -26418,7 +26454,7 @@ var renderStill = (options2) => {
26418
26454
  serveUrl,
26419
26455
  timeoutInMilliseconds: timeoutInMilliseconds ?? DEFAULT_TIMEOUT,
26420
26456
  logLevel,
26421
- serializedResolvedPropsWithCustomSchema: NoReactInternals21.serializeJSONWithSpecialTypes({
26457
+ serializedResolvedPropsWithCustomSchema: NoReactInternals23.serializeJSONWithSpecialTypes({
26422
26458
  indent: undefined,
26423
26459
  staticBase: null,
26424
26460
  data: composition.props ?? {}
@@ -26434,6 +26470,7 @@ var renderStill = (options2) => {
26434
26470
  chromeMode: chromeMode ?? "headless-shell",
26435
26471
  offthreadVideoThreads: offthreadVideoThreads ?? null,
26436
26472
  mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
26473
+ preferredEffectBackend: preferredEffectBackend ?? "auto",
26437
26474
  licenseKey: effectiveLicenseKey,
26438
26475
  onLog: defaultOnLog,
26439
26476
  isProduction: isProduction ?? null
@@ -26441,7 +26478,7 @@ var renderStill = (options2) => {
26441
26478
  };
26442
26479
 
26443
26480
  // src/select-composition.ts
26444
- import { NoReactInternals as NoReactInternals22 } from "remotion/no-react";
26481
+ import { NoReactInternals as NoReactInternals24 } from "remotion/no-react";
26445
26482
  var innerSelectComposition = async ({
26446
26483
  page,
26447
26484
  serializedInputPropsWithCustomSchema,
@@ -26454,6 +26491,7 @@ var innerSelectComposition = async ({
26454
26491
  logLevel,
26455
26492
  onServeUrlVisited,
26456
26493
  mediaCacheSizeInBytes,
26494
+ preferredEffectBackend,
26457
26495
  chromiumOptions
26458
26496
  }) => {
26459
26497
  validatePuppeteerTimeout(timeoutInMilliseconds);
@@ -26473,6 +26511,7 @@ var innerSelectComposition = async ({
26473
26511
  onServeUrlVisited,
26474
26512
  isMainTab: true,
26475
26513
  mediaCacheSizeInBytes,
26514
+ preferredEffectBackend,
26476
26515
  initialMemoryAvailable: getAvailableMemory(logLevel),
26477
26516
  darkMode: chromiumOptions.darkMode ?? false,
26478
26517
  sampleRate: 48000
@@ -26535,8 +26574,8 @@ var innerSelectComposition = async ({
26535
26574
  height,
26536
26575
  fps,
26537
26576
  durationInFrames,
26538
- props: NoReactInternals22.deserializeJSONWithSpecialTypes(res.serializedResolvedPropsWithCustomSchema),
26539
- defaultProps: NoReactInternals22.deserializeJSONWithSpecialTypes(res.serializedDefaultPropsWithCustomSchema),
26577
+ props: NoReactInternals24.deserializeJSONWithSpecialTypes(res.serializedResolvedPropsWithCustomSchema),
26578
+ defaultProps: NoReactInternals24.deserializeJSONWithSpecialTypes(res.serializedDefaultPropsWithCustomSchema),
26540
26579
  defaultCodec,
26541
26580
  defaultOutName,
26542
26581
  defaultVideoImageFormat,
@@ -26568,7 +26607,8 @@ var internalSelectCompositionRaw = async (options2) => {
26568
26607
  onBrowserDownload,
26569
26608
  onServeUrlVisited,
26570
26609
  chromeMode,
26571
- mediaCacheSizeInBytes
26610
+ mediaCacheSizeInBytes,
26611
+ preferredEffectBackend
26572
26612
  } = options2;
26573
26613
  const [{ page, cleanupPage }, serverUsed] = await Promise.all([
26574
26614
  getPageAndCleanupFn({
@@ -26632,7 +26672,8 @@ var internalSelectCompositionRaw = async (options2) => {
26632
26672
  onBrowserDownload,
26633
26673
  onServeUrlVisited,
26634
26674
  chromeMode,
26635
- mediaCacheSizeInBytes
26675
+ mediaCacheSizeInBytes,
26676
+ preferredEffectBackend
26636
26677
  }).then((data) => {
26637
26678
  return resolve(data);
26638
26679
  }).catch((err) => {
@@ -26666,7 +26707,8 @@ var selectComposition = async (options2) => {
26666
26707
  onBrowserDownload,
26667
26708
  chromeMode,
26668
26709
  offthreadVideoThreads,
26669
- mediaCacheSizeInBytes
26710
+ mediaCacheSizeInBytes,
26711
+ preferredEffectBackend
26670
26712
  } = options2;
26671
26713
  const indent = false;
26672
26714
  const logLevel = passedLogLevel ?? (verbose ? "verbose" : "info");
@@ -26676,7 +26718,7 @@ var selectComposition = async (options2) => {
26676
26718
  browserExecutable: browserExecutable ?? null,
26677
26719
  chromiumOptions: chromiumOptions ?? {},
26678
26720
  envVariables: envVariables ?? {},
26679
- serializedInputPropsWithCustomSchema: NoReactInternals22.serializeJSONWithSpecialTypes({
26721
+ serializedInputPropsWithCustomSchema: NoReactInternals24.serializeJSONWithSpecialTypes({
26680
26722
  indent: undefined,
26681
26723
  staticBase: null,
26682
26724
  data: inputProps ?? {}
@@ -26700,7 +26742,8 @@ var selectComposition = async (options2) => {
26700
26742
  },
26701
26743
  chromeMode: chromeMode ?? "headless-shell",
26702
26744
  offthreadVideoThreads: offthreadVideoThreads ?? null,
26703
- mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null
26745
+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
26746
+ preferredEffectBackend: preferredEffectBackend ?? "auto"
26704
26747
  });
26705
26748
  return data.metadata;
26706
26749
  };
@@ -27154,9 +27197,9 @@ var getAudibleParts = ({
27154
27197
  };
27155
27198
  // src/get-video-metadata.ts
27156
27199
  import { resolve as resolve2 } from "node:path";
27157
- import { NoReactInternals as NoReactInternals23 } from "remotion/no-react";
27200
+ import { NoReactInternals as NoReactInternals25 } from "remotion/no-react";
27158
27201
  var getVideoMetadata = async (videoSource, options2) => {
27159
- if (NoReactInternals23.ENABLE_V5_BREAKING_CHANGES) {
27202
+ if (NoReactInternals25.ENABLE_V5_BREAKING_CHANGES) {
27160
27203
  throw new Error("getVideoMetadata() has been removed in Remotion 5. Use Mediabunny instead: https://www.remotion.dev/docs/mediabunny/metadata");
27161
27204
  }
27162
27205
  const compositor = startLongRunningCompositor({
@@ -27195,6 +27238,7 @@ var customEditorLineNumberPlaceholder = "%LINE_NUMBER%";
27195
27238
  var customEditorColumnNumberPlaceholder = "%COLUMN_NUMBER%";
27196
27239
  // src/index.ts
27197
27240
  var RenderInternals = {
27241
+ isUserCancelledRender,
27198
27242
  resolveConcurrency,
27199
27243
  serveStatic,
27200
27244
  validateEvenDimensionsWithCodec,