@remotion/renderer 4.0.447 → 4.0.449

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 (52) hide show
  1. package/dist/assets/apply-tone-frequency.d.ts +2 -1
  2. package/dist/assets/apply-tone-frequency.js +3 -4
  3. package/dist/assets/download-map.d.ts +1 -1
  4. package/dist/assets/download-map.js +2 -2
  5. package/dist/assets/inline-audio-mixing.d.ts +3 -2
  6. package/dist/assets/inline-audio-mixing.js +9 -9
  7. package/dist/check-version-requirements.js +18 -0
  8. package/dist/client.d.ts +80 -0
  9. package/dist/combine-audio.d.ts +4 -3
  10. package/dist/combine-audio.js +14 -12
  11. package/dist/combine-chunks.d.ts +2 -1
  12. package/dist/combine-chunks.js +4 -2
  13. package/dist/create-audio.d.ts +2 -1
  14. package/dist/create-audio.js +4 -1
  15. package/dist/create-silent-audio.d.ts +2 -1
  16. package/dist/create-silent-audio.js +3 -4
  17. package/dist/esm/client.mjs +171 -125
  18. package/dist/esm/error-handling.mjs +4 -0
  19. package/dist/esm/index.mjs +189 -113
  20. package/dist/get-compositions.js +4 -1
  21. package/dist/get-extra-frames-to-capture.d.ts +2 -1
  22. package/dist/get-extra-frames-to-capture.js +5 -5
  23. package/dist/index.d.ts +22 -3
  24. package/dist/make-page.d.ts +2 -1
  25. package/dist/make-page.js +5 -2
  26. package/dist/memory/get-available-memory.js +1 -1
  27. package/dist/merge-audio-track.d.ts +1 -0
  28. package/dist/merge-audio-track.js +4 -1
  29. package/dist/options/index.d.ts +16 -0
  30. package/dist/options/index.js +2 -0
  31. package/dist/options/options-map.d.ts +64 -0
  32. package/dist/options/options-map.js +5 -0
  33. package/dist/options/sample-rate.d.ts +16 -0
  34. package/dist/options/sample-rate.js +34 -0
  35. package/dist/prepare-server.d.ts +2 -1
  36. package/dist/prepare-server.js +2 -2
  37. package/dist/preprocess-audio-track.d.ts +1 -0
  38. package/dist/preprocess-audio-track.js +3 -3
  39. package/dist/print-useful-error-message.js +4 -0
  40. package/dist/render-frames.d.ts +1 -0
  41. package/dist/render-frames.js +9 -3
  42. package/dist/render-media.d.ts +1 -1
  43. package/dist/render-media.js +7 -3
  44. package/dist/render-still.js +5 -1
  45. package/dist/select-composition.js +4 -1
  46. package/dist/set-props-and-env.d.ts +1 -0
  47. package/dist/set-props-and-env.js +7 -3
  48. package/dist/stitch-frames-to-video.d.ts +3 -1
  49. package/dist/stitch-frames-to-video.js +4 -2
  50. package/dist/stringify-ffmpeg-filter.d.ts +2 -1
  51. package/dist/stringify-ffmpeg-filter.js +4 -5
  52. package/package.json +13 -13
@@ -4075,6 +4075,7 @@ var getShouldUsePartitionedRendering = () => {
4075
4075
  };
4076
4076
 
4077
4077
  // src/check-version-requirements.ts
4078
+ import os2 from "node:os";
4078
4079
  import { NoReactInternals as NoReactInternals3 } from "remotion/no-react";
4079
4080
  var getRequiredLibCVersion = () => {
4080
4081
  if (process.platform !== "linux") {
@@ -4138,12 +4139,25 @@ var checkBunVersion = () => {
4138
4139
  throw new Error(`Remotion requires at least Bun ${NoReactInternals3.MIN_BUN_VERSION}. You currently have ${Bun.version}. Update your Bun version to ${NoReactInternals3.MIN_BUN_VERSION} to use Remotion.`);
4139
4140
  }
4140
4141
  };
4142
+ var MIN_DARWIN_VERSION = 24;
4143
+ var MIN_MACOS_DISPLAY_VERSION = "15 (Sequoia)";
4144
+ var checkMacOSVersion = (logLevel, indent) => {
4145
+ if (process.platform !== "darwin") {
4146
+ return;
4147
+ }
4148
+ const majorVersion = Number(os2.release().split(".")[0]);
4149
+ if (Number.isNaN(majorVersion) || majorVersion >= MIN_DARWIN_VERSION) {
4150
+ return;
4151
+ }
4152
+ Log.warn({ logLevel, indent }, `Your macOS version is older than macOS ${MIN_MACOS_DISPLAY_VERSION}. Some features such as rendering may not work.`);
4153
+ };
4141
4154
  var checkRuntimeVersion = (logLevel, indent) => {
4142
4155
  if (typeof Bun === "undefined") {
4143
4156
  checkNodeVersion();
4144
4157
  } else {
4145
4158
  checkBunVersion();
4146
4159
  }
4160
+ checkMacOSVersion(logLevel, indent);
4147
4161
  checkLibCRequirement(logLevel, indent);
4148
4162
  };
4149
4163
 
@@ -4735,7 +4749,7 @@ var defaultOnLog = ({ logLevel, tag, previewString }) => {
4735
4749
 
4736
4750
  // src/open-browser.ts
4737
4751
  import fs10 from "node:fs";
4738
- import os5 from "node:os";
4752
+ import os6 from "node:os";
4739
4753
  import path9 from "node:path";
4740
4754
 
4741
4755
  // src/browser/Launcher.ts
@@ -4773,18 +4787,18 @@ import fs8 from "fs";
4773
4787
 
4774
4788
  // src/browser/BrowserFetcher.ts
4775
4789
  import * as fs7 from "node:fs";
4776
- import * as os3 from "node:os";
4790
+ import * as os4 from "node:os";
4777
4791
  import * as path8 from "node:path";
4778
4792
  import { promisify } from "node:util";
4779
4793
  import extractZip from "extract-zip";
4780
4794
 
4781
4795
  // src/browser/get-chrome-download-url.ts
4782
4796
  import * as fs5 from "node:fs";
4783
- import * as os2 from "node:os";
4797
+ import * as os3 from "node:os";
4784
4798
  var TESTED_VERSION = "144.0.7559.20";
4785
4799
  var PLAYWRIGHT_VERSION = "1207";
4786
4800
  var isAmazonLinux2023 = () => {
4787
- if (os2.platform() !== "linux") {
4801
+ if (os3.platform() !== "linux") {
4788
4802
  return false;
4789
4803
  }
4790
4804
  try {
@@ -4922,12 +4936,12 @@ function existsAsync(filePath) {
4922
4936
  });
4923
4937
  }
4924
4938
  var getPlatform = () => {
4925
- const platform3 = os3.platform();
4939
+ const platform3 = os4.platform();
4926
4940
  switch (platform3) {
4927
4941
  case "darwin":
4928
- return os3.arch() === "arm64" ? "mac-arm64" : "mac-x64";
4942
+ return os4.arch() === "arm64" ? "mac-arm64" : "mac-x64";
4929
4943
  case "linux":
4930
- return os3.arch() === "arm64" ? "linux-arm64" : "linux64";
4944
+ return os4.arch() === "arm64" ? "linux-arm64" : "linux64";
4931
4945
  case "win32":
4932
4946
  return "win64";
4933
4947
  default:
@@ -4989,7 +5003,7 @@ var downloadBrowser = async ({
4989
5003
  recursive: true
4990
5004
  });
4991
5005
  }
4992
- if (os3.platform() !== "darwin" && os3.platform() !== "linux" && os3.arch() === "arm64") {
5006
+ if (os4.platform() !== "darwin" && os4.platform() !== "linux" && os4.arch() === "arm64") {
4993
5007
  throw new Error([
4994
5008
  "Chrome Headless Shell is not available for Windows for arm64 architecture."
4995
5009
  ].join(`
@@ -5188,7 +5202,7 @@ var getLocalBrowserExecutable = ({
5188
5202
 
5189
5203
  // src/get-cpu-count.ts
5190
5204
  import { execSync as execSync2 } from "node:child_process";
5191
- import os4 from "node:os";
5205
+ import os5 from "node:os";
5192
5206
  var nprocCount;
5193
5207
  var getConcurrencyFromNProc = () => {
5194
5208
  if (nprocCount !== undefined) {
@@ -5203,10 +5217,10 @@ var getConcurrencyFromNProc = () => {
5203
5217
  }
5204
5218
  };
5205
5219
  var getNodeCpuCount = () => {
5206
- if (typeof os4.availableParallelism === "function") {
5207
- return os4.availableParallelism();
5220
+ if (typeof os5.availableParallelism === "function") {
5221
+ return os5.availableParallelism();
5208
5222
  }
5209
- return os4.cpus().length;
5223
+ return os5.cpus().length;
5210
5224
  };
5211
5225
  var getCpuCount = () => {
5212
5226
  const node = getNodeCpuCount();
@@ -5341,7 +5355,7 @@ var getAvailableMemory = (logLevel) => {
5341
5355
  Log.warn({ indent: false, logLevel }, `Memory reported by /proc/meminfo: ${(_procInfo / 1024 / 1024).toFixed(2)} MB`);
5342
5356
  }
5343
5357
  Log.warn({ indent: false, logLevel }, `Memory reported by Node: ${(nodeMemory / 1024 / 1024).toFixed(2)} MB`);
5344
- Log.warn({ indent: false, logLevel }, "You might have inadvertenly set the --memory flag of `docker run` to a value that is higher than the global Docker memory limit.");
5358
+ Log.warn({ indent: false, logLevel }, "You might have inadvertently set the --memory flag of `docker run` to a value that is higher than the global Docker memory limit.");
5345
5359
  Log.warn({ indent: false, logLevel }, "Using the lower amount of memory for calculation.");
5346
5360
  }
5347
5361
  return Math.min(nodeMemory, cgroupMemory);
@@ -5457,7 +5471,7 @@ var internalOpenBrowser = async ({
5457
5471
  if (chromiumOptions.userAgent) {
5458
5472
  Log.verbose({ indent, logLevel, tag: "openBrowser()" }, `Using custom user agent: ${chromiumOptions.userAgent}`);
5459
5473
  }
5460
- const userDataDir = await fs10.promises.mkdtemp(path9.join(os5.tmpdir(), "puppeteer_dev_chrome_profile-"));
5474
+ const userDataDir = await fs10.promises.mkdtemp(path9.join(os6.tmpdir(), "puppeteer_dev_chrome_profile-"));
5461
5475
  const browserInstance = await launchChrome({
5462
5476
  executablePath,
5463
5477
  logLevel,
@@ -15291,7 +15305,7 @@ class OffthreadVideoServerEmitter {
15291
15305
 
15292
15306
  // src/tmp-dir.ts
15293
15307
  import fs12, { mkdirSync } from "node:fs";
15294
- import os6 from "node:os";
15308
+ import os7 from "node:os";
15295
15309
  import path13 from "node:path";
15296
15310
  var alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
15297
15311
  var randomHash = () => {
@@ -15300,7 +15314,7 @@ var randomHash = () => {
15300
15314
  }).join("");
15301
15315
  };
15302
15316
  var tmpDir = (str) => {
15303
- const newDir = path13.join(os6.tmpdir(), str + randomHash());
15317
+ const newDir = path13.join(os7.tmpdir(), str + randomHash());
15304
15318
  if (fs12.existsSync(newDir)) {
15305
15319
  fs12.rmSync(newDir, {
15306
15320
  recursive: true,
@@ -15315,9 +15329,6 @@ var tmpDir = (str) => {
15315
15329
  import fs13, { writeSync } from "node:fs";
15316
15330
  import path14 from "node:path";
15317
15331
 
15318
- // src/sample-rate.ts
15319
- var DEFAULT_SAMPLE_RATE = 48000;
15320
-
15321
15332
  // src/assets/apply-tone-frequency.ts
15322
15333
  var applyToneFrequencyUsingFfmpeg = async ({
15323
15334
  input,
@@ -15326,9 +15337,10 @@ var applyToneFrequencyUsingFfmpeg = async ({
15326
15337
  indent,
15327
15338
  logLevel,
15328
15339
  binariesDirectory,
15329
- cancelSignal
15340
+ cancelSignal,
15341
+ sampleRate
15330
15342
  }) => {
15331
- const filter = `asetrate=${DEFAULT_SAMPLE_RATE}*${toneFrequency},aresample=${DEFAULT_SAMPLE_RATE},atempo=1/${toneFrequency}`;
15343
+ const filter = `asetrate=${sampleRate}*${toneFrequency},aresample=${sampleRate},atempo=1/${toneFrequency}`;
15332
15344
  const args = [
15333
15345
  "-hide_banner",
15334
15346
  "-i",
@@ -15337,7 +15349,7 @@ var applyToneFrequencyUsingFfmpeg = async ({
15337
15349
  "-filter:a",
15338
15350
  filter,
15339
15351
  ["-c:a", "pcm_s16le"],
15340
- ["-ar", String(DEFAULT_SAMPLE_RATE)],
15352
+ ["-ar", String(sampleRate)],
15341
15353
  "-y",
15342
15354
  output
15343
15355
  ].flat(2);
@@ -15377,7 +15389,7 @@ var correctFloatingPointError = (value) => {
15377
15389
  var BIT_DEPTH = 16;
15378
15390
  var BYTES_PER_SAMPLE = BIT_DEPTH / 8;
15379
15391
  var NUMBER_OF_CHANNELS = 2;
15380
- var makeInlineAudioMixing = (dir) => {
15392
+ var makeInlineAudioMixing = (dir, sampleRate) => {
15381
15393
  const folderToAdd = makeAndReturn(dir, "remotion-inline-audio-mixing");
15382
15394
  const openFiles = {};
15383
15395
  const writtenHeaders = {};
@@ -15411,7 +15423,7 @@ var makeInlineAudioMixing = (dir) => {
15411
15423
  return;
15412
15424
  }
15413
15425
  writtenHeaders[filePath] = true;
15414
- const expectedDataSize = Math.round((totalNumberOfFrames / fps - trimLeftOffset + trimRightOffset) * NUMBER_OF_CHANNELS * DEFAULT_SAMPLE_RATE * BYTES_PER_SAMPLE);
15426
+ const expectedDataSize = Math.round((totalNumberOfFrames / fps - trimLeftOffset + trimRightOffset) * NUMBER_OF_CHANNELS * sampleRate * BYTES_PER_SAMPLE);
15415
15427
  const expectedSize = 40 + expectedDataSize;
15416
15428
  const fd = openFiles[filePath];
15417
15429
  writeSync(fd, new Uint8Array([82, 73, 70, 70]), 0, 4, 0);
@@ -15421,8 +15433,8 @@ var makeInlineAudioMixing = (dir) => {
15421
15433
  writeSync(fd, new Uint8Array([BIT_DEPTH, 0, 0, 0]), 0, 4, 16);
15422
15434
  writeSync(fd, new Uint8Array([1, 0]), 0, 2, 20);
15423
15435
  writeSync(fd, new Uint8Array([NUMBER_OF_CHANNELS, 0]), 0, 2, 22);
15424
- writeSync(fd, new Uint8Array(numberTo32BiIntLittleEndian(DEFAULT_SAMPLE_RATE)), 0, 4, 24);
15425
- writeSync(fd, new Uint8Array(numberTo32BiIntLittleEndian(DEFAULT_SAMPLE_RATE * NUMBER_OF_CHANNELS * BYTES_PER_SAMPLE)), 0, 4, 28);
15436
+ writeSync(fd, new Uint8Array(numberTo32BiIntLittleEndian(sampleRate)), 0, 4, 24);
15437
+ writeSync(fd, new Uint8Array(numberTo32BiIntLittleEndian(sampleRate * NUMBER_OF_CHANNELS * BYTES_PER_SAMPLE)), 0, 4, 28);
15426
15438
  writeSync(fd, new Uint8Array(numberTo16BitLittleEndian(NUMBER_OF_CHANNELS * BYTES_PER_SAMPLE)), 0, 2, 32);
15427
15439
  writeSync(fd, numberTo16BitLittleEndian(BIT_DEPTH), 0, 2, 34);
15428
15440
  writeSync(fd, new Uint8Array([100, 97, 116, 97]), 0, 4, 36);
@@ -15432,7 +15444,8 @@ var makeInlineAudioMixing = (dir) => {
15432
15444
  binariesDirectory,
15433
15445
  indent,
15434
15446
  logLevel,
15435
- cancelSignal
15447
+ cancelSignal,
15448
+ sampleRate: finishSampleRate
15436
15449
  }) => {
15437
15450
  for (const fd of Object.keys(openFiles)) {
15438
15451
  const frequency = toneFrequencies[fd];
@@ -15445,7 +15458,8 @@ var makeInlineAudioMixing = (dir) => {
15445
15458
  indent,
15446
15459
  logLevel,
15447
15460
  binariesDirectory,
15448
- cancelSignal
15461
+ cancelSignal,
15462
+ sampleRate: finishSampleRate
15449
15463
  });
15450
15464
  fs13.renameSync(tmpFile, fd);
15451
15465
  }
@@ -15475,8 +15489,8 @@ var makeInlineAudioMixing = (dir) => {
15475
15489
  let arr = new Int16Array(asset.audio);
15476
15490
  const isFirst = asset.frame === firstFrame;
15477
15491
  const isLast = asset.frame === totalNumberOfFrames + firstFrame - 1;
15478
- const samplesToShaveFromStart = trimLeftOffset * DEFAULT_SAMPLE_RATE;
15479
- const samplesToShaveFromEnd = trimRightOffset * DEFAULT_SAMPLE_RATE;
15492
+ const samplesToShaveFromStart = trimLeftOffset * sampleRate;
15493
+ const samplesToShaveFromEnd = trimRightOffset * sampleRate;
15480
15494
  if (isFirst) {
15481
15495
  arr = arr.slice(Math.floor(correctFloatingPointError(samplesToShaveFromStart)) * NUMBER_OF_CHANNELS);
15482
15496
  }
@@ -15484,7 +15498,7 @@ var makeInlineAudioMixing = (dir) => {
15484
15498
  arr = arr.slice(0, arr.length + Math.ceil(correctFloatingPointError(samplesToShaveFromEnd)) * NUMBER_OF_CHANNELS);
15485
15499
  }
15486
15500
  const positionInSeconds = (asset.frame - firstFrame) / fps - (isFirst ? 0 : trimLeftOffset);
15487
- const position = Math.floor(correctFloatingPointError(positionInSeconds * DEFAULT_SAMPLE_RATE)) * NUMBER_OF_CHANNELS * BYTES_PER_SAMPLE;
15501
+ const position = Math.floor(correctFloatingPointError(positionInSeconds * sampleRate)) * NUMBER_OF_CHANNELS * BYTES_PER_SAMPLE;
15488
15502
  writeSync(fileDescriptor, arr, 0, arr.byteLength, 44 + position);
15489
15503
  };
15490
15504
  return {
@@ -15501,7 +15515,7 @@ var makeAndReturn = (dir, name) => {
15501
15515
  mkdirSync2(p);
15502
15516
  return p;
15503
15517
  };
15504
- var makeDownloadMap = () => {
15518
+ var makeDownloadMap = (sampleRate) => {
15505
15519
  const dir = tmpDir(`remotion-v${VERSION2}-assets`);
15506
15520
  let prevented = false;
15507
15521
  return {
@@ -15529,7 +15543,7 @@ var makeDownloadMap = () => {
15529
15543
  isPreventedFromCleanup: () => {
15530
15544
  return prevented;
15531
15545
  },
15532
- inlineAudioMixing: makeInlineAudioMixing(dir),
15546
+ inlineAudioMixing: makeInlineAudioMixing(dir, sampleRate),
15533
15547
  cleanupController: new AbortController
15534
15548
  };
15535
15549
  };
@@ -15742,13 +15756,13 @@ var makeRange = (from, to) => {
15742
15756
  };
15743
15757
 
15744
15758
  // src/port-config.ts
15745
- import os7 from "os";
15759
+ import os8 from "os";
15746
15760
  var cached = null;
15747
15761
  var getPortConfig = (preferIpv4) => {
15748
15762
  if (cached) {
15749
15763
  return cached;
15750
15764
  }
15751
- const networkInterfaces = os7.networkInterfaces();
15765
+ const networkInterfaces = os8.networkInterfaces();
15752
15766
  const flattened = flattenNetworkInterfaces(networkInterfaces);
15753
15767
  const host = getHostToBind(flattened, preferIpv4);
15754
15768
  const hostsToTry = getHostsToTry(flattened);
@@ -16170,9 +16184,10 @@ var prepareServer = async ({
16170
16184
  indent,
16171
16185
  offthreadVideoCacheSizeInBytes,
16172
16186
  binariesDirectory,
16173
- forceIPv4
16187
+ forceIPv4,
16188
+ sampleRate
16174
16189
  }) => {
16175
- const downloadMap = makeDownloadMap();
16190
+ const downloadMap = makeDownloadMap(sampleRate);
16176
16191
  Log.verbose({ indent, logLevel }, "Created directory for temporary files", downloadMap.assetDir);
16177
16192
  if (isServeUrl(webpackConfigOrServeUrl)) {
16178
16193
  const {
@@ -16631,18 +16646,20 @@ var innerSetPropsAndEnv = async ({
16631
16646
  isMainTab,
16632
16647
  mediaCacheSizeInBytes,
16633
16648
  initialMemoryAvailable,
16634
- darkMode
16649
+ darkMode,
16650
+ sampleRate
16635
16651
  }) => {
16636
16652
  validatePuppeteerTimeout(timeoutInMilliseconds);
16637
16653
  const actualTimeout = timeoutInMilliseconds ?? DEFAULT_TIMEOUT;
16638
16654
  page.setDefaultTimeout(actualTimeout);
16639
16655
  page.setDefaultNavigationTimeout(actualTimeout);
16640
16656
  const urlToVisit = normalizeServeUrl(serveUrl);
16641
- await page.evaluateOnNewDocument((timeout, mainTab, cacheSizeInBytes, initMemoryAvailable) => {
16657
+ await page.evaluateOnNewDocument((timeout, mainTab, cacheSizeInBytes, initMemoryAvailable, sRate) => {
16642
16658
  window.remotion_puppeteerTimeout = timeout;
16643
16659
  window.remotion_isMainTab = mainTab;
16644
16660
  window.remotion_mediaCacheSizeInBytes = cacheSizeInBytes;
16645
16661
  window.remotion_initialMemoryAvailable = initMemoryAvailable;
16662
+ window.remotion_sampleRate = sRate;
16646
16663
  if (window.process === undefined) {
16647
16664
  window.process = {};
16648
16665
  }
@@ -16650,7 +16667,7 @@ var innerSetPropsAndEnv = async ({
16650
16667
  window.process.env = {};
16651
16668
  }
16652
16669
  window.process.env.NODE_ENV = "production";
16653
- }, actualTimeout, isMainTab, mediaCacheSizeInBytes, initialMemoryAvailable);
16670
+ }, actualTimeout, isMainTab, mediaCacheSizeInBytes, initialMemoryAvailable, sampleRate);
16654
16671
  await page.evaluateOnNewDocument('window.remotion_broadcastChannel = new BroadcastChannel("remotion-video-frame-extraction")');
16655
16672
  if (envVariables) {
16656
16673
  await page.evaluateOnNewDocument((input) => {
@@ -16707,7 +16724,8 @@ var innerSetPropsAndEnv = async ({
16707
16724
  isMainTab,
16708
16725
  mediaCacheSizeInBytes,
16709
16726
  initialMemoryAvailable,
16710
- darkMode
16727
+ darkMode,
16728
+ sampleRate
16711
16729
  });
16712
16730
  };
16713
16731
  const [pageRes, error] = await gotoPageOrThrow(page, urlToVisit, actualTimeout);
@@ -16912,6 +16930,10 @@ var printUsefulErrorMessage = (err, logLevel, indent) => {
16912
16930
  Log.info({ indent, logLevel }, "\uD83D\uDCA1 Remotion requires at least Libc 2.35.");
16913
16931
  Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue: https://github.com/remotion-dev/remotion/issues/2439");
16914
16932
  }
16933
+ if (err.message.includes("AVCaptureDeviceTypeContinuityCamera")) {
16934
+ Log.info({ indent, logLevel }, "\uD83D\uDCA1 Remotion requires macOS 15 (Sequoia) or later.");
16935
+ Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue: https://github.com/remotion-dev/remotion/issues/7027");
16936
+ }
16915
16937
  if (err.message.includes("EBADF")) {
16916
16938
  Log.info({ indent, logLevel }, "\uD83D\uDCA1 This error might be fixed by changing your Node version:");
16917
16939
  Log.info({ indent, logLevel }, " https://github.com/remotion-dev/remotion/issues/2452");
@@ -16981,7 +17003,8 @@ var innerGetCompositions = async ({
16981
17003
  isMainTab: true,
16982
17004
  mediaCacheSizeInBytes,
16983
17005
  initialMemoryAvailable: getAvailableMemory(logLevel),
16984
- darkMode
17006
+ darkMode,
17007
+ sampleRate: 48000
16985
17008
  });
16986
17009
  await puppeteerEvaluateWithCatch({
16987
17010
  page,
@@ -17022,7 +17045,8 @@ var innerGetCompositions = async ({
17022
17045
  defaultOutName,
17023
17046
  defaultVideoImageFormat,
17024
17047
  defaultPixelFormat,
17025
- defaultProResProfile
17048
+ defaultProResProfile,
17049
+ defaultSampleRate
17026
17050
  } = r;
17027
17051
  return {
17028
17052
  id,
@@ -17036,7 +17060,8 @@ var innerGetCompositions = async ({
17036
17060
  defaultOutName,
17037
17061
  defaultVideoImageFormat,
17038
17062
  defaultPixelFormat,
17039
- defaultProResProfile
17063
+ defaultProResProfile,
17064
+ defaultSampleRate
17040
17065
  };
17041
17066
  });
17042
17067
  };
@@ -17091,7 +17116,8 @@ var internalGetCompositionsRaw = async ({
17091
17116
  indent,
17092
17117
  offthreadVideoCacheSizeInBytes,
17093
17118
  binariesDirectory,
17094
- forceIPv4: false
17119
+ forceIPv4: false,
17120
+ sampleRate: 48000
17095
17121
  }, {
17096
17122
  onDownload: () => {
17097
17123
  return;
@@ -17813,17 +17839,18 @@ var parseFfmpegProgress = (input, fps) => {
17813
17839
  };
17814
17840
 
17815
17841
  // src/combine-audio.ts
17816
- var durationOf1Frame = 1024 / DEFAULT_SAMPLE_RATE * 1e6;
17842
+ var durationOf1Frame = (sampleRate) => 1024 / sampleRate * 1e6;
17817
17843
  var roundWithFix = (targetTime) => {
17818
17844
  if (targetTime % 1 > 0.4999999) {
17819
17845
  return Math.ceil(targetTime);
17820
17846
  }
17821
17847
  return Math.floor(targetTime);
17822
17848
  };
17823
- var getClosestAlignedTime = (targetTime) => {
17824
- const decimalFramesToTargetTime = targetTime * 1e6 / durationOf1Frame;
17849
+ var getClosestAlignedTime = (targetTime, sampleRate) => {
17850
+ const dur = durationOf1Frame(sampleRate);
17851
+ const decimalFramesToTargetTime = targetTime * 1e6 / dur;
17825
17852
  const nearestFrameIndexForTargetTime = roundWithFix(decimalFramesToTargetTime);
17826
- return nearestFrameIndexForTargetTime * durationOf1Frame / 1e6;
17853
+ return nearestFrameIndexForTargetTime * dur / 1e6;
17827
17854
  };
17828
17855
  var encodeAudio = async ({
17829
17856
  files,
@@ -17903,21 +17930,22 @@ var combineAudioSeamlessly = async ({
17903
17930
  fps,
17904
17931
  binariesDirectory,
17905
17932
  cancelSignal,
17906
- onProgress
17933
+ onProgress,
17934
+ sampleRate
17907
17935
  }) => {
17908
17936
  const startConcatenating = Date.now();
17909
17937
  const fileList = files.map((p, i) => {
17910
17938
  const isLast = i === files.length - 1;
17911
17939
  const targetStart = i * chunkDurationInSeconds;
17912
17940
  const endStart = (i + 1) * chunkDurationInSeconds;
17913
- const startTime = getClosestAlignedTime(targetStart) * 1e6;
17914
- const endTime = getClosestAlignedTime(endStart) * 1e6;
17941
+ const startTime = getClosestAlignedTime(targetStart, sampleRate) * 1e6;
17942
+ const endTime = getClosestAlignedTime(endStart, sampleRate) * 1e6;
17915
17943
  const realDuration = endTime - startTime;
17916
17944
  let inpoint = 0;
17917
17945
  if (i > 0) {
17918
- inpoint = durationOf1Frame * 4;
17946
+ inpoint = durationOf1Frame(sampleRate) * 4;
17919
17947
  }
17920
- const outpoint = (i === 0 ? durationOf1Frame * 2 : inpoint) + realDuration - (isLast ? 0 : durationOf1Frame);
17948
+ const outpoint = (i === 0 ? durationOf1Frame(sampleRate) * 2 : inpoint) + realDuration - (isLast ? 0 : durationOf1Frame(sampleRate));
17921
17949
  return [`file '${p}'`, `inpoint ${inpoint}us`, `outpoint ${outpoint}us`].filter(truthy).join(`
17922
17950
  `);
17923
17951
  }).join(`
@@ -17981,7 +18009,8 @@ var createCombinedAudio = ({
17981
18009
  binariesDirectory,
17982
18010
  fps,
17983
18011
  cancelSignal,
17984
- onProgress
18012
+ onProgress,
18013
+ sampleRate
17985
18014
  }) => {
17986
18015
  if (seamless) {
17987
18016
  return combineAudioSeamlessly({
@@ -17995,7 +18024,8 @@ var createCombinedAudio = ({
17995
18024
  binariesDirectory,
17996
18025
  fps,
17997
18026
  cancelSignal,
17998
- onProgress
18027
+ onProgress,
18028
+ sampleRate
17999
18029
  });
18000
18030
  }
18001
18031
  return encodeAudio({
@@ -18019,7 +18049,8 @@ var getExtraFramesToCapture = ({
18019
18049
  compositionStart,
18020
18050
  realFrameRange,
18021
18051
  fps,
18022
- forSeamlessAacConcatenation
18052
+ forSeamlessAacConcatenation,
18053
+ sampleRate
18023
18054
  }) => {
18024
18055
  if (!forSeamlessAacConcatenation) {
18025
18056
  return {
@@ -18039,8 +18070,8 @@ var getExtraFramesToCapture = ({
18039
18070
  throw new Error("chunkStat - compositionStart may not be below 0");
18040
18071
  }
18041
18072
  const realRightEnd = realLeftEnd + (realFrameRange[1] - realFrameRange[0] + 1);
18042
- const aacAdjustedLeftEnd = Math.max(0, getClosestAlignedTime(realLeftEnd / fps) - 2 * (1024 / DEFAULT_SAMPLE_RATE));
18043
- const aacAdjustedRightEnd = getClosestAlignedTime(realRightEnd / fps) + 2 * (1024 / DEFAULT_SAMPLE_RATE);
18073
+ const aacAdjustedLeftEnd = Math.max(0, getClosestAlignedTime(realLeftEnd / fps, sampleRate) - 2 * (1024 / sampleRate));
18074
+ const aacAdjustedRightEnd = getClosestAlignedTime(realRightEnd / fps, sampleRate) + 2 * (1024 / sampleRate);
18044
18075
  const alignedStartFrameWithoutOffset = Math.floor(aacAdjustedLeftEnd * fps);
18045
18076
  const alignedStartFrame = alignedStartFrameWithoutOffset + compositionStart;
18046
18077
  const alignedEndFrame = Math.ceil(aacAdjustedRightEnd * fps) + compositionStart;
@@ -18165,7 +18196,8 @@ var makePage = async ({
18165
18196
  isMainTab,
18166
18197
  mediaCacheSizeInBytes,
18167
18198
  onLog,
18168
- darkMode
18199
+ darkMode,
18200
+ sampleRate
18169
18201
  }) => {
18170
18202
  const page = await browserReplacer.getBrowser().newPage({ context, logLevel, indent, pageIndex, onBrowserLog, onLog });
18171
18203
  pagesArray.push(page);
@@ -18193,10 +18225,11 @@ var makePage = async ({
18193
18225
  isMainTab,
18194
18226
  mediaCacheSizeInBytes,
18195
18227
  initialMemoryAvailable: getAvailableMemory(logLevel),
18196
- darkMode
18228
+ darkMode,
18229
+ sampleRate
18197
18230
  });
18198
18231
  await puppeteerEvaluateWithCatch({
18199
- pageFunction: (id, props, durationInFrames, fps, height, width, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile) => {
18232
+ pageFunction: (id, props, durationInFrames, fps, height, width, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile, defaultSampleRate) => {
18200
18233
  window.remotion_setBundleMode({
18201
18234
  type: "composition",
18202
18235
  compositionName: id,
@@ -18209,7 +18242,8 @@ var makePage = async ({
18209
18242
  compositionDefaultOutName: defaultOutName,
18210
18243
  compositionDefaultVideoImageFormat: defaultVideoImageFormat,
18211
18244
  compositionDefaultPixelFormat: defaultPixelFormat,
18212
- compositionDefaultProResProfile: defaultProResProfile
18245
+ compositionDefaultProResProfile: defaultProResProfile,
18246
+ compositionDefaultSampleRate: defaultSampleRate
18213
18247
  });
18214
18248
  },
18215
18249
  args: [
@@ -18223,7 +18257,8 @@ var makePage = async ({
18223
18257
  composition.defaultOutName,
18224
18258
  composition.defaultVideoImageFormat,
18225
18259
  composition.defaultPixelFormat,
18226
- composition.defaultProResProfile
18260
+ composition.defaultProResProfile,
18261
+ composition.defaultSampleRate
18227
18262
  ],
18228
18263
  frame: null,
18229
18264
  page,
@@ -19152,7 +19187,8 @@ var innerRenderFrames = async ({
19152
19187
  imageSequencePattern,
19153
19188
  mediaCacheSizeInBytes,
19154
19189
  onLog,
19155
- darkMode
19190
+ darkMode,
19191
+ sampleRate
19156
19192
  }) => {
19157
19193
  if (outputDir) {
19158
19194
  if (!fs15.existsSync(outputDir)) {
@@ -19173,7 +19209,8 @@ var innerRenderFrames = async ({
19173
19209
  fps: composition.fps,
19174
19210
  compositionStart,
19175
19211
  realFrameRange,
19176
- forSeamlessAacConcatenation
19212
+ forSeamlessAacConcatenation,
19213
+ sampleRate
19177
19214
  });
19178
19215
  const framesToRender = getFramesToRender(realFrameRange, everyNthFrame);
19179
19216
  const lastFrame = framesToRender[framesToRender.length - 1];
@@ -19201,7 +19238,8 @@ var innerRenderFrames = async ({
19201
19238
  isMainTab: pageIndex === 0,
19202
19239
  mediaCacheSizeInBytes,
19203
19240
  onLog,
19204
- darkMode
19241
+ darkMode,
19242
+ sampleRate
19205
19243
  });
19206
19244
  };
19207
19245
  const getPool = async () => {
@@ -19345,7 +19383,8 @@ var internalRenderFramesRaw = ({
19345
19383
  offthreadVideoThreads,
19346
19384
  imageSequencePattern,
19347
19385
  mediaCacheSizeInBytes,
19348
- onLog
19386
+ onLog,
19387
+ sampleRate
19349
19388
  }) => {
19350
19389
  validateDimension(composition.height, "height", "in the `config` object passed to `renderFrames()`");
19351
19390
  validateDimension(composition.width, "width", "in the `config` object passed to `renderFrames()`");
@@ -19391,7 +19430,8 @@ var internalRenderFramesRaw = ({
19391
19430
  indent,
19392
19431
  offthreadVideoCacheSizeInBytes,
19393
19432
  binariesDirectory,
19394
- forceIPv4: false
19433
+ forceIPv4: false,
19434
+ sampleRate
19395
19435
  }, {
19396
19436
  onDownload
19397
19437
  }),
@@ -19451,7 +19491,8 @@ var internalRenderFramesRaw = ({
19451
19491
  imageSequencePattern,
19452
19492
  mediaCacheSizeInBytes,
19453
19493
  onLog,
19454
- darkMode: chromiumOptions.darkMode ?? false
19494
+ darkMode: chromiumOptions.darkMode ?? false,
19495
+ sampleRate
19455
19496
  });
19456
19497
  })
19457
19498
  ]).then((res) => {
@@ -19521,7 +19562,8 @@ var renderFrames = (options) => {
19521
19562
  chromeMode,
19522
19563
  offthreadVideoThreads,
19523
19564
  imageSequencePattern,
19524
- mediaCacheSizeInBytes
19565
+ mediaCacheSizeInBytes,
19566
+ sampleRate
19525
19567
  } = options;
19526
19568
  if (!composition) {
19527
19569
  throw new Error("No `composition` option has been specified for renderFrames()");
@@ -19581,13 +19623,14 @@ var renderFrames = (options) => {
19581
19623
  offthreadVideoThreads: offthreadVideoThreads ?? null,
19582
19624
  imageSequencePattern: imageSequencePattern ?? null,
19583
19625
  mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
19584
- onLog: defaultOnLog
19626
+ onLog: defaultOnLog,
19627
+ sampleRate: sampleRate ?? composition.defaultSampleRate ?? 48000
19585
19628
  });
19586
19629
  };
19587
19630
 
19588
19631
  // src/render-media.ts
19589
19632
  import fs17 from "node:fs";
19590
- import os8 from "node:os";
19633
+ import os9 from "node:os";
19591
19634
  import path26 from "node:path";
19592
19635
  import { LicensingInternals } from "@remotion/licensing";
19593
19636
  import { NoReactInternals as NoReactInternals15 } from "remotion/no-react";
@@ -20528,7 +20571,8 @@ var createSilentAudio = async ({
20528
20571
  logLevel,
20529
20572
  binariesDirectory,
20530
20573
  cancelSignal,
20531
- chunkLengthInSeconds
20574
+ chunkLengthInSeconds,
20575
+ sampleRate
20532
20576
  }) => {
20533
20577
  await callFf({
20534
20578
  bin: "ffmpeg",
@@ -20536,13 +20580,13 @@ var createSilentAudio = async ({
20536
20580
  "-f",
20537
20581
  "lavfi",
20538
20582
  "-i",
20539
- `anullsrc=r=${DEFAULT_SAMPLE_RATE}`,
20583
+ `anullsrc=r=${sampleRate}`,
20540
20584
  "-c:a",
20541
20585
  "pcm_s16le",
20542
20586
  "-t",
20543
20587
  String(chunkLengthInSeconds),
20544
20588
  "-ar",
20545
- String(DEFAULT_SAMPLE_RATE),
20589
+ String(sampleRate),
20546
20590
  outName
20547
20591
  ],
20548
20592
  indent,
@@ -20564,7 +20608,8 @@ var mergeAudioTrackUnlimited = async ({
20564
20608
  cancelSignal,
20565
20609
  onProgress,
20566
20610
  fps,
20567
- chunkLengthInSeconds
20611
+ chunkLengthInSeconds,
20612
+ sampleRate
20568
20613
  }) => {
20569
20614
  if (files.length === 0) {
20570
20615
  await createSilentAudio({
@@ -20573,7 +20618,8 @@ var mergeAudioTrackUnlimited = async ({
20573
20618
  indent,
20574
20619
  logLevel,
20575
20620
  binariesDirectory,
20576
- cancelSignal
20621
+ cancelSignal,
20622
+ sampleRate
20577
20623
  });
20578
20624
  onProgress(1);
20579
20625
  return;
@@ -20605,7 +20651,8 @@ var mergeAudioTrackUnlimited = async ({
20605
20651
  partialProgress[i] = progress;
20606
20652
  callProgress();
20607
20653
  },
20608
- fps
20654
+ fps,
20655
+ sampleRate
20609
20656
  });
20610
20657
  return chunkOutname;
20611
20658
  }));
@@ -20629,7 +20676,8 @@ var mergeAudioTrackUnlimited = async ({
20629
20676
  callProgress();
20630
20677
  },
20631
20678
  fps,
20632
- chunkLengthInSeconds
20679
+ chunkLengthInSeconds,
20680
+ sampleRate
20633
20681
  });
20634
20682
  return;
20635
20683
  } finally {
@@ -20869,7 +20917,8 @@ var stringifyFfmpegFilter = ({
20869
20917
  asset,
20870
20918
  indent,
20871
20919
  logLevel,
20872
- presentationTimeOffsetInSeconds
20920
+ presentationTimeOffsetInSeconds,
20921
+ sampleRate
20873
20922
  }) => {
20874
20923
  if (channels === 0) {
20875
20924
  return null;
@@ -20913,12 +20962,12 @@ var stringifyFfmpegFilter = ({
20913
20962
  const padStart = startInVideoSeconds + (asset.trimLeft === 0 ? presentationTimeOffsetInSeconds : 0);
20914
20963
  return {
20915
20964
  filter: "[0:a]" + [
20916
- `aformat=sample_fmts=s16:sample_rates=${DEFAULT_SAMPLE_RATE}`,
20965
+ `aformat=sample_fmts=s16:sample_rates=${sampleRate}`,
20917
20966
  ...trimAndTempoFilter,
20918
20967
  volumeFilter.value === "1" ? null : `volume=${volumeFilter.value}:eval=${volumeFilter.eval}`,
20919
- toneFrequency && toneFrequency !== 1 ? `asetrate=${DEFAULT_SAMPLE_RATE}*${toneFrequency},aresample=${DEFAULT_SAMPLE_RATE},atempo=1/${toneFrequency}` : null
20968
+ toneFrequency && toneFrequency !== 1 ? `asetrate=${sampleRate}*${toneFrequency},aresample=${sampleRate},atempo=1/${toneFrequency}` : null
20920
20969
  ].filter(truthy).join(",") + `[a0]`,
20921
- pad_end: padAtEnd > 0.0000001 ? "apad=pad_len=" + Math.round(padAtEnd * DEFAULT_SAMPLE_RATE) : null,
20970
+ pad_end: padAtEnd > 0.0000001 ? "apad=pad_len=" + Math.round(padAtEnd * sampleRate) : null,
20922
20971
  pad_start: padStart === 0 ? null : `adelay=${new Array(channels + 1).fill((padStart * 1000).toFixed(0)).join("|")}`,
20923
20972
  actualTrimLeft
20924
20973
  };
@@ -20939,7 +20988,8 @@ var preprocessAudioTrackUnlimited = async ({
20939
20988
  trimLeftOffset,
20940
20989
  trimRightOffset,
20941
20990
  forSeamlessAacConcatenation,
20942
- audioStreamIndex
20991
+ audioStreamIndex,
20992
+ sampleRate
20943
20993
  }) => {
20944
20994
  const { channels, duration, startTime } = await getAudioChannelsAndDuration({
20945
20995
  downloadMap,
@@ -20962,7 +21012,8 @@ var preprocessAudioTrackUnlimited = async ({
20962
21012
  volume: flattenVolumeArray(asset.volume),
20963
21013
  indent,
20964
21014
  logLevel,
20965
- presentationTimeOffsetInSeconds: startTime ?? 0
21015
+ presentationTimeOffsetInSeconds: startTime ?? 0,
21016
+ sampleRate
20966
21017
  });
20967
21018
  if (filter === null) {
20968
21019
  return null;
@@ -20975,7 +21026,7 @@ var preprocessAudioTrackUnlimited = async ({
20975
21026
  ["-ac", "2"],
20976
21027
  file ? ["-filter_script:a", file] : null,
20977
21028
  ["-c:a", "pcm_s16le"],
20978
- ["-ar", String(DEFAULT_SAMPLE_RATE)],
21029
+ ["-ar", String(sampleRate)],
20979
21030
  ["-y", outName]
20980
21031
  ].flat(2).filter(truthy);
20981
21032
  Log.verbose({ indent, logLevel }, "Preprocessing audio track:", JSON.stringify(args.join(" ")), "Filter:", filter.filter);
@@ -21022,7 +21073,8 @@ var createAudio = async ({
21022
21073
  chunkLengthInSeconds,
21023
21074
  trimLeftOffset,
21024
21075
  trimRightOffset,
21025
- forSeamlessAacConcatenation
21076
+ forSeamlessAacConcatenation,
21077
+ sampleRate
21026
21078
  }) => {
21027
21079
  const fileUrlAssets = await convertAssetsToFileUrls({
21028
21080
  assets,
@@ -21064,7 +21116,8 @@ var createAudio = async ({
21064
21116
  trimLeftOffset,
21065
21117
  trimRightOffset,
21066
21118
  forSeamlessAacConcatenation,
21067
- audioStreamIndex: asset.audioStreamIndex
21119
+ audioStreamIndex: asset.audioStreamIndex,
21120
+ sampleRate
21068
21121
  });
21069
21122
  preprocessProgress[index] = 1;
21070
21123
  updateProgress();
@@ -21074,7 +21127,8 @@ var createAudio = async ({
21074
21127
  indent,
21075
21128
  logLevel,
21076
21129
  binariesDirectory,
21077
- cancelSignal
21130
+ cancelSignal,
21131
+ sampleRate
21078
21132
  });
21079
21133
  const inlinedAudio = downloadMap.inlineAudioMixing.getListOfAssets();
21080
21134
  const preprocessed = [
@@ -21105,7 +21159,8 @@ var createAudio = async ({
21105
21159
  mergeProgress = progress;
21106
21160
  updateProgress();
21107
21161
  },
21108
- chunkLengthInSeconds
21162
+ chunkLengthInSeconds,
21163
+ sampleRate
21109
21164
  });
21110
21165
  await compressAudio({
21111
21166
  audioBitrate,
@@ -21221,7 +21276,8 @@ var innerStitchFramesToVideo = async ({
21221
21276
  binariesDirectory,
21222
21277
  separateAudioTo,
21223
21278
  metadata,
21224
- hardwareAcceleration
21279
+ hardwareAcceleration,
21280
+ sampleRate
21225
21281
  }, remotionRoot) => {
21226
21282
  validateDimension(height, "height", "passed to `stitchFramesToVideo()`");
21227
21283
  validateDimension(width, "width", "passed to `stitchFramesToVideo()`");
@@ -21326,7 +21382,8 @@ var innerStitchFramesToVideo = async ({
21326
21382
  cancelSignal: cancelSignal ?? undefined,
21327
21383
  trimLeftOffset: assetsInfo.trimLeftOffset,
21328
21384
  trimRightOffset: assetsInfo.trimRightOffset,
21329
- forSeamlessAacConcatenation: assetsInfo.forSeamlessAacConcatenation
21385
+ forSeamlessAacConcatenation: assetsInfo.forSeamlessAacConcatenation,
21386
+ sampleRate
21330
21387
  }) : null;
21331
21388
  if (mediaSupport.audio && !mediaSupport.video) {
21332
21389
  if (!resolvedAudioCodec) {
@@ -21496,7 +21553,8 @@ var stitchFramesToVideo = ({
21496
21553
  binariesDirectory,
21497
21554
  separateAudioTo,
21498
21555
  metadata,
21499
- hardwareAcceleration
21556
+ hardwareAcceleration,
21557
+ sampleRate
21500
21558
  }) => {
21501
21559
  return internalStitchFramesToVideo({
21502
21560
  assetsInfo,
@@ -21530,7 +21588,8 @@ var stitchFramesToVideo = ({
21530
21588
  binariesDirectory: binariesDirectory ?? null,
21531
21589
  metadata: metadata ?? null,
21532
21590
  separateAudioTo: separateAudioTo ?? null,
21533
- hardwareAcceleration: hardwareAcceleration ?? "disable"
21591
+ hardwareAcceleration: hardwareAcceleration ?? "disable",
21592
+ sampleRate: sampleRate ?? 48000
21534
21593
  });
21535
21594
  };
21536
21595
 
@@ -21711,7 +21770,8 @@ var internalRenderMediaRaw = ({
21711
21770
  mediaCacheSizeInBytes,
21712
21771
  onLog,
21713
21772
  licenseKey,
21714
- isProduction
21773
+ isProduction,
21774
+ sampleRate
21715
21775
  }) => {
21716
21776
  const pixelFormat = userPixelFormat ?? compositionWithPossibleUnevenDimensions.defaultPixelFormat ?? DEFAULT_PIXEL_FORMAT;
21717
21777
  if (repro) {
@@ -21821,7 +21881,7 @@ var internalRenderMediaRaw = ({
21821
21881
  }
21822
21882
  const imageFormat = isAudioCodec(codec) ? "none" : provisionalImageFormat ?? compositionWithPossibleUnevenDimensions.defaultVideoImageFormat ?? DEFAULT_VIDEO_IMAGE_FORMAT;
21823
21883
  validateSelectedPixelFormatAndImageFormatCombination(pixelFormat, imageFormat);
21824
- const workingDir = fs17.mkdtempSync(path26.join(os8.tmpdir(), "react-motion-render"));
21884
+ const workingDir = fs17.mkdtempSync(path26.join(os9.tmpdir(), "react-motion-render"));
21825
21885
  const preEncodedFileLocation = parallelEncoding ? path26.join(workingDir, "pre-encode." + getFileExtensionFromCodec(codec, audioCodec)) : null;
21826
21886
  if (onCtrlCExit && workingDir) {
21827
21887
  onCtrlCExit(`Delete ${workingDir}`, () => deleteDirectory(workingDir));
@@ -21943,7 +22003,8 @@ var internalRenderMediaRaw = ({
21943
22003
  webpackConfigOrServeUrl: serveUrl,
21944
22004
  offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes ?? null,
21945
22005
  binariesDirectory,
21946
- forceIPv4: false
22006
+ forceIPv4: false,
22007
+ sampleRate
21947
22008
  }, {
21948
22009
  onDownload
21949
22010
  });
@@ -22024,7 +22085,8 @@ var internalRenderMediaRaw = ({
22024
22085
  chromeMode,
22025
22086
  imageSequencePattern: null,
22026
22087
  mediaCacheSizeInBytes,
22027
- onLog
22088
+ onLog,
22089
+ sampleRate
22028
22090
  });
22029
22091
  return renderFramesProc;
22030
22092
  }).then((renderFramesReturn) => {
@@ -22085,7 +22147,8 @@ var internalRenderMediaRaw = ({
22085
22147
  binariesDirectory,
22086
22148
  separateAudioTo,
22087
22149
  metadata,
22088
- hardwareAcceleration
22150
+ hardwareAcceleration,
22151
+ sampleRate
22089
22152
  });
22090
22153
  }).then((buffer) => {
22091
22154
  Log.verbose({ indent, logLevel }, "Stitching done in", encodedDoneIn + "ms");
@@ -22223,6 +22286,7 @@ var renderMedia = ({
22223
22286
  compositionStart,
22224
22287
  mediaCacheSizeInBytes,
22225
22288
  isProduction,
22289
+ sampleRate,
22226
22290
  ...apiKeyOrLicenseKey
22227
22291
  }) => {
22228
22292
  const indent = false;
@@ -22312,7 +22376,8 @@ var renderMedia = ({
22312
22376
  mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
22313
22377
  licenseKey: licenseKey ?? apiKey ?? null,
22314
22378
  onLog: defaultOnLog,
22315
- isProduction: isProduction ?? null
22379
+ isProduction: isProduction ?? null,
22380
+ sampleRate: sampleRate ?? composition.defaultSampleRate ?? 48000
22316
22381
  });
22317
22382
  };
22318
22383
 
@@ -22448,10 +22513,11 @@ var innerRenderStill = async ({
22448
22513
  isMainTab: true,
22449
22514
  mediaCacheSizeInBytes,
22450
22515
  initialMemoryAvailable: getAvailableMemory(logLevel),
22451
- darkMode: chromiumOptions.darkMode ?? false
22516
+ darkMode: chromiumOptions.darkMode ?? false,
22517
+ sampleRate: 48000
22452
22518
  });
22453
22519
  await puppeteerEvaluateWithCatch({
22454
- pageFunction: (id, props, durationInFrames, fps, height, width, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile) => {
22520
+ pageFunction: (id, props, durationInFrames, fps, height, width, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile, defaultSampleRate) => {
22455
22521
  window.remotion_setBundleMode({
22456
22522
  type: "composition",
22457
22523
  compositionName: id,
@@ -22464,7 +22530,8 @@ var innerRenderStill = async ({
22464
22530
  compositionDefaultOutName: defaultOutName,
22465
22531
  compositionDefaultVideoImageFormat: defaultVideoImageFormat,
22466
22532
  compositionDefaultPixelFormat: defaultPixelFormat,
22467
- compositionDefaultProResProfile: defaultProResProfile
22533
+ compositionDefaultProResProfile: defaultProResProfile,
22534
+ compositionDefaultSampleRate: defaultSampleRate
22468
22535
  });
22469
22536
  },
22470
22537
  args: [
@@ -22478,7 +22545,8 @@ var innerRenderStill = async ({
22478
22545
  composition.defaultOutName,
22479
22546
  composition.defaultVideoImageFormat,
22480
22547
  composition.defaultPixelFormat,
22481
- composition.defaultProResProfile
22548
+ composition.defaultProResProfile,
22549
+ composition.defaultSampleRate
22482
22550
  ],
22483
22551
  frame: null,
22484
22552
  page,
@@ -22544,7 +22612,8 @@ var internalRenderStillRaw = (options) => {
22544
22612
  indent: options.indent,
22545
22613
  offthreadVideoCacheSizeInBytes: options.offthreadVideoCacheSizeInBytes,
22546
22614
  binariesDirectory: options.binariesDirectory,
22547
- forceIPv4: false
22615
+ forceIPv4: false,
22616
+ sampleRate: 48000
22548
22617
  }, {
22549
22618
  onDownload: options.onDownload
22550
22619
  }).then(({ server, cleanupServer }) => {
@@ -22720,7 +22789,8 @@ var innerSelectComposition = async ({
22720
22789
  isMainTab: true,
22721
22790
  mediaCacheSizeInBytes,
22722
22791
  initialMemoryAvailable: getAvailableMemory(logLevel),
22723
- darkMode: chromiumOptions.darkMode ?? false
22792
+ darkMode: chromiumOptions.darkMode ?? false,
22793
+ sampleRate: 48000
22724
22794
  });
22725
22795
  await puppeteerEvaluateWithCatch({
22726
22796
  page,
@@ -22770,7 +22840,8 @@ var innerSelectComposition = async ({
22770
22840
  defaultOutName,
22771
22841
  defaultVideoImageFormat,
22772
22842
  defaultPixelFormat,
22773
- defaultProResProfile
22843
+ defaultProResProfile,
22844
+ defaultSampleRate
22774
22845
  } = res;
22775
22846
  return {
22776
22847
  metadata: {
@@ -22785,7 +22856,8 @@ var innerSelectComposition = async ({
22785
22856
  defaultOutName,
22786
22857
  defaultVideoImageFormat,
22787
22858
  defaultPixelFormat,
22788
- defaultProResProfile
22859
+ defaultProResProfile,
22860
+ defaultSampleRate
22789
22861
  },
22790
22862
  propsSize: size
22791
22863
  };
@@ -22836,7 +22908,8 @@ var internalSelectCompositionRaw = async (options) => {
22836
22908
  indent,
22837
22909
  offthreadVideoCacheSizeInBytes,
22838
22910
  binariesDirectory,
22839
- forceIPv4: false
22911
+ forceIPv4: false,
22912
+ sampleRate: 48000
22840
22913
  }, {
22841
22914
  onDownload: () => {
22842
22915
  return;
@@ -23225,7 +23298,8 @@ var internalCombineChunks = async ({
23225
23298
  preferLossless,
23226
23299
  everyNthFrame,
23227
23300
  frameRange,
23228
- compositionDurationInFrames
23301
+ compositionDurationInFrames,
23302
+ sampleRate
23229
23303
  }) => {
23230
23304
  validateNumberOfGifLoops(numberOfGifLoops, codec);
23231
23305
  const filelistDir = tmpDir(REMOTION_FILELIST_TOKEN);
@@ -23274,7 +23348,8 @@ var internalCombineChunks = async ({
23274
23348
  onProgress: (frames) => {
23275
23349
  concatenatedAudio = frames;
23276
23350
  updateProgress();
23277
- }
23351
+ },
23352
+ sampleRate
23278
23353
  }) : null,
23279
23354
  shouldCreateVideo && !seamlessVideo && videoOutput ? combineVideoStreams({
23280
23355
  codec,
@@ -23339,7 +23414,8 @@ var combineChunks = (options) => {
23339
23414
  videoFiles: options.videoFiles,
23340
23415
  everyNthFrame: options.everyNthFrame ?? 1,
23341
23416
  frameRange: options.frameRange ?? null,
23342
- compositionDurationInFrames: options.compositionDurationInFrames
23417
+ compositionDurationInFrames: options.compositionDurationInFrames,
23418
+ sampleRate: options.sampleRate ?? 48000
23343
23419
  });
23344
23420
  };
23345
23421
  // src/extract-audio.ts