@remotion/renderer 4.0.0-alpha5 → 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 (54) hide show
  1. package/dist/assets/download-and-map-assets-to-file.js +6 -6
  2. package/dist/assets/download-file.d.ts +3 -2
  3. package/dist/assets/download-file.js +18 -3
  4. package/dist/assets/download-map.js +7 -7
  5. package/dist/assets/read-file.d.ts +1 -1
  6. package/dist/assets/read-file.js +2 -2
  7. package/dist/assets/sanitize-filepath.js +2 -2
  8. package/dist/audio-codec.d.ts +1 -1
  9. package/dist/browser/BrowserFetcher.js +13 -13
  10. package/dist/browser/BrowserRunner.d.ts +1 -1
  11. package/dist/browser/BrowserRunner.js +2 -2
  12. package/dist/browser/Launcher.js +4 -4
  13. package/dist/browser/NodeWebSocketTransport.js +4 -4
  14. package/dist/browser/get-download-destination.js +8 -8
  15. package/dist/call-ffmpeg.js +6 -3
  16. package/dist/client.d.ts +16 -4
  17. package/dist/combine-videos.js +6 -6
  18. package/dist/compositor/compose.js +8 -5
  19. package/dist/compositor/compositor.js +6 -4
  20. package/dist/delete-directory.js +3 -3
  21. package/dist/does-have-m2-bug.js +2 -2
  22. package/dist/ensure-output-directory.js +5 -5
  23. package/dist/ffmpeg-filter-file.js +7 -7
  24. package/dist/file-extensions.js +7 -1
  25. package/dist/find-closest-package-json.js +6 -6
  26. package/dist/get-concurrency.js +3 -3
  27. package/dist/get-extension-of-filename.js +2 -2
  28. package/dist/get-local-browser-executable.js +4 -4
  29. package/dist/get-video-threads-flag.js +3 -3
  30. package/dist/index.d.ts +16 -4
  31. package/dist/merge-audio-track.js +2 -2
  32. package/dist/mime-types.js +2 -2
  33. package/dist/offthread-video-server.d.ts +1 -1
  34. package/dist/offthread-video-server.js +2 -2
  35. package/dist/options/jpeg-quality.js +1 -1
  36. package/dist/prepare-server.js +4 -4
  37. package/dist/prestitcher-memory-usage.js +2 -2
  38. package/dist/puppeteer-screenshot.js +1 -1
  39. package/dist/render-frames.js +5 -5
  40. package/dist/render-media.js +9 -9
  41. package/dist/render-still.d.ts +2 -0
  42. package/dist/render-still.js +17 -6
  43. package/dist/resolve-asset-src.js +2 -2
  44. package/dist/screenshot-task.js +2 -2
  45. package/dist/serve-handler/index.d.ts +1 -1
  46. package/dist/serve-handler/index.js +15 -15
  47. package/dist/serve-handler/is-path-inside.js +3 -3
  48. package/dist/serve-static.js +2 -2
  49. package/dist/stitch-frames-to-video.js +13 -13
  50. package/dist/take-frame-and-compose.js +6 -6
  51. package/dist/tmp-dir.js +7 -7
  52. package/install-toolchain.mjs +2 -2
  53. package/package.json +9 -9
  54. package/types/ws/index.d.ts +5 -5
@@ -27,8 +27,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.downloadAndMapAssetsToFileUrl = exports.getSanitizedFilenameForAssetUrl = exports.markAllAssetsAsDownloaded = exports.downloadAsset = void 0;
30
- const fs_1 = __importDefault(require("fs"));
31
- const path_1 = __importStar(require("path"));
30
+ const node_fs_1 = __importDefault(require("node:fs"));
31
+ const node_path_1 = __importStar(require("node:path"));
32
32
  const remotion_1 = require("remotion");
33
33
  const compress_assets_1 = require("../compress-assets");
34
34
  const ensure_output_directory_1 = require("../ensure-output-directory");
@@ -124,7 +124,7 @@ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
124
124
  if ((_a = downloadMap.hasBeenDownloadedMap[src]) === null || _a === void 0 ? void 0 : _a[downloadDir]) {
125
125
  const claimedDownloadLocation = (_b = downloadMap.hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir];
126
126
  // The OS might have deleted the file since even though we marked it as downloaded. In that case we reset the state and download it again
127
- if (fs_1.default.existsSync(claimedDownloadLocation)) {
127
+ if (node_fs_1.default.existsSync(claimedDownloadLocation)) {
128
128
  return claimedDownloadLocation;
129
129
  }
130
130
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -168,7 +168,7 @@ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
168
168
  });
169
169
  (0, ensure_output_directory_1.ensureOutputDirectory)(output);
170
170
  const buff = Buffer.from(assetData, encoding);
171
- await fs_1.default.promises.writeFile(output, buff);
171
+ await node_fs_1.default.promises.writeFile(output, buff);
172
172
  notifyAssetIsDownloaded({ src, downloadMap, downloadDir, to: output });
173
173
  return output;
174
174
  }
@@ -212,7 +212,7 @@ const getFilename = ({ contentDisposition, src, contentType, }) => {
212
212
  };
213
213
  }
214
214
  const { pathname, search } = new URL(src);
215
- const ext = (0, path_1.extname)(pathname);
215
+ const ext = (0, node_path_1.extname)(pathname);
216
216
  // Has no file extension, check if we can derive it from contentType
217
217
  if (!ext && contentType) {
218
218
  const matchedExt = (0, mime_types_1.getExt)(contentType);
@@ -238,7 +238,7 @@ const getSanitizedFilenameForAssetUrl = ({ src, downloadDir, contentDisposition,
238
238
  : '';
239
239
  const hashedFileName = String((0, remotion_1.random)(`${pathname}${search}`)).replace('0.', '');
240
240
  const filename = hashedFileName + fileExtension;
241
- return path_1.default.join(downloadDir, (0, sanitize_filepath_1.sanitizeFilePath)(filename));
241
+ return node_path_1.default.join(downloadDir, (0, sanitize_filepath_1.sanitizeFilePath)(filename));
242
242
  };
243
243
  exports.getSanitizedFilenameForAssetUrl = getSanitizedFilenameForAssetUrl;
244
244
  const downloadAndMapAssetsToFileUrl = async ({ asset, onDownload, downloadMap, }) => {
@@ -2,7 +2,7 @@ declare type Response = {
2
2
  sizeInBytes: number;
3
3
  to: string;
4
4
  };
5
- export declare const downloadFile: ({ onProgress, url, to: toFn, }: {
5
+ declare type Options = {
6
6
  url: string;
7
7
  to: (contentDisposition: string | null, contentType: string | null) => string;
8
8
  onProgress: ((progress: {
@@ -10,5 +10,6 @@ export declare const downloadFile: ({ onProgress, url, to: toFn, }: {
10
10
  downloaded: number;
11
11
  totalSize: number | null;
12
12
  }) => void) | undefined;
13
- }) => Promise<Response>;
13
+ };
14
+ export declare const downloadFile: (options: Options, retries?: number) => Promise<Response>;
14
15
  export {};
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.downloadFile = void 0;
4
- const fs_1 = require("fs");
4
+ const node_fs_1 = require("node:fs");
5
5
  const ensure_output_directory_1 = require("../ensure-output-directory");
6
6
  const read_file_1 = require("./read-file");
7
- const downloadFile = ({ onProgress, url, to: toFn, }) => {
7
+ const downloadFileWithoutRetries = ({ onProgress, url, to: toFn }) => {
8
8
  return new Promise((resolve, reject) => {
9
9
  let rejected = false;
10
10
  let resolved = false;
@@ -44,7 +44,7 @@ const downloadFile = ({ onProgress, url, to: toFn, }) => {
44
44
  (0, ensure_output_directory_1.ensureOutputDirectory)(to);
45
45
  const sizeHeader = res.headers['content-length'];
46
46
  const totalSize = typeof sizeHeader === 'undefined' ? null : Number(sizeHeader);
47
- const writeStream = (0, fs_1.createWriteStream)(to);
47
+ const writeStream = (0, node_fs_1.createWriteStream)(to);
48
48
  let downloaded = 0;
49
49
  // Listen to 'close' event instead of more
50
50
  // concise method to avoid this problem
@@ -86,4 +86,19 @@ const downloadFile = ({ onProgress, url, to: toFn, }) => {
86
86
  });
87
87
  });
88
88
  };
89
+ const downloadFile = async (options, retries = 2) => {
90
+ try {
91
+ const res = await downloadFileWithoutRetries(options);
92
+ return res;
93
+ }
94
+ catch (err) {
95
+ if (err.message === 'aborted') {
96
+ if (retries === 0) {
97
+ throw err;
98
+ }
99
+ return (0, exports.downloadFile)(options, retries - 1);
100
+ }
101
+ throw err;
102
+ }
103
+ };
89
104
  exports.downloadFile = downloadFile;
@@ -27,18 +27,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.cleanDownloadMap = exports.makeDownloadMap = void 0;
30
- const fs_1 = __importStar(require("fs"));
31
- const path_1 = __importDefault(require("path"));
30
+ const node_fs_1 = __importStar(require("node:fs"));
31
+ const node_path_1 = __importDefault(require("node:path"));
32
32
  const delete_directory_1 = require("../delete-directory");
33
33
  const tmp_dir_1 = require("../tmp-dir");
34
34
  const makeAndReturn = (dir, name) => {
35
- const p = path_1.default.join(dir, name);
36
- (0, fs_1.mkdirSync)(p);
35
+ const p = node_path_1.default.join(dir, name);
36
+ (0, node_fs_1.mkdirSync)(p);
37
37
  return p;
38
38
  };
39
- const packageJsonPath = path_1.default.join(__dirname, '..', '..', 'package.json');
40
- const packageJson = fs_1.default.existsSync(packageJsonPath)
41
- ? JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8'))
39
+ const packageJsonPath = node_path_1.default.join(__dirname, '..', '..', 'package.json');
40
+ const packageJson = node_fs_1.default.existsSync(packageJsonPath)
41
+ ? JSON.parse(node_fs_1.default.readFileSync(packageJsonPath, 'utf-8'))
42
42
  : null;
43
43
  const makeDownloadMap = () => {
44
44
  const dir = (0, tmp_dir_1.tmpDir)(packageJson
@@ -1,2 +1,2 @@
1
- import http from 'http';
1
+ import http from 'node:http';
2
2
  export declare const readFile: (url: string, redirectsSoFar?: number) => Promise<http.IncomingMessage>;
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.readFile = void 0;
7
- const http_1 = __importDefault(require("http"));
8
7
  const https_1 = __importDefault(require("https"));
8
+ const node_http_1 = __importDefault(require("node:http"));
9
9
  const redirect_status_codes_1 = require("../redirect-status-codes");
10
10
  const getClient = (url) => {
11
11
  if (url.startsWith('https://')) {
12
12
  return https_1.default.get;
13
13
  }
14
14
  if (url.startsWith('http://')) {
15
- return http_1.default.get;
15
+ return node_http_1.default.get;
16
16
  }
17
17
  throw new Error('Can only download URLs starting with http:// or https://');
18
18
  };
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.sanitizeFilePath = void 0;
7
- const path_1 = __importDefault(require("path"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
8
  const sanitize_filename_1 = require("./sanitize-filename");
9
9
  const pathSeparators = /[/\\]/;
10
10
  const sanitizeFilePath = (pathToSanitize) => {
11
11
  return pathToSanitize
12
12
  .split(pathSeparators)
13
13
  .map((s) => (0, sanitize_filename_1.sanitizeFilename)(s))
14
- .join(path_1.default.sep);
14
+ .join(node_path_1.default.sep);
15
15
  };
16
16
  exports.sanitizeFilePath = sanitizeFilePath;
@@ -5,7 +5,7 @@ export declare const supportedAudioCodecs: {
5
5
  readonly h264: readonly ["aac", "pcm-16"];
6
6
  readonly 'h264-mkv': readonly ["pcm-16"];
7
7
  readonly aac: readonly ["aac", "pcm-16"];
8
- readonly gif: const[];
8
+ readonly gif: ("pcm-16" | "aac" | "mp3" | "opus")[];
9
9
  readonly h265: readonly ["aac", "pcm-16"];
10
10
  readonly mp3: readonly ["mp3", "pcm-16"];
11
11
  readonly prores: readonly ["aac", "pcm-16"];
@@ -42,16 +42,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
42
42
  };
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
44
  exports.getRevisionInfo = exports.getFolderPath = exports.removeBrowser = exports.localRevisions = exports.download = exports.getDownloadHost = exports.getDownloadsFolder = exports.getPlatform = void 0;
45
- const childProcess = __importStar(require("child_process"));
46
- const fs = __importStar(require("fs"));
47
- const http = __importStar(require("http"));
48
45
  const https = __importStar(require("https"));
49
- const os = __importStar(require("os"));
50
- const path = __importStar(require("path"));
51
- const util_1 = __importDefault(require("util"));
46
+ const childProcess = __importStar(require("node:child_process"));
47
+ const fs = __importStar(require("node:fs"));
48
+ const http = __importStar(require("node:http"));
49
+ const os = __importStar(require("node:os"));
50
+ const path = __importStar(require("node:path"));
51
+ const node_util_1 = __importDefault(require("node:util"));
52
52
  const extract_zip_1 = __importDefault(require("extract-zip"));
53
- const URL = __importStar(require("url"));
54
- const util_2 = require("util");
53
+ const URL = __importStar(require("node:url"));
54
+ const node_util_2 = require("node:util");
55
55
  const assert_1 = require("./assert");
56
56
  const delete_directory_1 = require("../delete-directory");
57
57
  const get_download_destination_1 = require("./get-download-destination");
@@ -109,7 +109,7 @@ function _downloadURL(product, platform, host, revision) {
109
109
  if (platform === 'win64' || platform === 'win32') {
110
110
  return 'https://remotionchromium-binaries.s3.eu-central-1.amazonaws.com/thorium-107.zip';
111
111
  }
112
- return util_1.default.format(downloadURLs[product][platform], host, revision, archiveName(product, platform, revision));
112
+ return node_util_1.default.format(downloadURLs[product][platform], host, revision, archiveName(product, platform, revision));
113
113
  }
114
114
  function handleArm64() {
115
115
  let exists = fs.existsSync('/usr/bin/chromium-browser');
@@ -126,10 +126,10 @@ function handleArm64() {
126
126
  '\n\n sudo apt install chromium-browser\n');
127
127
  throw new Error();
128
128
  }
129
- const readdirAsync = (0, util_2.promisify)(fs.readdir.bind(fs));
130
- const mkdirAsync = (0, util_2.promisify)(fs.mkdir.bind(fs));
131
- const unlinkAsync = (0, util_2.promisify)(fs.unlink.bind(fs));
132
- const chmodAsync = (0, util_2.promisify)(fs.chmod.bind(fs));
129
+ const readdirAsync = (0, node_util_2.promisify)(fs.readdir.bind(fs));
130
+ const mkdirAsync = (0, node_util_2.promisify)(fs.mkdir.bind(fs));
131
+ const unlinkAsync = (0, node_util_2.promisify)(fs.unlink.bind(fs));
132
+ const chmodAsync = (0, node_util_2.promisify)(fs.chmod.bind(fs));
133
133
  function existsAsync(filePath) {
134
134
  return new Promise((resolve) => {
135
135
  fs.access(filePath, (err) => {
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  /// <reference types="node" />
17
- import * as childProcess from 'child_process';
17
+ import * as childProcess from 'node:child_process';
18
18
  import { Connection } from './Connection';
19
19
  import type { LaunchOptions } from './LaunchOptions';
20
20
  export declare class BrowserRunner {
@@ -51,8 +51,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
51
51
  var _BrowserRunner_executablePath, _BrowserRunner_processArguments, _BrowserRunner_userDataDir, _BrowserRunner_closed, _BrowserRunner_listeners, _BrowserRunner_processClosing;
52
52
  Object.defineProperty(exports, "__esModule", { value: true });
53
53
  exports.BrowserRunner = void 0;
54
- const childProcess = __importStar(require("child_process"));
55
- const fs = __importStar(require("fs"));
54
+ const childProcess = __importStar(require("node:child_process"));
55
+ const fs = __importStar(require("node:fs"));
56
56
  const readline = __importStar(require("readline"));
57
57
  const delete_directory_1 = require("../delete-directory");
58
58
  const assert_1 = require("./assert");
@@ -42,9 +42,9 @@ exports.ChromeLauncher = void 0;
42
42
  * See the License for the specific language governing permissions and
43
43
  * limitations under the License.
44
44
  */
45
- const fs_1 = __importDefault(require("fs"));
46
- const os = __importStar(require("os"));
47
- const path = __importStar(require("path"));
45
+ const node_fs_1 = __importDefault(require("node:fs"));
46
+ const os = __importStar(require("node:os"));
47
+ const path = __importStar(require("node:path"));
48
48
  const assert_1 = require("./assert");
49
49
  const Browser_1 = require("./Browser");
50
50
  const BrowserRunner_1 = require("./BrowserRunner");
@@ -72,7 +72,7 @@ class ChromeLauncher {
72
72
  }
73
73
  // Check for the user data dir argument, which will always be set even
74
74
  // with a custom directory specified via the userDataDir option.
75
- const userDataDir = await fs_1.default.promises.mkdtemp(path.join(tmpDir(), 'puppeteer_dev_chrome_profile-'));
75
+ const userDataDir = await node_fs_1.default.promises.mkdtemp(path.join(tmpDir(), 'puppeteer_dev_chrome_profile-'));
76
76
  chromeArguments.push(`--user-data-dir=${userDataDir}`);
77
77
  let chromeExecutable = executablePath;
78
78
  if (!chromeExecutable) {
@@ -28,8 +28,8 @@ exports.NodeWebSocketTransport = void 0;
28
28
  * See the License for the specific language governing permissions and
29
29
  * limitations under the License.
30
30
  */
31
- const dns_1 = require("dns");
32
- const url_1 = require("url");
31
+ const node_dns_1 = require("node:dns");
32
+ const node_url_1 = require("node:url");
33
33
  const ws_types_1 = require("../ws/ws-types");
34
34
  class NodeWebSocketTransport {
35
35
  constructor(ws) {
@@ -56,9 +56,9 @@ class NodeWebSocketTransport {
56
56
  // manually with the previous behavior according to:
57
57
  // - https://nodejs.org/api/dns.html#dnslookuphostname-options-callback
58
58
  // because of https://bugzilla.mozilla.org/show_bug.cgi?id=1769994.
59
- const url = new url_1.URL(urlString);
59
+ const url = new node_url_1.URL(urlString);
60
60
  if (url.hostname === 'localhost') {
61
- const { address } = await dns_1.promises.lookup(url.hostname, { verbatim: false });
61
+ const { address } = await node_dns_1.promises.lookup(url.hostname, { verbatim: false });
62
62
  url.hostname = address;
63
63
  }
64
64
  return new Promise((resolve, reject) => {
@@ -4,20 +4,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getDownloadsCacheDir = 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 getDownloadsCacheDir = () => {
10
10
  const cwd = process.cwd();
11
11
  let dir = cwd;
12
12
  for (;;) {
13
13
  try {
14
- if (fs_1.default.statSync(path_1.default.join(dir, 'package.json')).isFile()) {
14
+ if (node_fs_1.default.statSync(node_path_1.default.join(dir, 'package.json')).isFile()) {
15
15
  break;
16
16
  }
17
17
  // eslint-disable-next-line no-empty
18
18
  }
19
19
  catch (e) { }
20
- const parent = path_1.default.dirname(dir);
20
+ const parent = node_path_1.default.dirname(dir);
21
21
  if (dir === parent) {
22
22
  dir = undefined;
23
23
  break;
@@ -25,14 +25,14 @@ const getDownloadsCacheDir = () => {
25
25
  dir = parent;
26
26
  }
27
27
  if (!dir) {
28
- return path_1.default.resolve(cwd, '.remotion');
28
+ return node_path_1.default.resolve(cwd, '.remotion');
29
29
  }
30
30
  if (process.versions.pnp === '1') {
31
- return path_1.default.resolve(dir, '.pnp/.remotion');
31
+ return node_path_1.default.resolve(dir, '.pnp/.remotion');
32
32
  }
33
33
  if (process.versions.pnp === '3') {
34
- return path_1.default.resolve(dir, '.yarn/.remotion');
34
+ return node_path_1.default.resolve(dir, '.yarn/.remotion');
35
35
  }
36
- return path_1.default.resolve(dir, 'node_modules/.remotion');
36
+ return node_path_1.default.resolve(dir, 'node_modules/.remotion');
37
37
  };
38
38
  exports.getDownloadsCacheDir = getDownloadsCacheDir;
@@ -5,11 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.callFf = exports.dynamicLibraryPathOptions = void 0;
7
7
  const execa_1 = __importDefault(require("execa"));
8
- const path_1 = __importDefault(require("path"));
8
+ const node_fs_1 = require("node:fs");
9
+ const node_path_1 = __importDefault(require("node:path"));
9
10
  const get_executable_path_1 = require("./compositor/get-executable-path");
10
11
  const truthy_1 = require("./truthy");
11
12
  const dynamicLibraryPathOptions = () => {
12
- const lib = path_1.default.join((0, get_executable_path_1.getExecutablePath)('ffmpeg-cwd'), 'remotion', 'lib');
13
+ const lib = node_path_1.default.join((0, get_executable_path_1.getExecutablePath)('ffmpeg-cwd'), 'remotion', 'lib');
13
14
  return {
14
15
  env: {
15
16
  RUST_BACKTRACE: 'full',
@@ -29,7 +30,9 @@ const dynamicLibraryPathOptions = () => {
29
30
  };
30
31
  exports.dynamicLibraryPathOptions = dynamicLibraryPathOptions;
31
32
  const callFf = (bin, args, options) => {
32
- return (0, execa_1.default)((0, get_executable_path_1.getExecutablePath)(bin), args.filter(truthy_1.truthy), {
33
+ const executablePath = (0, get_executable_path_1.getExecutablePath)(bin);
34
+ (0, node_fs_1.chmodSync)(executablePath, 0o755);
35
+ return (0, execa_1.default)(executablePath, args.filter(truthy_1.truthy), {
33
36
  ...(0, exports.dynamicLibraryPathOptions)(),
34
37
  ...options,
35
38
  });
package/dist/client.d.ts CHANGED
@@ -12,7 +12,7 @@ export declare const BrowserSafeApis: {
12
12
  readonly h264: readonly ["aac", "pcm-16"];
13
13
  readonly 'h264-mkv': readonly ["pcm-16"];
14
14
  readonly aac: readonly ["aac", "pcm-16"];
15
- readonly gif: const[];
15
+ readonly gif: ("pcm-16" | "aac" | "mp3" | "opus")[];
16
16
  readonly h265: readonly ["aac", "pcm-16"];
17
17
  readonly mp3: readonly ["mp3", "pcm-16"];
18
18
  readonly prores: readonly ["aac", "pcm-16"];
@@ -133,7 +133,19 @@ export declare const BrowserSafeApis: {
133
133
  gif: {
134
134
  default: import("./file-extensions").FileExtension;
135
135
  forAudioCodec: {
136
- [x: string]: {
136
+ "pcm-16": {
137
+ possible: import("./file-extensions").FileExtension[];
138
+ default: import("./file-extensions").FileExtension;
139
+ };
140
+ aac: {
141
+ possible: import("./file-extensions").FileExtension[];
142
+ default: import("./file-extensions").FileExtension;
143
+ };
144
+ mp3: {
145
+ possible: import("./file-extensions").FileExtension[];
146
+ default: import("./file-extensions").FileExtension;
147
+ };
148
+ opus: {
137
149
  possible: import("./file-extensions").FileExtension[];
138
150
  default: import("./file-extensions").FileExtension;
139
151
  };
@@ -178,8 +190,8 @@ export declare const BrowserSafeApis: {
178
190
  lossless: "pcm-16" | null;
179
191
  };
180
192
  gif: {
181
- compressed: any;
182
- lossless: any;
193
+ compressed: "pcm-16" | "aac" | "mp3" | "opus" | null;
194
+ lossless: "pcm-16" | "aac" | "mp3" | "opus" | null;
183
195
  };
184
196
  };
185
197
  defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "aac" | "mp3" | "h264" | "h265" | "vp8" | "vp9" | "wav" | "prores" | "h264-mkv" | "gif">;
@@ -2,8 +2,8 @@
2
2
  // Combine multiple video chunks, useful for decentralized rendering
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.combineVideos = void 0;
5
- const fs_1 = require("fs");
6
- const path_1 = require("path");
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
7
  const audio_codec_1 = require("./audio-codec");
8
8
  const call_ffmpeg_1 = require("./call-ffmpeg");
9
9
  const is_audio_codec_1 = require("./is-audio-codec");
@@ -13,8 +13,8 @@ const combineVideos = async (options) => {
13
13
  var _a;
14
14
  const { files, filelistDir, output, onProgress, numberOfFrames, codec, fps, numberOfGifLoops, audioCodec, } = options;
15
15
  const fileList = files.map((p) => `file '${p}'`).join('\n');
16
- const fileListTxt = (0, path_1.join)(filelistDir, 'files.txt');
17
- (0, fs_1.writeFileSync)(fileListTxt, fileList);
16
+ const fileListTxt = (0, node_path_1.join)(filelistDir, 'files.txt');
17
+ (0, node_fs_1.writeFileSync)(fileListTxt, fileList);
18
18
  const resolvedAudioCodec = audioCodec !== null && audioCodec !== void 0 ? audioCodec : (0, audio_codec_1.getDefaultAudioCodec)({ codec, preferLossless: false });
19
19
  try {
20
20
  const task = (0, call_ffmpeg_1.callFf)('ffmpeg', [
@@ -56,10 +56,10 @@ const combineVideos = async (options) => {
56
56
  });
57
57
  await task;
58
58
  onProgress(numberOfFrames);
59
- (0, fs_1.rmSync)(filelistDir, { recursive: true });
59
+ (0, node_fs_1.rmSync)(filelistDir, { recursive: true });
60
60
  }
61
61
  catch (err) {
62
- (0, fs_1.rmSync)(filelistDir, { recursive: true });
62
+ (0, node_fs_1.rmSync)(filelistDir, { recursive: true });
63
63
  throw err;
64
64
  }
65
65
  };
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.callCompositor = exports.compose = exports.serializeCommand = void 0;
4
- const child_process_1 = require("child_process");
5
- const crypto_1 = require("crypto");
6
- const promises_1 = require("fs/promises");
4
+ const node_child_process_1 = require("node:child_process");
5
+ const node_crypto_1 = require("node:crypto");
6
+ const node_fs_1 = require("node:fs");
7
+ const promises_1 = require("node:fs/promises");
7
8
  const call_ffmpeg_1 = require("../call-ffmpeg");
8
9
  const get_executable_path_1 = require("./get-executable-path");
9
10
  const make_nonce_1 = require("./make-nonce");
10
11
  const getCompositorHash = ({ ...input }) => {
11
- return (0, crypto_1.createHash)('sha256').update(JSON.stringify(input)).digest('base64');
12
+ return (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(input)).digest('base64');
12
13
  };
13
14
  const serializeCommand = (command, params) => {
14
15
  return {
@@ -39,7 +40,9 @@ const compose = async ({ height, width, layers, output, downloadMap, imageFormat
39
40
  exports.compose = compose;
40
41
  const callCompositor = (payload) => {
41
42
  return new Promise((resolve, reject) => {
42
- const child = (0, child_process_1.spawn)((0, get_executable_path_1.getExecutablePath)('compositor'), [payload], (0, call_ffmpeg_1.dynamicLibraryPathOptions)());
43
+ const execPath = (0, get_executable_path_1.getExecutablePath)('compositor');
44
+ (0, node_fs_1.chmodSync)(execPath, 0o755);
45
+ const child = (0, node_child_process_1.spawn)(execPath, [payload], (0, call_ffmpeg_1.dynamicLibraryPathOptions)());
43
46
  child.stdin.write(payload);
44
47
  child.stdin.end();
45
48
  const stderrChunks = [];
@@ -4,15 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.startCompositor = exports.startLongRunningCompositor = exports.getIdealMaximumFrameCacheItems = void 0;
7
- const child_process_1 = require("child_process");
8
- const os_1 = __importDefault(require("os"));
7
+ const node_child_process_1 = require("node:child_process");
8
+ const node_fs_1 = require("node:fs");
9
+ const node_os_1 = __importDefault(require("node:os"));
9
10
  const call_ffmpeg_1 = require("../call-ffmpeg");
10
11
  const get_concurrency_1 = require("../get-concurrency");
11
12
  const compose_1 = require("./compose");
12
13
  const get_executable_path_1 = require("./get-executable-path");
13
14
  const make_nonce_1 = require("./make-nonce");
14
15
  const getIdealMaximumFrameCacheItems = () => {
15
- const freeMemory = os_1.default.freemem();
16
+ const freeMemory = node_os_1.default.freemem();
16
17
  // Assuming 1 frame is approximately 6MB
17
18
  // Assuming only half the available memory should be used
18
19
  const max = Math.floor(freeMemory / (1024 * 1024 * 6));
@@ -32,8 +33,9 @@ exports.startLongRunningCompositor = startLongRunningCompositor;
32
33
  const startCompositor = (type, payload) => {
33
34
  var _a;
34
35
  const bin = (0, get_executable_path_1.getExecutablePath)('compositor');
36
+ (0, node_fs_1.chmodSync)(bin, 0o755);
35
37
  const fullCommand = (0, compose_1.serializeCommand)(type, payload);
36
- const child = (0, child_process_1.spawn)(bin, [JSON.stringify(fullCommand)], (0, call_ffmpeg_1.dynamicLibraryPathOptions)());
38
+ const child = (0, node_child_process_1.spawn)(bin, [JSON.stringify(fullCommand)], (0, call_ffmpeg_1.dynamicLibraryPathOptions)());
37
39
  const stderrChunks = [];
38
40
  let outputBuffer = Buffer.from('');
39
41
  const separator = Buffer.from('remotion_buffer:');
@@ -24,13 +24,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.deleteDirectory = void 0;
27
- const fs_1 = __importStar(require("fs"));
27
+ const node_fs_1 = __importStar(require("node:fs"));
28
28
  const is_serve_url_1 = require("./is-serve-url");
29
29
  const deleteDirectory = (directory) => {
30
30
  if ((0, is_serve_url_1.isServeUrl)(directory)) {
31
31
  return;
32
32
  }
33
- if (!(0, fs_1.existsSync)(directory)) {
33
+ if (!(0, node_fs_1.existsSync)(directory)) {
34
34
  return;
35
35
  }
36
36
  // Working around a bug with NodeJS 16 on Windows:
@@ -41,7 +41,7 @@ const deleteDirectory = (directory) => {
41
41
  let retries = 2;
42
42
  while (retries >= 0) {
43
43
  try {
44
- fs_1.default.rmSync(directory, {
44
+ node_fs_1.default.rmSync(directory, {
45
45
  maxRetries: 2,
46
46
  recursive: true,
47
47
  force: true,
@@ -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
  };
@@ -23,7 +23,13 @@ exports.defaultFileExtensionMap = {
23
23
  },
24
24
  gif: {
25
25
  default: 'gif',
26
- 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
+ },
27
33
  },
28
34
  h264: {
29
35
  default: 'mp4',