@remotion/renderer 4.0.163 → 4.0.165

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,19 +1,19 @@
1
1
  export { AvailableOptions, TypeOfOption } from './options';
2
2
  export declare const BrowserSafeApis: {
3
- getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif">(codec: T, audioCodec: "opus" | "aac" | "mp3" | "pcm-16" | null) => import("./file-extensions").FileExtension;
3
+ getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif">(codec: T, audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => import("./file-extensions").FileExtension;
4
4
  validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "h264-ts", "gif"];
5
5
  validAudioCodecs: readonly ["pcm-16", "aac", "mp3", "opus"];
6
- getDefaultCrfForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif") => number;
7
- getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif") => [number, number];
8
- isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null | undefined) => boolean;
6
+ getDefaultCrfForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif") => number;
7
+ getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif") => [number, number];
8
+ isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null | undefined) => boolean;
9
9
  proResProfileOptions: readonly ["4444-xq", "4444", "hq", "standard", "light", "proxy"];
10
10
  x264PresetOptions: readonly ["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo"];
11
11
  validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
12
12
  validOpenGlRenderers: readonly ["swangle", "angle", "egl", "swiftshader", "vulkan", "angle-egl"];
13
- validPixelFormatsForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif") => readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"] | ("yuv420p" | "yuv422p" | "yuv444p" | "yuva420p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le")[];
13
+ validPixelFormatsForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif") => readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"] | ("yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le")[];
14
14
  validVideoImageFormats: readonly ["png", "jpeg", "none"];
15
15
  validStillImageFormats: readonly ["png", "jpeg", "pdf", "webp"];
16
- DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuv422p" | "yuv444p" | "yuva420p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
16
+ DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
17
17
  DEFAULT_TIMEOUT: number;
18
18
  DEFAULT_JPEG_QUALITY: number;
19
19
  DEFAULT_COLOR_SPACE: "default";
@@ -35,11 +35,11 @@ export declare const BrowserSafeApis: {
35
35
  h264: {
36
36
  default: import("./file-extensions").FileExtension;
37
37
  forAudioCodec: {
38
- aac: {
38
+ mp3: {
39
39
  possible: import("./file-extensions").FileExtension[];
40
40
  default: import("./file-extensions").FileExtension;
41
41
  };
42
- mp3: {
42
+ aac: {
43
43
  possible: import("./file-extensions").FileExtension[];
44
44
  default: import("./file-extensions").FileExtension;
45
45
  };
@@ -65,11 +65,11 @@ export declare const BrowserSafeApis: {
65
65
  vp8: {
66
66
  default: import("./file-extensions").FileExtension;
67
67
  forAudioCodec: {
68
- opus: {
68
+ "pcm-16": {
69
69
  possible: import("./file-extensions").FileExtension[];
70
70
  default: import("./file-extensions").FileExtension;
71
71
  };
72
- "pcm-16": {
72
+ opus: {
73
73
  possible: import("./file-extensions").FileExtension[];
74
74
  default: import("./file-extensions").FileExtension;
75
75
  };
@@ -78,20 +78,20 @@ export declare const BrowserSafeApis: {
78
78
  vp9: {
79
79
  default: import("./file-extensions").FileExtension;
80
80
  forAudioCodec: {
81
- opus: {
81
+ "pcm-16": {
82
82
  possible: import("./file-extensions").FileExtension[];
83
83
  default: import("./file-extensions").FileExtension;
84
84
  };
85
- "pcm-16": {
85
+ opus: {
86
86
  possible: import("./file-extensions").FileExtension[];
87
87
  default: import("./file-extensions").FileExtension;
88
88
  };
89
89
  };
90
90
  };
91
- prores: {
91
+ mp3: {
92
92
  default: import("./file-extensions").FileExtension;
93
93
  forAudioCodec: {
94
- aac: {
94
+ mp3: {
95
95
  possible: import("./file-extensions").FileExtension[];
96
96
  default: import("./file-extensions").FileExtension;
97
97
  };
@@ -114,22 +114,22 @@ export declare const BrowserSafeApis: {
114
114
  };
115
115
  };
116
116
  };
117
- mp3: {
117
+ wav: {
118
118
  default: import("./file-extensions").FileExtension;
119
119
  forAudioCodec: {
120
- mp3: {
121
- possible: import("./file-extensions").FileExtension[];
122
- default: import("./file-extensions").FileExtension;
123
- };
124
120
  "pcm-16": {
125
121
  possible: import("./file-extensions").FileExtension[];
126
122
  default: import("./file-extensions").FileExtension;
127
123
  };
128
124
  };
129
125
  };
130
- wav: {
126
+ prores: {
131
127
  default: import("./file-extensions").FileExtension;
132
128
  forAudioCodec: {
129
+ aac: {
130
+ possible: import("./file-extensions").FileExtension[];
131
+ default: import("./file-extensions").FileExtension;
132
+ };
133
133
  "pcm-16": {
134
134
  possible: import("./file-extensions").FileExtension[];
135
135
  default: import("./file-extensions").FileExtension;
@@ -169,37 +169,37 @@ export declare const BrowserSafeApis: {
169
169
  };
170
170
  defaultAudioCodecs: {
171
171
  h264: {
172
- compressed: "aac" | "mp3" | "pcm-16" | null;
173
- lossless: "aac" | "mp3" | "pcm-16" | null;
172
+ compressed: "mp3" | "aac" | "pcm-16" | null;
173
+ lossless: "mp3" | "aac" | "pcm-16" | null;
174
174
  };
175
175
  h265: {
176
176
  compressed: "aac" | "pcm-16" | null;
177
177
  lossless: "aac" | "pcm-16" | null;
178
178
  };
179
179
  vp8: {
180
- compressed: "opus" | "pcm-16" | null;
181
- lossless: "opus" | "pcm-16" | null;
180
+ compressed: "pcm-16" | "opus" | null;
181
+ lossless: "pcm-16" | "opus" | null;
182
182
  };
183
183
  vp9: {
184
- compressed: "opus" | "pcm-16" | null;
185
- lossless: "opus" | "pcm-16" | null;
184
+ compressed: "pcm-16" | "opus" | null;
185
+ lossless: "pcm-16" | "opus" | null;
186
186
  };
187
- prores: {
188
- compressed: "aac" | "pcm-16" | null;
189
- lossless: "aac" | "pcm-16" | null;
187
+ mp3: {
188
+ compressed: "mp3" | "pcm-16" | null;
189
+ lossless: "mp3" | "pcm-16" | null;
190
190
  };
191
191
  aac: {
192
192
  compressed: "aac" | "pcm-16" | null;
193
193
  lossless: "aac" | "pcm-16" | null;
194
194
  };
195
- mp3: {
196
- compressed: "mp3" | "pcm-16" | null;
197
- lossless: "mp3" | "pcm-16" | null;
198
- };
199
195
  wav: {
200
196
  compressed: "pcm-16" | null;
201
197
  lossless: "pcm-16" | null;
202
198
  };
199
+ prores: {
200
+ compressed: "aac" | "pcm-16" | null;
201
+ lossless: "aac" | "pcm-16" | null;
202
+ };
203
203
  "h264-mkv": {
204
204
  compressed: "mp3" | "pcm-16" | null;
205
205
  lossless: "mp3" | "pcm-16" | null;
@@ -213,10 +213,10 @@ export declare const BrowserSafeApis: {
213
213
  lossless: null;
214
214
  };
215
215
  };
216
- defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif">;
217
- validateOutputFilename: <T_1 extends "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif">({ codec, audioCodecSetting, extension, preferLossless, separateAudioTo, }: {
216
+ defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif">;
217
+ validateOutputFilename: <T_1 extends "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif">({ codec, audioCodecSetting, extension, preferLossless, separateAudioTo, }: {
218
218
  codec: T_1;
219
- audioCodecSetting: "opus" | "aac" | "mp3" | "pcm-16" | null;
219
+ audioCodecSetting: "mp3" | "aac" | "pcm-16" | "opus" | null;
220
220
  extension: string;
221
221
  preferLossless: boolean;
222
222
  separateAudioTo: string | null;
@@ -224,12 +224,12 @@ export declare const BrowserSafeApis: {
224
224
  options: {
225
225
  audioCodecOption: {
226
226
  cliFlag: "audio-codec";
227
- setConfig: (audioCodec: "opus" | "aac" | "mp3" | "pcm-16" | null) => void;
227
+ setConfig: (audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => void;
228
228
  getValue: ({ commandLine }: {
229
229
  commandLine: Record<string, unknown>;
230
230
  }) => {
231
231
  source: string;
232
- value: "opus" | "aac" | "mp3" | "pcm-16";
232
+ value: "mp3" | "aac" | "pcm-16" | "opus";
233
233
  } | {
234
234
  source: string;
235
235
  value: null;
@@ -238,7 +238,7 @@ export declare const BrowserSafeApis: {
238
238
  docLink: string;
239
239
  name: string;
240
240
  ssrName: "audioCodec";
241
- type: "opus" | "aac" | "mp3" | "pcm-16";
241
+ type: "mp3" | "aac" | "pcm-16" | "opus";
242
242
  };
243
243
  scaleOption: {
244
244
  name: string;
@@ -357,17 +357,17 @@ export declare const BrowserSafeApis: {
357
357
  description: () => import("react/jsx-runtime").JSX.Element;
358
358
  ssrName: string;
359
359
  docLink: string;
360
- type: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
360
+ type: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
361
361
  getValue: ({ commandLine }: {
362
362
  commandLine: Record<string, unknown>;
363
363
  }, { compositionCodec, configFile, downloadName, outName, uiCodec, }: {
364
364
  outName: string | null;
365
365
  downloadName: string | null;
366
- configFile: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null;
367
- uiCodec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null;
368
- compositionCodec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null;
366
+ configFile: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null;
367
+ uiCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null;
368
+ compositionCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null;
369
369
  }) => {
370
- value: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
370
+ value: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
371
371
  source: string;
372
372
  };
373
373
  setConfig: (newCodec: import("./codec").CodecOrUndefined) => void;
@@ -915,17 +915,17 @@ export declare const BrowserSafeApis: {
915
915
  description: () => import("react/jsx-runtime").JSX.Element;
916
916
  ssrName: string;
917
917
  docLink: string;
918
- type: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
918
+ type: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
919
919
  getValue: ({ commandLine }: {
920
920
  commandLine: Record<string, unknown>;
921
921
  }, { compositionCodec, configFile, downloadName, outName, uiCodec, }: {
922
922
  outName: string | null;
923
923
  downloadName: string | null;
924
- configFile: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null;
925
- uiCodec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null;
926
- compositionCodec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null;
924
+ configFile: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null;
925
+ uiCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null;
926
+ compositionCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null;
927
927
  }) => {
928
- value: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
928
+ value: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
929
929
  source: string;
930
930
  };
931
931
  setConfig: (newCodec: import("./codec").CodecOrUndefined) => void;
@@ -1079,12 +1079,12 @@ export declare const BrowserSafeApis: {
1079
1079
  };
1080
1080
  readonly audioCodec: {
1081
1081
  cliFlag: "audio-codec";
1082
- setConfig: (audioCodec: "opus" | "aac" | "mp3" | "pcm-16" | null) => void;
1082
+ setConfig: (audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => void;
1083
1083
  getValue: ({ commandLine }: {
1084
1084
  commandLine: Record<string, unknown>;
1085
1085
  }) => {
1086
1086
  source: string;
1087
- value: "opus" | "aac" | "mp3" | "pcm-16";
1087
+ value: "mp3" | "aac" | "pcm-16" | "opus";
1088
1088
  } | {
1089
1089
  source: string;
1090
1090
  value: null;
@@ -1093,7 +1093,7 @@ export declare const BrowserSafeApis: {
1093
1093
  docLink: string;
1094
1094
  name: string;
1095
1095
  ssrName: "audioCodec";
1096
- type: "opus" | "aac" | "mp3" | "pcm-16";
1096
+ type: "mp3" | "aac" | "pcm-16" | "opus";
1097
1097
  };
1098
1098
  readonly onBrowserDownload: {
1099
1099
  name: string;
@@ -2249,9 +2249,9 @@ export declare const BrowserSafeApis: {
2249
2249
  };
2250
2250
  };
2251
2251
  };
2252
- codecSupportsCrf: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif") => boolean;
2253
- codecSupportsVideoBitrate: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif") => boolean;
2252
+ codecSupportsCrf: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif") => boolean;
2253
+ codecSupportsVideoBitrate: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif") => boolean;
2254
2254
  logLevels: readonly ["verbose", "info", "warn", "error"];
2255
2255
  getOutputCodecOrUndefined: () => import("./codec").CodecOrUndefined;
2256
- getExtensionFromAudioCodec: (audioCodec: "opus" | "aac" | "mp3" | "pcm-16") => "opus" | "aac" | "mp3" | "wav";
2256
+ getExtensionFromAudioCodec: (audioCodec: "mp3" | "aac" | "pcm-16" | "opus") => "mp3" | "aac" | "wav" | "opus";
2257
2257
  };
@@ -1,9 +1,8 @@
1
- /// <reference types="node" />
2
1
  import type { LogLevel } from '../log-level';
3
2
  import type { CompositorCommand } from './payloads';
4
3
  export type Compositor = {
5
4
  finishCommands: () => Promise<void>;
6
- executeCommand: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T]) => Promise<Buffer>;
5
+ executeCommand: <T extends keyof CompositorCommand>(type: T, payload: CompositorCommand[T]) => Promise<Uint8Array>;
7
6
  waitForDone: () => Promise<void>;
8
7
  pid: number | null;
9
8
  };
@@ -9,6 +9,7 @@ const node_path_1 = __importDefault(require("node:path"));
9
9
  const get_concurrency_1 = require("../get-concurrency");
10
10
  const log_level_1 = require("../log-level");
11
11
  const logger_1 = require("../logger");
12
+ const streaming_1 = require("../streaming");
12
13
  const compose_1 = require("./compose");
13
14
  const get_executable_path_1 = require("./get-executable-path");
14
15
  const make_file_executable_1 = require("./make-file-executable");
@@ -49,22 +50,20 @@ const startCompositor = ({ type, payload, logLevel, indent, binariesDirectory =
49
50
  : undefined,
50
51
  });
51
52
  let stderrChunks = [];
52
- let outputBuffer = Buffer.from('');
53
- const separator = Buffer.from('remotion_buffer:');
54
53
  const waiters = new Map();
55
54
  const onMessage = (statusType, nonce, data) => {
56
55
  // Nonce '0' just means that the message should be logged
57
56
  if (nonce === '0') {
58
- logger_1.Log.verbose({ indent, logLevel, tag: 'compositor' }, data.toString('utf8'));
57
+ logger_1.Log.verbose({ indent, logLevel, tag: 'compositor' }, new TextDecoder('utf8').decode(data));
59
58
  }
60
- if (waiters.has(nonce)) {
59
+ else if (waiters.has(nonce)) {
61
60
  if (statusType === 'error') {
62
61
  try {
63
- const parsed = JSON.parse(data.toString('utf8'));
62
+ const parsed = JSON.parse(new TextDecoder('utf8').decode(data));
64
63
  waiters.get(nonce).reject(new Error(`Compositor error: ${parsed.error}\n${parsed.backtrace}`));
65
64
  }
66
65
  catch (err) {
67
- waiters.get(nonce).reject(new Error(data.toString('utf8')));
66
+ waiters.get(nonce).reject(new Error(new TextDecoder('utf8').decode(data)));
68
67
  }
69
68
  }
70
69
  else {
@@ -73,89 +72,9 @@ const startCompositor = ({ type, payload, logLevel, indent, binariesDirectory =
73
72
  waiters.delete(nonce);
74
73
  }
75
74
  };
75
+ const { onData, getOutputBuffer, clear } = (0, streaming_1.makeStreamer)(onMessage);
76
76
  let runningStatus = { type: 'running' };
77
- let missingData = null;
78
- const processInput = () => {
79
- let separatorIndex = outputBuffer.indexOf(separator);
80
- if (separatorIndex === -1) {
81
- return;
82
- }
83
- separatorIndex += separator.length;
84
- let nonceString = '';
85
- let lengthString = '';
86
- let statusString = '';
87
- // Each message from Rust is prefixed with `remotion_buffer:{[nonce]}:{[length]}`
88
- // Let's read the buffer to extract the nonce, and if the full length is available,
89
- // we'll extract the data and pass it to the callback.
90
- // eslint-disable-next-line no-constant-condition
91
- while (true) {
92
- if (separatorIndex > outputBuffer.length - 1) {
93
- return;
94
- }
95
- const nextDigit = outputBuffer[separatorIndex];
96
- separatorIndex++;
97
- // 0x3a is the character ":"
98
- if (nextDigit === 0x3a) {
99
- break;
100
- }
101
- nonceString += String.fromCharCode(nextDigit);
102
- }
103
- // eslint-disable-next-line no-constant-condition
104
- while (true) {
105
- if (separatorIndex > outputBuffer.length - 1) {
106
- return;
107
- }
108
- const nextDigit = outputBuffer[separatorIndex];
109
- separatorIndex++;
110
- if (nextDigit === 0x3a) {
111
- break;
112
- }
113
- lengthString += String.fromCharCode(nextDigit);
114
- }
115
- // eslint-disable-next-line no-constant-condition
116
- while (true) {
117
- if (separatorIndex > outputBuffer.length - 1) {
118
- return;
119
- }
120
- const nextDigit = outputBuffer[separatorIndex];
121
- if (nextDigit === 0x3a) {
122
- break;
123
- }
124
- separatorIndex++;
125
- statusString += String.fromCharCode(nextDigit);
126
- }
127
- const length = Number(lengthString);
128
- const status = Number(statusString);
129
- const dataLength = outputBuffer.length - separatorIndex - 1;
130
- if (dataLength < length) {
131
- missingData = {
132
- dataMissing: length - dataLength,
133
- };
134
- return;
135
- }
136
- const data = outputBuffer.subarray(separatorIndex + 1, separatorIndex + 1 + Number(lengthString));
137
- onMessage(status === 1 ? 'error' : 'success', nonceString, data);
138
- missingData = null;
139
- outputBuffer = outputBuffer.subarray(separatorIndex + Number(lengthString) + 1);
140
- processInput();
141
- };
142
- let unprocessedBuffers = [];
143
- child.stdout.on('data', (data) => {
144
- unprocessedBuffers.push(data);
145
- const separatorIndex = data.indexOf(separator);
146
- if (separatorIndex === -1) {
147
- if (missingData) {
148
- missingData.dataMissing -= data.length;
149
- }
150
- if (!missingData || missingData.dataMissing > 0) {
151
- return;
152
- }
153
- }
154
- unprocessedBuffers.unshift(outputBuffer);
155
- outputBuffer = Buffer.concat(unprocessedBuffers);
156
- unprocessedBuffers = [];
157
- processInput();
158
- });
77
+ child.stdout.on('data', onData);
159
78
  child.stderr.on('data', (data) => {
160
79
  stderrChunks.push(data);
161
80
  });
@@ -173,7 +92,7 @@ const startCompositor = ({ type, payload, logLevel, indent, binariesDirectory =
173
92
  }
174
93
  else {
175
94
  const errorMessage = Buffer.concat(stderrChunks).toString('utf-8') +
176
- outputBuffer.toString('utf-8');
95
+ new TextDecoder('utf-8').decode(getOutputBuffer());
177
96
  runningStatus = { type: 'quit-with-error', error: errorMessage, signal };
178
97
  const error = code === null
179
98
  ? new Error(`Compositor exited with signal ${signal}`)
@@ -185,7 +104,7 @@ const startCompositor = ({ type, payload, logLevel, indent, binariesDirectory =
185
104
  reject === null || reject === void 0 ? void 0 : reject(error);
186
105
  }
187
106
  // Need to manually free up memory
188
- outputBuffer = Buffer.from('');
107
+ clear();
189
108
  stderrChunks = [];
190
109
  });
191
110
  return {
@@ -40,7 +40,7 @@ const getSilentParts = async ({ src, noiseThresholdInDecibels: passedNoiseThresh
40
40
  minDurationInSeconds,
41
41
  noiseThresholdInDecibels,
42
42
  });
43
- const response = JSON.parse(res.toString('utf-8'));
43
+ const response = JSON.parse(new TextDecoder('utf-8').decode(res));
44
44
  await compositor.finishCommands();
45
45
  await compositor.waitForDone();
46
46
  const { silentParts, durationInSeconds } = response;
@@ -15,6 +15,6 @@ const getVideoMetadata = async (videoSource, options) => {
15
15
  });
16
16
  await compositor.finishCommands();
17
17
  await compositor.waitForDone();
18
- return JSON.parse(metadataResponse.toString('utf-8'));
18
+ return JSON.parse(new TextDecoder('utf-8').decode(metadataResponse));
19
19
  };
20
20
  exports.getVideoMetadata = getVideoMetadata;
package/dist/index.d.ts CHANGED
@@ -69,10 +69,10 @@ export declare const RenderInternals: {
69
69
  width: number;
70
70
  height: number;
71
71
  scale: number;
72
- codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
72
+ codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
73
73
  wantsImageSequence: boolean;
74
74
  }) => void;
75
- getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif">(codec: T, audioCodec: "opus" | "aac" | "mp3" | "pcm-16" | null) => import("./file-extensions").FileExtension;
75
+ getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif">(codec: T, audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => import("./file-extensions").FileExtension;
76
76
  tmpDir: (str: string) => string;
77
77
  deleteDirectory: (directory: string) => void;
78
78
  isServeUrl: (potentialUrl: string) => boolean;
@@ -129,7 +129,7 @@ export declare const RenderInternals: {
129
129
  };
130
130
  registerErrorSymbolicationLock: () => number;
131
131
  unlockErrorSymbolicationLock: (id: number) => void;
132
- canUseParallelEncoding: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif") => boolean;
132
+ canUseParallelEncoding: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif") => boolean;
133
133
  mimeContentType: typeof mimeContentType;
134
134
  mimeLookup: typeof mimeLookup;
135
135
  validateConcurrency: ({ setting, value, checkIfValidForCurrentMachine, }: {
@@ -143,11 +143,11 @@ export declare const RenderInternals: {
143
143
  DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
144
144
  validateOpenGlRenderer: (option: unknown) => "swangle" | "angle" | "egl" | "swiftshader" | "vulkan" | "angle-egl" | null;
145
145
  validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "h264-ts", "gif"];
146
- DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuv422p" | "yuv444p" | "yuva420p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
146
+ DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
147
147
  validateJpegQuality: (q: unknown) => void;
148
148
  DEFAULT_TIMEOUT: number;
149
- DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
150
- isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null | undefined) => boolean;
149
+ DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
150
+ isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null | undefined) => boolean;
151
151
  logLevels: readonly ["verbose", "info", "warn", "error"];
152
152
  isEqualOrBelowLogLevel: (currentLevel: "verbose" | "info" | "warn" | "error", level: "verbose" | "info" | "warn" | "error") => boolean;
153
153
  isValidLogLevel: (level: string) => boolean;
@@ -164,10 +164,10 @@ export declare const RenderInternals: {
164
164
  output: string;
165
165
  onProgress: (p: number) => void;
166
166
  numberOfFrames: number;
167
- codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
167
+ codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
168
168
  fps: number;
169
169
  numberOfGifLoops: number | null;
170
- resolvedAudioCodec: "opus" | "aac" | "mp3" | "pcm-16" | null;
170
+ resolvedAudioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
171
171
  audioBitrate: string | null;
172
172
  indent: boolean;
173
173
  logLevel: "verbose" | "info" | "warn" | "error";
@@ -181,18 +181,18 @@ export declare const RenderInternals: {
181
181
  getMinConcurrency: () => number;
182
182
  getMaxConcurrency: () => number;
183
183
  getDefaultAudioCodec: ({ codec, preferLossless, }: {
184
- codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
184
+ codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
185
185
  preferLossless: boolean;
186
- }) => "opus" | "aac" | "mp3" | "pcm-16" | null;
186
+ }) => "mp3" | "aac" | "pcm-16" | "opus" | null;
187
187
  defaultFileExtensionMap: {
188
188
  h264: {
189
189
  default: import("./file-extensions").FileExtension;
190
190
  forAudioCodec: {
191
- aac: {
191
+ mp3: {
192
192
  possible: import("./file-extensions").FileExtension[];
193
193
  default: import("./file-extensions").FileExtension;
194
194
  };
195
- mp3: {
195
+ aac: {
196
196
  possible: import("./file-extensions").FileExtension[];
197
197
  default: import("./file-extensions").FileExtension;
198
198
  };
@@ -218,11 +218,11 @@ export declare const RenderInternals: {
218
218
  vp8: {
219
219
  default: import("./file-extensions").FileExtension;
220
220
  forAudioCodec: {
221
- opus: {
221
+ "pcm-16": {
222
222
  possible: import("./file-extensions").FileExtension[];
223
223
  default: import("./file-extensions").FileExtension;
224
224
  };
225
- "pcm-16": {
225
+ opus: {
226
226
  possible: import("./file-extensions").FileExtension[];
227
227
  default: import("./file-extensions").FileExtension;
228
228
  };
@@ -231,20 +231,20 @@ export declare const RenderInternals: {
231
231
  vp9: {
232
232
  default: import("./file-extensions").FileExtension;
233
233
  forAudioCodec: {
234
- opus: {
234
+ "pcm-16": {
235
235
  possible: import("./file-extensions").FileExtension[];
236
236
  default: import("./file-extensions").FileExtension;
237
237
  };
238
- "pcm-16": {
238
+ opus: {
239
239
  possible: import("./file-extensions").FileExtension[];
240
240
  default: import("./file-extensions").FileExtension;
241
241
  };
242
242
  };
243
243
  };
244
- prores: {
244
+ mp3: {
245
245
  default: import("./file-extensions").FileExtension;
246
246
  forAudioCodec: {
247
- aac: {
247
+ mp3: {
248
248
  possible: import("./file-extensions").FileExtension[];
249
249
  default: import("./file-extensions").FileExtension;
250
250
  };
@@ -267,22 +267,22 @@ export declare const RenderInternals: {
267
267
  };
268
268
  };
269
269
  };
270
- mp3: {
270
+ wav: {
271
271
  default: import("./file-extensions").FileExtension;
272
272
  forAudioCodec: {
273
- mp3: {
274
- possible: import("./file-extensions").FileExtension[];
275
- default: import("./file-extensions").FileExtension;
276
- };
277
273
  "pcm-16": {
278
274
  possible: import("./file-extensions").FileExtension[];
279
275
  default: import("./file-extensions").FileExtension;
280
276
  };
281
277
  };
282
278
  };
283
- wav: {
279
+ prores: {
284
280
  default: import("./file-extensions").FileExtension;
285
281
  forAudioCodec: {
282
+ aac: {
283
+ possible: import("./file-extensions").FileExtension[];
284
+ default: import("./file-extensions").FileExtension;
285
+ };
286
286
  "pcm-16": {
287
287
  possible: import("./file-extensions").FileExtension[];
288
288
  default: import("./file-extensions").FileExtension;
@@ -334,10 +334,10 @@ export declare const RenderInternals: {
334
334
  readonly vp9: readonly ["opus", "pcm-16"];
335
335
  readonly wav: readonly ["pcm-16"];
336
336
  };
337
- makeFileExtensionMap: () => Record<string, ("h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif")[]>;
338
- defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif">;
337
+ makeFileExtensionMap: () => Record<string, ("h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif")[]>;
338
+ defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif">;
339
339
  getExecutablePath: ({ indent, logLevel, type, binariesDirectory, }: {
340
- type: "compositor" | "ffmpeg" | "ffprobe";
340
+ type: "ffmpeg" | "ffprobe" | "compositor";
341
341
  indent: boolean;
342
342
  logLevel: "verbose" | "info" | "warn" | "error";
343
343
  binariesDirectory: string | null;
@@ -771,21 +771,21 @@ export declare const RenderInternals: {
771
771
  hostsToTry: string[];
772
772
  };
773
773
  makeDownloadMap: () => import("./assets/download-map").DownloadMap;
774
- getExtensionFromAudioCodec: (audioCodec: "opus" | "aac" | "mp3" | "pcm-16") => "opus" | "aac" | "mp3" | "wav";
774
+ getExtensionFromAudioCodec: (audioCodec: "mp3" | "aac" | "pcm-16" | "opus") => "mp3" | "aac" | "wav" | "opus";
775
775
  makeFileExecutableIfItIsNot: (path: string) => void;
776
776
  resolveAudioCodec: ({ codec, setting, preferLossless, separateAudioTo, }: {
777
- setting: "opus" | "aac" | "mp3" | "pcm-16" | null;
778
- codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
777
+ setting: "mp3" | "aac" | "pcm-16" | "opus" | null;
778
+ codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
779
779
  preferLossless: boolean;
780
780
  separateAudioTo: string | null;
781
- }) => "opus" | "aac" | "mp3" | "pcm-16" | null;
781
+ }) => "mp3" | "aac" | "pcm-16" | "opus" | null;
782
782
  getShouldRenderAudio: ({ codec, assetsInfo, enforceAudioTrack, muted, }: {
783
- codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
783
+ codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
784
784
  assetsInfo: import("./assets/download-map").RenderAssetInfo | null;
785
785
  enforceAudioTrack: boolean;
786
786
  muted: boolean;
787
787
  }) => "yes" | "maybe" | "no";
788
- codecSupportsMedia: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif") => {
788
+ codecSupportsMedia: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif") => {
789
789
  video: boolean;
790
790
  audio: boolean;
791
791
  };
@@ -10,6 +10,17 @@ const get_video_threads_flag_1 = require("./get-video-threads-flag");
10
10
  const log_level_1 = require("./log-level");
11
11
  const logger_1 = require("./logger");
12
12
  const gl_1 = require("./options/gl");
13
+ const featuresToEnable = (option) => {
14
+ const renderer = option !== null && option !== void 0 ? option : gl_1.DEFAULT_OPENGL_RENDERER;
15
+ const enableAlways = ['NetworkService', 'NetworkServiceInProcess'];
16
+ if (renderer === 'vulkan') {
17
+ return [...enableAlways, 'Vulkan', 'UseSkiaRenderer'];
18
+ }
19
+ if (renderer === 'angle-egl') {
20
+ return [...enableAlways, 'VaapiVideoDecoder'];
21
+ }
22
+ return enableAlways;
23
+ };
13
24
  const getOpenGlRenderer = (option) => {
14
25
  const renderer = option !== null && option !== void 0 ? option : gl_1.DEFAULT_OPENGL_RENDERER;
15
26
  (0, gl_1.validateOpenGlRenderer)(renderer);
@@ -25,7 +36,6 @@ const getOpenGlRenderer = (option) => {
25
36
  '--use-vulkan=swiftshader',
26
37
  '--disable-vulkan-fallback-to-gl-for-testing',
27
38
  '--dignore-gpu-blocklist',
28
- '--enable-features=Vulkan,UseSkiaRenderer',
29
39
  ];
30
40
  }
31
41
  if (renderer === null) {
@@ -61,7 +71,7 @@ const internalOpenBrowser = async ({ browser, browserExecutable, chromiumOptions
61
71
  'about:blank',
62
72
  '--allow-pre-commit-input',
63
73
  '--disable-background-networking',
64
- '--enable-features=NetworkService,NetworkServiceInProcess',
74
+ `--enable-features=${featuresToEnable(chromiumOptions.gl).join(',')}`,
65
75
  '--disable-background-timer-throttling',
66
76
  '--disable-backgrounding-occluded-windows',
67
77
  '--disable-breakpad',
@@ -83,7 +93,7 @@ const internalOpenBrowser = async ({ browser, browserExecutable, chromiumOptions
83
93
  '--metrics-recording-only',
84
94
  '--mute-audio',
85
95
  '--no-first-run',
86
- '--video-threads=' + (0, get_video_threads_flag_1.getIdealVideoThreadsFlag)(logLevel),
96
+ `--video-threads=${(0, get_video_threads_flag_1.getIdealVideoThreadsFlag)(logLevel)}`,
87
97
  '--enable-automation',
88
98
  '--password-store=basic',
89
99
  '--use-mock-keychain',
@@ -24,25 +24,25 @@ export declare const defaultAudioCodecs: {
24
24
  [k in 'compressed' | 'lossless']: (typeof supportedAudioCodecs)[key][number] | null;
25
25
  };
26
26
  };
27
- export declare const getExtensionFromAudioCodec: (audioCodec: AudioCodec) => "opus" | "aac" | "mp3" | "wav";
27
+ export declare const getExtensionFromAudioCodec: (audioCodec: AudioCodec) => "mp3" | "aac" | "wav" | "opus";
28
28
  export declare const resolveAudioCodec: ({ codec, setting, preferLossless, separateAudioTo, }: {
29
29
  setting: AudioCodec | null;
30
30
  codec: Codec;
31
31
  preferLossless: boolean;
32
32
  separateAudioTo: string | null;
33
- }) => "opus" | "aac" | "mp3" | "pcm-16" | null;
33
+ }) => "mp3" | "aac" | "pcm-16" | "opus" | null;
34
34
  export declare const getDefaultAudioCodec: ({ codec, preferLossless, }: {
35
35
  codec: Codec;
36
36
  preferLossless: boolean;
37
37
  }) => AudioCodec | null;
38
38
  export declare const audioCodecOption: {
39
39
  cliFlag: "audio-codec";
40
- setConfig: (audioCodec: "opus" | "aac" | "mp3" | "pcm-16" | null) => void;
40
+ setConfig: (audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => void;
41
41
  getValue: ({ commandLine }: {
42
42
  commandLine: Record<string, unknown>;
43
43
  }) => {
44
44
  source: string;
45
- value: "opus" | "aac" | "mp3" | "pcm-16";
45
+ value: "mp3" | "aac" | "pcm-16" | "opus";
46
46
  } | {
47
47
  source: string;
48
48
  value: null;
@@ -51,6 +51,6 @@ export declare const audioCodecOption: {
51
51
  docLink: string;
52
52
  name: string;
53
53
  ssrName: "audioCodec";
54
- type: "opus" | "aac" | "mp3" | "pcm-16";
54
+ type: "mp3" | "aac" | "pcm-16" | "opus";
55
55
  };
56
56
  export {};
@@ -2,12 +2,12 @@ import type { AnyRemotionOption } from './option';
2
2
  export declare const allOptions: {
3
3
  audioCodecOption: {
4
4
  cliFlag: "audio-codec";
5
- setConfig: (audioCodec: "opus" | "aac" | "mp3" | "pcm-16" | null) => void;
5
+ setConfig: (audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => void;
6
6
  getValue: ({ commandLine }: {
7
7
  commandLine: Record<string, unknown>;
8
8
  }) => {
9
9
  source: string;
10
- value: "opus" | "aac" | "mp3" | "pcm-16";
10
+ value: "mp3" | "aac" | "pcm-16" | "opus";
11
11
  } | {
12
12
  source: string;
13
13
  value: null;
@@ -16,7 +16,7 @@ export declare const allOptions: {
16
16
  docLink: string;
17
17
  name: string;
18
18
  ssrName: "audioCodec";
19
- type: "opus" | "aac" | "mp3" | "pcm-16";
19
+ type: "mp3" | "aac" | "pcm-16" | "opus";
20
20
  };
21
21
  scaleOption: {
22
22
  name: string;
@@ -135,17 +135,17 @@ export declare const allOptions: {
135
135
  description: () => import("react/jsx-runtime").JSX.Element;
136
136
  ssrName: string;
137
137
  docLink: string;
138
- type: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
138
+ type: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
139
139
  getValue: ({ commandLine }: {
140
140
  commandLine: Record<string, unknown>;
141
141
  }, { compositionCodec, configFile, downloadName, outName, uiCodec, }: {
142
142
  outName: string | null;
143
143
  downloadName: string | null;
144
- configFile: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null;
145
- uiCodec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null;
146
- compositionCodec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null;
144
+ configFile: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null;
145
+ uiCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null;
146
+ compositionCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null;
147
147
  }) => {
148
- value: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
148
+ value: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
149
149
  source: string;
150
150
  };
151
151
  setConfig: (newCodec: import("..").CodecOrUndefined) => void;
@@ -123,17 +123,17 @@ export declare const optionsMap: {
123
123
  description: () => import("react/jsx-runtime").JSX.Element;
124
124
  ssrName: string;
125
125
  docLink: string;
126
- type: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
126
+ type: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
127
127
  getValue: ({ commandLine }: {
128
128
  commandLine: Record<string, unknown>;
129
129
  }, { compositionCodec, configFile, downloadName, outName, uiCodec, }: {
130
130
  outName: string | null;
131
131
  downloadName: string | null;
132
- configFile: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null;
133
- uiCodec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null;
134
- compositionCodec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif" | null;
132
+ configFile: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null;
133
+ uiCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null;
134
+ compositionCodec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif" | null;
135
135
  }) => {
136
- value: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
136
+ value: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
137
137
  source: string;
138
138
  };
139
139
  setConfig: (newCodec: import("..").CodecOrUndefined) => void;
@@ -287,12 +287,12 @@ export declare const optionsMap: {
287
287
  };
288
288
  readonly audioCodec: {
289
289
  cliFlag: "audio-codec";
290
- setConfig: (audioCodec: "opus" | "aac" | "mp3" | "pcm-16" | null) => void;
290
+ setConfig: (audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null) => void;
291
291
  getValue: ({ commandLine }: {
292
292
  commandLine: Record<string, unknown>;
293
293
  }) => {
294
294
  source: string;
295
- value: "opus" | "aac" | "mp3" | "pcm-16";
295
+ value: "mp3" | "aac" | "pcm-16" | "opus";
296
296
  } | {
297
297
  source: string;
298
298
  value: null;
@@ -301,7 +301,7 @@ export declare const optionsMap: {
301
301
  docLink: string;
302
302
  name: string;
303
303
  ssrName: "audioCodec";
304
- type: "opus" | "aac" | "mp3" | "pcm-16";
304
+ type: "mp3" | "aac" | "pcm-16" | "opus";
305
305
  };
306
306
  readonly onBrowserDownload: {
307
307
  name: string;
@@ -6,7 +6,7 @@ export declare const videoCodecOption: {
6
6
  description: () => import("react/jsx-runtime").JSX.Element;
7
7
  ssrName: string;
8
8
  docLink: string;
9
- type: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "h264-ts" | "gif";
9
+ type: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "h264-ts" | "gif";
10
10
  getValue: ({ commandLine }: {
11
11
  commandLine: Record<string, unknown>;
12
12
  }, { compositionCodec, configFile, downloadName, outName, uiCodec, }: {
package/dist/pure.d.ts CHANGED
@@ -12,4 +12,14 @@ export declare const NoReactAPIs: {
12
12
  preferLossless: boolean;
13
13
  separateAudioTo: string | null;
14
14
  }) => void;
15
+ makeStreamer: (onMessage: (statusType: "error" | "success", nonce: string, data: Uint8Array) => void) => {
16
+ onData: (data: Uint8Array) => void;
17
+ getOutputBuffer: () => Uint8Array;
18
+ clear: () => void;
19
+ };
20
+ makeStreamPayloadMessage: ({ status, body, nonce, }: {
21
+ nonce: string;
22
+ status: 0 | 1;
23
+ body: Uint8Array;
24
+ }) => Uint8Array;
15
25
  };
package/dist/pure.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NoReactAPIs = void 0;
4
4
  const get_extension_from_codec_1 = require("./get-extension-from-codec");
5
5
  const get_extension_of_filename_1 = require("./get-extension-of-filename");
6
+ const streaming_1 = require("./streaming");
6
7
  const validate_output_filename_1 = require("./validate-output-filename");
7
8
  const wrap_with_error_handling_1 = require("./wrap-with-error-handling");
8
9
  exports.NoReactAPIs = {
@@ -10,4 +11,6 @@ exports.NoReactAPIs = {
10
11
  getExtensionOfFilename: get_extension_of_filename_1.getExtensionOfFilename,
11
12
  getFileExtensionFromCodec: get_extension_from_codec_1.getFileExtensionFromCodec,
12
13
  validateOutputFilename: validate_output_filename_1.validateOutputFilename,
14
+ makeStreamer: streaming_1.makeStreamer,
15
+ makeStreamPayloadMessage: streaming_1.makeStreamPayloadMessage,
13
16
  };
@@ -1,5 +1,11 @@
1
+ export declare const streamingKey = "remotion_buffer:";
1
2
  export declare const makeStreamer: (onMessage: (statusType: 'success' | 'error', nonce: string, data: Uint8Array) => void) => {
2
3
  onData: (data: Uint8Array) => void;
3
4
  getOutputBuffer: () => Uint8Array;
4
5
  clear: () => void;
5
6
  };
7
+ export declare const makeStreamPayloadMessage: ({ status, body, nonce, }: {
8
+ nonce: string;
9
+ status: 0 | 1;
10
+ body: Uint8Array;
11
+ }) => Uint8Array;
package/dist/streaming.js CHANGED
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeStreamer = void 0;
3
+ exports.makeStreamPayloadMessage = exports.makeStreamer = exports.streamingKey = void 0;
4
+ exports.streamingKey = 'remotion_buffer:';
5
+ const magicWordStr = 'remotion_buffer:';
4
6
  const makeStreamer = (onMessage) => {
5
- const separatorStr = 'remotion_buffer:';
6
- const separator = new Uint8Array(separatorStr.length);
7
- for (let i = 0; i < separatorStr.length; i++) {
8
- separator[i] = separatorStr.charCodeAt(i);
7
+ const separator = new Uint8Array(magicWordStr.length);
8
+ for (let i = 0; i < magicWordStr.length; i++) {
9
+ separator[i] = magicWordStr.charCodeAt(i);
9
10
  }
10
11
  let unprocessedBuffers = [];
11
12
  let outputBuffer = new Uint8Array(0);
@@ -104,3 +105,36 @@ const makeStreamer = (onMessage) => {
104
105
  };
105
106
  };
106
107
  exports.makeStreamer = makeStreamer;
108
+ const makeStreamPayloadMessage = ({ status, body, nonce, }) => {
109
+ const nonceArr = new TextEncoder().encode(nonce);
110
+ const magicWordArr = new TextEncoder().encode(magicWordStr);
111
+ const separatorArr = new TextEncoder().encode(':');
112
+ const bodyLengthArr = new TextEncoder().encode(body.length.toString());
113
+ const statusArr = new TextEncoder().encode(String(status));
114
+ // Calculate total length of new Uint8Array
115
+ const totalLength = nonceArr.length +
116
+ magicWordArr.length +
117
+ separatorArr.length * 3 +
118
+ bodyLengthArr.length +
119
+ statusArr.length +
120
+ body.length;
121
+ // Create a new Uint8Array to hold all combined parts
122
+ const concat = new Uint8Array(totalLength);
123
+ let offset = 0;
124
+ // Function to append data to concat
125
+ const appendToConcat = (data) => {
126
+ concat.set(data, offset);
127
+ offset += data.length;
128
+ };
129
+ // Building the final Uint8Array
130
+ appendToConcat(magicWordArr);
131
+ appendToConcat(nonceArr);
132
+ appendToConcat(separatorArr);
133
+ appendToConcat(bodyLengthArr);
134
+ appendToConcat(separatorArr);
135
+ appendToConcat(statusArr);
136
+ appendToConcat(separatorArr);
137
+ appendToConcat(body);
138
+ return concat;
139
+ };
140
+ exports.makeStreamPayloadMessage = makeStreamPayloadMessage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.0.163",
3
+ "version": "4.0.165",
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.163"
21
+ "remotion": "4.0.165"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=16.8.0",
@@ -43,13 +43,13 @@
43
43
  "@types/ws": "8.5.10"
44
44
  },
45
45
  "optionalDependencies": {
46
- "@remotion/compositor-darwin-x64": "4.0.163",
47
- "@remotion/compositor-darwin-arm64": "4.0.163",
48
- "@remotion/compositor-linux-arm64-gnu": "4.0.163",
49
- "@remotion/compositor-linux-arm64-musl": "4.0.163",
50
- "@remotion/compositor-linux-x64-gnu": "4.0.163",
51
- "@remotion/compositor-win32-x64-msvc": "4.0.163",
52
- "@remotion/compositor-linux-x64-musl": "4.0.163"
46
+ "@remotion/compositor-darwin-arm64": "4.0.165",
47
+ "@remotion/compositor-linux-x64-gnu": "4.0.165",
48
+ "@remotion/compositor-linux-arm64-gnu": "4.0.165",
49
+ "@remotion/compositor-linux-arm64-musl": "4.0.165",
50
+ "@remotion/compositor-linux-x64-musl": "4.0.165",
51
+ "@remotion/compositor-win32-x64-msvc": "4.0.165",
52
+ "@remotion/compositor-darwin-x64": "4.0.165"
53
53
  },
54
54
  "keywords": [
55
55
  "remotion",