@remotion/renderer 4.0.539 → 4.0.541

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 (162) hide show
  1. package/dist/assets/download-and-map-assets-to-file.js +16 -3
  2. package/dist/assets/download-file.js +10 -6
  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 +6 -5
  6. package/dist/browser/BrowserFetcher.js +4 -1
  7. package/dist/browser/BrowserPage.js +27 -8
  8. package/dist/browser/BrowserRunner.js +36 -10
  9. package/dist/browser/NetworkManager.js +6 -1
  10. package/dist/browser/devtools-commands.d.ts +6 -1
  11. package/dist/browser/get-chrome-download-url.d.ts +1 -1
  12. package/dist/browser/get-chrome-download-url.js +4 -1
  13. package/dist/check-version-requirements.js +6 -6
  14. package/dist/client.d.ts +459 -238
  15. package/dist/collect-assets.js +1 -1
  16. package/dist/esm/client.mjs +349 -310
  17. package/dist/esm/index.mjs +348 -272
  18. package/dist/get-compositions.js +6 -3
  19. package/dist/index.d.ts +113 -41
  20. package/dist/index.js +4 -2
  21. package/dist/make-page.d.ts +3 -1
  22. package/dist/make-page.js +2 -1
  23. package/dist/open-browser.js +2 -0
  24. package/dist/options/allow-html-in-canvas.d.ts +1 -1
  25. package/dist/options/api-key.d.ts +1 -1
  26. package/dist/options/ask-ai.d.ts +1 -1
  27. package/dist/options/ask-ai.js +1 -1
  28. package/dist/options/audio-bitrate.d.ts +1 -1
  29. package/dist/options/beep-on-finish.d.ts +1 -1
  30. package/dist/options/benchmark-concurrencies.d.ts +1 -1
  31. package/dist/options/binaries-directory.d.ts +1 -1
  32. package/dist/options/browser-executable.d.ts +1 -1
  33. package/dist/options/browser-executable.js +1 -1
  34. package/dist/options/browser.d.ts +1 -1
  35. package/dist/options/bundle-cache.d.ts +1 -1
  36. package/dist/options/canvas-tabs.d.ts +1 -1
  37. package/dist/options/chrome-mode.d.ts +1 -1
  38. package/dist/options/color-space.d.ts +1 -1
  39. package/dist/options/concurrency.d.ts +1 -1
  40. package/dist/options/config.d.ts +1 -1
  41. package/dist/options/crf.d.ts +1 -1
  42. package/dist/options/crf.js +1 -1
  43. package/dist/options/cross-site-isolation.d.ts +1 -1
  44. package/dist/options/cross-site-isolation.js +2 -2
  45. package/dist/options/dark-mode.d.ts +1 -1
  46. package/dist/options/default-coding-agent.d.ts +1 -1
  47. package/dist/options/default-editor.d.ts +1 -1
  48. package/dist/options/default-premount-in-seconds.d.ts +1 -1
  49. package/dist/options/delete-after.d.ts +1 -1
  50. package/dist/options/disable-git-source.d.ts +2 -2
  51. package/dist/options/disable-shared-memory-capture.d.ts +1 -1
  52. package/dist/options/disable-web-security.d.ts +1 -1
  53. package/dist/options/disallow-parallel-encoding.d.ts +1 -1
  54. package/dist/options/enable-cancellation.d.ts +1 -1
  55. package/dist/options/enable-lambda-insights.d.ts +1 -1
  56. package/dist/options/enable-lambda-insights.js +2 -2
  57. package/dist/options/enable-multiprocess-on-linux.d.ts +1 -1
  58. package/dist/options/enable-multiprocess-on-linux.js +2 -2
  59. package/dist/options/encoding-buffer-size.d.ts +1 -1
  60. package/dist/options/encoding-max-rate.d.ts +1 -1
  61. package/dist/options/enforce-audio.d.ts +1 -1
  62. package/dist/options/env-file.d.ts +1 -1
  63. package/dist/options/every-nth-frame.d.ts +1 -1
  64. package/dist/options/experimental-keep-audio-context-alive.d.ts +1 -1
  65. package/dist/options/folder-expiry.d.ts +1 -1
  66. package/dist/options/folder-expiry.js +1 -1
  67. package/dist/options/for-seamless-aac-concatenation.d.ts +1 -1
  68. package/dist/options/force-new-studio.d.ts +1 -1
  69. package/dist/options/frames.d.ts +1 -1
  70. package/dist/options/gl.d.ts +1 -1
  71. package/dist/options/gop-size.d.ts +1 -1
  72. package/dist/options/headless.d.ts +1 -1
  73. package/dist/options/ignore-certificate-errors.d.ts +1 -1
  74. package/dist/options/image-sequence-pattern.d.ts +1 -1
  75. package/dist/options/image-sequence.d.ts +1 -1
  76. package/dist/options/index.d.ts +119 -102
  77. package/dist/options/index.js +2 -0
  78. package/dist/options/interactivity.d.ts +1 -1
  79. package/dist/options/ipv4.d.ts +1 -1
  80. package/dist/options/is-production.d.ts +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/log-level.d.ts +1 -1
  86. package/dist/options/metadata.d.ts +1 -1
  87. package/dist/options/mute.d.ts +1 -1
  88. package/dist/options/no-open.d.ts +1 -1
  89. package/dist/options/number-of-gif-loops.d.ts +1 -1
  90. package/dist/options/number-of-shared-audio-tags.d.ts +1 -1
  91. package/dist/options/offthreadvideo-cache-size.d.ts +1 -1
  92. package/dist/options/offthreadvideo-threads.d.ts +1 -1
  93. package/dist/options/on-browser-download.d.ts +1 -1
  94. package/dist/options/options-map.d.ts +340 -136
  95. package/dist/options/options-map.js +13 -0
  96. package/dist/options/out-dir.d.ts +1 -1
  97. package/dist/options/override-duration.d.ts +1 -1
  98. package/dist/options/override-fps.d.ts +1 -1
  99. package/dist/options/override-height.d.ts +1 -1
  100. package/dist/options/override-width.d.ts +1 -1
  101. package/dist/options/overwrite.d.ts +1 -1
  102. package/dist/options/package-manager.d.ts +1 -1
  103. package/dist/options/pixel-format.d.ts +1 -1
  104. package/dist/options/port.d.ts +1 -1
  105. package/dist/options/prefer-lossless.d.ts +1 -1
  106. package/dist/options/preferred-effect-backend.d.ts +18 -0
  107. package/dist/options/preferred-effect-backend.js +28 -0
  108. package/dist/options/preserve-pitch-on-playback.d.ts +1 -1
  109. package/dist/options/preview-sample-rate.d.ts +1 -1
  110. package/dist/options/props.d.ts +1 -1
  111. package/dist/options/prores-profile.d.ts +1 -1
  112. package/dist/options/public-dir.d.ts +1 -1
  113. package/dist/options/public-license-key.d.ts +1 -1
  114. package/dist/options/public-path.d.ts +1 -1
  115. package/dist/options/repro.d.ts +1 -1
  116. package/dist/options/rspack.d.ts +1 -1
  117. package/dist/options/runs.d.ts +1 -1
  118. package/dist/options/sample-rate.d.ts +1 -1
  119. package/dist/options/scale.d.ts +1 -1
  120. package/dist/options/sequence-activity-limit.d.ts +1 -1
  121. package/dist/options/show-layer-frame-numbers.d.ts +1 -1
  122. package/dist/options/show-premounting.d.ts +1 -1
  123. package/dist/options/skip-skills.d.ts +1 -1
  124. package/dist/options/still-frame.d.ts +1 -1
  125. package/dist/options/still-image-format.d.ts +1 -1
  126. package/dist/options/throw-if-site-exists.d.ts +2 -2
  127. package/dist/options/timeout.d.ts +1 -1
  128. package/dist/options/user-agent.d.ts +1 -1
  129. package/dist/options/version-flag.d.ts +1 -1
  130. package/dist/options/video-bitrate.d.ts +1 -1
  131. package/dist/options/video-cache-size.d.ts +1 -1
  132. package/dist/options/video-codec.d.ts +1 -1
  133. package/dist/options/video-image-format.d.ts +1 -1
  134. package/dist/options/webhook-custom-data.d.ts +1 -1
  135. package/dist/options/webpack-poll.d.ts +1 -1
  136. package/dist/options/x264-preset.d.ts +1 -1
  137. package/dist/pool.js +3 -0
  138. package/dist/render-frame-and-retry-target-close.js +2 -1
  139. package/dist/render-frames.js +6 -3
  140. package/dist/render-media.d.ts +1 -1
  141. package/dist/render-media.js +4 -2
  142. package/dist/render-still.js +6 -2
  143. package/dist/select-composition.js +6 -3
  144. package/dist/set-props-and-env.d.ts +2 -0
  145. package/dist/set-props-and-env.js +8 -3
  146. package/dist/stringify-ffmpeg-filter.js +6 -2
  147. package/dist/symbolicate-stacktrace.js +1 -1
  148. package/dist/validate-selected-frames.d.ts +4 -4
  149. package/dist/validate-selected-frames.js +2 -31
  150. package/package.json +15 -15
  151. package/dist/options/experimental-client-side-rendering.d.ts +0 -16
  152. package/dist/options/experimental-client-side-rendering.js +0 -30
  153. package/dist/options/experimental-sequence-activity-limit.d.ts +0 -19
  154. package/dist/options/experimental-sequence-activity-limit.js +0 -40
  155. package/dist/options/experimental-sequence-activity.d.ts +0 -19
  156. package/dist/options/experimental-sequence-activity.js +0 -38
  157. package/dist/options/experimental-tracks.d.ts +0 -19
  158. package/dist/options/experimental-tracks.js +0 -43
  159. package/dist/prestitcher-memory-usage.d.ts +0 -13
  160. package/dist/prestitcher-memory-usage.js +0 -33
  161. package/dist/render-partitions.d.ts +0 -7
  162. package/dist/render-partitions.js +0 -50
@@ -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,11 +1147,11 @@ 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}`);
@@ -1158,7 +1159,7 @@ var readFile = async (url, redirectsSoFar = 0) => {
1158
1159
  const redirectUrl = new URL(response.headers.location, url).toString();
1159
1160
  request.destroy();
1160
1161
  response.destroy();
1161
- return readFile(redirectUrl, redirectsSoFar + 1);
1162
+ return readFile(redirectUrl, signal, redirectsSoFar + 1);
1162
1163
  }
1163
1164
  if (response.statusCode >= 400) {
1164
1165
  const body = await tryToObtainBody(response);
@@ -1240,23 +1241,27 @@ var downloadFileWithoutRetries = ({
1240
1241
  return;
1241
1242
  }
1242
1243
  rejectAndFlag(new Error(`Tried to download file ${url}, ${noDataSentToken} 20 seconds`));
1244
+ closeConnection();
1243
1245
  }, 20000);
1244
1246
  };
1245
1247
  refreshTimeout();
1246
1248
  let finishEventSent = false;
1247
- let closeConnection = () => {
1248
- return;
1249
- };
1249
+ const requestController = new AbortController;
1250
+ let closeConnection = () => requestController.abort();
1250
1251
  const onAbort = () => {
1251
1252
  rejectAndFlag(new Error(CANCELLED_ERROR));
1252
1253
  closeConnection();
1253
1254
  };
1254
1255
  abortSignal.addEventListener("abort", onAbort);
1255
- readFile(url).then(({ response, request }) => {
1256
+ readFile(url, requestController.signal).then(({ response, request }) => {
1256
1257
  closeConnection = () => {
1257
1258
  request.destroy();
1258
1259
  response.destroy();
1259
1260
  };
1261
+ if (rejected) {
1262
+ closeConnection();
1263
+ return;
1264
+ }
1260
1265
  if (abortSignal.aborted) {
1261
1266
  onAbort();
1262
1267
  return;
@@ -1324,7 +1329,7 @@ var downloadFile = async (options2, retries = 2, attempt = 1) => {
1324
1329
  if (message === CANCELLED_ERROR) {
1325
1330
  throw err;
1326
1331
  }
1327
- if (message === "aborted" || message.includes("ECONNRESET") || message.includes(incorrectContentLengthToken) || message.includes(noDataSentToken) || message.includes("503") || message.includes("502") || message.includes("504") || message.includes("500")) {
1332
+ if (message === "aborted" || message.includes("ECONNRESET") || message.includes(incorrectContentLengthToken) || message.includes(noDataSentToken) || /^Received a status code of (500|502|503|504) while downloading file /.test(message)) {
1328
1333
  if (retries === 0) {
1329
1334
  throw err;
1330
1335
  }
@@ -2595,7 +2600,10 @@ class NetworkManager extends EventEmitter {
2595
2600
  this.#client.on("Network.responseReceivedExtraInfo", this.#onResponseReceivedExtraInfo.bind(this));
2596
2601
  }
2597
2602
  async initialize() {
2598
- await this.#client.send("Network.enable");
2603
+ await this.#client.send("Network.enable", {
2604
+ maxTotalBufferSize: 0,
2605
+ maxResourceBufferSize: 0
2606
+ });
2599
2607
  }
2600
2608
  #onRequestWillBeSent(event) {
2601
2609
  this.#onRequest(event, undefined);
@@ -3490,6 +3498,19 @@ class Page extends EventEmitter {
3490
3498
  client.on("Runtime.consoleAPICalled", (event) => {
3491
3499
  return this.#onConsoleAPI(event);
3492
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
+ });
3493
3514
  client.on("Runtime.bindingCalled", (event) => {
3494
3515
  return this.#onBindingCalled(event);
3495
3516
  });
@@ -3576,7 +3597,7 @@ class Page extends EventEmitter {
3576
3597
  this.emit("error", new Error("Page crashed!"));
3577
3598
  }
3578
3599
  #onLogEntryAdded(event) {
3579
- const { level, text, args, source, url, lineNumber } = event.entry;
3600
+ const { level, text, args, source, url, lineNumber, stackTrace } = event.entry;
3580
3601
  if (args) {
3581
3602
  args.map((arg) => {
3582
3603
  return releaseObject(this.#client, arg);
@@ -3588,16 +3609,15 @@ class Page extends EventEmitter {
3588
3609
  type: level,
3589
3610
  text,
3590
3611
  args: [],
3591
- 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 }],
3592
3617
  previewString,
3593
3618
  logLevel: logLevelFromRemotionLog ?? logLevelFromEvent,
3594
3619
  tag
3595
3620
  });
3596
- this.onBrowserLog?.({
3597
- stackTrace: message.stackTrace(),
3598
- text: message.text,
3599
- type: message.type
3600
- });
3601
3621
  this.#onConsole(message);
3602
3622
  }
3603
3623
  }
@@ -4020,7 +4040,7 @@ var makeBrowserRunner = async ({
4020
4040
  const transport = await NodeWebSocketTransport.create(browserWSEndpoint);
4021
4041
  const connection = new Connection(transport);
4022
4042
  const killProcess = () => {
4023
- if (proc.pid && pidExists(proc.pid)) {
4043
+ if (!closed && proc.pid && pidExists(proc.pid)) {
4024
4044
  try {
4025
4045
  if (process.platform === "win32") {
4026
4046
  childProcess.exec(`taskkill /pid ${proc.pid} /T /F`, (error) => {
@@ -4046,15 +4066,41 @@ Error cause: ${isErrorLike(error) ? error.stack : error}`);
4046
4066
  deleteDirectory(userDataDir);
4047
4067
  removeEventListeners(listeners);
4048
4068
  };
4069
+ let closePromise = null;
4049
4070
  const closeProcess = () => {
4050
- if (closed) {
4051
- return Promise.resolve();
4071
+ if (closePromise) {
4072
+ return closePromise;
4052
4073
  }
4053
- Log.verbose({ indent, logLevel }, "Received SIGTERM signal. Killing browser process");
4054
- killProcess();
4055
- deleteDirectory(userDataDir);
4056
- removeEventListeners(listeners);
4057
- return processClosing;
4074
+ closePromise = (async () => {
4075
+ let timeoutId = null;
4076
+ try {
4077
+ if (!closed) {
4078
+ try {
4079
+ connection.send("Browser.close").catch(() => {
4080
+ return;
4081
+ });
4082
+ } catch {}
4083
+ await Promise.race([
4084
+ processClosing,
4085
+ new Promise((resolve) => {
4086
+ timeoutId = setTimeout(resolve, 2000);
4087
+ })
4088
+ ]);
4089
+ if (!closed) {
4090
+ Log.verbose({ indent, logLevel }, "Browser did not exit gracefully. Killing browser process");
4091
+ killProcess();
4092
+ }
4093
+ await processClosing;
4094
+ }
4095
+ } finally {
4096
+ if (timeoutId !== null) {
4097
+ clearTimeout(timeoutId);
4098
+ }
4099
+ deleteDirectory(userDataDir);
4100
+ removeEventListeners(listeners);
4101
+ }
4102
+ })();
4103
+ return closePromise;
4058
4104
  };
4059
4105
  if (dumpio) {
4060
4106
  proc.stdout?.on("data", (d) => {
@@ -4778,8 +4824,106 @@ var canUseParallelEncoding = (codec) => {
4778
4824
  };
4779
4825
 
4780
4826
  // src/check-version-requirements.ts
4781
- import os2 from "node:os";
4827
+ import os3 from "node:os";
4782
4828
  import { NoReactInternals as NoReactInternals3 } from "remotion/no-react";
4829
+
4830
+ // src/browser/get-chrome-download-url.ts
4831
+ import * as fs5 from "node:fs";
4832
+ import * as os2 from "node:os";
4833
+ var TESTED_VERSION = "158.0.8127.2";
4834
+ var isAmazonLinux2023 = () => {
4835
+ if (os2.platform() !== "linux") {
4836
+ return false;
4837
+ }
4838
+ try {
4839
+ const osRelease = fs5.readFileSync("/etc/os-release", "utf-8");
4840
+ return osRelease.includes("Amazon Linux") && osRelease.includes('VERSION="2023"');
4841
+ } catch {
4842
+ return false;
4843
+ }
4844
+ };
4845
+ var MINIMUM_GLIBC_FOR_REMOTION_MEDIA = [2, 35];
4846
+ var getGlibcVersion = () => {
4847
+ if (process.platform !== "linux") {
4848
+ return null;
4849
+ }
4850
+ const { report } = process;
4851
+ if (!report) {
4852
+ return null;
4853
+ }
4854
+ const rep = report.getReport();
4855
+ if (typeof rep === "string") {
4856
+ return null;
4857
+ }
4858
+ const { glibcVersionRuntime } = rep.header;
4859
+ if (!glibcVersionRuntime) {
4860
+ return null;
4861
+ }
4862
+ const split = glibcVersionRuntime.split(".");
4863
+ if (split.length !== 2) {
4864
+ return null;
4865
+ }
4866
+ return [Number(split[0]), Number(split[1])];
4867
+ };
4868
+ var isGlibcVersionAtLeast = (required) => {
4869
+ const version = getGlibcVersion();
4870
+ if (version === null) {
4871
+ return false;
4872
+ }
4873
+ const [major, minor] = version;
4874
+ const [reqMajor, reqMinor] = required;
4875
+ if (major > reqMajor) {
4876
+ return true;
4877
+ }
4878
+ if (major === reqMajor && minor >= reqMinor) {
4879
+ return true;
4880
+ }
4881
+ return false;
4882
+ };
4883
+ var canUseRemotionMediaBinaries = () => {
4884
+ if (process.platform !== "linux") {
4885
+ return false;
4886
+ }
4887
+ return isGlibcVersionAtLeast(MINIMUM_GLIBC_FOR_REMOTION_MEDIA);
4888
+ };
4889
+ function getChromeDownloadUrl({
4890
+ platform,
4891
+ version,
4892
+ chromeMode
4893
+ }) {
4894
+ if (platform === "linux-arm64" && version && /^\d+$/.test(version)) {
4895
+ const archive = chromeMode === "chrome-for-testing" ? "chromium-linux-arm64" : "chromium-headless-shell-linux-arm64";
4896
+ return `https://playwright.azureedge.net/builds/chromium/${version}/${archive}.zip`;
4897
+ }
4898
+ if (chromeMode === "headless-shell" && version === null) {
4899
+ if (platform === "mac-arm64") {
4900
+ return `https://remotion.media/chromium-headless-shell-mac-arm64-${TESTED_VERSION}.zip?clear`;
4901
+ }
4902
+ if (platform === "win64") {
4903
+ return `https://remotion.media/chromium-headless-shell-win-x64-${TESTED_VERSION}.zip?clear`;
4904
+ }
4905
+ if (platform === "linux64" || platform === "linux-arm64") {
4906
+ const architecture = platform === "linux64" ? "x64" : "arm64";
4907
+ if (isAmazonLinux2023()) {
4908
+ return `https://remotion.media/chromium-headless-shell-amazon-linux-${architecture}-${TESTED_VERSION}.zip?clear`;
4909
+ }
4910
+ if (canUseRemotionMediaBinaries()) {
4911
+ return `https://remotion.media/chromium-headless-shell-linux-${architecture}-${TESTED_VERSION}.zip?clear`;
4912
+ }
4913
+ }
4914
+ }
4915
+ const archive = chromeMode === "headless-shell" ? "chrome-headless-shell" : "chrome";
4916
+ return `https://storage.googleapis.com/chrome-for-testing-public/${version ?? TESTED_VERSION}/${platform}/${archive}-${platform}.zip`;
4917
+ }
4918
+ var logDownloadUrl = ({
4919
+ url,
4920
+ logLevel,
4921
+ indent
4922
+ }) => {
4923
+ Log.info({ indent, logLevel }, `Downloading from: ${url}`);
4924
+ };
4925
+
4926
+ // src/check-version-requirements.ts
4783
4927
  var getRequiredLibCVersion = () => {
4784
4928
  if (process.platform !== "linux") {
4785
4929
  return null;
@@ -4787,10 +4931,10 @@ var getRequiredLibCVersion = () => {
4787
4931
  if (isMusl({ indent: false, logLevel: "warn" })) {
4788
4932
  return null;
4789
4933
  }
4790
- if (process.arch === "arm64") {
4791
- return [2, 26];
4934
+ if (process.arch === "arm64" && isAmazonLinux2023()) {
4935
+ return [2, 34];
4792
4936
  }
4793
- return [2, 31];
4937
+ return [2, 35];
4794
4938
  };
4795
4939
  var required = getRequiredLibCVersion();
4796
4940
  var gLibCErrorMessage = (libCString) => {
@@ -4807,7 +4951,7 @@ var gLibCErrorMessage = (libCString) => {
4807
4951
  if (Number(split[0]) > required[0]) {
4808
4952
  return null;
4809
4953
  }
4810
- return `Rendering videos requires glibc ${required.join(".")} on your or higher on your OS. Your system has glibc ${libCString}.`;
4954
+ return `Rendering videos requires glibc ${required.join(".")} or higher on your OS. Your system has glibc ${libCString}.`;
4811
4955
  };
4812
4956
  var checkLibCRequirement = (logLevel, indent) => {
4813
4957
  if (process.platform === "win32" || process.platform === "darwin") {
@@ -4848,7 +4992,7 @@ var checkMacOSVersion = (logLevel, indent) => {
4848
4992
  if (process.platform !== "darwin") {
4849
4993
  return;
4850
4994
  }
4851
- const majorVersion = Number(os2.release().split(".")[0]);
4995
+ const majorVersion = Number(os3.release().split(".")[0]);
4852
4996
  if (Number.isNaN(majorVersion) || majorVersion >= MIN_DARWIN_VERSION) {
4853
4997
  return;
4854
4998
  }
@@ -4922,7 +5066,7 @@ var formatStackFrameLocationLine = (frame) => {
4922
5066
  };
4923
5067
 
4924
5068
  // src/symbolicate-stacktrace.ts
4925
- import { readFileSync } from "fs";
5069
+ import { readFileSync as readFileSync2 } from "fs";
4926
5070
  import path6 from "path";
4927
5071
  import { SourceMapConsumer } from "source-map";
4928
5072
  function extractSourceMapUrl(fileContents) {
@@ -4968,14 +5112,14 @@ var getSourceMap = (filePath, fileContents, type) => {
4968
5112
  }
4969
5113
  if (type === "local") {
4970
5114
  const newFilePath = path6.join(path6.dirname(filePath), sm);
4971
- return Promise.resolve(new SourceMapConsumer(readFileSync(newFilePath, "utf8")));
5115
+ return Promise.resolve(new SourceMapConsumer(readFileSync2(newFilePath, "utf8")));
4972
5116
  }
4973
5117
  const index = filePath.lastIndexOf("/");
4974
5118
  const url = filePath.substring(0, index + 1) + sm;
4975
5119
  return getSourceMapFromRemoteUrl(url);
4976
5120
  };
4977
5121
  var fetchUrl = async (url) => {
4978
- const { request, response } = await readFile(url);
5122
+ const { request, response } = await readFile(url, null);
4979
5123
  return new Promise((resolve, reject) => {
4980
5124
  let downloaded = "";
4981
5125
  response.on("data", (d) => {
@@ -5051,7 +5195,7 @@ var getSourceMapFromRemoteFile = async (fileName) => {
5051
5195
  return getSourceMap(fileName, fileContents, "remote");
5052
5196
  };
5053
5197
  var getSourceMapFromLocalFile = (fileName) => {
5054
- const fileContents = readFileSync(fileName, "utf8");
5198
+ const fileContents = readFileSync2(fileName, "utf8");
5055
5199
  return getSourceMap(fileName, fileContents, "local");
5056
5200
  };
5057
5201
 
@@ -5465,7 +5609,7 @@ var validateFrameRange = (frameRange) => {
5465
5609
  };
5466
5610
 
5467
5611
  // src/get-compositions.ts
5468
- import { NoReactInternals as NoReactInternals11 } from "remotion/no-react";
5612
+ import { NoReactInternals as NoReactInternals12 } from "remotion/no-react";
5469
5613
 
5470
5614
  // src/to-megabytes.ts
5471
5615
  function toMegabytes(bytes) {
@@ -5553,8 +5697,8 @@ import { promisify as promisify2 } from "node:util";
5553
5697
 
5554
5698
  // src/browser/browser-download-lock.ts
5555
5699
  import { randomUUID } from "node:crypto";
5556
- import * as fs5 from "node:fs";
5557
- import os3 from "node:os";
5700
+ import * as fs6 from "node:fs";
5701
+ import os4 from "node:os";
5558
5702
  var RETRY_INTERVAL_IN_MS = 100;
5559
5703
  var STALE_LOCK_IN_MS = 30000;
5560
5704
  var HEARTBEAT_INTERVAL_IN_MS = 5000;
@@ -5568,7 +5712,7 @@ var isErrorWithCode = (error, code) => {
5568
5712
  };
5569
5713
  var readLock = async (lockPath) => {
5570
5714
  try {
5571
- const parsed = JSON.parse(await fs5.promises.readFile(lockPath, "utf8"));
5715
+ const parsed = JSON.parse(await fs6.promises.readFile(lockPath, "utf8"));
5572
5716
  if (typeof parsed.hostname !== "string" || typeof parsed.pid !== "number" || typeof parsed.token !== "string") {
5573
5717
  return null;
5574
5718
  }
@@ -5588,7 +5732,7 @@ var isProcessRunning = (pid) => {
5588
5732
  var removeStaleLock = async (lockPath) => {
5589
5733
  let stats;
5590
5734
  try {
5591
- stats = await fs5.promises.stat(lockPath);
5735
+ stats = await fs6.promises.stat(lockPath);
5592
5736
  } catch (error) {
5593
5737
  if (isErrorWithCode(error, "ENOENT")) {
5594
5738
  return;
@@ -5596,7 +5740,7 @@ var removeStaleLock = async (lockPath) => {
5596
5740
  throw error;
5597
5741
  }
5598
5742
  const lock = await readLock(lockPath);
5599
- if (lock?.hostname === os3.hostname()) {
5743
+ if (lock?.hostname === os4.hostname()) {
5600
5744
  if (isProcessRunning(lock.pid)) {
5601
5745
  return;
5602
5746
  }
@@ -5604,7 +5748,7 @@ var removeStaleLock = async (lockPath) => {
5604
5748
  return;
5605
5749
  }
5606
5750
  try {
5607
- await fs5.promises.unlink(lockPath);
5751
+ await fs6.promises.unlink(lockPath);
5608
5752
  } catch (error) {
5609
5753
  if (!isErrorWithCode(error, "ENOENT")) {
5610
5754
  throw error;
@@ -5616,7 +5760,7 @@ var acquireBrowserDownloadLock = async (lockPath) => {
5616
5760
  const token = randomUUID();
5617
5761
  let lockFile;
5618
5762
  try {
5619
- lockFile = await fs5.promises.open(lockPath, "wx");
5763
+ lockFile = await fs6.promises.open(lockPath, "wx");
5620
5764
  } catch (error) {
5621
5765
  if (!isErrorWithCode(error, "EEXIST")) {
5622
5766
  throw error;
@@ -5627,13 +5771,13 @@ var acquireBrowserDownloadLock = async (lockPath) => {
5627
5771
  }
5628
5772
  try {
5629
5773
  await lockFile.writeFile(JSON.stringify({
5630
- hostname: os3.hostname(),
5774
+ hostname: os4.hostname(),
5631
5775
  pid: process.pid,
5632
5776
  token
5633
5777
  }));
5634
5778
  } catch (error) {
5635
5779
  await lockFile.close();
5636
- await fs5.promises.rm(lockPath, { force: true });
5780
+ await fs6.promises.rm(lockPath, { force: true });
5637
5781
  throw error;
5638
5782
  }
5639
5783
  const heartbeat = setInterval(async () => {
@@ -5643,7 +5787,7 @@ var acquireBrowserDownloadLock = async (lockPath) => {
5643
5787
  }
5644
5788
  const now = new Date;
5645
5789
  try {
5646
- await fs5.promises.utimes(lockPath, now, now);
5790
+ await fs6.promises.utimes(lockPath, now, now);
5647
5791
  } catch {}
5648
5792
  }, HEARTBEAT_INTERVAL_IN_MS);
5649
5793
  heartbeat.unref();
@@ -5652,7 +5796,7 @@ var acquireBrowserDownloadLock = async (lockPath) => {
5652
5796
  const currentLock = await readLock(lockPath);
5653
5797
  await lockFile.close();
5654
5798
  if (currentLock?.token === token) {
5655
- await fs5.promises.rm(lockPath, { force: true });
5799
+ await fs6.promises.rm(lockPath, { force: true });
5656
5800
  }
5657
5801
  };
5658
5802
  }
@@ -5667,7 +5811,7 @@ import { pipeline } from "node:stream/promises";
5667
5811
  import { promisify } from "node:util";
5668
5812
 
5669
5813
  // vendor/yauzl-patched/index.js
5670
- var fs6 = __require("fs");
5814
+ var fs7 = __require("fs");
5671
5815
  var zlib = __require("zlib");
5672
5816
  var fd_slicer = require_fd_slicer();
5673
5817
  var crc32 = require_buffer_crc32();
@@ -5696,12 +5840,12 @@ function open(path, options2, callback) {
5696
5840
  options2.strictFileNames = false;
5697
5841
  if (callback == null)
5698
5842
  callback = defaultCallback;
5699
- fs6.open(path, "r", function(err, fd) {
5843
+ fs7.open(path, "r", function(err, fd) {
5700
5844
  if (err)
5701
5845
  return callback(err);
5702
5846
  fromFd(fd, options2, function(err, zipfile) {
5703
5847
  if (err)
5704
- fs6.close(fd, defaultCallback);
5848
+ fs7.close(fd, defaultCallback);
5705
5849
  callback(err, zipfile);
5706
5850
  });
5707
5851
  });
@@ -5725,7 +5869,7 @@ function fromFd(fd, options2, callback) {
5725
5869
  options2.strictFileNames = false;
5726
5870
  if (callback == null)
5727
5871
  callback = defaultCallback;
5728
- fs6.fstat(fd, function(err, stats) {
5872
+ fs7.fstat(fd, function(err, stats) {
5729
5873
  if (err)
5730
5874
  return callback(err);
5731
5875
  var reader = fd_slicer.createFromFd(fd, { autoClose: true });
@@ -6551,99 +6695,6 @@ var extractZipArchive = async (archivePath, dir) => {
6551
6695
  });
6552
6696
  };
6553
6697
 
6554
- // src/browser/get-chrome-download-url.ts
6555
- import * as fs7 from "node:fs";
6556
- import * as os4 from "node:os";
6557
- var TESTED_VERSION = "157.0.8080.0";
6558
- var isAmazonLinux2023 = () => {
6559
- if (os4.platform() !== "linux") {
6560
- return false;
6561
- }
6562
- try {
6563
- const osRelease = fs7.readFileSync("/etc/os-release", "utf-8");
6564
- return osRelease.includes("Amazon Linux") && osRelease.includes('VERSION="2023"');
6565
- } catch {
6566
- return false;
6567
- }
6568
- };
6569
- var MINIMUM_GLIBC_FOR_REMOTION_MEDIA = [2, 35];
6570
- var getGlibcVersion = () => {
6571
- if (process.platform !== "linux") {
6572
- return null;
6573
- }
6574
- const { report } = process;
6575
- if (!report) {
6576
- return null;
6577
- }
6578
- const rep = report.getReport();
6579
- if (typeof rep === "string") {
6580
- return null;
6581
- }
6582
- const { glibcVersionRuntime } = rep.header;
6583
- if (!glibcVersionRuntime) {
6584
- return null;
6585
- }
6586
- const split = glibcVersionRuntime.split(".");
6587
- if (split.length !== 2) {
6588
- return null;
6589
- }
6590
- return [Number(split[0]), Number(split[1])];
6591
- };
6592
- var isGlibcVersionAtLeast = (required) => {
6593
- const version = getGlibcVersion();
6594
- if (version === null) {
6595
- return false;
6596
- }
6597
- const [major, minor] = version;
6598
- const [reqMajor, reqMinor] = required;
6599
- if (major > reqMajor) {
6600
- return true;
6601
- }
6602
- if (major === reqMajor && minor >= reqMinor) {
6603
- return true;
6604
- }
6605
- return false;
6606
- };
6607
- var canUseRemotionMediaBinaries = () => {
6608
- if (process.platform !== "linux") {
6609
- return false;
6610
- }
6611
- return isGlibcVersionAtLeast(MINIMUM_GLIBC_FOR_REMOTION_MEDIA);
6612
- };
6613
- function getChromeDownloadUrl({
6614
- platform,
6615
- version,
6616
- chromeMode
6617
- }) {
6618
- if (platform === "linux-arm64" && version && /^\d+$/.test(version)) {
6619
- const archive = chromeMode === "chrome-for-testing" ? "chromium-linux-arm64" : "chromium-headless-shell-linux-arm64";
6620
- return `https://playwright.azureedge.net/builds/chromium/${version}/${archive}.zip`;
6621
- }
6622
- if (chromeMode === "headless-shell" && version === null) {
6623
- if (platform === "mac-arm64") {
6624
- return `https://remotion.media/chromium-headless-shell-mac-arm64-${TESTED_VERSION}.zip?clear`;
6625
- }
6626
- if (platform === "linux64" || platform === "linux-arm64") {
6627
- const architecture = platform === "linux64" ? "x64" : "arm64";
6628
- if (isAmazonLinux2023()) {
6629
- return `https://remotion.media/chromium-headless-shell-amazon-linux-${architecture}-${TESTED_VERSION}.zip?clear`;
6630
- }
6631
- if (canUseRemotionMediaBinaries()) {
6632
- return `https://remotion.media/chromium-headless-shell-linux-${architecture}-${TESTED_VERSION}.zip?clear`;
6633
- }
6634
- }
6635
- }
6636
- const archive = chromeMode === "headless-shell" ? "chrome-headless-shell" : "chrome";
6637
- return `https://storage.googleapis.com/chrome-for-testing-public/${version ?? TESTED_VERSION}/${platform}/${archive}-${platform}.zip`;
6638
- }
6639
- var logDownloadUrl = ({
6640
- url,
6641
- logLevel,
6642
- indent
6643
- }) => {
6644
- Log.info({ indent, logLevel }, `Downloading from: ${url}`);
6645
- };
6646
-
6647
6698
  // src/browser/get-download-destination.ts
6648
6699
  import fs8 from "node:fs";
6649
6700
  import path8 from "node:path";
@@ -6745,7 +6796,7 @@ var downloadBrowser = async ({
6745
6796
  }) => {
6746
6797
  const platform = getPlatform();
6747
6798
  const downloadURL = getChromeDownloadUrl({ platform, version, chromeMode });
6748
- const fileName = downloadURL.split("/").pop();
6799
+ const fileName = downloadURL.split("/").pop()?.split("?")[0];
6749
6800
  if (!fileName) {
6750
6801
  throw new Error(`A malformed download URL was found: ${downloadURL}.`);
6751
6802
  }
@@ -7359,6 +7410,7 @@ var internalOpenBrowser = async ({
7359
7410
  "--proxy-server='direct://'",
7360
7411
  "--proxy-bypass-list=*",
7361
7412
  "--force-gpu-mem-available-mb=4096",
7413
+ process.platform === "win32" ? "--disable-skia-graphite" : null,
7362
7414
  process.env.__RESERVED_IS_INSIDE_REMOTION_LAMBDA === "true" ? "--disable-gpu-rasterization" : null,
7363
7415
  "--disable-hang-monitor",
7364
7416
  "--disable-extensions",
@@ -16468,8 +16520,12 @@ var waitForAssetToBeDownloaded = ({
16468
16520
  if (!downloadMap.listeners[src][downloadDir]) {
16469
16521
  downloadMap.listeners[src][downloadDir] = [];
16470
16522
  }
16471
- return new Promise((resolve) => {
16472
- downloadMap.listeners[src][downloadDir].push(() => {
16523
+ return new Promise((resolve, reject) => {
16524
+ downloadMap.listeners[src][downloadDir].push((err) => {
16525
+ if (err) {
16526
+ reject(err);
16527
+ return;
16528
+ }
16473
16529
  const srcMap = downloadMap.hasBeenDownloadedMap[src];
16474
16530
  if (!srcMap?.[downloadDir]) {
16475
16531
  throw new Error("Expected file for " + src + "to be available in " + downloadDir);
@@ -16498,7 +16554,7 @@ var notifyAssetIsDownloaded = ({
16498
16554
  downloadMap.hasBeenDownloadedMap[src] = {};
16499
16555
  }
16500
16556
  downloadMap.hasBeenDownloadedMap[src][downloadDir] = to;
16501
- downloadMap.listeners[src][downloadDir].forEach((fn) => fn());
16557
+ downloadMap.listeners[src][downloadDir].forEach((fn) => fn(null));
16502
16558
  };
16503
16559
  var validateMimeType = (mimeType, src) => {
16504
16560
  if (!mimeType.includes("/")) {
@@ -16612,6 +16668,12 @@ var downloadAsset = async ({
16612
16668
  indent,
16613
16669
  logLevel,
16614
16670
  abortSignal: downloadMap.cleanupController.signal
16671
+ }).catch((err) => {
16672
+ delete downloadMap.isDownloadingMap[src]?.[downloadDir];
16673
+ const listeners = downloadMap.listeners[src]?.[downloadDir] ?? [];
16674
+ delete downloadMap.listeners[src]?.[downloadDir];
16675
+ listeners.forEach((fn) => fn(err));
16676
+ throw err;
16615
16677
  });
16616
16678
  notifyAssetIsDownloaded({ src, downloadMap, downloadDir, to });
16617
16679
  if (shouldAnalyzeAudioImmediately) {
@@ -18544,6 +18606,7 @@ var seekToFrame = async ({
18544
18606
  };
18545
18607
 
18546
18608
  // src/set-props-and-env.ts
18609
+ import { NoReactInternals as NoReactInternals11 } from "remotion/no-react";
18547
18610
  import { VERSION as VERSION3 } from "remotion/version";
18548
18611
 
18549
18612
  // src/goto-page-or-throw.ts
@@ -18598,19 +18661,23 @@ var innerSetPropsAndEnv = async ({
18598
18661
  onServeUrlVisited,
18599
18662
  isMainTab,
18600
18663
  mediaCacheSizeInBytes,
18664
+ preferredEffectBackend,
18601
18665
  initialMemoryAvailable,
18602
18666
  darkMode,
18603
18667
  sampleRate
18604
18668
  }) => {
18669
+ NoReactInternals11.validatePreferredEffectBackend(preferredEffectBackend);
18605
18670
  validatePuppeteerTimeout(timeoutInMilliseconds);
18606
18671
  const actualTimeout = timeoutInMilliseconds ?? DEFAULT_TIMEOUT;
18607
18672
  page.setDefaultTimeout(actualTimeout);
18608
18673
  page.setDefaultNavigationTimeout(actualTimeout);
18609
18674
  const urlToVisit = normalizeServeUrl(serveUrl);
18610
- await page.evaluateOnNewDocument((timeout, mainTab, cacheSizeInBytes, initMemoryAvailable, sRate) => {
18675
+ await page.evaluateOnNewDocument((timeout, mainTab, cacheSizeInBytes, effectBackend, disableWebGpuEffects, initMemoryAvailable, sRate) => {
18611
18676
  window.remotion_puppeteerTimeout = timeout;
18612
18677
  window.remotion_isMainTab = mainTab;
18613
18678
  window.remotion_mediaCacheSizeInBytes = cacheSizeInBytes;
18679
+ window.remotion_preferredEffectBackend = effectBackend;
18680
+ window.remotion_disableWebGpuEffects = disableWebGpuEffects;
18614
18681
  window.remotion_initialMemoryAvailable = initMemoryAvailable;
18615
18682
  window.remotion_sampleRate = sRate;
18616
18683
  if (window.process === undefined) {
@@ -18620,7 +18687,7 @@ var innerSetPropsAndEnv = async ({
18620
18687
  window.process.env = {};
18621
18688
  }
18622
18689
  window.process.env.NODE_ENV = "production";
18623
- }, actualTimeout, isMainTab, mediaCacheSizeInBytes, initialMemoryAvailable, sampleRate);
18690
+ }, actualTimeout, isMainTab, mediaCacheSizeInBytes, preferredEffectBackend, Boolean(process.env.AWS_LAMBDA_FUNCTION_NAME), initialMemoryAvailable, sampleRate);
18624
18691
  await page.evaluateOnNewDocument('window.remotion_broadcastChannel = new BroadcastChannel("remotion-video-frame-extraction")');
18625
18692
  if (envVariables) {
18626
18693
  await page.evaluateOnNewDocument((input) => {
@@ -18676,6 +18743,7 @@ var innerSetPropsAndEnv = async ({
18676
18743
  onServeUrlVisited,
18677
18744
  isMainTab,
18678
18745
  mediaCacheSizeInBytes,
18746
+ preferredEffectBackend,
18679
18747
  initialMemoryAvailable,
18680
18748
  darkMode,
18681
18749
  sampleRate
@@ -18955,6 +19023,7 @@ var innerGetCompositions = async ({
18955
19023
  indent,
18956
19024
  logLevel,
18957
19025
  mediaCacheSizeInBytes,
19026
+ preferredEffectBackend,
18958
19027
  darkMode
18959
19028
  }) => {
18960
19029
  validatePuppeteerTimeout(timeoutInMilliseconds);
@@ -18976,6 +19045,7 @@ var innerGetCompositions = async ({
18976
19045
  },
18977
19046
  isMainTab: true,
18978
19047
  mediaCacheSizeInBytes,
19048
+ preferredEffectBackend,
18979
19049
  initialMemoryAvailable: getAvailableMemory(logLevel),
18980
19050
  darkMode,
18981
19051
  sampleRate: 48000
@@ -19028,8 +19098,8 @@ var innerGetCompositions = async ({
19028
19098
  height,
19029
19099
  fps,
19030
19100
  durationInFrames,
19031
- props: NoReactInternals11.deserializeJSONWithSpecialTypes(r.serializedResolvedPropsWithCustomSchema),
19032
- defaultProps: NoReactInternals11.deserializeJSONWithSpecialTypes(r.serializedDefaultPropsWithCustomSchema),
19101
+ props: NoReactInternals12.deserializeJSONWithSpecialTypes(r.serializedResolvedPropsWithCustomSchema),
19102
+ defaultProps: NoReactInternals12.deserializeJSONWithSpecialTypes(r.serializedDefaultPropsWithCustomSchema),
19033
19103
  defaultCodec,
19034
19104
  defaultOutName,
19035
19105
  defaultVideoImageFormat,
@@ -19058,6 +19128,7 @@ var internalGetCompositionsRaw = async ({
19058
19128
  chromeMode,
19059
19129
  offthreadVideoThreads,
19060
19130
  mediaCacheSizeInBytes,
19131
+ preferredEffectBackend,
19061
19132
  onLog
19062
19133
  }) => {
19063
19134
  const { page, cleanupPage } = await getPageAndCleanupFn({
@@ -19116,6 +19187,7 @@ var internalGetCompositionsRaw = async ({
19116
19187
  chromeMode,
19117
19188
  offthreadVideoThreads,
19118
19189
  mediaCacheSizeInBytes,
19190
+ preferredEffectBackend,
19119
19191
  darkMode: chromiumOptions.darkMode ?? false
19120
19192
  });
19121
19193
  }).then((comp) => {
@@ -19131,7 +19203,7 @@ var internalGetCompositionsRaw = async ({
19131
19203
  };
19132
19204
  var internalGetCompositions = wrapWithErrorHandling(internalGetCompositionsRaw);
19133
19205
  var getCompositions = (...args) => {
19134
- const options2 = convertGetCompositionsArgumentsToOptions(args, NoReactInternals11.ENABLE_V5_BREAKING_CHANGES);
19206
+ const options2 = convertGetCompositionsArgumentsToOptions(args, NoReactInternals12.ENABLE_V5_BREAKING_CHANGES);
19135
19207
  if (typeof options2?.serveUrl !== "string" || !options2.serveUrl) {
19136
19208
  throw new Error("No serve URL or webpack bundle directory was passed to getCompositions().");
19137
19209
  }
@@ -19151,6 +19223,7 @@ var getCompositions = (...args) => {
19151
19223
  chromeMode,
19152
19224
  offthreadVideoThreads,
19153
19225
  mediaCacheSizeInBytes,
19226
+ preferredEffectBackend,
19154
19227
  serveUrl
19155
19228
  } = options2;
19156
19229
  const indent = false;
@@ -19159,7 +19232,7 @@ var getCompositions = (...args) => {
19159
19232
  browserExecutable: browserExecutable ?? null,
19160
19233
  chromiumOptions: chromiumOptions ?? {},
19161
19234
  envVariables: envVariables ?? {},
19162
- serializedInputPropsWithCustomSchema: NoReactInternals11.serializeJSONWithSpecialTypes({
19235
+ serializedInputPropsWithCustomSchema: NoReactInternals12.serializeJSONWithSpecialTypes({
19163
19236
  data: inputProps ?? {},
19164
19237
  indent: undefined,
19165
19238
  staticBase: null
@@ -19182,6 +19255,7 @@ var getCompositions = (...args) => {
19182
19255
  chromeMode: chromeMode ?? "headless-shell",
19183
19256
  offthreadVideoThreads: offthreadVideoThreads ?? null,
19184
19257
  mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
19258
+ preferredEffectBackend: preferredEffectBackend ?? "auto",
19185
19259
  onLog: defaultOnLog
19186
19260
  });
19187
19261
  };
@@ -19494,6 +19568,41 @@ var validateJpegQuality = (q) => {
19494
19568
  }
19495
19569
  };
19496
19570
 
19571
+ // src/make-cancel-signal.ts
19572
+ var makeCancelSignal = () => {
19573
+ const callbacks = [];
19574
+ let cancelled = false;
19575
+ return {
19576
+ cancelSignal: (callback) => {
19577
+ callbacks.push(callback);
19578
+ if (cancelled) {
19579
+ callback();
19580
+ }
19581
+ },
19582
+ cancel: () => {
19583
+ if (cancelled) {
19584
+ return;
19585
+ }
19586
+ callbacks.forEach((cb) => {
19587
+ cb();
19588
+ });
19589
+ cancelled = true;
19590
+ }
19591
+ };
19592
+ };
19593
+ var cancelErrorMessages = {
19594
+ renderMedia: "renderMedia() got cancelled",
19595
+ renderFrames: "renderFrames() got cancelled",
19596
+ renderStill: "renderStill() got cancelled",
19597
+ stitchFramesToVideo: "stitchFramesToVideo() got cancelled"
19598
+ };
19599
+ var isUserCancelledRender = (err) => {
19600
+ if (typeof err === "object" && err !== null && "message" in err && typeof err.message === "string") {
19601
+ return err.message.includes(cancelErrorMessages.renderMedia) || err.message.includes(cancelErrorMessages.renderFrames) || err.message.includes(cancelErrorMessages.renderStill) || err.message.includes(cancelErrorMessages.stitchFramesToVideo);
19602
+ }
19603
+ return false;
19604
+ };
19605
+
19497
19606
  // src/perf.ts
19498
19607
  var perf = {
19499
19608
  capture: [],
@@ -19800,11 +19909,11 @@ var getCodecName = ({
19800
19909
  };
19801
19910
 
19802
19911
  // src/options/color-space.tsx
19803
- import { NoReactInternals as NoReactInternals12 } from "remotion/no-react";
19912
+ import { NoReactInternals as NoReactInternals13 } from "remotion/no-react";
19804
19913
  var validV4ColorSpaces = ["default", "bt601", "bt709", "bt2020-ncl"];
19805
19914
  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";
19915
+ var validColorSpaces = NoReactInternals13.ENABLE_V5_BREAKING_CHANGES ? validV5ColorSpaces : validV4ColorSpaces;
19916
+ var DEFAULT_COLOR_SPACE = NoReactInternals13.ENABLE_V5_BREAKING_CHANGES ? "bt709" : "default";
19808
19917
 
19809
19918
  // src/options/gop-size.tsx
19810
19919
  var validateGopSize = (value) => {
@@ -20398,10 +20507,10 @@ var createRemotionSharedMemoryFfmpegBridge = ({
20398
20507
  };
20399
20508
 
20400
20509
  // 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;
20510
+ import { NoReactInternals as NoReactInternals14 } from "remotion/no-react";
20511
+ var validateFps = NoReactInternals14.validateFps;
20512
+ var validateDimension = NoReactInternals14.validateDimension;
20513
+ var validateDurationInFrames = NoReactInternals14.validateDurationInFrames;
20405
20514
 
20406
20515
  // src/validate-even-dimensions-with-codec.ts
20407
20516
  var validateEvenDimensionsWithCodec = ({
@@ -21101,7 +21210,7 @@ var probeSharedMemoryCapture = async ({
21101
21210
  // src/render-frames.ts
21102
21211
  import fs18 from "node:fs";
21103
21212
  import path24 from "node:path";
21104
- import { NoReactInternals as NoReactInternals16 } from "remotion/no-react";
21213
+ import { NoReactInternals as NoReactInternals18 } from "remotion/no-react";
21105
21214
 
21106
21215
  // src/cycle-browser-tabs.ts
21107
21216
  var cycleBrowserTabs = ({
@@ -21676,41 +21785,6 @@ var getFilePadLength = ({
21676
21785
  throw new Error("Unknown file type");
21677
21786
  };
21678
21787
 
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
21788
  // src/make-page.ts
21715
21789
  var makePage = async ({
21716
21790
  context,
@@ -21733,6 +21807,7 @@ var makePage = async ({
21733
21807
  pageIndex,
21734
21808
  isMainTab,
21735
21809
  mediaCacheSizeInBytes,
21810
+ preferredEffectBackend,
21736
21811
  onLog,
21737
21812
  darkMode,
21738
21813
  sampleRate
@@ -21762,6 +21837,7 @@ var makePage = async ({
21762
21837
  },
21763
21838
  isMainTab,
21764
21839
  mediaCacheSizeInBytes,
21840
+ preferredEffectBackend,
21765
21841
  initialMemoryAvailable: getAvailableMemory(logLevel),
21766
21842
  darkMode,
21767
21843
  sampleRate
@@ -21847,6 +21923,9 @@ class Pool {
21847
21923
  });
21848
21924
  }
21849
21925
  release(resource) {
21926
+ if (resource.closed) {
21927
+ return;
21928
+ }
21850
21929
  const waiter = this.waiters.shift();
21851
21930
  if (waiter === undefined) {
21852
21931
  this.resources.push(resource);
@@ -21857,10 +21936,10 @@ class Pool {
21857
21936
  }
21858
21937
 
21859
21938
  // src/render-frame-and-retry-target-close.ts
21860
- import { NoReactInternals as NoReactInternals15 } from "remotion/no-react";
21939
+ import { NoReactInternals as NoReactInternals16 } from "remotion/no-react";
21861
21940
 
21862
21941
  // src/is-delay-render-error-with-retry.ts
21863
- import { NoReactInternals as NoReactInternals14 } from "remotion/no-react";
21942
+ import { NoReactInternals as NoReactInternals15 } from "remotion/no-react";
21864
21943
  var getRetriesLeftFromError = (error) => {
21865
21944
  if (!error) {
21866
21945
  throw new Error("Expected stack");
@@ -21869,15 +21948,15 @@ var getRetriesLeftFromError = (error) => {
21869
21948
  if (!stack) {
21870
21949
  throw new Error("Expected stack: " + JSON.stringify(error));
21871
21950
  }
21872
- const beforeIndex = stack.indexOf(NoReactInternals14.DELAY_RENDER_ATTEMPT_TOKEN);
21951
+ const beforeIndex = stack.indexOf(NoReactInternals15.DELAY_RENDER_ATTEMPT_TOKEN);
21873
21952
  if (beforeIndex === -1) {
21874
21953
  throw new Error("Expected to find attempt token in stack");
21875
21954
  }
21876
- const afterIndex = stack.indexOf(NoReactInternals14.DELAY_RENDER_RETRY_TOKEN);
21955
+ const afterIndex = stack.indexOf(NoReactInternals15.DELAY_RENDER_RETRY_TOKEN);
21877
21956
  if (afterIndex === -1) {
21878
21957
  throw new Error("Expected to find retry token in stack");
21879
21958
  }
21880
- const inbetween = stack.substring(beforeIndex + NoReactInternals14.DELAY_RENDER_ATTEMPT_TOKEN.length, afterIndex);
21959
+ const inbetween = stack.substring(beforeIndex + NoReactInternals15.DELAY_RENDER_ATTEMPT_TOKEN.length, afterIndex);
21881
21960
  const parsed = Number(inbetween);
21882
21961
  if (Number.isNaN(parsed)) {
21883
21962
  throw new Error(`Expected to find a number in the stack ${stack}`);
@@ -21911,7 +21990,7 @@ var collectAssets = async ({
21911
21990
  if (typeof asset.content !== "string") {
21912
21991
  throw new Error(`Expected string content for artifact ${asset.id}, but got ${asset.content}`);
21913
21992
  }
21914
- const stringOrUintArray = asset.contentType === "binary" ? new TextEncoder().encode(atob(asset.content)) : asset.content;
21993
+ const stringOrUintArray = asset.contentType === "binary" ? new Uint8Array(Buffer.from(asset.content, "base64")) : asset.content;
21915
21994
  return {
21916
21995
  ...asset,
21917
21996
  content: stringOrUintArray
@@ -22551,7 +22630,7 @@ var renderFrameAndRetryTargetClose = async ({
22551
22630
  currentPool.release(freePage);
22552
22631
  } catch (err) {
22553
22632
  const isTargetClosedError = isTargetClosedErr(err);
22554
- const shouldRetryError = err.stack?.includes(NoReactInternals15.DELAY_RENDER_RETRY_TOKEN);
22633
+ const shouldRetryError = err.stack?.includes(NoReactInternals16.DELAY_RENDER_RETRY_TOKEN);
22555
22634
  const flakyNetworkError = isFlakyNetworkError(err);
22556
22635
  if (isUserCancelledRender(err) && !shouldRetryError) {
22557
22636
  throw err;
@@ -22626,16 +22705,17 @@ var renderFrameAndRetryTargetClose = async ({
22626
22705
  });
22627
22706
  }
22628
22707
  Log.warn({ indent, logLevel }, `The browser crashed while rendering frame ${frame}, retrying ${retriesLeft} more times. Learn more about this error under https://www.remotion.dev/docs/target-closed`);
22708
+ nextFrameToRender.returnFrame(frame);
22629
22709
  await remotionSharedMemory?.forgetAllPages();
22630
22710
  await browserReplacer.replaceBrowser(makeBrowser, async () => {
22631
22711
  const pages = new Array(concurrencyOrFramesToRender).fill(true).map((_, i) => makeNewPage(frame, i));
22632
22712
  const puppeteerPages = await Promise.all(pages);
22633
22713
  const pool = await poolPromise;
22714
+ pool.resources = pool.resources.filter((p) => !p.closed);
22634
22715
  for (const newPage of puppeteerPages) {
22635
22716
  pool.release(newPage);
22636
22717
  }
22637
22718
  });
22638
- nextFrameToRender.returnFrame(frame);
22639
22719
  await renderFrameAndRetryTargetClose({
22640
22720
  retriesLeft: retriesLeft - 1,
22641
22721
  attempt: attempt + 1,
@@ -22740,39 +22820,10 @@ var validateScale = (scale) => {
22740
22820
  };
22741
22821
 
22742
22822
  // 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
- };
22823
+ import { NoReactInternals as NoReactInternals17 } from "remotion/no-react";
22824
+ var {
22825
+ validateSelectedFrames
22826
+ } = NoReactInternals17;
22776
22827
 
22777
22828
  // src/render-frames.ts
22778
22829
  var MAX_RETRIES_PER_FRAME = 1;
@@ -22817,6 +22868,7 @@ var innerRenderFrames = async ({
22817
22868
  binariesDirectory,
22818
22869
  imageSequencePattern,
22819
22870
  mediaCacheSizeInBytes,
22871
+ preferredEffectBackend,
22820
22872
  onLog,
22821
22873
  darkMode,
22822
22874
  sampleRate
@@ -22875,6 +22927,7 @@ var innerRenderFrames = async ({
22875
22927
  pageIndex,
22876
22928
  isMainTab: pageIndex === 0,
22877
22929
  mediaCacheSizeInBytes,
22930
+ preferredEffectBackend,
22878
22931
  onLog,
22879
22932
  darkMode,
22880
22933
  sampleRate
@@ -23026,6 +23079,7 @@ var internalRenderFramesRaw = ({
23026
23079
  offthreadVideoThreads,
23027
23080
  imageSequencePattern,
23028
23081
  mediaCacheSizeInBytes,
23082
+ preferredEffectBackend,
23029
23083
  onLog,
23030
23084
  sampleRate
23031
23085
  }) => {
@@ -23137,6 +23191,7 @@ var internalRenderFramesRaw = ({
23137
23191
  offthreadVideoThreads,
23138
23192
  imageSequencePattern,
23139
23193
  mediaCacheSizeInBytes,
23194
+ preferredEffectBackend,
23140
23195
  onLog,
23141
23196
  darkMode: chromiumOptions.darkMode ?? false,
23142
23197
  sampleRate
@@ -23214,6 +23269,7 @@ var renderFrames = (options2) => {
23214
23269
  offthreadVideoThreads,
23215
23270
  imageSequencePattern,
23216
23271
  mediaCacheSizeInBytes,
23272
+ preferredEffectBackend,
23217
23273
  sampleRate
23218
23274
  } = options2;
23219
23275
  if (!composition) {
@@ -23252,12 +23308,12 @@ var renderFrames = (options2) => {
23252
23308
  indent,
23253
23309
  jpegQuality: jpegQuality ?? DEFAULT_JPEG_QUALITY,
23254
23310
  onDownload: onDownload ?? null,
23255
- serializedInputPropsWithCustomSchema: NoReactInternals16.serializeJSONWithSpecialTypes({
23311
+ serializedInputPropsWithCustomSchema: NoReactInternals18.serializeJSONWithSpecialTypes({
23256
23312
  indent: undefined,
23257
23313
  staticBase: null,
23258
23314
  data: inputProps ?? {}
23259
23315
  }).serializedString,
23260
- serializedResolvedPropsWithCustomSchema: NoReactInternals16.serializeJSONWithSpecialTypes({
23316
+ serializedResolvedPropsWithCustomSchema: NoReactInternals18.serializeJSONWithSpecialTypes({
23261
23317
  indent: undefined,
23262
23318
  staticBase: null,
23263
23319
  data: composition.props
@@ -23288,6 +23344,7 @@ var renderFrames = (options2) => {
23288
23344
  offthreadVideoThreads: offthreadVideoThreads ?? null,
23289
23345
  imageSequencePattern: imageSequencePattern ?? null,
23290
23346
  mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
23347
+ preferredEffectBackend: preferredEffectBackend ?? "auto",
23291
23348
  onLog: defaultOnLog,
23292
23349
  sampleRate: sampleRate ?? composition.defaultSampleRate ?? 48000
23293
23350
  });
@@ -23298,7 +23355,7 @@ import fs20 from "node:fs";
23298
23355
  import os11 from "node:os";
23299
23356
  import path31 from "node:path";
23300
23357
  import { LicensingInternals } from "@remotion/licensing";
23301
- import { NoReactInternals as NoReactInternals20 } from "remotion/no-react";
23358
+ import { NoReactInternals as NoReactInternals22 } from "remotion/no-react";
23302
23359
 
23303
23360
  // src/codec-supports-media.ts
23304
23361
  var support = {
@@ -23421,7 +23478,7 @@ var validateSelectedCodecAndPresetCombination = ({
23421
23478
  var DEFAULT_OVERWRITE = true;
23422
23479
 
23423
23480
  // src/prores-profile.ts
23424
- import { NoReactInternals as NoReactInternals17 } from "remotion/no-react";
23481
+ import { NoReactInternals as NoReactInternals19 } from "remotion/no-react";
23425
23482
  var validateSelectedCodecAndProResCombination = ({
23426
23483
  codec,
23427
23484
  proResProfile
@@ -23429,15 +23486,15 @@ var validateSelectedCodecAndProResCombination = ({
23429
23486
  if (typeof proResProfile !== "undefined" && codec !== "prores") {
23430
23487
  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
23488
  }
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(", ")}`);
23489
+ if (proResProfile !== undefined && !NoReactInternals19.proResProfileOptions.includes(proResProfile)) {
23490
+ throw new TypeError(`The ProRes profile "${proResProfile}" is not valid. Valid options are ${NoReactInternals19.proResProfileOptions.map((p) => `"${p}"`).join(", ")}`);
23434
23491
  }
23435
23492
  };
23436
23493
 
23437
23494
  // src/stitch-frames-to-video.ts
23438
23495
  import { cpSync as cpSync2, promises as promises5, rmSync as rmSync4 } from "node:fs";
23439
23496
  import path30 from "node:path";
23440
- import { NoReactInternals as NoReactInternals18 } from "remotion/no-react";
23497
+ import { NoReactInternals as NoReactInternals20 } from "remotion/no-react";
23441
23498
 
23442
23499
  // src/aac-priming.ts
23443
23500
  var LIBFDK_AAC_LC_ENCODER_DELAY_IN_SAMPLES = 2048;
@@ -24229,6 +24286,8 @@ var stringifyFfmpegFilter = ({
24229
24286
  const startInVideoSeconds = startInVideo / fps;
24230
24287
  const assetTrimLeftOffset = startInVideo === 0 ? trimLeftOffset : 0;
24231
24288
  const startInChunkSeconds = startInVideo === 0 ? 0 : startInVideoSeconds - trimLeftOffset;
24289
+ const capturedFrameCount = Math.round((chunkLengthInSeconds + trimLeftOffset - trimRightOffset) * fps);
24290
+ const assetTrimRightOffset = startInVideo + asset.duration >= capturedFrameCount ? trimRightOffset : 0;
24232
24291
  const { trimLeft, maxTrim } = getActualTrimLeft({
24233
24292
  trimLeft: asset.trimLeft,
24234
24293
  fps,
@@ -24251,7 +24310,7 @@ var stringifyFfmpegFilter = ({
24251
24310
  } = trimAndSetTempo({
24252
24311
  assetDuration,
24253
24312
  trimLeftOffset: assetTrimLeftOffset,
24254
- trimRightOffset,
24313
+ trimRightOffset: assetTrimRightOffset,
24255
24314
  asset,
24256
24315
  fps,
24257
24316
  indent,
@@ -24273,7 +24332,7 @@ var stringifyFfmpegFilter = ({
24273
24332
  toneFrequency && toneFrequency !== 1 ? `asetrate=${sampleRate}*${toneFrequency},aresample=${sampleRate},atempo=1/${toneFrequency}` : null
24274
24333
  ].filter(truthy).join(",") + `[a0]`,
24275
24334
  pad_end: padAtEnd > 0.0000001 ? "apad=pad_len=" + Math.round(padAtEnd * sampleRate) : null,
24276
- pad_start: padStart === 0 ? null : `adelay=${new Array(channels + 1).fill((padStart * 1000).toFixed(0)).join("|")}`,
24335
+ pad_start: padStart === 0 ? null : `adelay=${new Array(channels + 1).fill(`${Math.round(padStart * sampleRate)}S`).join("|")}`,
24277
24336
  actualTrimLeft
24278
24337
  };
24279
24338
  };
@@ -24811,7 +24870,7 @@ var innerStitchFramesToVideo = async ({
24811
24870
  const outputExtension = (getExtensionOfFilename(outputLocation) ?? getFileExtensionFromCodec(codec, resolvedAudioCodec)).toLowerCase();
24812
24871
  if (codec === "aac" && (outputExtension === "mpg" || outputExtension === "mpeg")) {
24813
24872
  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.";
24814
- if (NoReactInternals18.ENABLE_V5_BREAKING_CHANGES) {
24873
+ if (NoReactInternals20.ENABLE_V5_BREAKING_CHANGES) {
24815
24874
  throw new Error(message);
24816
24875
  }
24817
24876
  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.`);
@@ -25251,7 +25310,7 @@ var validateNumberOfGifLoops = (numberOfGifLoops, codec) => {
25251
25310
  };
25252
25311
 
25253
25312
  // src/validate-output-filename.ts
25254
- import { NoReactInternals as NoReactInternals19 } from "remotion/no-react";
25313
+ import { NoReactInternals as NoReactInternals21 } from "remotion/no-react";
25255
25314
  var validateOutputFilename = ({
25256
25315
  codec,
25257
25316
  audioCodecSetting,
@@ -25263,7 +25322,7 @@ var validateOutputFilename = ({
25263
25322
  throw new TypeError(`The codec "${codec}" is not supported. Supported codecs are: ${Object.keys(defaultFileExtensionMap).join(", ")}`);
25264
25323
  }
25265
25324
  const normalizedExtension = extension === null ? null : extension.toLowerCase();
25266
- if (NoReactInternals19.ENABLE_V5_BREAKING_CHANGES && codec === "aac" && (normalizedExtension === "mpg" || normalizedExtension === "mpeg")) {
25325
+ if (NoReactInternals21.ENABLE_V5_BREAKING_CHANGES && codec === "aac" && (normalizedExtension === "mpg" || normalizedExtension === "mpeg")) {
25267
25326
  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.");
25268
25327
  }
25269
25328
  const map = defaultFileExtensionMap[codec];
@@ -25351,6 +25410,7 @@ var internalRenderMediaRaw = async ({
25351
25410
  chromeMode,
25352
25411
  offthreadVideoThreads,
25353
25412
  mediaCacheSizeInBytes,
25413
+ preferredEffectBackend,
25354
25414
  onLog,
25355
25415
  licenseKey,
25356
25416
  isProduction,
@@ -25750,6 +25810,7 @@ var internalRenderMediaRaw = async ({
25750
25810
  chromeMode,
25751
25811
  imageSequencePattern: null,
25752
25812
  mediaCacheSizeInBytes,
25813
+ preferredEffectBackend,
25753
25814
  onLog,
25754
25815
  sampleRate
25755
25816
  });
@@ -25957,6 +26018,7 @@ var renderMedia = ({
25957
26018
  offthreadVideoThreads,
25958
26019
  compositionStart,
25959
26020
  mediaCacheSizeInBytes,
26021
+ preferredEffectBackend,
25960
26022
  isProduction,
25961
26023
  sampleRate,
25962
26024
  ...apiKeyOrLicenseKey
@@ -25968,8 +26030,8 @@ var renderMedia = ({
25968
26030
  }
25969
26031
  const licenseKey = "licenseKey" in apiKeyOrLicenseKey && typeof apiKeyOrLicenseKey.licenseKey === "string" ? apiKeyOrLicenseKey.licenseKey : null;
25970
26032
  const apiKey = "apiKey" in apiKeyOrLicenseKey && typeof apiKeyOrLicenseKey.apiKey === "string" ? apiKeyOrLicenseKey.apiKey : null;
25971
- const effectiveLicenseKey = (NoReactInternals20.ENABLE_V5_BREAKING_CHANGES ? licenseKey : licenseKey ?? apiKey) ?? null;
25972
- if (NoReactInternals20.ENABLE_V5_BREAKING_CHANGES && effectiveLicenseKey === null) {
26033
+ const effectiveLicenseKey = (NoReactInternals22.ENABLE_V5_BREAKING_CHANGES ? licenseKey : licenseKey ?? apiKey) ?? null;
26034
+ if (NoReactInternals22.ENABLE_V5_BREAKING_CHANGES && effectiveLicenseKey === null) {
25973
26035
  Log.warn({ indent, logLevel }, 'Pass "licenseKey" to renderMedia(). If you qualify for the Free License (https://remotion.dev/license), pass "free-license" instead.');
25974
26036
  }
25975
26037
  return internalRenderMedia({
@@ -25994,7 +26056,7 @@ var renderMedia = ({
25994
26056
  ffmpegOverride: ffmpegOverride ?? undefined,
25995
26057
  frameRange: frameRange ?? null,
25996
26058
  imageFormat: imageFormat ?? null,
25997
- serializedInputPropsWithCustomSchema: NoReactInternals20.serializeJSONWithSpecialTypes({
26059
+ serializedInputPropsWithCustomSchema: NoReactInternals22.serializeJSONWithSpecialTypes({
25998
26060
  indent: undefined,
25999
26061
  staticBase: null,
26000
26062
  data: inputProps ?? {}
@@ -26029,7 +26091,7 @@ var renderMedia = ({
26029
26091
  return;
26030
26092
  },
26031
26093
  server: undefined,
26032
- serializedResolvedPropsWithCustomSchema: NoReactInternals20.serializeJSONWithSpecialTypes({
26094
+ serializedResolvedPropsWithCustomSchema: NoReactInternals22.serializeJSONWithSpecialTypes({
26033
26095
  indent: undefined,
26034
26096
  staticBase: null,
26035
26097
  data: composition.props ?? {}
@@ -26052,6 +26114,7 @@ var renderMedia = ({
26052
26114
  hardwareAcceleration: hardwareAcceleration ?? "disable",
26053
26115
  chromeMode: chromeMode ?? "headless-shell",
26054
26116
  mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
26117
+ preferredEffectBackend: preferredEffectBackend ?? "auto",
26055
26118
  licenseKey: effectiveLicenseKey,
26056
26119
  onLog: defaultOnLog,
26057
26120
  isProduction: isProduction ?? null,
@@ -26063,7 +26126,7 @@ var renderMedia = ({
26063
26126
  import fs21, { statSync as statSync2 } from "node:fs";
26064
26127
  import path32 from "node:path";
26065
26128
  import { LicensingInternals as LicensingInternals2 } from "@remotion/licensing";
26066
- import { NoReactInternals as NoReactInternals21 } from "remotion/no-react";
26129
+ import { NoReactInternals as NoReactInternals23 } from "remotion/no-react";
26067
26130
  var innerRenderStill = async ({
26068
26131
  composition,
26069
26132
  imageFormat = DEFAULT_STILL_IMAGE_FORMAT,
@@ -26091,6 +26154,7 @@ var innerRenderStill = async ({
26091
26154
  onArtifact,
26092
26155
  chromeMode,
26093
26156
  mediaCacheSizeInBytes,
26157
+ preferredEffectBackend,
26094
26158
  onLog
26095
26159
  }) => {
26096
26160
  validateDimension(composition.height, "height", "in the `config` object passed to `renderStill()`");
@@ -26101,7 +26165,7 @@ var innerRenderStill = async ({
26101
26165
  allowFloats: false
26102
26166
  });
26103
26167
  validateStillImageFormat(imageFormat);
26104
- NoReactInternals21.validateFrame({
26168
+ NoReactInternals23.validateFrame({
26105
26169
  frame,
26106
26170
  durationInFrames: composition.durationInFrames,
26107
26171
  allowFloats: false
@@ -26159,8 +26223,10 @@ var innerRenderStill = async ({
26159
26223
  onError: errorCallback,
26160
26224
  frame: null
26161
26225
  });
26226
+ page.on("error", errorCallback);
26162
26227
  const cleanup = async () => {
26163
26228
  cleanUpJSException();
26229
+ page.off("error", errorCallback);
26164
26230
  if (puppeteerInstance) {
26165
26231
  await page.close();
26166
26232
  } else {
@@ -26190,6 +26256,7 @@ var innerRenderStill = async ({
26190
26256
  },
26191
26257
  isMainTab: true,
26192
26258
  mediaCacheSizeInBytes,
26259
+ preferredEffectBackend,
26193
26260
  initialMemoryAvailable: getAvailableMemory(logLevel),
26194
26261
  darkMode: chromiumOptions.darkMode ?? false,
26195
26262
  sampleRate: 48000
@@ -26374,6 +26441,7 @@ var renderStill = (options2) => {
26374
26441
  chromeMode,
26375
26442
  offthreadVideoThreads,
26376
26443
  mediaCacheSizeInBytes,
26444
+ preferredEffectBackend,
26377
26445
  isProduction,
26378
26446
  ...apiKeyOrLicenseKey
26379
26447
  } = options2;
@@ -26387,8 +26455,8 @@ var renderStill = (options2) => {
26387
26455
  }
26388
26456
  const licenseKey = "licenseKey" in apiKeyOrLicenseKey && typeof apiKeyOrLicenseKey.licenseKey === "string" ? apiKeyOrLicenseKey.licenseKey : null;
26389
26457
  const apiKey = "apiKey" in apiKeyOrLicenseKey && typeof apiKeyOrLicenseKey.apiKey === "string" ? apiKeyOrLicenseKey.apiKey : null;
26390
- const effectiveLicenseKey = (NoReactInternals21.ENABLE_V5_BREAKING_CHANGES ? licenseKey : licenseKey ?? apiKey) ?? null;
26391
- if (NoReactInternals21.ENABLE_V5_BREAKING_CHANGES && effectiveLicenseKey === null) {
26458
+ const effectiveLicenseKey = (NoReactInternals23.ENABLE_V5_BREAKING_CHANGES ? licenseKey : licenseKey ?? apiKey) ?? null;
26459
+ if (NoReactInternals23.ENABLE_V5_BREAKING_CHANGES && effectiveLicenseKey === null) {
26392
26460
  Log.warn({ indent, logLevel }, 'Pass "licenseKey" to renderStill(). If you qualify for the Free License (https://remotion.dev/license), pass "free-license" instead.');
26393
26461
  }
26394
26462
  return internalRenderStill({
@@ -26400,7 +26468,7 @@ var renderStill = (options2) => {
26400
26468
  frame: frame ?? 0,
26401
26469
  imageFormat: imageFormat ?? DEFAULT_STILL_IMAGE_FORMAT,
26402
26470
  indent,
26403
- serializedInputPropsWithCustomSchema: NoReactInternals21.serializeJSONWithSpecialTypes({
26471
+ serializedInputPropsWithCustomSchema: NoReactInternals23.serializeJSONWithSpecialTypes({
26404
26472
  staticBase: null,
26405
26473
  indent: undefined,
26406
26474
  data: inputProps ?? {}
@@ -26417,7 +26485,7 @@ var renderStill = (options2) => {
26417
26485
  serveUrl,
26418
26486
  timeoutInMilliseconds: timeoutInMilliseconds ?? DEFAULT_TIMEOUT,
26419
26487
  logLevel,
26420
- serializedResolvedPropsWithCustomSchema: NoReactInternals21.serializeJSONWithSpecialTypes({
26488
+ serializedResolvedPropsWithCustomSchema: NoReactInternals23.serializeJSONWithSpecialTypes({
26421
26489
  indent: undefined,
26422
26490
  staticBase: null,
26423
26491
  data: composition.props ?? {}
@@ -26433,6 +26501,7 @@ var renderStill = (options2) => {
26433
26501
  chromeMode: chromeMode ?? "headless-shell",
26434
26502
  offthreadVideoThreads: offthreadVideoThreads ?? null,
26435
26503
  mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
26504
+ preferredEffectBackend: preferredEffectBackend ?? "auto",
26436
26505
  licenseKey: effectiveLicenseKey,
26437
26506
  onLog: defaultOnLog,
26438
26507
  isProduction: isProduction ?? null
@@ -26440,7 +26509,7 @@ var renderStill = (options2) => {
26440
26509
  };
26441
26510
 
26442
26511
  // src/select-composition.ts
26443
- import { NoReactInternals as NoReactInternals22 } from "remotion/no-react";
26512
+ import { NoReactInternals as NoReactInternals24 } from "remotion/no-react";
26444
26513
  var innerSelectComposition = async ({
26445
26514
  page,
26446
26515
  serializedInputPropsWithCustomSchema,
@@ -26453,6 +26522,7 @@ var innerSelectComposition = async ({
26453
26522
  logLevel,
26454
26523
  onServeUrlVisited,
26455
26524
  mediaCacheSizeInBytes,
26525
+ preferredEffectBackend,
26456
26526
  chromiumOptions
26457
26527
  }) => {
26458
26528
  validatePuppeteerTimeout(timeoutInMilliseconds);
@@ -26472,6 +26542,7 @@ var innerSelectComposition = async ({
26472
26542
  onServeUrlVisited,
26473
26543
  isMainTab: true,
26474
26544
  mediaCacheSizeInBytes,
26545
+ preferredEffectBackend,
26475
26546
  initialMemoryAvailable: getAvailableMemory(logLevel),
26476
26547
  darkMode: chromiumOptions.darkMode ?? false,
26477
26548
  sampleRate: 48000
@@ -26534,8 +26605,8 @@ var innerSelectComposition = async ({
26534
26605
  height,
26535
26606
  fps,
26536
26607
  durationInFrames,
26537
- props: NoReactInternals22.deserializeJSONWithSpecialTypes(res.serializedResolvedPropsWithCustomSchema),
26538
- defaultProps: NoReactInternals22.deserializeJSONWithSpecialTypes(res.serializedDefaultPropsWithCustomSchema),
26608
+ props: NoReactInternals24.deserializeJSONWithSpecialTypes(res.serializedResolvedPropsWithCustomSchema),
26609
+ defaultProps: NoReactInternals24.deserializeJSONWithSpecialTypes(res.serializedDefaultPropsWithCustomSchema),
26539
26610
  defaultCodec,
26540
26611
  defaultOutName,
26541
26612
  defaultVideoImageFormat,
@@ -26567,7 +26638,8 @@ var internalSelectCompositionRaw = async (options2) => {
26567
26638
  onBrowserDownload,
26568
26639
  onServeUrlVisited,
26569
26640
  chromeMode,
26570
- mediaCacheSizeInBytes
26641
+ mediaCacheSizeInBytes,
26642
+ preferredEffectBackend
26571
26643
  } = options2;
26572
26644
  const [{ page, cleanupPage }, serverUsed] = await Promise.all([
26573
26645
  getPageAndCleanupFn({
@@ -26631,7 +26703,8 @@ var internalSelectCompositionRaw = async (options2) => {
26631
26703
  onBrowserDownload,
26632
26704
  onServeUrlVisited,
26633
26705
  chromeMode,
26634
- mediaCacheSizeInBytes
26706
+ mediaCacheSizeInBytes,
26707
+ preferredEffectBackend
26635
26708
  }).then((data) => {
26636
26709
  return resolve(data);
26637
26710
  }).catch((err) => {
@@ -26665,7 +26738,8 @@ var selectComposition = async (options2) => {
26665
26738
  onBrowserDownload,
26666
26739
  chromeMode,
26667
26740
  offthreadVideoThreads,
26668
- mediaCacheSizeInBytes
26741
+ mediaCacheSizeInBytes,
26742
+ preferredEffectBackend
26669
26743
  } = options2;
26670
26744
  const indent = false;
26671
26745
  const logLevel = passedLogLevel ?? (verbose ? "verbose" : "info");
@@ -26675,7 +26749,7 @@ var selectComposition = async (options2) => {
26675
26749
  browserExecutable: browserExecutable ?? null,
26676
26750
  chromiumOptions: chromiumOptions ?? {},
26677
26751
  envVariables: envVariables ?? {},
26678
- serializedInputPropsWithCustomSchema: NoReactInternals22.serializeJSONWithSpecialTypes({
26752
+ serializedInputPropsWithCustomSchema: NoReactInternals24.serializeJSONWithSpecialTypes({
26679
26753
  indent: undefined,
26680
26754
  staticBase: null,
26681
26755
  data: inputProps ?? {}
@@ -26699,7 +26773,8 @@ var selectComposition = async (options2) => {
26699
26773
  },
26700
26774
  chromeMode: chromeMode ?? "headless-shell",
26701
26775
  offthreadVideoThreads: offthreadVideoThreads ?? null,
26702
- mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null
26776
+ mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
26777
+ preferredEffectBackend: preferredEffectBackend ?? "auto"
26703
26778
  });
26704
26779
  return data.metadata;
26705
26780
  };
@@ -27153,9 +27228,9 @@ var getAudibleParts = ({
27153
27228
  };
27154
27229
  // src/get-video-metadata.ts
27155
27230
  import { resolve as resolve2 } from "node:path";
27156
- import { NoReactInternals as NoReactInternals23 } from "remotion/no-react";
27231
+ import { NoReactInternals as NoReactInternals25 } from "remotion/no-react";
27157
27232
  var getVideoMetadata = async (videoSource, options2) => {
27158
- if (NoReactInternals23.ENABLE_V5_BREAKING_CHANGES) {
27233
+ if (NoReactInternals25.ENABLE_V5_BREAKING_CHANGES) {
27159
27234
  throw new Error("getVideoMetadata() has been removed in Remotion 5. Use Mediabunny instead: https://www.remotion.dev/docs/mediabunny/metadata");
27160
27235
  }
27161
27236
  const compositor = startLongRunningCompositor({
@@ -27194,6 +27269,7 @@ var customEditorLineNumberPlaceholder = "%LINE_NUMBER%";
27194
27269
  var customEditorColumnNumberPlaceholder = "%COLUMN_NUMBER%";
27195
27270
  // src/index.ts
27196
27271
  var RenderInternals = {
27272
+ isUserCancelledRender,
27197
27273
  resolveConcurrency,
27198
27274
  serveStatic,
27199
27275
  validateEvenDimensionsWithCodec,