@remotion/renderer 4.0.33 → 4.0.34

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.
package/dist/client.d.ts CHANGED
@@ -1,10 +1,11 @@
1
+ /// <reference types="react" />
1
2
  export declare const BrowserSafeApis: {
2
- getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif">(codec: T, audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => import("./file-extensions").FileExtension;
3
+ getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">(codec: T, audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => import("./file-extensions").FileExtension;
3
4
  validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
4
5
  validAudioCodecs: readonly ["pcm-16", "aac", "mp3", "opus"];
5
- getDefaultCrfForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif") => number;
6
- getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif") => [number, number];
7
- isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif" | undefined) => boolean;
6
+ getDefaultCrfForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => number;
7
+ getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => [number, number];
8
+ isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
8
9
  proResProfileOptions: readonly ["4444-xq", "4444", "hq", "standard", "light", "proxy"];
9
10
  x264PresetOptions: readonly ["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo"];
10
11
  validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
@@ -78,10 +79,10 @@ export declare const BrowserSafeApis: {
78
79
  };
79
80
  };
80
81
  };
81
- prores: {
82
+ mp3: {
82
83
  default: import("./file-extensions").FileExtension;
83
84
  forAudioCodec: {
84
- aac: {
85
+ mp3: {
85
86
  possible: import("./file-extensions").FileExtension[];
86
87
  default: import("./file-extensions").FileExtension;
87
88
  };
@@ -91,10 +92,10 @@ export declare const BrowserSafeApis: {
91
92
  };
92
93
  };
93
94
  };
94
- mp3: {
95
+ aac: {
95
96
  default: import("./file-extensions").FileExtension;
96
97
  forAudioCodec: {
97
- mp3: {
98
+ aac: {
98
99
  possible: import("./file-extensions").FileExtension[];
99
100
  default: import("./file-extensions").FileExtension;
100
101
  };
@@ -104,22 +105,22 @@ export declare const BrowserSafeApis: {
104
105
  };
105
106
  };
106
107
  };
107
- aac: {
108
+ wav: {
108
109
  default: import("./file-extensions").FileExtension;
109
110
  forAudioCodec: {
110
- aac: {
111
- possible: import("./file-extensions").FileExtension[];
112
- default: import("./file-extensions").FileExtension;
113
- };
114
111
  "pcm-16": {
115
112
  possible: import("./file-extensions").FileExtension[];
116
113
  default: import("./file-extensions").FileExtension;
117
114
  };
118
115
  };
119
116
  };
120
- wav: {
117
+ prores: {
121
118
  default: import("./file-extensions").FileExtension;
122
119
  forAudioCodec: {
120
+ aac: {
121
+ possible: import("./file-extensions").FileExtension[];
122
+ default: import("./file-extensions").FileExtension;
123
+ };
123
124
  "pcm-16": {
124
125
  possible: import("./file-extensions").FileExtension[];
125
126
  default: import("./file-extensions").FileExtension;
@@ -161,10 +162,6 @@ export declare const BrowserSafeApis: {
161
162
  compressed: "pcm-16" | "opus" | null;
162
163
  lossless: "pcm-16" | "opus" | null;
163
164
  };
164
- prores: {
165
- compressed: "aac" | "pcm-16" | null;
166
- lossless: "aac" | "pcm-16" | null;
167
- };
168
165
  mp3: {
169
166
  compressed: "mp3" | "pcm-16" | null;
170
167
  lossless: "mp3" | "pcm-16" | null;
@@ -177,6 +174,10 @@ export declare const BrowserSafeApis: {
177
174
  compressed: "pcm-16" | null;
178
175
  lossless: "pcm-16" | null;
179
176
  };
177
+ prores: {
178
+ compressed: "aac" | "pcm-16" | null;
179
+ lossless: "aac" | "pcm-16" | null;
180
+ };
180
181
  "h264-mkv": {
181
182
  compressed: "mp3" | "pcm-16" | null;
182
183
  lossless: "mp3" | "pcm-16" | null;
@@ -186,8 +187,8 @@ export declare const BrowserSafeApis: {
186
187
  lossless: null;
187
188
  };
188
189
  };
189
- defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif">;
190
- validateOutputFilename: <T_1 extends "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif">({ codec, audioCodec, extension, preferLossless, }: {
190
+ defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">;
191
+ validateOutputFilename: <T_1 extends "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">({ codec, audioCodec, extension, preferLossless, }: {
191
192
  codec: T_1;
192
193
  audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
193
194
  extension: string;
@@ -280,7 +281,7 @@ export declare const BrowserSafeApis: {
280
281
  description: () => JSX.Element;
281
282
  docLink: string;
282
283
  ssrName: string;
283
- type: "bt709" | "default";
284
+ type: "default" | "bt709";
284
285
  };
285
286
  deleteAfterOption: {
286
287
  name: string;
@@ -382,6 +383,6 @@ export declare const BrowserSafeApis: {
382
383
  type: number | null;
383
384
  }];
384
385
  };
385
- codecSupportsCrf: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif") => boolean;
386
- codecSupportsVideoBitrate: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif") => boolean;
386
+ codecSupportsCrf: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => boolean;
387
+ codecSupportsVideoBitrate: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => boolean;
387
388
  };
@@ -0,0 +1 @@
1
+ export declare const getAvailableMemory: () => number;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAvailableMemory = void 0;
4
+ const node_fs_1 = require("node:fs");
5
+ const node_os_1 = require("node:os");
6
+ const logger_1 = require("./logger");
7
+ const getFreeMemoryFromProcMeminfo = () => {
8
+ const data = (0, node_fs_1.readFileSync)('/proc/meminfo', 'utf-8');
9
+ // Split the file by lines and find the line with MemFree
10
+ const lines = data.split('\n');
11
+ const memAvailableLine = lines.find((line) => line.startsWith('MemAvailable'));
12
+ // If we couldn't find MemAvailable, return an error
13
+ if (!memAvailableLine) {
14
+ throw new Error('MemAvailable not found in /proc/meminfo');
15
+ }
16
+ // Extract the value and unit from the line
17
+ const matches = memAvailableLine.match(/(\d+)\s+(\w+)/);
18
+ if (!matches || matches.length !== 3) {
19
+ throw new Error('Failed to parse MemAvailable value');
20
+ }
21
+ const value = parseInt(matches[1], 10);
22
+ const unit = matches[2].toLowerCase();
23
+ // Convert the value to bytes based on its unit
24
+ switch (unit) {
25
+ case 'kb':
26
+ return value * 1024;
27
+ case 'mb':
28
+ return value * 1024 * 1024;
29
+ case 'gb':
30
+ return value * 1024 * 1024 * 1024;
31
+ default:
32
+ throw new Error(`Unknown unit: ${unit}`);
33
+ }
34
+ };
35
+ const getAvailableMemory = () => {
36
+ if ((0, node_fs_1.existsSync)('/proc/meminfo')) {
37
+ try {
38
+ getFreeMemoryFromProcMeminfo();
39
+ }
40
+ catch (err) {
41
+ logger_1.Log.warn('Tried to get available memory from /proc/meminfo but failed. Falling back to os.freemem(). Error:');
42
+ logger_1.Log.warn(err);
43
+ }
44
+ }
45
+ return (0, node_os_1.freemem)();
46
+ };
47
+ exports.getAvailableMemory = getAvailableMemory;
@@ -1,26 +1,23 @@
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.getActualConcurrency = void 0;
7
- const node_os_1 = __importDefault(require("node:os"));
4
+ const get_cpu_count_1 = require("./get-cpu-count");
8
5
  const getActualConcurrency = (userPreference) => {
6
+ const maxCpus = (0, get_cpu_count_1.getCpuCount)();
9
7
  if (userPreference === null) {
10
- return Math.round(Math.min(8, Math.max(1, node_os_1.default.cpus().length / 2)));
8
+ return Math.round(Math.min(8, Math.max(1, maxCpus / 2)));
11
9
  }
12
- const max = node_os_1.default.cpus().length;
13
10
  const min = 1;
14
11
  let rounded;
15
12
  if (typeof userPreference === 'string') {
16
13
  const percentage = parseInt(userPreference.slice(0, -1), 10);
17
- rounded = Math.floor((percentage / 100) * max);
14
+ rounded = Math.floor((percentage / 100) * maxCpus);
18
15
  }
19
16
  else {
20
17
  rounded = Math.floor(userPreference);
21
18
  }
22
- if (rounded > max) {
23
- throw new Error(`Maximum for --concurrency is ${max} (number of cores on this system)`);
19
+ if (rounded > maxCpus) {
20
+ throw new Error(`Maximum for --concurrency is ${maxCpus} (number of cores on this system)`);
24
21
  }
25
22
  if (rounded < min) {
26
23
  throw new Error(`Minimum for concurrency is ${min}.`);
@@ -0,0 +1 @@
1
+ export declare const getCpuCount: () => number;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ // Kubernetes uses the following command to spawn Docker containers:
3
+ // docker run --cpuset-cpus="0,1" to assign only 2 CPUs.
4
+ // However, Node.js returns the core count of the host system (up to 96!)
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getCpuCount = void 0;
7
+ const node_child_process_1 = require("node:child_process");
8
+ const node_os_1 = require("node:os");
9
+ // We also get it from nproc and use the minimum of the two.
10
+ const getConcurrencyFromNProc = () => {
11
+ try {
12
+ return parseInt((0, node_child_process_1.execSync)('nproc').toString().trim(), 10);
13
+ }
14
+ catch (error) {
15
+ return null;
16
+ }
17
+ };
18
+ const getCpuCount = () => {
19
+ const node = (0, node_os_1.cpus)().length;
20
+ const nproc = getConcurrencyFromNProc();
21
+ if (nproc === null) {
22
+ return node;
23
+ }
24
+ return Math.min(nproc, node);
25
+ };
26
+ exports.getCpuCount = getCpuCount;
@@ -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" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif">(codec: T, audioCodec: AudioCodec | null) => FileExtension;
5
- export declare const makeFileExtensionMap: () => Record<string, ("h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif")[]>;
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")[]>;
6
6
  export declare const defaultCodecsForFileExtension: Record<FileExtension, Codec>;
@@ -1,15 +1,13 @@
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.getIdealVideoThreadsFlag = void 0;
7
- const node_os_1 = __importDefault(require("node:os"));
4
+ const get_available_memory_1 = require("./get-available-memory");
5
+ const get_cpu_count_1 = require("./get-cpu-count");
8
6
  const MEMORY_USAGE_PER_THREAD = 400000000; // 400MB
9
7
  const RESERVED_MEMORY = 2000000000;
10
8
  const getIdealVideoThreadsFlag = () => {
11
- const freeMemory = node_os_1.default.freemem();
12
- const cpus = node_os_1.default.cpus().length;
9
+ const freeMemory = (0, get_available_memory_1.getAvailableMemory)();
10
+ const cpus = (0, get_cpu_count_1.getCpuCount)();
13
11
  const maxRecommendedBasedOnCpus = (cpus * 2) / 3;
14
12
  const maxRecommendedBasedOnMemory = (freeMemory - RESERVED_MEMORY) / MEMORY_USAGE_PER_THREAD;
15
13
  const maxRecommended = Math.min(maxRecommendedBasedOnCpus, maxRecommendedBasedOnMemory);
package/dist/index.d.ts CHANGED
@@ -60,9 +60,9 @@ export declare const RenderInternals: {
60
60
  width: number;
61
61
  height: number;
62
62
  scale: number;
63
- codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif";
63
+ codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
64
64
  }) => void;
65
- getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif">(codec: T, audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => import("./file-extensions").FileExtension;
65
+ getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">(codec: T, audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => import("./file-extensions").FileExtension;
66
66
  tmpDir: (str: string) => string;
67
67
  deleteDirectory: (directory: string) => void;
68
68
  isServeUrl: (potentialUrl: string) => boolean;
@@ -112,7 +112,7 @@ export declare const RenderInternals: {
112
112
  };
113
113
  registerErrorSymbolicationLock: () => number;
114
114
  unlockErrorSymbolicationLock: (id: number) => void;
115
- canUseParallelEncoding: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif") => boolean;
115
+ canUseParallelEncoding: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => boolean;
116
116
  mimeContentType: typeof mimeContentType;
117
117
  mimeLookup: typeof mimeLookup;
118
118
  validateConcurrency: ({ setting, value, checkIfValidForCurrentMachine, }: {
@@ -129,8 +129,8 @@ export declare const RenderInternals: {
129
129
  DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
130
130
  validateJpegQuality: (q: number | undefined) => void;
131
131
  DEFAULT_TIMEOUT: number;
132
- DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif";
133
- isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif" | undefined) => boolean;
132
+ DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
133
+ isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
134
134
  logLevels: readonly ["verbose", "info", "warn", "error"];
135
135
  isEqualOrBelowLogLevel: (currentLevel: "verbose" | "info" | "warn" | "error", level: "verbose" | "info" | "warn" | "error") => boolean;
136
136
  isValidLogLevel: (level: string) => boolean;
@@ -147,15 +147,15 @@ export declare const RenderInternals: {
147
147
  output: string;
148
148
  onProgress: (p: number) => void;
149
149
  numberOfFrames: number;
150
- codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif";
150
+ codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
151
151
  fps: number;
152
152
  numberOfGifLoops: number | null;
153
153
  audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
154
154
  }) => Promise<void>;
155
155
  getMinConcurrency: () => number;
156
- getMaxConcurrency: () => any;
156
+ getMaxConcurrency: () => number;
157
157
  getDefaultAudioCodec: ({ codec, preferLossless, }: {
158
- codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif";
158
+ codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
159
159
  preferLossless: boolean;
160
160
  }) => "mp3" | "aac" | "pcm-16" | "opus" | null;
161
161
  validAudioCodecs: readonly ["pcm-16", "aac", "mp3", "opus"];
@@ -216,10 +216,10 @@ export declare const RenderInternals: {
216
216
  };
217
217
  };
218
218
  };
219
- prores: {
219
+ mp3: {
220
220
  default: import("./file-extensions").FileExtension;
221
221
  forAudioCodec: {
222
- aac: {
222
+ mp3: {
223
223
  possible: import("./file-extensions").FileExtension[];
224
224
  default: import("./file-extensions").FileExtension;
225
225
  };
@@ -229,10 +229,10 @@ export declare const RenderInternals: {
229
229
  };
230
230
  };
231
231
  };
232
- mp3: {
232
+ aac: {
233
233
  default: import("./file-extensions").FileExtension;
234
234
  forAudioCodec: {
235
- mp3: {
235
+ aac: {
236
236
  possible: import("./file-extensions").FileExtension[];
237
237
  default: import("./file-extensions").FileExtension;
238
238
  };
@@ -242,22 +242,22 @@ export declare const RenderInternals: {
242
242
  };
243
243
  };
244
244
  };
245
- aac: {
245
+ wav: {
246
246
  default: import("./file-extensions").FileExtension;
247
247
  forAudioCodec: {
248
- aac: {
249
- possible: import("./file-extensions").FileExtension[];
250
- default: import("./file-extensions").FileExtension;
251
- };
252
248
  "pcm-16": {
253
249
  possible: import("./file-extensions").FileExtension[];
254
250
  default: import("./file-extensions").FileExtension;
255
251
  };
256
252
  };
257
253
  };
258
- wav: {
254
+ prores: {
259
255
  default: import("./file-extensions").FileExtension;
260
256
  forAudioCodec: {
257
+ aac: {
258
+ possible: import("./file-extensions").FileExtension[];
259
+ default: import("./file-extensions").FileExtension;
260
+ };
261
261
  "pcm-16": {
262
262
  possible: import("./file-extensions").FileExtension[];
263
263
  default: import("./file-extensions").FileExtension;
@@ -294,8 +294,8 @@ export declare const RenderInternals: {
294
294
  readonly vp9: readonly ["opus", "pcm-16"];
295
295
  readonly wav: readonly ["pcm-16"];
296
296
  };
297
- makeFileExtensionMap: () => Record<string, ("h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif")[]>;
298
- defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif">;
297
+ makeFileExtensionMap: () => Record<string, ("h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif")[]>;
298
+ defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">;
299
299
  getExecutablePath: (type: "compositor" | "ffmpeg" | "ffprobe" | "ffmpeg-cwd") => string;
300
300
  callFf: (bin: "ffmpeg" | "ffprobe", args: (string | null)[], options?: execa.Options<string> | undefined) => execa.ExecaChildProcess<string>;
301
301
  dynamicLibraryPathOptions: () => {
@@ -313,7 +313,7 @@ export declare const RenderInternals: {
313
313
  validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
314
314
  validVideoImageFormats: readonly ["png", "jpeg", "none"];
315
315
  DEFAULT_STILL_IMAGE_FORMAT: "png" | "jpeg" | "pdf" | "webp";
316
- DEFAULT_VIDEO_IMAGE_FORMAT: "none" | "png" | "jpeg";
316
+ DEFAULT_VIDEO_IMAGE_FORMAT: "png" | "jpeg" | "none";
317
317
  DEFAULT_JPEG_QUALITY: number;
318
318
  chalk: {
319
319
  enabled: () => boolean;
@@ -7,6 +7,6 @@ export declare const colorSpaceOption: {
7
7
  description: () => JSX.Element;
8
8
  docLink: string;
9
9
  ssrName: string;
10
- type: "bt709" | "default";
10
+ type: "default" | "bt709";
11
11
  };
12
12
  export declare const validateColorSpace: (option: unknown) => void;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const deleteAfterOption: {
2
3
  name: string;
3
4
  cliFlag: "delete-after";
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const folderExpiryOption: {
2
3
  name: string;
3
4
  cliFlag: "enable-folder-expiry";
@@ -1,10 +1,7 @@
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.shouldUseParallelEncoding = void 0;
7
- const node_os_1 = __importDefault(require("node:os"));
4
+ const get_available_memory_1 = require("./get-available-memory");
8
5
  const estimateMemoryUsageForPrestitcher = ({ width, height, }) => {
9
6
  // Empirically we detected that per 1 million pixels, FFMPEG uses around 1GB of memory, relatively independent of
10
7
  // the duration of the video.
@@ -13,7 +10,7 @@ const estimateMemoryUsageForPrestitcher = ({ width, height, }) => {
13
10
  return memoryUsageOfPixel * width * height;
14
11
  };
15
12
  const shouldUseParallelEncoding = ({ width, height, }) => {
16
- const freeMemory = node_os_1.default.freemem();
13
+ const freeMemory = (0, get_available_memory_1.getAvailableMemory)();
17
14
  const estimatedUsage = estimateMemoryUsageForPrestitcher({
18
15
  height,
19
16
  width,
@@ -98,6 +98,12 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, s
98
98
  logLevel,
99
99
  tag: 'renderMedia()',
100
100
  }, 'Free memory:', freeMemory, 'Estimated usage parallel encoding', estimatedUsage);
101
+ const actualConcurrency = (0, get_concurrency_1.getActualConcurrency)(concurrency);
102
+ logger_1.Log.verboseAdvanced({
103
+ indent,
104
+ logLevel,
105
+ tag: 'renderMedia()',
106
+ }, 'Using concurrency:', actualConcurrency);
101
107
  logger_1.Log.verboseAdvanced({
102
108
  indent,
103
109
  logLevel,
@@ -233,7 +239,7 @@ const internalRenderMediaRaw = ({ proResProfile, x264Preset, crf, composition, s
233
239
  Promise.resolve(createPrestitcherIfNecessary())
234
240
  .then(() => {
235
241
  return (0, prepare_server_1.makeOrReuseServer)(reusedServer, {
236
- concurrency: (0, get_concurrency_1.getActualConcurrency)(concurrency),
242
+ concurrency: actualConcurrency,
237
243
  indent,
238
244
  port,
239
245
  remotionRoot: (0, find_closest_package_json_1.findRemotionRoot)(),
@@ -3,5 +3,5 @@ export declare const validateConcurrency: ({ setting, value, checkIfValidForCurr
3
3
  setting: string;
4
4
  checkIfValidForCurrentMachine: boolean;
5
5
  }) => void;
6
- export declare const getMaxConcurrency: () => any;
6
+ export declare const getMaxConcurrency: () => number;
7
7
  export declare const getMinConcurrency: () => number;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMinConcurrency = exports.getMaxConcurrency = exports.validateConcurrency = void 0;
4
+ const get_cpu_count_1 = require("./get-cpu-count");
4
5
  const validateConcurrency = ({ setting, value, checkIfValidForCurrentMachine, }) => {
5
6
  if (typeof value === 'undefined') {
6
7
  return;
@@ -30,7 +31,7 @@ const validateConcurrency = ({ setting, value, checkIfValidForCurrentMachine, })
30
31
  };
31
32
  exports.validateConcurrency = validateConcurrency;
32
33
  const getMaxConcurrency = () => {
33
- return require('os').cpus().length;
34
+ return (0, get_cpu_count_1.getCpuCount)();
34
35
  };
35
36
  exports.getMaxConcurrency = getMaxConcurrency;
36
37
  const getMinConcurrency = () => 1;
@@ -1,5 +1,5 @@
1
1
  import type { AudioCodec } from './audio-codec';
2
- export declare const validateOutputFilename: <T extends "h264" | "h265" | "vp8" | "vp9" | "prores" | "mp3" | "aac" | "wav" | "h264-mkv" | "gif">({ codec, audioCodec, extension, preferLossless, }: {
2
+ export declare const validateOutputFilename: <T extends "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">({ codec, audioCodec, extension, preferLossless, }: {
3
3
  codec: T;
4
4
  audioCodec: AudioCodec | null;
5
5
  extension: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.0.33",
3
+ "version": "4.0.34",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "extract-zip": "2.0.1",
19
19
  "source-map": "^0.8.0-beta.0",
20
20
  "ws": "8.7.0",
21
- "remotion": "4.0.33"
21
+ "remotion": "4.0.34"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=16.8.0",
@@ -40,13 +40,13 @@
40
40
  "vitest": "0.31.1"
41
41
  },
42
42
  "optionalDependencies": {
43
- "@remotion/compositor-darwin-arm64": "4.0.33",
44
- "@remotion/compositor-darwin-x64": "4.0.33",
45
- "@remotion/compositor-linux-arm64-gnu": "4.0.33",
46
- "@remotion/compositor-linux-arm64-musl": "4.0.33",
47
- "@remotion/compositor-linux-x64-gnu": "4.0.33",
48
- "@remotion/compositor-linux-x64-musl": "4.0.33",
49
- "@remotion/compositor-win32-x64-msvc": "4.0.33"
43
+ "@remotion/compositor-darwin-arm64": "4.0.34",
44
+ "@remotion/compositor-darwin-x64": "4.0.34",
45
+ "@remotion/compositor-linux-arm64-gnu": "4.0.34",
46
+ "@remotion/compositor-linux-arm64-musl": "4.0.34",
47
+ "@remotion/compositor-linux-x64-gnu": "4.0.34",
48
+ "@remotion/compositor-linux-x64-musl": "4.0.34",
49
+ "@remotion/compositor-win32-x64-msvc": "4.0.34"
50
50
  },
51
51
  "keywords": [
52
52
  "remotion",