@remotion/renderer 4.0.447 → 4.0.448

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 (51) 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 +21 -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 +191 -112
  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/merge-audio-track.d.ts +1 -0
  27. package/dist/merge-audio-track.js +4 -1
  28. package/dist/options/index.d.ts +16 -0
  29. package/dist/options/index.js +2 -0
  30. package/dist/options/options-map.d.ts +64 -0
  31. package/dist/options/options-map.js +5 -0
  32. package/dist/options/sample-rate.d.ts +16 -0
  33. package/dist/options/sample-rate.js +34 -0
  34. package/dist/prepare-server.d.ts +2 -1
  35. package/dist/prepare-server.js +2 -2
  36. package/dist/preprocess-audio-track.d.ts +1 -0
  37. package/dist/preprocess-audio-track.js +3 -3
  38. package/dist/print-useful-error-message.js +4 -0
  39. package/dist/render-frames.d.ts +1 -0
  40. package/dist/render-frames.js +9 -3
  41. package/dist/render-media.d.ts +1 -1
  42. package/dist/render-media.js +7 -3
  43. package/dist/render-still.js +5 -1
  44. package/dist/select-composition.js +4 -1
  45. package/dist/set-props-and-env.d.ts +1 -0
  46. package/dist/set-props-and-env.js +7 -3
  47. package/dist/stitch-frames-to-video.d.ts +3 -1
  48. package/dist/stitch-frames-to-video.js +4 -2
  49. package/dist/stringify-ffmpeg-filter.d.ts +2 -1
  50. package/dist/stringify-ffmpeg-filter.js +4 -5
  51. 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,28 @@ 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 = 22;
4143
+ var MIN_MACOS_DISPLAY_VERSION = "13 (Ventura)";
4144
+ var checkMacOSVersion = (logLevel, indent) => {
4145
+ if (process.platform !== "darwin") {
4146
+ return;
4147
+ }
4148
+ const darwinRelease = os2.release();
4149
+ const majorVersion = Number(darwinRelease.split(".")[0]);
4150
+ if (Number.isNaN(majorVersion)) {
4151
+ return;
4152
+ }
4153
+ if (majorVersion < MIN_DARWIN_VERSION) {
4154
+ Log.warn({ logLevel, indent }, `Your macOS version is older than macOS ${MIN_MACOS_DISPLAY_VERSION}. Some features such as rendering may not work.`);
4155
+ }
4156
+ };
4141
4157
  var checkRuntimeVersion = (logLevel, indent) => {
4142
4158
  if (typeof Bun === "undefined") {
4143
4159
  checkNodeVersion();
4144
4160
  } else {
4145
4161
  checkBunVersion();
4146
4162
  }
4163
+ checkMacOSVersion(logLevel, indent);
4147
4164
  checkLibCRequirement(logLevel, indent);
4148
4165
  };
4149
4166
 
@@ -4735,7 +4752,7 @@ var defaultOnLog = ({ logLevel, tag, previewString }) => {
4735
4752
 
4736
4753
  // src/open-browser.ts
4737
4754
  import fs10 from "node:fs";
4738
- import os5 from "node:os";
4755
+ import os6 from "node:os";
4739
4756
  import path9 from "node:path";
4740
4757
 
4741
4758
  // src/browser/Launcher.ts
@@ -4773,18 +4790,18 @@ import fs8 from "fs";
4773
4790
 
4774
4791
  // src/browser/BrowserFetcher.ts
4775
4792
  import * as fs7 from "node:fs";
4776
- import * as os3 from "node:os";
4793
+ import * as os4 from "node:os";
4777
4794
  import * as path8 from "node:path";
4778
4795
  import { promisify } from "node:util";
4779
4796
  import extractZip from "extract-zip";
4780
4797
 
4781
4798
  // src/browser/get-chrome-download-url.ts
4782
4799
  import * as fs5 from "node:fs";
4783
- import * as os2 from "node:os";
4800
+ import * as os3 from "node:os";
4784
4801
  var TESTED_VERSION = "144.0.7559.20";
4785
4802
  var PLAYWRIGHT_VERSION = "1207";
4786
4803
  var isAmazonLinux2023 = () => {
4787
- if (os2.platform() !== "linux") {
4804
+ if (os3.platform() !== "linux") {
4788
4805
  return false;
4789
4806
  }
4790
4807
  try {
@@ -4922,12 +4939,12 @@ function existsAsync(filePath) {
4922
4939
  });
4923
4940
  }
4924
4941
  var getPlatform = () => {
4925
- const platform3 = os3.platform();
4942
+ const platform3 = os4.platform();
4926
4943
  switch (platform3) {
4927
4944
  case "darwin":
4928
- return os3.arch() === "arm64" ? "mac-arm64" : "mac-x64";
4945
+ return os4.arch() === "arm64" ? "mac-arm64" : "mac-x64";
4929
4946
  case "linux":
4930
- return os3.arch() === "arm64" ? "linux-arm64" : "linux64";
4947
+ return os4.arch() === "arm64" ? "linux-arm64" : "linux64";
4931
4948
  case "win32":
4932
4949
  return "win64";
4933
4950
  default:
@@ -4989,7 +5006,7 @@ var downloadBrowser = async ({
4989
5006
  recursive: true
4990
5007
  });
4991
5008
  }
4992
- if (os3.platform() !== "darwin" && os3.platform() !== "linux" && os3.arch() === "arm64") {
5009
+ if (os4.platform() !== "darwin" && os4.platform() !== "linux" && os4.arch() === "arm64") {
4993
5010
  throw new Error([
4994
5011
  "Chrome Headless Shell is not available for Windows for arm64 architecture."
4995
5012
  ].join(`
@@ -5188,7 +5205,7 @@ var getLocalBrowserExecutable = ({
5188
5205
 
5189
5206
  // src/get-cpu-count.ts
5190
5207
  import { execSync as execSync2 } from "node:child_process";
5191
- import os4 from "node:os";
5208
+ import os5 from "node:os";
5192
5209
  var nprocCount;
5193
5210
  var getConcurrencyFromNProc = () => {
5194
5211
  if (nprocCount !== undefined) {
@@ -5203,10 +5220,10 @@ var getConcurrencyFromNProc = () => {
5203
5220
  }
5204
5221
  };
5205
5222
  var getNodeCpuCount = () => {
5206
- if (typeof os4.availableParallelism === "function") {
5207
- return os4.availableParallelism();
5223
+ if (typeof os5.availableParallelism === "function") {
5224
+ return os5.availableParallelism();
5208
5225
  }
5209
- return os4.cpus().length;
5226
+ return os5.cpus().length;
5210
5227
  };
5211
5228
  var getCpuCount = () => {
5212
5229
  const node = getNodeCpuCount();
@@ -5457,7 +5474,7 @@ var internalOpenBrowser = async ({
5457
5474
  if (chromiumOptions.userAgent) {
5458
5475
  Log.verbose({ indent, logLevel, tag: "openBrowser()" }, `Using custom user agent: ${chromiumOptions.userAgent}`);
5459
5476
  }
5460
- const userDataDir = await fs10.promises.mkdtemp(path9.join(os5.tmpdir(), "puppeteer_dev_chrome_profile-"));
5477
+ const userDataDir = await fs10.promises.mkdtemp(path9.join(os6.tmpdir(), "puppeteer_dev_chrome_profile-"));
5461
5478
  const browserInstance = await launchChrome({
5462
5479
  executablePath,
5463
5480
  logLevel,
@@ -15291,7 +15308,7 @@ class OffthreadVideoServerEmitter {
15291
15308
 
15292
15309
  // src/tmp-dir.ts
15293
15310
  import fs12, { mkdirSync } from "node:fs";
15294
- import os6 from "node:os";
15311
+ import os7 from "node:os";
15295
15312
  import path13 from "node:path";
15296
15313
  var alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
15297
15314
  var randomHash = () => {
@@ -15300,7 +15317,7 @@ var randomHash = () => {
15300
15317
  }).join("");
15301
15318
  };
15302
15319
  var tmpDir = (str) => {
15303
- const newDir = path13.join(os6.tmpdir(), str + randomHash());
15320
+ const newDir = path13.join(os7.tmpdir(), str + randomHash());
15304
15321
  if (fs12.existsSync(newDir)) {
15305
15322
  fs12.rmSync(newDir, {
15306
15323
  recursive: true,
@@ -15315,9 +15332,6 @@ var tmpDir = (str) => {
15315
15332
  import fs13, { writeSync } from "node:fs";
15316
15333
  import path14 from "node:path";
15317
15334
 
15318
- // src/sample-rate.ts
15319
- var DEFAULT_SAMPLE_RATE = 48000;
15320
-
15321
15335
  // src/assets/apply-tone-frequency.ts
15322
15336
  var applyToneFrequencyUsingFfmpeg = async ({
15323
15337
  input,
@@ -15326,9 +15340,10 @@ var applyToneFrequencyUsingFfmpeg = async ({
15326
15340
  indent,
15327
15341
  logLevel,
15328
15342
  binariesDirectory,
15329
- cancelSignal
15343
+ cancelSignal,
15344
+ sampleRate
15330
15345
  }) => {
15331
- const filter = `asetrate=${DEFAULT_SAMPLE_RATE}*${toneFrequency},aresample=${DEFAULT_SAMPLE_RATE},atempo=1/${toneFrequency}`;
15346
+ const filter = `asetrate=${sampleRate}*${toneFrequency},aresample=${sampleRate},atempo=1/${toneFrequency}`;
15332
15347
  const args = [
15333
15348
  "-hide_banner",
15334
15349
  "-i",
@@ -15337,7 +15352,7 @@ var applyToneFrequencyUsingFfmpeg = async ({
15337
15352
  "-filter:a",
15338
15353
  filter,
15339
15354
  ["-c:a", "pcm_s16le"],
15340
- ["-ar", String(DEFAULT_SAMPLE_RATE)],
15355
+ ["-ar", String(sampleRate)],
15341
15356
  "-y",
15342
15357
  output
15343
15358
  ].flat(2);
@@ -15377,7 +15392,7 @@ var correctFloatingPointError = (value) => {
15377
15392
  var BIT_DEPTH = 16;
15378
15393
  var BYTES_PER_SAMPLE = BIT_DEPTH / 8;
15379
15394
  var NUMBER_OF_CHANNELS = 2;
15380
- var makeInlineAudioMixing = (dir) => {
15395
+ var makeInlineAudioMixing = (dir, sampleRate) => {
15381
15396
  const folderToAdd = makeAndReturn(dir, "remotion-inline-audio-mixing");
15382
15397
  const openFiles = {};
15383
15398
  const writtenHeaders = {};
@@ -15411,7 +15426,7 @@ var makeInlineAudioMixing = (dir) => {
15411
15426
  return;
15412
15427
  }
15413
15428
  writtenHeaders[filePath] = true;
15414
- const expectedDataSize = Math.round((totalNumberOfFrames / fps - trimLeftOffset + trimRightOffset) * NUMBER_OF_CHANNELS * DEFAULT_SAMPLE_RATE * BYTES_PER_SAMPLE);
15429
+ const expectedDataSize = Math.round((totalNumberOfFrames / fps - trimLeftOffset + trimRightOffset) * NUMBER_OF_CHANNELS * sampleRate * BYTES_PER_SAMPLE);
15415
15430
  const expectedSize = 40 + expectedDataSize;
15416
15431
  const fd = openFiles[filePath];
15417
15432
  writeSync(fd, new Uint8Array([82, 73, 70, 70]), 0, 4, 0);
@@ -15421,8 +15436,8 @@ var makeInlineAudioMixing = (dir) => {
15421
15436
  writeSync(fd, new Uint8Array([BIT_DEPTH, 0, 0, 0]), 0, 4, 16);
15422
15437
  writeSync(fd, new Uint8Array([1, 0]), 0, 2, 20);
15423
15438
  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);
15439
+ writeSync(fd, new Uint8Array(numberTo32BiIntLittleEndian(sampleRate)), 0, 4, 24);
15440
+ writeSync(fd, new Uint8Array(numberTo32BiIntLittleEndian(sampleRate * NUMBER_OF_CHANNELS * BYTES_PER_SAMPLE)), 0, 4, 28);
15426
15441
  writeSync(fd, new Uint8Array(numberTo16BitLittleEndian(NUMBER_OF_CHANNELS * BYTES_PER_SAMPLE)), 0, 2, 32);
15427
15442
  writeSync(fd, numberTo16BitLittleEndian(BIT_DEPTH), 0, 2, 34);
15428
15443
  writeSync(fd, new Uint8Array([100, 97, 116, 97]), 0, 4, 36);
@@ -15432,7 +15447,8 @@ var makeInlineAudioMixing = (dir) => {
15432
15447
  binariesDirectory,
15433
15448
  indent,
15434
15449
  logLevel,
15435
- cancelSignal
15450
+ cancelSignal,
15451
+ sampleRate: finishSampleRate
15436
15452
  }) => {
15437
15453
  for (const fd of Object.keys(openFiles)) {
15438
15454
  const frequency = toneFrequencies[fd];
@@ -15445,7 +15461,8 @@ var makeInlineAudioMixing = (dir) => {
15445
15461
  indent,
15446
15462
  logLevel,
15447
15463
  binariesDirectory,
15448
- cancelSignal
15464
+ cancelSignal,
15465
+ sampleRate: finishSampleRate
15449
15466
  });
15450
15467
  fs13.renameSync(tmpFile, fd);
15451
15468
  }
@@ -15475,8 +15492,8 @@ var makeInlineAudioMixing = (dir) => {
15475
15492
  let arr = new Int16Array(asset.audio);
15476
15493
  const isFirst = asset.frame === firstFrame;
15477
15494
  const isLast = asset.frame === totalNumberOfFrames + firstFrame - 1;
15478
- const samplesToShaveFromStart = trimLeftOffset * DEFAULT_SAMPLE_RATE;
15479
- const samplesToShaveFromEnd = trimRightOffset * DEFAULT_SAMPLE_RATE;
15495
+ const samplesToShaveFromStart = trimLeftOffset * sampleRate;
15496
+ const samplesToShaveFromEnd = trimRightOffset * sampleRate;
15480
15497
  if (isFirst) {
15481
15498
  arr = arr.slice(Math.floor(correctFloatingPointError(samplesToShaveFromStart)) * NUMBER_OF_CHANNELS);
15482
15499
  }
@@ -15484,7 +15501,7 @@ var makeInlineAudioMixing = (dir) => {
15484
15501
  arr = arr.slice(0, arr.length + Math.ceil(correctFloatingPointError(samplesToShaveFromEnd)) * NUMBER_OF_CHANNELS);
15485
15502
  }
15486
15503
  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;
15504
+ const position = Math.floor(correctFloatingPointError(positionInSeconds * sampleRate)) * NUMBER_OF_CHANNELS * BYTES_PER_SAMPLE;
15488
15505
  writeSync(fileDescriptor, arr, 0, arr.byteLength, 44 + position);
15489
15506
  };
15490
15507
  return {
@@ -15501,7 +15518,7 @@ var makeAndReturn = (dir, name) => {
15501
15518
  mkdirSync2(p);
15502
15519
  return p;
15503
15520
  };
15504
- var makeDownloadMap = () => {
15521
+ var makeDownloadMap = (sampleRate) => {
15505
15522
  const dir = tmpDir(`remotion-v${VERSION2}-assets`);
15506
15523
  let prevented = false;
15507
15524
  return {
@@ -15529,7 +15546,7 @@ var makeDownloadMap = () => {
15529
15546
  isPreventedFromCleanup: () => {
15530
15547
  return prevented;
15531
15548
  },
15532
- inlineAudioMixing: makeInlineAudioMixing(dir),
15549
+ inlineAudioMixing: makeInlineAudioMixing(dir, sampleRate),
15533
15550
  cleanupController: new AbortController
15534
15551
  };
15535
15552
  };
@@ -15742,13 +15759,13 @@ var makeRange = (from, to) => {
15742
15759
  };
15743
15760
 
15744
15761
  // src/port-config.ts
15745
- import os7 from "os";
15762
+ import os8 from "os";
15746
15763
  var cached = null;
15747
15764
  var getPortConfig = (preferIpv4) => {
15748
15765
  if (cached) {
15749
15766
  return cached;
15750
15767
  }
15751
- const networkInterfaces = os7.networkInterfaces();
15768
+ const networkInterfaces = os8.networkInterfaces();
15752
15769
  const flattened = flattenNetworkInterfaces(networkInterfaces);
15753
15770
  const host = getHostToBind(flattened, preferIpv4);
15754
15771
  const hostsToTry = getHostsToTry(flattened);
@@ -16170,9 +16187,10 @@ var prepareServer = async ({
16170
16187
  indent,
16171
16188
  offthreadVideoCacheSizeInBytes,
16172
16189
  binariesDirectory,
16173
- forceIPv4
16190
+ forceIPv4,
16191
+ sampleRate
16174
16192
  }) => {
16175
- const downloadMap = makeDownloadMap();
16193
+ const downloadMap = makeDownloadMap(sampleRate);
16176
16194
  Log.verbose({ indent, logLevel }, "Created directory for temporary files", downloadMap.assetDir);
16177
16195
  if (isServeUrl(webpackConfigOrServeUrl)) {
16178
16196
  const {
@@ -16631,18 +16649,20 @@ var innerSetPropsAndEnv = async ({
16631
16649
  isMainTab,
16632
16650
  mediaCacheSizeInBytes,
16633
16651
  initialMemoryAvailable,
16634
- darkMode
16652
+ darkMode,
16653
+ sampleRate
16635
16654
  }) => {
16636
16655
  validatePuppeteerTimeout(timeoutInMilliseconds);
16637
16656
  const actualTimeout = timeoutInMilliseconds ?? DEFAULT_TIMEOUT;
16638
16657
  page.setDefaultTimeout(actualTimeout);
16639
16658
  page.setDefaultNavigationTimeout(actualTimeout);
16640
16659
  const urlToVisit = normalizeServeUrl(serveUrl);
16641
- await page.evaluateOnNewDocument((timeout, mainTab, cacheSizeInBytes, initMemoryAvailable) => {
16660
+ await page.evaluateOnNewDocument((timeout, mainTab, cacheSizeInBytes, initMemoryAvailable, sRate) => {
16642
16661
  window.remotion_puppeteerTimeout = timeout;
16643
16662
  window.remotion_isMainTab = mainTab;
16644
16663
  window.remotion_mediaCacheSizeInBytes = cacheSizeInBytes;
16645
16664
  window.remotion_initialMemoryAvailable = initMemoryAvailable;
16665
+ window.remotion_sampleRate = sRate;
16646
16666
  if (window.process === undefined) {
16647
16667
  window.process = {};
16648
16668
  }
@@ -16650,7 +16670,7 @@ var innerSetPropsAndEnv = async ({
16650
16670
  window.process.env = {};
16651
16671
  }
16652
16672
  window.process.env.NODE_ENV = "production";
16653
- }, actualTimeout, isMainTab, mediaCacheSizeInBytes, initialMemoryAvailable);
16673
+ }, actualTimeout, isMainTab, mediaCacheSizeInBytes, initialMemoryAvailable, sampleRate);
16654
16674
  await page.evaluateOnNewDocument('window.remotion_broadcastChannel = new BroadcastChannel("remotion-video-frame-extraction")');
16655
16675
  if (envVariables) {
16656
16676
  await page.evaluateOnNewDocument((input) => {
@@ -16707,7 +16727,8 @@ var innerSetPropsAndEnv = async ({
16707
16727
  isMainTab,
16708
16728
  mediaCacheSizeInBytes,
16709
16729
  initialMemoryAvailable,
16710
- darkMode
16730
+ darkMode,
16731
+ sampleRate
16711
16732
  });
16712
16733
  };
16713
16734
  const [pageRes, error] = await gotoPageOrThrow(page, urlToVisit, actualTimeout);
@@ -16912,6 +16933,10 @@ var printUsefulErrorMessage = (err, logLevel, indent) => {
16912
16933
  Log.info({ indent, logLevel }, "\uD83D\uDCA1 Remotion requires at least Libc 2.35.");
16913
16934
  Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue: https://github.com/remotion-dev/remotion/issues/2439");
16914
16935
  }
16936
+ if (err.message.includes("AVCaptureDeviceTypeContinuityCamera")) {
16937
+ Log.info({ indent, logLevel }, "\uD83D\uDCA1 Remotion requires macOS 13 (Ventura) or later.");
16938
+ Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue: https://github.com/remotion-dev/remotion/issues/7027");
16939
+ }
16915
16940
  if (err.message.includes("EBADF")) {
16916
16941
  Log.info({ indent, logLevel }, "\uD83D\uDCA1 This error might be fixed by changing your Node version:");
16917
16942
  Log.info({ indent, logLevel }, " https://github.com/remotion-dev/remotion/issues/2452");
@@ -16981,7 +17006,8 @@ var innerGetCompositions = async ({
16981
17006
  isMainTab: true,
16982
17007
  mediaCacheSizeInBytes,
16983
17008
  initialMemoryAvailable: getAvailableMemory(logLevel),
16984
- darkMode
17009
+ darkMode,
17010
+ sampleRate: 48000
16985
17011
  });
16986
17012
  await puppeteerEvaluateWithCatch({
16987
17013
  page,
@@ -17022,7 +17048,8 @@ var innerGetCompositions = async ({
17022
17048
  defaultOutName,
17023
17049
  defaultVideoImageFormat,
17024
17050
  defaultPixelFormat,
17025
- defaultProResProfile
17051
+ defaultProResProfile,
17052
+ defaultSampleRate
17026
17053
  } = r;
17027
17054
  return {
17028
17055
  id,
@@ -17036,7 +17063,8 @@ var innerGetCompositions = async ({
17036
17063
  defaultOutName,
17037
17064
  defaultVideoImageFormat,
17038
17065
  defaultPixelFormat,
17039
- defaultProResProfile
17066
+ defaultProResProfile,
17067
+ defaultSampleRate
17040
17068
  };
17041
17069
  });
17042
17070
  };
@@ -17091,7 +17119,8 @@ var internalGetCompositionsRaw = async ({
17091
17119
  indent,
17092
17120
  offthreadVideoCacheSizeInBytes,
17093
17121
  binariesDirectory,
17094
- forceIPv4: false
17122
+ forceIPv4: false,
17123
+ sampleRate: 48000
17095
17124
  }, {
17096
17125
  onDownload: () => {
17097
17126
  return;
@@ -17813,17 +17842,18 @@ var parseFfmpegProgress = (input, fps) => {
17813
17842
  };
17814
17843
 
17815
17844
  // src/combine-audio.ts
17816
- var durationOf1Frame = 1024 / DEFAULT_SAMPLE_RATE * 1e6;
17845
+ var durationOf1Frame = (sampleRate) => 1024 / sampleRate * 1e6;
17817
17846
  var roundWithFix = (targetTime) => {
17818
17847
  if (targetTime % 1 > 0.4999999) {
17819
17848
  return Math.ceil(targetTime);
17820
17849
  }
17821
17850
  return Math.floor(targetTime);
17822
17851
  };
17823
- var getClosestAlignedTime = (targetTime) => {
17824
- const decimalFramesToTargetTime = targetTime * 1e6 / durationOf1Frame;
17852
+ var getClosestAlignedTime = (targetTime, sampleRate) => {
17853
+ const dur = durationOf1Frame(sampleRate);
17854
+ const decimalFramesToTargetTime = targetTime * 1e6 / dur;
17825
17855
  const nearestFrameIndexForTargetTime = roundWithFix(decimalFramesToTargetTime);
17826
- return nearestFrameIndexForTargetTime * durationOf1Frame / 1e6;
17856
+ return nearestFrameIndexForTargetTime * dur / 1e6;
17827
17857
  };
17828
17858
  var encodeAudio = async ({
17829
17859
  files,
@@ -17903,21 +17933,22 @@ var combineAudioSeamlessly = async ({
17903
17933
  fps,
17904
17934
  binariesDirectory,
17905
17935
  cancelSignal,
17906
- onProgress
17936
+ onProgress,
17937
+ sampleRate
17907
17938
  }) => {
17908
17939
  const startConcatenating = Date.now();
17909
17940
  const fileList = files.map((p, i) => {
17910
17941
  const isLast = i === files.length - 1;
17911
17942
  const targetStart = i * chunkDurationInSeconds;
17912
17943
  const endStart = (i + 1) * chunkDurationInSeconds;
17913
- const startTime = getClosestAlignedTime(targetStart) * 1e6;
17914
- const endTime = getClosestAlignedTime(endStart) * 1e6;
17944
+ const startTime = getClosestAlignedTime(targetStart, sampleRate) * 1e6;
17945
+ const endTime = getClosestAlignedTime(endStart, sampleRate) * 1e6;
17915
17946
  const realDuration = endTime - startTime;
17916
17947
  let inpoint = 0;
17917
17948
  if (i > 0) {
17918
- inpoint = durationOf1Frame * 4;
17949
+ inpoint = durationOf1Frame(sampleRate) * 4;
17919
17950
  }
17920
- const outpoint = (i === 0 ? durationOf1Frame * 2 : inpoint) + realDuration - (isLast ? 0 : durationOf1Frame);
17951
+ const outpoint = (i === 0 ? durationOf1Frame(sampleRate) * 2 : inpoint) + realDuration - (isLast ? 0 : durationOf1Frame(sampleRate));
17921
17952
  return [`file '${p}'`, `inpoint ${inpoint}us`, `outpoint ${outpoint}us`].filter(truthy).join(`
17922
17953
  `);
17923
17954
  }).join(`
@@ -17981,7 +18012,8 @@ var createCombinedAudio = ({
17981
18012
  binariesDirectory,
17982
18013
  fps,
17983
18014
  cancelSignal,
17984
- onProgress
18015
+ onProgress,
18016
+ sampleRate
17985
18017
  }) => {
17986
18018
  if (seamless) {
17987
18019
  return combineAudioSeamlessly({
@@ -17995,7 +18027,8 @@ var createCombinedAudio = ({
17995
18027
  binariesDirectory,
17996
18028
  fps,
17997
18029
  cancelSignal,
17998
- onProgress
18030
+ onProgress,
18031
+ sampleRate
17999
18032
  });
18000
18033
  }
18001
18034
  return encodeAudio({
@@ -18019,7 +18052,8 @@ var getExtraFramesToCapture = ({
18019
18052
  compositionStart,
18020
18053
  realFrameRange,
18021
18054
  fps,
18022
- forSeamlessAacConcatenation
18055
+ forSeamlessAacConcatenation,
18056
+ sampleRate
18023
18057
  }) => {
18024
18058
  if (!forSeamlessAacConcatenation) {
18025
18059
  return {
@@ -18039,8 +18073,8 @@ var getExtraFramesToCapture = ({
18039
18073
  throw new Error("chunkStat - compositionStart may not be below 0");
18040
18074
  }
18041
18075
  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);
18076
+ const aacAdjustedLeftEnd = Math.max(0, getClosestAlignedTime(realLeftEnd / fps, sampleRate) - 2 * (1024 / sampleRate));
18077
+ const aacAdjustedRightEnd = getClosestAlignedTime(realRightEnd / fps, sampleRate) + 2 * (1024 / sampleRate);
18044
18078
  const alignedStartFrameWithoutOffset = Math.floor(aacAdjustedLeftEnd * fps);
18045
18079
  const alignedStartFrame = alignedStartFrameWithoutOffset + compositionStart;
18046
18080
  const alignedEndFrame = Math.ceil(aacAdjustedRightEnd * fps) + compositionStart;
@@ -18165,7 +18199,8 @@ var makePage = async ({
18165
18199
  isMainTab,
18166
18200
  mediaCacheSizeInBytes,
18167
18201
  onLog,
18168
- darkMode
18202
+ darkMode,
18203
+ sampleRate
18169
18204
  }) => {
18170
18205
  const page = await browserReplacer.getBrowser().newPage({ context, logLevel, indent, pageIndex, onBrowserLog, onLog });
18171
18206
  pagesArray.push(page);
@@ -18193,10 +18228,11 @@ var makePage = async ({
18193
18228
  isMainTab,
18194
18229
  mediaCacheSizeInBytes,
18195
18230
  initialMemoryAvailable: getAvailableMemory(logLevel),
18196
- darkMode
18231
+ darkMode,
18232
+ sampleRate
18197
18233
  });
18198
18234
  await puppeteerEvaluateWithCatch({
18199
- pageFunction: (id, props, durationInFrames, fps, height, width, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile) => {
18235
+ pageFunction: (id, props, durationInFrames, fps, height, width, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile, defaultSampleRate) => {
18200
18236
  window.remotion_setBundleMode({
18201
18237
  type: "composition",
18202
18238
  compositionName: id,
@@ -18209,7 +18245,8 @@ var makePage = async ({
18209
18245
  compositionDefaultOutName: defaultOutName,
18210
18246
  compositionDefaultVideoImageFormat: defaultVideoImageFormat,
18211
18247
  compositionDefaultPixelFormat: defaultPixelFormat,
18212
- compositionDefaultProResProfile: defaultProResProfile
18248
+ compositionDefaultProResProfile: defaultProResProfile,
18249
+ compositionDefaultSampleRate: defaultSampleRate
18213
18250
  });
18214
18251
  },
18215
18252
  args: [
@@ -18223,7 +18260,8 @@ var makePage = async ({
18223
18260
  composition.defaultOutName,
18224
18261
  composition.defaultVideoImageFormat,
18225
18262
  composition.defaultPixelFormat,
18226
- composition.defaultProResProfile
18263
+ composition.defaultProResProfile,
18264
+ composition.defaultSampleRate
18227
18265
  ],
18228
18266
  frame: null,
18229
18267
  page,
@@ -19152,7 +19190,8 @@ var innerRenderFrames = async ({
19152
19190
  imageSequencePattern,
19153
19191
  mediaCacheSizeInBytes,
19154
19192
  onLog,
19155
- darkMode
19193
+ darkMode,
19194
+ sampleRate
19156
19195
  }) => {
19157
19196
  if (outputDir) {
19158
19197
  if (!fs15.existsSync(outputDir)) {
@@ -19173,7 +19212,8 @@ var innerRenderFrames = async ({
19173
19212
  fps: composition.fps,
19174
19213
  compositionStart,
19175
19214
  realFrameRange,
19176
- forSeamlessAacConcatenation
19215
+ forSeamlessAacConcatenation,
19216
+ sampleRate
19177
19217
  });
19178
19218
  const framesToRender = getFramesToRender(realFrameRange, everyNthFrame);
19179
19219
  const lastFrame = framesToRender[framesToRender.length - 1];
@@ -19201,7 +19241,8 @@ var innerRenderFrames = async ({
19201
19241
  isMainTab: pageIndex === 0,
19202
19242
  mediaCacheSizeInBytes,
19203
19243
  onLog,
19204
- darkMode
19244
+ darkMode,
19245
+ sampleRate
19205
19246
  });
19206
19247
  };
19207
19248
  const getPool = async () => {
@@ -19345,7 +19386,8 @@ var internalRenderFramesRaw = ({
19345
19386
  offthreadVideoThreads,
19346
19387
  imageSequencePattern,
19347
19388
  mediaCacheSizeInBytes,
19348
- onLog
19389
+ onLog,
19390
+ sampleRate
19349
19391
  }) => {
19350
19392
  validateDimension(composition.height, "height", "in the `config` object passed to `renderFrames()`");
19351
19393
  validateDimension(composition.width, "width", "in the `config` object passed to `renderFrames()`");
@@ -19391,7 +19433,8 @@ var internalRenderFramesRaw = ({
19391
19433
  indent,
19392
19434
  offthreadVideoCacheSizeInBytes,
19393
19435
  binariesDirectory,
19394
- forceIPv4: false
19436
+ forceIPv4: false,
19437
+ sampleRate
19395
19438
  }, {
19396
19439
  onDownload
19397
19440
  }),
@@ -19451,7 +19494,8 @@ var internalRenderFramesRaw = ({
19451
19494
  imageSequencePattern,
19452
19495
  mediaCacheSizeInBytes,
19453
19496
  onLog,
19454
- darkMode: chromiumOptions.darkMode ?? false
19497
+ darkMode: chromiumOptions.darkMode ?? false,
19498
+ sampleRate
19455
19499
  });
19456
19500
  })
19457
19501
  ]).then((res) => {
@@ -19521,7 +19565,8 @@ var renderFrames = (options) => {
19521
19565
  chromeMode,
19522
19566
  offthreadVideoThreads,
19523
19567
  imageSequencePattern,
19524
- mediaCacheSizeInBytes
19568
+ mediaCacheSizeInBytes,
19569
+ sampleRate
19525
19570
  } = options;
19526
19571
  if (!composition) {
19527
19572
  throw new Error("No `composition` option has been specified for renderFrames()");
@@ -19581,13 +19626,14 @@ var renderFrames = (options) => {
19581
19626
  offthreadVideoThreads: offthreadVideoThreads ?? null,
19582
19627
  imageSequencePattern: imageSequencePattern ?? null,
19583
19628
  mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
19584
- onLog: defaultOnLog
19629
+ onLog: defaultOnLog,
19630
+ sampleRate: sampleRate ?? composition.defaultSampleRate ?? 48000
19585
19631
  });
19586
19632
  };
19587
19633
 
19588
19634
  // src/render-media.ts
19589
19635
  import fs17 from "node:fs";
19590
- import os8 from "node:os";
19636
+ import os9 from "node:os";
19591
19637
  import path26 from "node:path";
19592
19638
  import { LicensingInternals } from "@remotion/licensing";
19593
19639
  import { NoReactInternals as NoReactInternals15 } from "remotion/no-react";
@@ -20528,7 +20574,8 @@ var createSilentAudio = async ({
20528
20574
  logLevel,
20529
20575
  binariesDirectory,
20530
20576
  cancelSignal,
20531
- chunkLengthInSeconds
20577
+ chunkLengthInSeconds,
20578
+ sampleRate
20532
20579
  }) => {
20533
20580
  await callFf({
20534
20581
  bin: "ffmpeg",
@@ -20536,13 +20583,13 @@ var createSilentAudio = async ({
20536
20583
  "-f",
20537
20584
  "lavfi",
20538
20585
  "-i",
20539
- `anullsrc=r=${DEFAULT_SAMPLE_RATE}`,
20586
+ `anullsrc=r=${sampleRate}`,
20540
20587
  "-c:a",
20541
20588
  "pcm_s16le",
20542
20589
  "-t",
20543
20590
  String(chunkLengthInSeconds),
20544
20591
  "-ar",
20545
- String(DEFAULT_SAMPLE_RATE),
20592
+ String(sampleRate),
20546
20593
  outName
20547
20594
  ],
20548
20595
  indent,
@@ -20564,7 +20611,8 @@ var mergeAudioTrackUnlimited = async ({
20564
20611
  cancelSignal,
20565
20612
  onProgress,
20566
20613
  fps,
20567
- chunkLengthInSeconds
20614
+ chunkLengthInSeconds,
20615
+ sampleRate
20568
20616
  }) => {
20569
20617
  if (files.length === 0) {
20570
20618
  await createSilentAudio({
@@ -20573,7 +20621,8 @@ var mergeAudioTrackUnlimited = async ({
20573
20621
  indent,
20574
20622
  logLevel,
20575
20623
  binariesDirectory,
20576
- cancelSignal
20624
+ cancelSignal,
20625
+ sampleRate
20577
20626
  });
20578
20627
  onProgress(1);
20579
20628
  return;
@@ -20605,7 +20654,8 @@ var mergeAudioTrackUnlimited = async ({
20605
20654
  partialProgress[i] = progress;
20606
20655
  callProgress();
20607
20656
  },
20608
- fps
20657
+ fps,
20658
+ sampleRate
20609
20659
  });
20610
20660
  return chunkOutname;
20611
20661
  }));
@@ -20629,7 +20679,8 @@ var mergeAudioTrackUnlimited = async ({
20629
20679
  callProgress();
20630
20680
  },
20631
20681
  fps,
20632
- chunkLengthInSeconds
20682
+ chunkLengthInSeconds,
20683
+ sampleRate
20633
20684
  });
20634
20685
  return;
20635
20686
  } finally {
@@ -20869,7 +20920,8 @@ var stringifyFfmpegFilter = ({
20869
20920
  asset,
20870
20921
  indent,
20871
20922
  logLevel,
20872
- presentationTimeOffsetInSeconds
20923
+ presentationTimeOffsetInSeconds,
20924
+ sampleRate
20873
20925
  }) => {
20874
20926
  if (channels === 0) {
20875
20927
  return null;
@@ -20913,12 +20965,12 @@ var stringifyFfmpegFilter = ({
20913
20965
  const padStart = startInVideoSeconds + (asset.trimLeft === 0 ? presentationTimeOffsetInSeconds : 0);
20914
20966
  return {
20915
20967
  filter: "[0:a]" + [
20916
- `aformat=sample_fmts=s16:sample_rates=${DEFAULT_SAMPLE_RATE}`,
20968
+ `aformat=sample_fmts=s16:sample_rates=${sampleRate}`,
20917
20969
  ...trimAndTempoFilter,
20918
20970
  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
20971
+ toneFrequency && toneFrequency !== 1 ? `asetrate=${sampleRate}*${toneFrequency},aresample=${sampleRate},atempo=1/${toneFrequency}` : null
20920
20972
  ].filter(truthy).join(",") + `[a0]`,
20921
- pad_end: padAtEnd > 0.0000001 ? "apad=pad_len=" + Math.round(padAtEnd * DEFAULT_SAMPLE_RATE) : null,
20973
+ pad_end: padAtEnd > 0.0000001 ? "apad=pad_len=" + Math.round(padAtEnd * sampleRate) : null,
20922
20974
  pad_start: padStart === 0 ? null : `adelay=${new Array(channels + 1).fill((padStart * 1000).toFixed(0)).join("|")}`,
20923
20975
  actualTrimLeft
20924
20976
  };
@@ -20939,7 +20991,8 @@ var preprocessAudioTrackUnlimited = async ({
20939
20991
  trimLeftOffset,
20940
20992
  trimRightOffset,
20941
20993
  forSeamlessAacConcatenation,
20942
- audioStreamIndex
20994
+ audioStreamIndex,
20995
+ sampleRate
20943
20996
  }) => {
20944
20997
  const { channels, duration, startTime } = await getAudioChannelsAndDuration({
20945
20998
  downloadMap,
@@ -20962,7 +21015,8 @@ var preprocessAudioTrackUnlimited = async ({
20962
21015
  volume: flattenVolumeArray(asset.volume),
20963
21016
  indent,
20964
21017
  logLevel,
20965
- presentationTimeOffsetInSeconds: startTime ?? 0
21018
+ presentationTimeOffsetInSeconds: startTime ?? 0,
21019
+ sampleRate
20966
21020
  });
20967
21021
  if (filter === null) {
20968
21022
  return null;
@@ -20975,7 +21029,7 @@ var preprocessAudioTrackUnlimited = async ({
20975
21029
  ["-ac", "2"],
20976
21030
  file ? ["-filter_script:a", file] : null,
20977
21031
  ["-c:a", "pcm_s16le"],
20978
- ["-ar", String(DEFAULT_SAMPLE_RATE)],
21032
+ ["-ar", String(sampleRate)],
20979
21033
  ["-y", outName]
20980
21034
  ].flat(2).filter(truthy);
20981
21035
  Log.verbose({ indent, logLevel }, "Preprocessing audio track:", JSON.stringify(args.join(" ")), "Filter:", filter.filter);
@@ -21022,7 +21076,8 @@ var createAudio = async ({
21022
21076
  chunkLengthInSeconds,
21023
21077
  trimLeftOffset,
21024
21078
  trimRightOffset,
21025
- forSeamlessAacConcatenation
21079
+ forSeamlessAacConcatenation,
21080
+ sampleRate
21026
21081
  }) => {
21027
21082
  const fileUrlAssets = await convertAssetsToFileUrls({
21028
21083
  assets,
@@ -21064,7 +21119,8 @@ var createAudio = async ({
21064
21119
  trimLeftOffset,
21065
21120
  trimRightOffset,
21066
21121
  forSeamlessAacConcatenation,
21067
- audioStreamIndex: asset.audioStreamIndex
21122
+ audioStreamIndex: asset.audioStreamIndex,
21123
+ sampleRate
21068
21124
  });
21069
21125
  preprocessProgress[index] = 1;
21070
21126
  updateProgress();
@@ -21074,7 +21130,8 @@ var createAudio = async ({
21074
21130
  indent,
21075
21131
  logLevel,
21076
21132
  binariesDirectory,
21077
- cancelSignal
21133
+ cancelSignal,
21134
+ sampleRate
21078
21135
  });
21079
21136
  const inlinedAudio = downloadMap.inlineAudioMixing.getListOfAssets();
21080
21137
  const preprocessed = [
@@ -21105,7 +21162,8 @@ var createAudio = async ({
21105
21162
  mergeProgress = progress;
21106
21163
  updateProgress();
21107
21164
  },
21108
- chunkLengthInSeconds
21165
+ chunkLengthInSeconds,
21166
+ sampleRate
21109
21167
  });
21110
21168
  await compressAudio({
21111
21169
  audioBitrate,
@@ -21221,7 +21279,8 @@ var innerStitchFramesToVideo = async ({
21221
21279
  binariesDirectory,
21222
21280
  separateAudioTo,
21223
21281
  metadata,
21224
- hardwareAcceleration
21282
+ hardwareAcceleration,
21283
+ sampleRate
21225
21284
  }, remotionRoot) => {
21226
21285
  validateDimension(height, "height", "passed to `stitchFramesToVideo()`");
21227
21286
  validateDimension(width, "width", "passed to `stitchFramesToVideo()`");
@@ -21326,7 +21385,8 @@ var innerStitchFramesToVideo = async ({
21326
21385
  cancelSignal: cancelSignal ?? undefined,
21327
21386
  trimLeftOffset: assetsInfo.trimLeftOffset,
21328
21387
  trimRightOffset: assetsInfo.trimRightOffset,
21329
- forSeamlessAacConcatenation: assetsInfo.forSeamlessAacConcatenation
21388
+ forSeamlessAacConcatenation: assetsInfo.forSeamlessAacConcatenation,
21389
+ sampleRate
21330
21390
  }) : null;
21331
21391
  if (mediaSupport.audio && !mediaSupport.video) {
21332
21392
  if (!resolvedAudioCodec) {
@@ -21496,7 +21556,8 @@ var stitchFramesToVideo = ({
21496
21556
  binariesDirectory,
21497
21557
  separateAudioTo,
21498
21558
  metadata,
21499
- hardwareAcceleration
21559
+ hardwareAcceleration,
21560
+ sampleRate
21500
21561
  }) => {
21501
21562
  return internalStitchFramesToVideo({
21502
21563
  assetsInfo,
@@ -21530,7 +21591,8 @@ var stitchFramesToVideo = ({
21530
21591
  binariesDirectory: binariesDirectory ?? null,
21531
21592
  metadata: metadata ?? null,
21532
21593
  separateAudioTo: separateAudioTo ?? null,
21533
- hardwareAcceleration: hardwareAcceleration ?? "disable"
21594
+ hardwareAcceleration: hardwareAcceleration ?? "disable",
21595
+ sampleRate: sampleRate ?? 48000
21534
21596
  });
21535
21597
  };
21536
21598
 
@@ -21711,7 +21773,8 @@ var internalRenderMediaRaw = ({
21711
21773
  mediaCacheSizeInBytes,
21712
21774
  onLog,
21713
21775
  licenseKey,
21714
- isProduction
21776
+ isProduction,
21777
+ sampleRate
21715
21778
  }) => {
21716
21779
  const pixelFormat = userPixelFormat ?? compositionWithPossibleUnevenDimensions.defaultPixelFormat ?? DEFAULT_PIXEL_FORMAT;
21717
21780
  if (repro) {
@@ -21821,7 +21884,7 @@ var internalRenderMediaRaw = ({
21821
21884
  }
21822
21885
  const imageFormat = isAudioCodec(codec) ? "none" : provisionalImageFormat ?? compositionWithPossibleUnevenDimensions.defaultVideoImageFormat ?? DEFAULT_VIDEO_IMAGE_FORMAT;
21823
21886
  validateSelectedPixelFormatAndImageFormatCombination(pixelFormat, imageFormat);
21824
- const workingDir = fs17.mkdtempSync(path26.join(os8.tmpdir(), "react-motion-render"));
21887
+ const workingDir = fs17.mkdtempSync(path26.join(os9.tmpdir(), "react-motion-render"));
21825
21888
  const preEncodedFileLocation = parallelEncoding ? path26.join(workingDir, "pre-encode." + getFileExtensionFromCodec(codec, audioCodec)) : null;
21826
21889
  if (onCtrlCExit && workingDir) {
21827
21890
  onCtrlCExit(`Delete ${workingDir}`, () => deleteDirectory(workingDir));
@@ -21943,7 +22006,8 @@ var internalRenderMediaRaw = ({
21943
22006
  webpackConfigOrServeUrl: serveUrl,
21944
22007
  offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes ?? null,
21945
22008
  binariesDirectory,
21946
- forceIPv4: false
22009
+ forceIPv4: false,
22010
+ sampleRate
21947
22011
  }, {
21948
22012
  onDownload
21949
22013
  });
@@ -22024,7 +22088,8 @@ var internalRenderMediaRaw = ({
22024
22088
  chromeMode,
22025
22089
  imageSequencePattern: null,
22026
22090
  mediaCacheSizeInBytes,
22027
- onLog
22091
+ onLog,
22092
+ sampleRate
22028
22093
  });
22029
22094
  return renderFramesProc;
22030
22095
  }).then((renderFramesReturn) => {
@@ -22085,7 +22150,8 @@ var internalRenderMediaRaw = ({
22085
22150
  binariesDirectory,
22086
22151
  separateAudioTo,
22087
22152
  metadata,
22088
- hardwareAcceleration
22153
+ hardwareAcceleration,
22154
+ sampleRate
22089
22155
  });
22090
22156
  }).then((buffer) => {
22091
22157
  Log.verbose({ indent, logLevel }, "Stitching done in", encodedDoneIn + "ms");
@@ -22223,6 +22289,7 @@ var renderMedia = ({
22223
22289
  compositionStart,
22224
22290
  mediaCacheSizeInBytes,
22225
22291
  isProduction,
22292
+ sampleRate,
22226
22293
  ...apiKeyOrLicenseKey
22227
22294
  }) => {
22228
22295
  const indent = false;
@@ -22312,7 +22379,8 @@ var renderMedia = ({
22312
22379
  mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null,
22313
22380
  licenseKey: licenseKey ?? apiKey ?? null,
22314
22381
  onLog: defaultOnLog,
22315
- isProduction: isProduction ?? null
22382
+ isProduction: isProduction ?? null,
22383
+ sampleRate: sampleRate ?? composition.defaultSampleRate ?? 48000
22316
22384
  });
22317
22385
  };
22318
22386
 
@@ -22448,10 +22516,11 @@ var innerRenderStill = async ({
22448
22516
  isMainTab: true,
22449
22517
  mediaCacheSizeInBytes,
22450
22518
  initialMemoryAvailable: getAvailableMemory(logLevel),
22451
- darkMode: chromiumOptions.darkMode ?? false
22519
+ darkMode: chromiumOptions.darkMode ?? false,
22520
+ sampleRate: 48000
22452
22521
  });
22453
22522
  await puppeteerEvaluateWithCatch({
22454
- pageFunction: (id, props, durationInFrames, fps, height, width, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile) => {
22523
+ pageFunction: (id, props, durationInFrames, fps, height, width, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat, defaultProResProfile, defaultSampleRate) => {
22455
22524
  window.remotion_setBundleMode({
22456
22525
  type: "composition",
22457
22526
  compositionName: id,
@@ -22464,7 +22533,8 @@ var innerRenderStill = async ({
22464
22533
  compositionDefaultOutName: defaultOutName,
22465
22534
  compositionDefaultVideoImageFormat: defaultVideoImageFormat,
22466
22535
  compositionDefaultPixelFormat: defaultPixelFormat,
22467
- compositionDefaultProResProfile: defaultProResProfile
22536
+ compositionDefaultProResProfile: defaultProResProfile,
22537
+ compositionDefaultSampleRate: defaultSampleRate
22468
22538
  });
22469
22539
  },
22470
22540
  args: [
@@ -22478,7 +22548,8 @@ var innerRenderStill = async ({
22478
22548
  composition.defaultOutName,
22479
22549
  composition.defaultVideoImageFormat,
22480
22550
  composition.defaultPixelFormat,
22481
- composition.defaultProResProfile
22551
+ composition.defaultProResProfile,
22552
+ composition.defaultSampleRate
22482
22553
  ],
22483
22554
  frame: null,
22484
22555
  page,
@@ -22544,7 +22615,8 @@ var internalRenderStillRaw = (options) => {
22544
22615
  indent: options.indent,
22545
22616
  offthreadVideoCacheSizeInBytes: options.offthreadVideoCacheSizeInBytes,
22546
22617
  binariesDirectory: options.binariesDirectory,
22547
- forceIPv4: false
22618
+ forceIPv4: false,
22619
+ sampleRate: 48000
22548
22620
  }, {
22549
22621
  onDownload: options.onDownload
22550
22622
  }).then(({ server, cleanupServer }) => {
@@ -22720,7 +22792,8 @@ var innerSelectComposition = async ({
22720
22792
  isMainTab: true,
22721
22793
  mediaCacheSizeInBytes,
22722
22794
  initialMemoryAvailable: getAvailableMemory(logLevel),
22723
- darkMode: chromiumOptions.darkMode ?? false
22795
+ darkMode: chromiumOptions.darkMode ?? false,
22796
+ sampleRate: 48000
22724
22797
  });
22725
22798
  await puppeteerEvaluateWithCatch({
22726
22799
  page,
@@ -22770,7 +22843,8 @@ var innerSelectComposition = async ({
22770
22843
  defaultOutName,
22771
22844
  defaultVideoImageFormat,
22772
22845
  defaultPixelFormat,
22773
- defaultProResProfile
22846
+ defaultProResProfile,
22847
+ defaultSampleRate
22774
22848
  } = res;
22775
22849
  return {
22776
22850
  metadata: {
@@ -22785,7 +22859,8 @@ var innerSelectComposition = async ({
22785
22859
  defaultOutName,
22786
22860
  defaultVideoImageFormat,
22787
22861
  defaultPixelFormat,
22788
- defaultProResProfile
22862
+ defaultProResProfile,
22863
+ defaultSampleRate
22789
22864
  },
22790
22865
  propsSize: size
22791
22866
  };
@@ -22836,7 +22911,8 @@ var internalSelectCompositionRaw = async (options) => {
22836
22911
  indent,
22837
22912
  offthreadVideoCacheSizeInBytes,
22838
22913
  binariesDirectory,
22839
- forceIPv4: false
22914
+ forceIPv4: false,
22915
+ sampleRate: 48000
22840
22916
  }, {
22841
22917
  onDownload: () => {
22842
22918
  return;
@@ -23225,7 +23301,8 @@ var internalCombineChunks = async ({
23225
23301
  preferLossless,
23226
23302
  everyNthFrame,
23227
23303
  frameRange,
23228
- compositionDurationInFrames
23304
+ compositionDurationInFrames,
23305
+ sampleRate
23229
23306
  }) => {
23230
23307
  validateNumberOfGifLoops(numberOfGifLoops, codec);
23231
23308
  const filelistDir = tmpDir(REMOTION_FILELIST_TOKEN);
@@ -23274,7 +23351,8 @@ var internalCombineChunks = async ({
23274
23351
  onProgress: (frames) => {
23275
23352
  concatenatedAudio = frames;
23276
23353
  updateProgress();
23277
- }
23354
+ },
23355
+ sampleRate
23278
23356
  }) : null,
23279
23357
  shouldCreateVideo && !seamlessVideo && videoOutput ? combineVideoStreams({
23280
23358
  codec,
@@ -23339,7 +23417,8 @@ var combineChunks = (options) => {
23339
23417
  videoFiles: options.videoFiles,
23340
23418
  everyNthFrame: options.everyNthFrame ?? 1,
23341
23419
  frameRange: options.frameRange ?? null,
23342
- compositionDurationInFrames: options.compositionDurationInFrames
23420
+ compositionDurationInFrames: options.compositionDurationInFrames,
23421
+ sampleRate: options.sampleRate ?? 48000
23343
23422
  });
23344
23423
  };
23345
23424
  // src/extract-audio.ts