@remotion/renderer 4.0.0-alpha4 → 4.0.0-alpha6

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 (143) hide show
  1. package/README.md +5 -43
  2. package/dist/assets/download-and-map-assets-to-file.js +6 -6
  3. package/dist/assets/download-file.d.ts +3 -2
  4. package/dist/assets/download-file.js +18 -3
  5. package/dist/assets/download-map.d.ts +0 -26
  6. package/dist/assets/download-map.js +7 -12
  7. package/dist/assets/get-audio-channels.d.ts +1 -2
  8. package/dist/assets/get-audio-channels.js +5 -9
  9. package/dist/assets/read-file.d.ts +1 -1
  10. package/dist/assets/read-file.js +2 -2
  11. package/dist/assets/sanitize-filepath.js +2 -2
  12. package/dist/audio-codec.d.ts +4 -3
  13. package/dist/audio-codec.js +3 -9
  14. package/dist/browser/BrowserFetcher.d.ts +0 -1
  15. package/dist/browser/BrowserFetcher.js +14 -15
  16. package/dist/browser/BrowserRunner.d.ts +1 -1
  17. package/dist/browser/BrowserRunner.js +10 -4
  18. package/dist/browser/FrameManager.js +2 -3
  19. package/dist/browser/LaunchOptions.d.ts +1 -0
  20. package/dist/browser/Launcher.js +6 -5
  21. package/dist/browser/NodeWebSocketTransport.js +4 -4
  22. package/dist/browser/devtools-commands.d.ts +5 -1
  23. package/dist/browser/devtools-types.d.ts +78 -0
  24. package/dist/browser/get-download-destination.js +8 -8
  25. package/dist/browser/is-target-closed-err.d.ts +1 -0
  26. package/dist/browser/is-target-closed-err.js +9 -0
  27. package/dist/call-ffmpeg.d.ts +14 -0
  28. package/dist/call-ffmpeg.js +40 -0
  29. package/dist/check-apple-silicon.js +2 -45
  30. package/dist/client.d.ts +79 -42
  31. package/dist/client.js +27 -1
  32. package/dist/codec-supports-media.d.ts +2 -1
  33. package/dist/codec-supports-media.js +20 -5
  34. package/dist/combine-videos.d.ts +0 -3
  35. package/dist/combine-videos.js +9 -13
  36. package/dist/compositor/compose.d.ts +3 -1
  37. package/dist/compositor/compose.js +41 -18
  38. package/dist/compositor/compositor.d.ts +12 -0
  39. package/dist/compositor/compositor.js +204 -0
  40. package/dist/compositor/get-executable-path.d.ts +1 -1
  41. package/dist/compositor/get-executable-path.js +27 -8
  42. package/dist/compositor/make-nonce.d.ts +1 -0
  43. package/dist/compositor/make-nonce.js +8 -0
  44. package/dist/compositor/payloads.d.ts +34 -7
  45. package/dist/create-ffmpeg-complex-filter.d.ts +5 -5
  46. package/dist/create-ffmpeg-complex-filter.js +2 -4
  47. package/dist/create-ffmpeg-merge-filter.d.ts +2 -5
  48. package/dist/create-ffmpeg-merge-filter.js +2 -10
  49. package/dist/create-silent-audio.d.ts +1 -4
  50. package/dist/create-silent-audio.js +3 -7
  51. package/dist/crf.js +8 -2
  52. package/dist/delete-directory.js +18 -18
  53. package/dist/does-have-m2-bug.js +2 -2
  54. package/dist/ensure-output-directory.js +5 -5
  55. package/dist/ffmpeg-filter-file.js +7 -7
  56. package/dist/file-extensions.d.ts +1 -12
  57. package/dist/file-extensions.js +8 -14
  58. package/dist/find-closest-package-json.js +6 -6
  59. package/dist/get-compositions.d.ts +3 -5
  60. package/dist/get-compositions.js +8 -11
  61. package/dist/get-concurrency.js +3 -3
  62. package/dist/get-extension-from-codec.d.ts +2 -2
  63. package/dist/get-extension-of-filename.js +2 -2
  64. package/dist/get-frame-padded-index.d.ts +2 -1
  65. package/dist/get-local-browser-executable.js +4 -4
  66. package/dist/get-video-threads-flag.js +3 -3
  67. package/dist/guess-extension-for-media.d.ts +1 -3
  68. package/dist/guess-extension-for-media.js +4 -8
  69. package/dist/image-format.d.ts +12 -6
  70. package/dist/image-format.js +16 -13
  71. package/dist/index.d.ts +80 -61
  72. package/dist/index.js +15 -17
  73. package/dist/jpeg-quality.d.ts +1 -0
  74. package/dist/jpeg-quality.js +21 -0
  75. package/dist/merge-audio-track.d.ts +0 -2
  76. package/dist/merge-audio-track.js +5 -12
  77. package/dist/mime-types.js +2 -2
  78. package/dist/offthread-video-server.d.ts +9 -9
  79. package/dist/offthread-video-server.js +65 -58
  80. package/dist/open-browser.d.ts +1 -0
  81. package/dist/open-browser.js +7 -6
  82. package/dist/options/audio-bitrate.d.ts +2 -0
  83. package/dist/options/audio-bitrate.js +11 -0
  84. package/dist/options/crf.d.ts +2 -0
  85. package/dist/options/crf.js +11 -0
  86. package/dist/options/enforce-audio.d.ts +2 -0
  87. package/dist/options/enforce-audio.js +11 -0
  88. package/dist/options/jpeg-quality.d.ts +2 -0
  89. package/dist/options/jpeg-quality.js +11 -0
  90. package/dist/options/mute.d.ts +2 -0
  91. package/dist/options/mute.js +11 -0
  92. package/dist/options/option.d.ts +8 -0
  93. package/dist/options/option.js +2 -0
  94. package/dist/options/scale.d.ts +2 -0
  95. package/dist/options/scale.js +11 -0
  96. package/dist/options/video-bitrate.d.ts +2 -0
  97. package/dist/options/video-bitrate.js +11 -0
  98. package/dist/options/video-codec.d.ts +2 -0
  99. package/dist/options/video-codec.js +11 -0
  100. package/dist/perf.d.ts +1 -1
  101. package/dist/perf.js +9 -7
  102. package/dist/prepare-server.d.ts +3 -4
  103. package/dist/prepare-server.js +9 -9
  104. package/dist/preprocess-audio-track.d.ts +0 -4
  105. package/dist/preprocess-audio-track.js +4 -8
  106. package/dist/prespawn-ffmpeg.d.ts +6 -9
  107. package/dist/prespawn-ffmpeg.js +7 -12
  108. package/dist/prestitcher-memory-usage.d.ts +0 -4
  109. package/dist/prestitcher-memory-usage.js +4 -5
  110. package/dist/prores-profile.d.ts +1 -2
  111. package/dist/prores-profile.js +4 -4
  112. package/dist/provide-screenshot.d.ts +4 -5
  113. package/dist/provide-screenshot.js +2 -2
  114. package/dist/puppeteer-screenshot.d.ts +3 -3
  115. package/dist/puppeteer-screenshot.js +10 -33
  116. package/dist/render-frames.d.ts +13 -25
  117. package/dist/render-frames.js +34 -45
  118. package/dist/render-media.d.ts +16 -18
  119. package/dist/render-media.js +42 -52
  120. package/dist/render-still.d.ts +12 -8
  121. package/dist/render-still.js +30 -18
  122. package/dist/resolve-asset-src.js +2 -2
  123. package/dist/screenshot-dom-element.d.ts +4 -5
  124. package/dist/screenshot-dom-element.js +6 -3
  125. package/dist/screenshot-task.d.ts +2 -3
  126. package/dist/screenshot-task.js +40 -25
  127. package/dist/serve-handler/index.d.ts +1 -1
  128. package/dist/serve-handler/index.js +21 -19
  129. package/dist/serve-handler/is-path-inside.js +3 -3
  130. package/dist/serve-static.d.ts +2 -3
  131. package/dist/serve-static.js +26 -22
  132. package/dist/stitch-frames-to-video.d.ts +2 -12
  133. package/dist/stitch-frames-to-video.js +37 -46
  134. package/dist/take-frame-and-compose.d.ts +4 -5
  135. package/dist/take-frame-and-compose.js +15 -9
  136. package/dist/tmp-dir.js +7 -8
  137. package/dist/validate-concurrency.d.ts +2 -0
  138. package/dist/validate-concurrency.js +11 -5
  139. package/dist/validate-output-filename.d.ts +1 -1
  140. package/dist/validate-puppeteer-timeout.js +1 -0
  141. package/install-toolchain.mjs +36 -0
  142. package/package.json +11 -10
  143. package/types/ws/index.d.ts +5 -5
@@ -22,37 +22,37 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  exports.deleteDirectory = void 0;
30
- const execa_1 = __importDefault(require("execa"));
31
- const fs_1 = __importStar(require("fs"));
27
+ const node_fs_1 = __importStar(require("node:fs"));
32
28
  const is_serve_url_1 = require("./is-serve-url");
33
29
  const deleteDirectory = (directory) => {
34
- var _a;
35
30
  if ((0, is_serve_url_1.isServeUrl)(directory)) {
36
31
  return;
37
32
  }
38
- if (!(0, fs_1.existsSync)(directory)) {
33
+ if (!(0, node_fs_1.existsSync)(directory)) {
39
34
  return;
40
35
  }
41
- if (process.platform === 'win32') {
42
- // We use del before to remove all files inside the directories otherwise
43
- // rmdir will throw an error.
44
- execa_1.default.sync('cmd', ['/c', 'del', '/f', '/s', '/q', directory]);
36
+ // Working around a bug with NodeJS 16 on Windows:
37
+ // If a subdirectory is already deleted, it will fail with EPERM
38
+ // even with force: true and recursive and maxRetries set higher.
39
+ // This is even with the fixWinEPERMSync function being called by Node.JS.
40
+ // This is a workaround for this issue.
41
+ let retries = 2;
42
+ while (retries >= 0) {
45
43
  try {
46
- execa_1.default.sync('cmd', ['/c', 'rmdir', '/s', '/q', directory]);
44
+ node_fs_1.default.rmSync(directory, {
45
+ maxRetries: 2,
46
+ recursive: true,
47
+ force: true,
48
+ retryDelay: 100,
49
+ });
47
50
  }
48
51
  catch (err) {
49
- // Is not a directory
52
+ retries--;
53
+ continue;
50
54
  }
51
- }
52
- else {
53
- ((_a = fs_1.default.rmSync) !== null && _a !== void 0 ? _a : fs_1.default.rmdirSync)(directory, {
54
- recursive: true,
55
- });
55
+ break;
56
56
  }
57
57
  };
58
58
  exports.deleteDirectory = deleteDirectory;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.warnAboutM2Bug = void 0;
4
- const os_1 = require("os");
4
+ const node_os_1 = require("node:os");
5
5
  const warnAboutM2Bug = (codec, pixelFormat) => {
6
- const isM2 = (0, os_1.cpus)().find((c) => c.model.includes('Apple M2'));
6
+ const isM2 = (0, node_os_1.cpus)().find((c) => c.model.includes('Apple M2'));
7
7
  if (codec === 'prores' && pixelFormat === 'yuv422p10le' && isM2) {
8
8
  console.warn();
9
9
  console.warn('⚠️ Known issue: Apple M2 CPUs currently suffer from a bug where transparent ProRes videos have flickering. https://github.com/remotion-dev/remotion/issues/1929');
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ensureOutputDirectory = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
9
  const ensureOutputDirectory = (outputLocation) => {
10
- const dirName = path_1.default.dirname(outputLocation);
11
- if (!fs_1.default.existsSync(dirName)) {
12
- fs_1.default.mkdirSync(dirName, {
10
+ const dirName = node_path_1.default.dirname(outputLocation);
11
+ if (!node_fs_1.default.existsSync(dirName)) {
12
+ node_fs_1.default.mkdirSync(dirName, {
13
13
  recursive: true,
14
14
  });
15
15
  }
@@ -29,25 +29,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
29
  };
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
31
  exports.makeFfmpegFilterFileStr = exports.makeFfmpegFilterFile = void 0;
32
- const fs_1 = __importStar(require("fs"));
33
- const path_1 = __importDefault(require("path"));
32
+ const node_fs_1 = __importStar(require("node:fs"));
33
+ const node_path_1 = __importDefault(require("node:path"));
34
34
  const makeFfmpegFilterFile = (complexFilter, downloadMap) => {
35
35
  return (0, exports.makeFfmpegFilterFileStr)(complexFilter.filter, downloadMap);
36
36
  };
37
37
  exports.makeFfmpegFilterFile = makeFfmpegFilterFile;
38
38
  const makeFfmpegFilterFileStr = async (complexFilter, downloadMap) => {
39
39
  const random = Math.random().toString().replace('.', '');
40
- const filterFile = path_1.default.join(downloadMap.complexFilter, 'complex-filter-' + random + '.txt');
40
+ const filterFile = node_path_1.default.join(downloadMap.complexFilter, 'complex-filter-' + random + '.txt');
41
41
  // Race condition: Sometimes the download map is deleted before the file is written.
42
42
  // Can remove this once the original bug has been fixed
43
- if (!(0, fs_1.existsSync)(downloadMap.complexFilter)) {
44
- fs_1.default.mkdirSync(downloadMap.complexFilter, { recursive: true });
43
+ if (!(0, node_fs_1.existsSync)(downloadMap.complexFilter)) {
44
+ node_fs_1.default.mkdirSync(downloadMap.complexFilter, { recursive: true });
45
45
  }
46
- await fs_1.default.promises.writeFile(filterFile, complexFilter);
46
+ await node_fs_1.default.promises.writeFile(filterFile, complexFilter);
47
47
  return {
48
48
  file: filterFile,
49
49
  cleanup: () => {
50
- fs_1.default.unlinkSync(filterFile);
50
+ node_fs_1.default.unlinkSync(filterFile);
51
51
  },
52
52
  };
53
53
  };
@@ -1,16 +1,5 @@
1
+ import type { supportedAudioCodecs } from './audio-codec';
1
2
  import type { Codec } from './codec';
2
- export declare const supportedAudioCodecs: {
3
- readonly h264: readonly ["aac", "pcm-16"];
4
- readonly 'h264-mkv': readonly ["pcm-16"];
5
- readonly aac: readonly ["aac", "pcm-16"];
6
- readonly gif: readonly [];
7
- readonly h265: readonly ["aac", "pcm-16"];
8
- readonly mp3: readonly ["mp3", "pcm-16"];
9
- readonly prores: readonly ["pcm-16", "aac"];
10
- readonly vp8: readonly ["opus", "pcm-16"];
11
- readonly vp9: readonly ["opus", "pcm-16"];
12
- readonly wav: readonly ["pcm-16"];
13
- };
14
3
  export declare type FileExtension = 'aac' | '3gp' | 'm4a' | 'm4b' | 'mpg' | 'mpeg' | 'mkv' | 'mp4' | 'gif' | 'hevc' | 'mp3' | 'mov' | 'mxf' | 'wav' | 'webm';
15
4
  export declare const defaultFileExtensionMap: {
16
5
  [key in Codec]: {
@@ -1,18 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultFileExtensionMap = exports.supportedAudioCodecs = void 0;
4
- exports.supportedAudioCodecs = {
5
- h264: ['aac', 'pcm-16'],
6
- 'h264-mkv': ['pcm-16'],
7
- aac: ['aac', 'pcm-16'],
8
- gif: [],
9
- h265: ['aac', 'pcm-16'],
10
- mp3: ['mp3', 'pcm-16'],
11
- prores: ['pcm-16', 'aac'],
12
- vp8: ['opus', 'pcm-16'],
13
- vp9: ['opus', 'pcm-16'],
14
- wav: ['pcm-16'],
15
- };
3
+ exports.defaultFileExtensionMap = void 0;
16
4
  exports.defaultFileExtensionMap = {
17
5
  'h264-mkv': {
18
6
  default: 'mkv',
@@ -35,7 +23,13 @@ exports.defaultFileExtensionMap = {
35
23
  },
36
24
  gif: {
37
25
  default: 'gif',
38
- forAudioCodec: {},
26
+ forAudioCodec: {
27
+ // This is just to make the types happy, GIF does not support any audio
28
+ 'pcm-16': { possible: [], default: 'wav' },
29
+ aac: { possible: [], default: 'wav' },
30
+ mp3: { possible: [], default: 'wav' },
31
+ opus: { possible: [], default: 'wav' },
32
+ },
39
33
  },
40
34
  h264: {
41
35
  default: 'mp4',
@@ -4,19 +4,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.findRemotionRoot = exports.findClosestPackageJson = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
9
  const recursionLimit = 5;
10
10
  const findClosestPackageJson = () => {
11
11
  let currentDir = process.cwd();
12
12
  let possiblePackageJson = '';
13
13
  for (let i = 0; i < recursionLimit; i++) {
14
- possiblePackageJson = path_1.default.join(currentDir, 'package.json');
15
- const exists = fs_1.default.existsSync(possiblePackageJson);
14
+ possiblePackageJson = node_path_1.default.join(currentDir, 'package.json');
15
+ const exists = node_fs_1.default.existsSync(possiblePackageJson);
16
16
  if (exists) {
17
17
  return possiblePackageJson;
18
18
  }
19
- currentDir = path_1.default.dirname(currentDir);
19
+ currentDir = node_path_1.default.dirname(currentDir);
20
20
  }
21
21
  return null;
22
22
  };
@@ -26,6 +26,6 @@ const findRemotionRoot = () => {
26
26
  if (closestPackageJson === null) {
27
27
  return process.cwd();
28
28
  }
29
- return path_1.default.dirname(closestPackageJson);
29
+ return node_path_1.default.dirname(closestPackageJson);
30
30
  };
31
31
  exports.findRemotionRoot = findRemotionRoot;
@@ -1,9 +1,8 @@
1
- import type { TCompMetadata } from 'remotion';
1
+ import type { AnyCompMetadata } from 'remotion';
2
2
  import type { DownloadMap } from './assets/download-map';
3
3
  import type { BrowserExecutable } from './browser-executable';
4
4
  import type { BrowserLog } from './browser-log';
5
5
  import type { Browser } from './browser/Browser';
6
- import type { FfmpegExecutable } from './ffmpeg-executable';
7
6
  import type { ChromiumOptions } from './open-browser';
8
7
  declare type GetCompositionsConfig = {
9
8
  inputProps?: object | null;
@@ -13,17 +12,16 @@ declare type GetCompositionsConfig = {
13
12
  browserExecutable?: BrowserExecutable;
14
13
  timeoutInMilliseconds?: number;
15
14
  chromiumOptions?: ChromiumOptions;
16
- ffmpegExecutable?: FfmpegExecutable;
17
- ffprobeExecutable?: FfmpegExecutable;
18
15
  port?: number | null;
19
16
  /**
20
17
  * @deprecated Only for Remotion internal usage
21
18
  */
22
19
  downloadMap?: DownloadMap;
20
+ verbose?: boolean;
23
21
  };
24
22
  /**
25
23
  * @description Gets the compositions defined in a Remotion project based on a Webpack bundle.
26
24
  * @see [Documentation](https://www.remotion.dev/docs/renderer/get-compositions)
27
25
  */
28
- export declare const getCompositions: (serveUrlOrWebpackUrl: string, config?: GetCompositionsConfig) => Promise<TCompMetadata[]>;
26
+ export declare const getCompositions: (serveUrlOrWebpackUrl: string, config?: GetCompositionsConfig) => Promise<AnyCompMetadata[]>;
29
27
  export {};
@@ -9,7 +9,6 @@ const prepare_server_1 = require("./prepare-server");
9
9
  const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
10
10
  const seek_to_frame_1 = require("./seek-to-frame");
11
11
  const set_props_and_env_1 = require("./set-props-and-env");
12
- const validate_ffmpeg_1 = require("./validate-ffmpeg");
13
12
  const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
14
13
  const innerGetCompositions = async (serveUrl, page, config, proxyPort) => {
15
14
  if (config === null || config === void 0 ? void 0 : config.onBrowserLog) {
@@ -61,17 +60,15 @@ const innerGetCompositions = async (serveUrl, page, config, proxyPort) => {
61
60
  * @see [Documentation](https://www.remotion.dev/docs/renderer/get-compositions)
62
61
  */
63
62
  const getCompositions = async (serveUrlOrWebpackUrl, config) => {
64
- var _a, _b, _c, _d, _e;
65
- await (0, validate_ffmpeg_1.validateFfmpeg)((_a = config === null || config === void 0 ? void 0 : config.ffmpegExecutable) !== null && _a !== void 0 ? _a : null, (0, find_closest_package_json_1.findRemotionRoot)(), 'ffmpeg');
66
- await (0, validate_ffmpeg_1.validateFfmpeg)((_b = config === null || config === void 0 ? void 0 : config.ffprobeExecutable) !== null && _b !== void 0 ? _b : null, (0, find_closest_package_json_1.findRemotionRoot)(), 'ffprobe');
67
- const downloadMap = (_c = config === null || config === void 0 ? void 0 : config.downloadMap) !== null && _c !== void 0 ? _c : (0, download_map_1.makeDownloadMap)();
63
+ var _a, _b, _c;
64
+ const downloadMap = (_a = config === null || config === void 0 ? void 0 : config.downloadMap) !== null && _a !== void 0 ? _a : (0, download_map_1.makeDownloadMap)();
68
65
  const { page, cleanup } = await (0, get_browser_instance_1.getPageAndCleanupFn)({
69
66
  passedInInstance: config === null || config === void 0 ? void 0 : config.puppeteerInstance,
70
- browserExecutable: (_d = config === null || config === void 0 ? void 0 : config.browserExecutable) !== null && _d !== void 0 ? _d : null,
71
- chromiumOptions: (_e = config === null || config === void 0 ? void 0 : config.chromiumOptions) !== null && _e !== void 0 ? _e : {},
67
+ browserExecutable: (_b = config === null || config === void 0 ? void 0 : config.browserExecutable) !== null && _b !== void 0 ? _b : null,
68
+ chromiumOptions: (_c = config === null || config === void 0 ? void 0 : config.chromiumOptions) !== null && _c !== void 0 ? _c : {},
72
69
  });
73
70
  return new Promise((resolve, reject) => {
74
- var _a, _b, _c;
71
+ var _a, _b;
75
72
  const onError = (err) => reject(err);
76
73
  const cleanupPageError = (0, handle_javascript_exception_1.handleJavascriptException)({
77
74
  page,
@@ -83,11 +80,11 @@ const getCompositions = async (serveUrlOrWebpackUrl, config) => {
83
80
  webpackConfigOrServeUrl: serveUrlOrWebpackUrl,
84
81
  onDownload: () => undefined,
85
82
  onError,
86
- ffmpegExecutable: (_a = config === null || config === void 0 ? void 0 : config.ffmpegExecutable) !== null && _a !== void 0 ? _a : null,
87
- ffprobeExecutable: (_b = config === null || config === void 0 ? void 0 : config.ffprobeExecutable) !== null && _b !== void 0 ? _b : null,
88
- port: (_c = config === null || config === void 0 ? void 0 : config.port) !== null && _c !== void 0 ? _c : null,
83
+ port: (_a = config === null || config === void 0 ? void 0 : config.port) !== null && _a !== void 0 ? _a : null,
89
84
  downloadMap,
90
85
  remotionRoot: (0, find_closest_package_json_1.findRemotionRoot)(),
86
+ concurrency: 1,
87
+ verbose: (_b = config === null || config === void 0 ? void 0 : config.verbose) !== null && _b !== void 0 ? _b : false,
91
88
  })
92
89
  .then(({ serveUrl, closeServer, offthreadPort }) => {
93
90
  close = closeServer;
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getActualConcurrency = void 0;
7
- const os_1 = __importDefault(require("os"));
7
+ const node_os_1 = __importDefault(require("node:os"));
8
8
  const getActualConcurrency = (userPreference) => {
9
9
  if (userPreference === null) {
10
- return Math.round(Math.min(8, Math.max(1, os_1.default.cpus().length / 2)));
10
+ return Math.round(Math.min(8, Math.max(1, node_os_1.default.cpus().length / 2)));
11
11
  }
12
- const max = os_1.default.cpus().length;
12
+ const max = node_os_1.default.cpus().length;
13
13
  const min = 1;
14
14
  let rounded;
15
15
  if (typeof userPreference === 'string') {
@@ -1,6 +1,6 @@
1
1
  import type { AudioCodec } from './audio-codec';
2
2
  import type { Codec } from './codec';
3
3
  import type { FileExtension } from './file-extensions';
4
- export declare const getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">(codec: T, audioCodec: AudioCodec | null) => FileExtension;
5
- export declare const makeFileExtensionMap: () => Record<string, ("h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif")[]>;
4
+ export declare const getFileExtensionFromCodec: <T extends "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif">(codec: T, audioCodec: AudioCodec | null) => FileExtension;
5
+ export declare const makeFileExtensionMap: () => Record<string, ("aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif")[]>;
6
6
  export declare const defaultCodecsForFileExtension: Record<FileExtension, Codec>;
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getExtensionOfFilename = void 0;
7
- const path_1 = __importDefault(require("path"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
8
  const getExtensionOfFilename = (filename) => {
9
9
  if (filename === null) {
10
10
  return null;
11
11
  }
12
- const filenameArr = path_1.default.normalize(filename).split('.');
12
+ const filenameArr = node_path_1.default.normalize(filename).split('.');
13
13
  const hasExtension = filenameArr.length >= 2;
14
14
  const filenameArrLength = filenameArr.length;
15
15
  const extension = hasExtension ? filenameArr[filenameArrLength - 1] : null;
@@ -1,8 +1,9 @@
1
+ import type { VideoImageFormat } from './image-format';
1
2
  export declare type CountType = 'from-zero' | 'actual-frames';
2
3
  export declare const getFrameOutputFileName: ({ index, frame, imageFormat, countType, lastFrame, totalFrames, }: {
3
4
  index: number;
4
5
  frame: number;
5
- imageFormat: 'png' | 'jpeg' | 'none';
6
+ imageFormat: VideoImageFormat;
6
7
  countType: CountType;
7
8
  lastFrame: number;
8
9
  totalFrames: number;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getLocalBrowserExecutable = exports.ensureLocalBrowser = void 0;
7
- const fs_1 = __importDefault(require("fs"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const BrowserFetcher_1 = require("./browser/BrowserFetcher");
9
9
  const create_browser_fetcher_1 = require("./browser/create-browser-fetcher");
10
10
  const revisions_1 = require("./browser/revisions");
@@ -38,7 +38,7 @@ const getSearchPathsForProduct = (product) => {
38
38
  const mapBrowserToProduct = (browser) => browser;
39
39
  const getLocalBrowser = (product) => {
40
40
  for (const p of getSearchPathsForProduct(product)) {
41
- if (fs_1.default.existsSync(p)) {
41
+ if (node_fs_1.default.existsSync(p)) {
42
42
  return p;
43
43
  }
44
44
  }
@@ -46,7 +46,7 @@ const getLocalBrowser = (product) => {
46
46
  };
47
47
  const getBrowserStatus = (product, browserExecutablePath) => {
48
48
  if (browserExecutablePath) {
49
- if (!fs_1.default.existsSync(browserExecutablePath)) {
49
+ if (!node_fs_1.default.existsSync(browserExecutablePath)) {
50
50
  console.warn(`Browser executable was specified as '${browserExecutablePath}' but the path doesn't exist.`);
51
51
  }
52
52
  return { path: browserExecutablePath, type: 'user-defined-path' };
@@ -56,7 +56,7 @@ const getBrowserStatus = (product, browserExecutablePath) => {
56
56
  return { path: localBrowser, type: 'local-browser' };
57
57
  }
58
58
  const revision = (0, BrowserFetcher_1.getRevisionInfo)(revisions_1.PUPPETEER_REVISIONS.chromium, product);
59
- if (revision.local && fs_1.default.existsSync(revision.executablePath)) {
59
+ if (revision.local && node_fs_1.default.existsSync(revision.executablePath)) {
60
60
  return { path: revision.executablePath, type: 'local-puppeteer-browser' };
61
61
  }
62
62
  return { type: 'no-browser' };
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getIdealVideoThreadsFlag = void 0;
7
- const os_1 = __importDefault(require("os"));
7
+ const node_os_1 = __importDefault(require("node:os"));
8
8
  const MEMORY_USAGE_PER_THREAD = 400000000; // 400MB
9
9
  const RESERVED_MEMORY = 2000000000;
10
10
  const getIdealVideoThreadsFlag = () => {
11
- const freeMemory = os_1.default.freemem();
12
- const cpus = os_1.default.cpus().length;
11
+ const freeMemory = node_os_1.default.freemem();
12
+ const cpus = node_os_1.default.cpus().length;
13
13
  const maxRecommendedBasedOnCpus = (cpus * 2) / 3;
14
14
  const maxRecommendedBasedOnMemory = (freeMemory - RESERVED_MEMORY) / MEMORY_USAGE_PER_THREAD;
15
15
  const maxRecommended = Math.min(maxRecommendedBasedOnCpus, maxRecommendedBasedOnMemory);
@@ -1,5 +1,3 @@
1
- export declare const guessExtensionForVideo: ({ src, remotionRoot, ffprobeBinary, }: {
1
+ export declare const guessExtensionForVideo: ({ src }: {
2
2
  src: string;
3
- remotionRoot: string;
4
- ffprobeBinary: string | null;
5
3
  }) => Promise<"mp3" | "wav" | "mp4" | "webm">;
@@ -1,14 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.guessExtensionForVideo = void 0;
7
- const execa_1 = __importDefault(require("execa"));
8
- const ffmpeg_flags_1 = require("./ffmpeg-flags");
9
- const guessExtensionForVideo = async ({ src, remotionRoot, ffprobeBinary, }) => {
10
- const { stderr } = await (0, execa_1.default)(await (0, ffmpeg_flags_1.getExecutableBinary)(ffprobeBinary, remotionRoot, 'ffprobe'), [src]);
11
- if (stderr.includes('mp3,')) {
4
+ const call_ffmpeg_1 = require("./call-ffmpeg");
5
+ const guessExtensionForVideo = async ({ src }) => {
6
+ const { stderr } = await (0, call_ffmpeg_1.callFf)('ffprobe', [src]);
7
+ if (stderr.includes('Audio: mp3,')) {
12
8
  return 'mp3';
13
9
  }
14
10
  if (stderr.includes('Video: vp9')) {
@@ -1,7 +1,13 @@
1
1
  import type { PixelFormat } from './pixel-format';
2
- export declare const validImageFormats: readonly ["png", "jpeg", "none"];
3
- export declare type ImageFormat = typeof validImageFormats[number];
4
- export declare type StillImageFormat = 'png' | 'jpeg';
5
- export declare const DEFAULT_IMAGE_FORMAT: ImageFormat;
6
- export declare const validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: PixelFormat | undefined, imageFormat: ImageFormat) => 'none' | 'valid';
7
- export declare const validateNonNullImageFormat: (imageFormat: ImageFormat) => void;
2
+ export declare const validVideoImageFormats: readonly ["png", "jpeg", "none"];
3
+ export declare const validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
4
+ export declare type VideoImageFormat = typeof validVideoImageFormats[number];
5
+ export declare type StillImageFormat = typeof validStillImageFormats[number];
6
+ /**
7
+ * @deprecated Use VideoImageFormat or StillImageFormat instead
8
+ */
9
+ export declare type ImageFormat = 'This type is deprecated, use VideoImageFormat or StillImageFormat instead';
10
+ export declare const DEFAULT_VIDEO_IMAGE_FORMAT: VideoImageFormat;
11
+ export declare const DEFAULT_STILL_IMAGE_FORMAT: StillImageFormat;
12
+ export declare const validateSelectedPixelFormatAndImageFormatCombination: (pixelFormat: PixelFormat | undefined, videoImageFormat: VideoImageFormat) => 'none' | 'valid';
13
+ export declare const validateStillImageFormat: (imageFormat: StillImageFormat) => void;
@@ -2,33 +2,36 @@
2
2
  // Keeping the default image format PNG if you don't pass a
3
3
  // value to the renderer for backwards compatibility.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.validateNonNullImageFormat = exports.validateSelectedPixelFormatAndImageFormatCombination = exports.DEFAULT_IMAGE_FORMAT = exports.validImageFormats = void 0;
6
- exports.validImageFormats = ['png', 'jpeg', 'none'];
7
- // However, the CLI will override it and use JPEG if suitable.
8
- exports.DEFAULT_IMAGE_FORMAT = 'png';
5
+ exports.validateStillImageFormat = exports.validateSelectedPixelFormatAndImageFormatCombination = exports.DEFAULT_STILL_IMAGE_FORMAT = exports.DEFAULT_VIDEO_IMAGE_FORMAT = exports.validStillImageFormats = exports.validVideoImageFormats = void 0;
6
+ exports.validVideoImageFormats = ['png', 'jpeg', 'none'];
7
+ exports.validStillImageFormats = ['png', 'jpeg', 'pdf', 'webp'];
8
+ exports.DEFAULT_VIDEO_IMAGE_FORMAT = 'jpeg';
9
+ exports.DEFAULT_STILL_IMAGE_FORMAT = 'png';
9
10
  // By returning a value, we improve testability as we can specifically test certain branches
10
- const validateSelectedPixelFormatAndImageFormatCombination = (pixelFormat, imageFormat) => {
11
- if (imageFormat === 'none') {
11
+ const validateSelectedPixelFormatAndImageFormatCombination = (pixelFormat, videoImageFormat) => {
12
+ if (videoImageFormat === 'none') {
12
13
  return 'none';
13
14
  }
14
15
  if (typeof pixelFormat === 'undefined') {
15
16
  return 'valid';
16
17
  }
17
- if (!exports.validImageFormats.includes(imageFormat)) {
18
- throw new TypeError(`Value ${imageFormat} is not valid as an image format.`);
18
+ if (!exports.validVideoImageFormats.includes(videoImageFormat)) {
19
+ throw new TypeError(`Value ${videoImageFormat} is not valid as an image format.`);
19
20
  }
20
21
  if (pixelFormat !== 'yuva420p' && pixelFormat !== 'yuva444p10le') {
21
22
  return 'valid';
22
23
  }
23
- if (imageFormat !== 'png') {
24
+ if (videoImageFormat !== 'png') {
24
25
  throw new TypeError(`Pixel format was set to '${pixelFormat}' but the image format is not PNG. To render transparent videos, you need to set PNG as the image format.`);
25
26
  }
26
27
  return 'valid';
27
28
  };
28
29
  exports.validateSelectedPixelFormatAndImageFormatCombination = validateSelectedPixelFormatAndImageFormatCombination;
29
- const validateNonNullImageFormat = (imageFormat) => {
30
- if (imageFormat !== 'jpeg' && imageFormat !== 'png') {
31
- throw new TypeError('Image format should be either "png" or "jpeg"');
30
+ const validateStillImageFormat = (imageFormat) => {
31
+ if (!exports.validStillImageFormats.includes(imageFormat)) {
32
+ throw new TypeError(String(`Image format should be one of: ${exports.validStillImageFormats
33
+ .map((v) => `"${v}"`)
34
+ .join(', ')}`));
32
35
  }
33
36
  };
34
- exports.validateNonNullImageFormat = validateNonNullImageFormat;
37
+ exports.validateStillImageFormat = validateStillImageFormat;