@remotion/renderer 4.0.121 → 4.0.123

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 (85) hide show
  1. package/dist/assets/get-audio-channels.d.ts +10 -2
  2. package/dist/assets/get-audio-channels.js +12 -4
  3. package/dist/calculate-ffmpeg-filters.d.ts +2 -1
  4. package/dist/calculate-ffmpeg-filters.js +14 -3
  5. package/dist/call-ffmpeg.d.ts +5 -2
  6. package/dist/call-ffmpeg.js +15 -11
  7. package/dist/can-use-parallel-encoding.js +2 -2
  8. package/dist/check-apple-silicon.d.ts +1 -3
  9. package/dist/check-apple-silicon.js +2 -32
  10. package/dist/client.d.ts +295 -69
  11. package/dist/client.js +3 -3
  12. package/dist/codec-supports-media.js +5 -0
  13. package/dist/codec.d.ts +1 -1
  14. package/dist/codec.js +1 -0
  15. package/dist/combine-audio.d.ts +1 -1
  16. package/dist/combine-audio.js +1 -1
  17. package/dist/combine-videos.d.ts +8 -3
  18. package/dist/combine-videos.js +85 -61
  19. package/dist/compositor/compose.js +2 -4
  20. package/dist/compositor/compositor.js +2 -4
  21. package/dist/compositor/make-file-executable.d.ts +1 -0
  22. package/dist/compositor/make-file-executable.js +14 -0
  23. package/dist/compress-audio.d.ts +5 -2
  24. package/dist/compress-audio.js +22 -3
  25. package/dist/create-audio.d.ts +3 -2
  26. package/dist/create-audio.js +28 -5
  27. package/dist/create-silent-audio.d.ts +3 -1
  28. package/dist/create-silent-audio.js +2 -1
  29. package/dist/crf.js +7 -7
  30. package/dist/does-have-m2-bug.d.ts +3 -0
  31. package/dist/does-have-m2-bug.js +12 -0
  32. package/dist/ffmpeg-args.js +1 -0
  33. package/dist/file-extensions.d.ts +2 -2
  34. package/dist/file-extensions.js +7 -0
  35. package/dist/get-codec-name.js +3 -3
  36. package/dist/get-extension-from-codec.d.ts +3 -3
  37. package/dist/get-extension-from-codec.js +1 -0
  38. package/dist/get-silent-parts.d.ts +1 -1
  39. package/dist/guess-extension-for-media.d.ts +3 -1
  40. package/dist/guess-extension-for-media.js +2 -1
  41. package/dist/index.d.ts +64 -37
  42. package/dist/index.js +6 -4
  43. package/dist/merge-audio-track.d.ts +5 -1
  44. package/dist/merge-audio-track.js +40 -3
  45. package/dist/options/audio-codec.d.ts +55 -0
  46. package/dist/options/audio-codec.js +190 -0
  47. package/dist/options/enforce-audio.d.ts +4 -1
  48. package/dist/options/enforce-audio.js +3 -3
  49. package/dist/options/for-seamless-aac-concatenation.d.ts +19 -0
  50. package/dist/options/for-seamless-aac-concatenation.js +40 -0
  51. package/dist/options/index.d.ts +88 -13
  52. package/dist/options/index.js +8 -0
  53. package/dist/options/log-level.d.ts +2 -2
  54. package/dist/options/options-map.d.ts +176 -45
  55. package/dist/options/options-map.js +13 -0
  56. package/dist/options/prores-profile.d.ts +0 -0
  57. package/dist/options/prores-profile.js +1 -0
  58. package/dist/options/separate-audio.d.ts +18 -0
  59. package/dist/options/separate-audio.js +28 -0
  60. package/dist/options/video-codec.d.ts +1 -1
  61. package/dist/options/webhook-custom-data.d.ts +1 -1
  62. package/dist/options/x264-preset.d.ts +2 -2
  63. package/dist/preprocess-audio-track.d.ts +4 -0
  64. package/dist/preprocess-audio-track.js +28 -2
  65. package/dist/prespawn-ffmpeg.js +1 -3
  66. package/dist/provide-screenshot.d.ts +1 -0
  67. package/dist/puppeteer-screenshot.d.ts +1 -0
  68. package/dist/pure.d.ts +4 -3
  69. package/dist/render-media.d.ts +1 -4
  70. package/dist/render-media.js +10 -5
  71. package/dist/screenshot-dom-element.d.ts +1 -0
  72. package/dist/screenshot-task.d.ts +1 -0
  73. package/dist/stitch-frames-to-video.d.ts +6 -5
  74. package/dist/stitch-frames-to-video.js +36 -98
  75. package/dist/stringify-ffmpeg-filter.js +9 -8
  76. package/dist/take-frame-and-compose.d.ts +1 -0
  77. package/dist/validate-output-filename.d.ts +4 -3
  78. package/dist/validate-output-filename.js +10 -4
  79. package/dist/x264-preset.d.ts +15 -0
  80. package/dist/x264-preset.js +26 -1
  81. package/package.json +9 -9
  82. package/dist/can-concatenate-seamlessly.d.ts +0 -3
  83. package/dist/can-concatenate-seamlessly.js +0 -7
  84. package/dist/should-seamless.d.ts +0 -3
  85. package/dist/should-seamless.js +0 -7
@@ -1,10 +1,18 @@
1
1
  import type { LogLevel } from '../log-level';
2
+ import type { CancelSignal } from '../make-cancel-signal';
2
3
  import type { AudioChannelsAndDurationResultCache, DownloadMap } from './download-map';
3
- export declare const getAudioChannelsAndDurationWithoutCache: (src: string, indent: boolean, logLevel: LogLevel, binariesDirectory: string | null) => Promise<AudioChannelsAndDurationResultCache>;
4
- export declare const getAudioChannelsAndDuration: ({ downloadMap, src, indent, logLevel, binariesDirectory, }: {
4
+ export declare const getAudioChannelsAndDurationWithoutCache: ({ src, indent, logLevel, binariesDirectory, cancelSignal, }: {
5
+ src: string;
6
+ indent: boolean;
7
+ logLevel: LogLevel;
8
+ binariesDirectory: string | null;
9
+ cancelSignal: CancelSignal | undefined;
10
+ }) => Promise<AudioChannelsAndDurationResultCache>;
11
+ export declare const getAudioChannelsAndDuration: ({ downloadMap, src, indent, logLevel, binariesDirectory, cancelSignal, }: {
5
12
  downloadMap: DownloadMap;
6
13
  src: string;
7
14
  indent: boolean;
8
15
  logLevel: LogLevel;
9
16
  binariesDirectory: string | null;
17
+ cancelSignal: CancelSignal | undefined;
10
18
  }) => Promise<AudioChannelsAndDurationResultCache>;
@@ -4,7 +4,7 @@ exports.getAudioChannelsAndDuration = exports.getAudioChannelsAndDurationWithout
4
4
  const call_ffmpeg_1 = require("../call-ffmpeg");
5
5
  const p_limit_1 = require("../p-limit");
6
6
  const limit = (0, p_limit_1.pLimit)(1);
7
- const getAudioChannelsAndDurationWithoutCache = async (src, indent, logLevel, binariesDirectory) => {
7
+ const getAudioChannelsAndDurationWithoutCache = async ({ src, indent, logLevel, binariesDirectory, cancelSignal, }) => {
8
8
  const args = [
9
9
  ['-v', 'error'],
10
10
  ['-show_entries', 'stream=channels:format=duration'],
@@ -19,6 +19,7 @@ const getAudioChannelsAndDurationWithoutCache = async (src, indent, logLevel, bi
19
19
  indent,
20
20
  logLevel,
21
21
  binariesDirectory,
22
+ cancelSignal,
22
23
  });
23
24
  const channels = task.stdout.match(/channels=([0-9]+)/);
24
25
  const duration = task.stdout.match(/duration=([0-9.]+)/);
@@ -29,21 +30,28 @@ const getAudioChannelsAndDurationWithoutCache = async (src, indent, logLevel, bi
29
30
  return result;
30
31
  };
31
32
  exports.getAudioChannelsAndDurationWithoutCache = getAudioChannelsAndDurationWithoutCache;
32
- async function getAudioChannelsAndDurationUnlimited({ downloadMap, src, indent, logLevel, binariesDirectory, }) {
33
+ async function getAudioChannelsAndDurationUnlimited({ downloadMap, src, indent, logLevel, binariesDirectory, cancelSignal, }) {
33
34
  if (downloadMap.durationOfAssetCache[src]) {
34
35
  return downloadMap.durationOfAssetCache[src];
35
36
  }
36
- const result = await (0, exports.getAudioChannelsAndDurationWithoutCache)(src, indent, logLevel, binariesDirectory);
37
+ const result = await (0, exports.getAudioChannelsAndDurationWithoutCache)({
38
+ src,
39
+ indent,
40
+ logLevel,
41
+ binariesDirectory,
42
+ cancelSignal,
43
+ });
37
44
  downloadMap.durationOfAssetCache[src] = result;
38
45
  return result;
39
46
  }
40
- const getAudioChannelsAndDuration = ({ downloadMap, src, indent, logLevel, binariesDirectory, }) => {
47
+ const getAudioChannelsAndDuration = ({ downloadMap, src, indent, logLevel, binariesDirectory, cancelSignal, }) => {
41
48
  return limit(() => getAudioChannelsAndDurationUnlimited({
42
49
  downloadMap,
43
50
  src,
44
51
  indent,
45
52
  logLevel,
46
53
  binariesDirectory,
54
+ cancelSignal,
47
55
  }));
48
56
  };
49
57
  exports.getAudioChannelsAndDuration = getAudioChannelsAndDuration;
@@ -1,9 +1,10 @@
1
1
  import type { MediaAsset } from './assets/types';
2
2
  import type { FilterWithoutPaddingApplied } from './stringify-ffmpeg-filter';
3
- export declare const calculateFfmpegFilter: ({ asset, fps, durationInFrames, channels, assetDuration, }: {
3
+ export declare const calculateFfmpegFilter: ({ asset, fps, durationInFrames, channels, assetDuration, forSeamlessAacConcatenation, }: {
4
4
  asset: MediaAsset;
5
5
  fps: number;
6
6
  durationInFrames: number;
7
7
  channels: number;
8
8
  assetDuration: number | null;
9
+ forSeamlessAacConcatenation: boolean;
9
10
  }) => FilterWithoutPaddingApplied | null;
@@ -2,13 +2,24 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calculateFfmpegFilter = void 0;
4
4
  const flatten_volume_array_1 = require("./assets/flatten-volume-array");
5
+ const combine_audio_1 = require("./combine-audio");
6
+ const sample_rate_1 = require("./sample-rate");
5
7
  const stringify_ffmpeg_filter_1 = require("./stringify-ffmpeg-filter");
6
- const calculateFfmpegFilter = ({ asset, fps, durationInFrames, channels, assetDuration, }) => {
8
+ const calculateFfmpegFilter = ({ asset, fps, durationInFrames, channels, assetDuration, forSeamlessAacConcatenation, }) => {
7
9
  if (channels === 0) {
8
10
  return null;
9
11
  }
10
- const assetTrimLeft = (asset.trimLeft * asset.playbackRate) / fps;
11
- const assetTrimRight = assetTrimLeft + (asset.duration * asset.playbackRate) / fps;
12
+ const assetTrimLeft = forSeamlessAacConcatenation
13
+ ? Math.max(0, (0, combine_audio_1.getClosestAlignedTime)(((asset.trimLeft * asset.playbackRate) / fps) * 1000000) /
14
+ 1000000 -
15
+ 2 * (1024 / sample_rate_1.DEFAULT_SAMPLE_RATE))
16
+ : (asset.trimLeft * asset.playbackRate) / fps;
17
+ const assetTrimRight = forSeamlessAacConcatenation
18
+ ? (0, combine_audio_1.getClosestAlignedTime)(((asset.trimLeft + asset.duration * asset.playbackRate) / fps) *
19
+ 1000000) /
20
+ 1000000 +
21
+ 2 * (1024 / sample_rate_1.DEFAULT_SAMPLE_RATE)
22
+ : assetTrimLeft + (asset.duration * asset.playbackRate) / fps;
12
23
  return (0, stringify_ffmpeg_filter_1.stringifyFfmpegFilter)({
13
24
  channels,
14
25
  startInVideo: asset.startInVideo,
@@ -2,19 +2,22 @@
2
2
  import execa from 'execa';
3
3
  import type { SpawnOptionsWithoutStdio } from 'node:child_process';
4
4
  import type { LogLevel } from './log-level';
5
- export declare const callFf: ({ args, bin, indent, logLevel, options, binariesDirectory, }: {
5
+ import type { CancelSignal } from './make-cancel-signal';
6
+ export declare const callFf: ({ args, bin, indent, logLevel, options, binariesDirectory, cancelSignal, }: {
6
7
  bin: 'ffmpeg' | 'ffprobe';
7
8
  args: (string | null)[];
8
9
  indent: boolean;
9
10
  logLevel: LogLevel;
10
11
  binariesDirectory: string | null;
12
+ cancelSignal: CancelSignal | undefined;
11
13
  options?: execa.Options<string> | undefined;
12
14
  }) => execa.ExecaChildProcess<string>;
13
- export declare const callFfNative: ({ args, bin, indent, logLevel, options, binariesDirectory, }: {
15
+ export declare const callFfNative: ({ args, bin, indent, logLevel, options, binariesDirectory, cancelSignal, }: {
14
16
  bin: 'ffmpeg' | 'ffprobe';
15
17
  args: (string | null)[];
16
18
  indent: boolean;
17
19
  logLevel: LogLevel;
18
20
  binariesDirectory: string | null;
21
+ cancelSignal: CancelSignal | undefined;
19
22
  options?: SpawnOptionsWithoutStdio | undefined;
20
23
  }) => import("child_process").ChildProcessWithoutNullStreams;
@@ -6,39 +6,43 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.callFfNative = exports.callFf = void 0;
7
7
  const execa_1 = __importDefault(require("execa"));
8
8
  const node_child_process_1 = require("node:child_process");
9
- const node_fs_1 = require("node:fs");
10
9
  const path_1 = __importDefault(require("path"));
11
10
  const get_executable_path_1 = require("./compositor/get-executable-path");
11
+ const make_file_executable_1 = require("./compositor/make-file-executable");
12
12
  const truthy_1 = require("./truthy");
13
- const callFf = ({ args, bin, indent, logLevel, options, binariesDirectory, }) => {
13
+ const callFf = ({ args, bin, indent, logLevel, options, binariesDirectory, cancelSignal, }) => {
14
14
  const executablePath = (0, get_executable_path_1.getExecutablePath)({
15
15
  type: bin,
16
16
  indent,
17
17
  logLevel,
18
18
  binariesDirectory,
19
19
  });
20
- if (!process.env.READ_ONLY_FS) {
21
- (0, node_fs_1.chmodSync)(executablePath, 0o755);
22
- }
23
- return (0, execa_1.default)(executablePath, args.filter(truthy_1.truthy), {
20
+ (0, make_file_executable_1.makeFileExecutableIfItIsNot)(executablePath);
21
+ const task = (0, execa_1.default)(executablePath, args.filter(truthy_1.truthy), {
24
22
  cwd: path_1.default.dirname(executablePath),
25
23
  ...options,
26
24
  });
25
+ cancelSignal === null || cancelSignal === void 0 ? void 0 : cancelSignal(() => {
26
+ task.kill();
27
+ });
28
+ return task;
27
29
  };
28
30
  exports.callFf = callFf;
29
- const callFfNative = ({ args, bin, indent, logLevel, options, binariesDirectory, }) => {
31
+ const callFfNative = ({ args, bin, indent, logLevel, options, binariesDirectory, cancelSignal, }) => {
30
32
  const executablePath = (0, get_executable_path_1.getExecutablePath)({
31
33
  type: bin,
32
34
  indent,
33
35
  logLevel,
34
36
  binariesDirectory,
35
37
  });
36
- if (!process.env.READ_ONLY_FS) {
37
- (0, node_fs_1.chmodSync)(executablePath, 0o755);
38
- }
39
- return (0, node_child_process_1.spawn)(executablePath, args.filter(truthy_1.truthy), {
38
+ (0, make_file_executable_1.makeFileExecutableIfItIsNot)(executablePath);
39
+ const task = (0, node_child_process_1.spawn)(executablePath, args.filter(truthy_1.truthy), {
40
40
  cwd: path_1.default.dirname(executablePath),
41
41
  ...options,
42
42
  });
43
+ cancelSignal === null || cancelSignal === void 0 ? void 0 : cancelSignal(() => {
44
+ task.kill();
45
+ });
46
+ return task;
43
47
  };
44
48
  exports.callFfNative = callFfNative;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.canUseParallelEncoding = void 0;
4
- const is_audio_codec_1 = require("./is-audio-codec");
4
+ const audio_codec_1 = require("./options/audio-codec");
5
5
  const canUseParallelEncoding = (codec) => {
6
- if ((0, is_audio_codec_1.isAudioCodec)(codec)) {
6
+ if ((0, audio_codec_1.isAudioCodec)(codec)) {
7
7
  return false;
8
8
  }
9
9
  return codec === 'h264' || codec === 'h264-mkv' || codec === 'h265';
@@ -1,3 +1 @@
1
- import type { LogLevel } from './log-level';
2
- export declare const gLibCErrorMessage: (libCString: string) => string | null;
3
- export declare const checkNodeVersionAndWarnAboutRosetta: (logLevel: LogLevel, indent: boolean) => void;
1
+ export declare const checkNodeVersionAndWarnAboutRosetta: () => void;
@@ -1,42 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkNodeVersionAndWarnAboutRosetta = exports.gLibCErrorMessage = void 0;
4
- const logger_1 = require("./logger");
5
- const gLibCErrorMessage = (libCString) => {
6
- const split = libCString.split('.');
7
- if (split.length !== 2) {
8
- return null;
9
- }
10
- if (split[0] === '2' && Number(split[1]) >= 35) {
11
- return null;
12
- }
13
- if (Number(split[0]) > 2) {
14
- return null;
15
- }
16
- return `Rendering videos requires glibc 2.35 or higher. Your system has glibc ${libCString}.`;
17
- };
18
- exports.gLibCErrorMessage = gLibCErrorMessage;
19
- const checkLibCRequirement = (logLevel, indent) => {
20
- const { report } = process;
21
- if (report) {
22
- // @ts-expect-error no types
23
- const { glibcVersionRuntime } = report.getReport().header;
24
- if (!glibcVersionRuntime) {
25
- return;
26
- }
27
- const error = (0, exports.gLibCErrorMessage)(glibcVersionRuntime);
28
- if (error) {
29
- logger_1.Log.warn({ logLevel, indent }, error);
30
- }
31
- }
32
- };
33
- const checkNodeVersionAndWarnAboutRosetta = (logLevel, indent) => {
3
+ exports.checkNodeVersionAndWarnAboutRosetta = void 0;
4
+ const checkNodeVersionAndWarnAboutRosetta = () => {
34
5
  const version = process.version.replace('v', '').split('.');
35
6
  const majorVersion = Number(version[0]);
36
7
  const requiredNodeVersion = 16;
37
8
  if (majorVersion < 16) {
38
9
  throw new Error(`Remotion requires at least Node ${requiredNodeVersion}. You currently have ${process.version}. Update your node version to ${requiredNodeVersion} to use Remotion.`);
39
10
  }
40
- checkLibCRequirement(logLevel, indent);
41
11
  };
42
12
  exports.checkNodeVersionAndWarnAboutRosetta = checkNodeVersionAndWarnAboutRosetta;