@remotion/renderer 4.0.77 → 4.0.80

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 (42) hide show
  1. package/dist/assets/download-file.js +6 -1
  2. package/dist/client.d.ts +179 -126
  3. package/dist/compositor/payloads.d.ts +1 -0
  4. package/dist/crf.d.ts +4 -2
  5. package/dist/crf.js +11 -4
  6. package/dist/ffmpeg-args.d.ts +4 -2
  7. package/dist/ffmpeg-args.js +6 -2
  8. package/dist/get-extension-from-codec.d.ts +2 -2
  9. package/dist/index.d.ts +60 -54
  10. package/dist/open-browser.js +3 -0
  11. package/dist/options/audio-bitrate.d.ts +1 -1
  12. package/dist/options/color-space.d.ts +1 -1
  13. package/dist/options/crf.d.ts +1 -1
  14. package/dist/options/enable-lambda-insights.d.ts +1 -1
  15. package/dist/options/encoding-buffer-size.d.ts +9 -0
  16. package/dist/options/encoding-buffer-size.js +12 -0
  17. package/dist/options/encoding-max-rate.d.ts +9 -0
  18. package/dist/options/encoding-max-rate.js +12 -0
  19. package/dist/options/enforce-audio.d.ts +1 -1
  20. package/dist/options/gl.d.ts +1 -1
  21. package/dist/options/index.d.ts +28 -11
  22. package/dist/options/index.js +5 -1
  23. package/dist/options/jpeg-quality.d.ts +1 -1
  24. package/dist/options/offthreadvideo-cache-size.d.ts +1 -1
  25. package/dist/options/offthreadvideo-cache-size.js +2 -2
  26. package/dist/options/option.d.ts +2 -2
  27. package/dist/options/options-map.d.ts +116 -80
  28. package/dist/options/options-map.js +33 -10
  29. package/dist/options/scale.d.ts +1 -1
  30. package/dist/options/video-bitrate.d.ts +1 -1
  31. package/dist/options/video-codec.d.ts +1 -1
  32. package/dist/pixel-format.d.ts +1 -1
  33. package/dist/prespawn-ffmpeg.d.ts +2 -0
  34. package/dist/prespawn-ffmpeg.js +2 -0
  35. package/dist/print-useful-error-message.js +1 -1
  36. package/dist/render-media.d.ts +12 -4
  37. package/dist/render-media.js +15 -3
  38. package/dist/seek-to-frame.js +8 -3
  39. package/dist/stitch-frames-to-video.d.ts +5 -1
  40. package/dist/stitch-frames-to-video.js +11 -2
  41. package/dist/validate-output-filename.d.ts +1 -1
  42. package/package.json +9 -9
@@ -96,7 +96,12 @@ const downloadFile = async (options, retries = 2, attempt = 1) => {
96
96
  catch (err) {
97
97
  const { message } = err;
98
98
  if (message === 'aborted' ||
99
- message.includes(incorrectContentLengthToken)) {
99
+ message.includes(incorrectContentLengthToken) ||
100
+ // Try again if hitting internal errors
101
+ message.includes('503') ||
102
+ message.includes('502') ||
103
+ message.includes('504') ||
104
+ message.includes('500')) {
100
105
  if (retries === 0) {
101
106
  throw err;
102
107
  }
package/dist/client.d.ts CHANGED
@@ -1,16 +1,17 @@
1
1
  /// <reference types="react" />
2
+ export { AvailableOptions } from './options';
2
3
  export declare const BrowserSafeApis: {
3
- getFileExtensionFromCodec: <T extends "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "gif">(codec: T, audioCodec: "opus" | "aac" | "mp3" | "pcm-16" | null) => import("./file-extensions").FileExtension;
4
+ 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;
4
5
  validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
5
6
  validAudioCodecs: readonly ["pcm-16", "aac", "mp3", "opus"];
6
- getDefaultCrfForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "gif") => number;
7
- getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "gif") => [number, number];
8
- isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "gif" | null | undefined) => boolean;
7
+ getDefaultCrfForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => number;
8
+ getValidCrfRanges: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => [number, number];
9
+ isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | null | undefined) => boolean;
9
10
  proResProfileOptions: readonly ["4444-xq", "4444", "hq", "standard", "light", "proxy"];
10
11
  x264PresetOptions: readonly ["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo"];
11
12
  validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
12
- validPixelFormatsForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "gif") => readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"] | ("yuv420p" | "yuv422p" | "yuv444p" | "yuva420p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le")[];
13
- DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuv422p" | "yuv444p" | "yuva420p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
13
+ validPixelFormatsForCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"] | ("yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le")[];
14
+ DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
14
15
  supportedAudioCodecs: {
15
16
  readonly h264: readonly ["aac", "pcm-16", "mp3"];
16
17
  readonly 'h264-mkv': readonly ["pcm-16", "mp3"];
@@ -27,11 +28,11 @@ export declare const BrowserSafeApis: {
27
28
  h264: {
28
29
  default: import("./file-extensions").FileExtension;
29
30
  forAudioCodec: {
30
- aac: {
31
+ mp3: {
31
32
  possible: import("./file-extensions").FileExtension[];
32
33
  default: import("./file-extensions").FileExtension;
33
34
  };
34
- mp3: {
35
+ aac: {
35
36
  possible: import("./file-extensions").FileExtension[];
36
37
  default: import("./file-extensions").FileExtension;
37
38
  };
@@ -57,11 +58,11 @@ export declare const BrowserSafeApis: {
57
58
  vp8: {
58
59
  default: import("./file-extensions").FileExtension;
59
60
  forAudioCodec: {
60
- opus: {
61
+ "pcm-16": {
61
62
  possible: import("./file-extensions").FileExtension[];
62
63
  default: import("./file-extensions").FileExtension;
63
64
  };
64
- "pcm-16": {
65
+ opus: {
65
66
  possible: import("./file-extensions").FileExtension[];
66
67
  default: import("./file-extensions").FileExtension;
67
68
  };
@@ -70,20 +71,20 @@ export declare const BrowserSafeApis: {
70
71
  vp9: {
71
72
  default: import("./file-extensions").FileExtension;
72
73
  forAudioCodec: {
73
- opus: {
74
+ "pcm-16": {
74
75
  possible: import("./file-extensions").FileExtension[];
75
76
  default: import("./file-extensions").FileExtension;
76
77
  };
77
- "pcm-16": {
78
+ opus: {
78
79
  possible: import("./file-extensions").FileExtension[];
79
80
  default: import("./file-extensions").FileExtension;
80
81
  };
81
82
  };
82
83
  };
83
- prores: {
84
+ mp3: {
84
85
  default: import("./file-extensions").FileExtension;
85
86
  forAudioCodec: {
86
- aac: {
87
+ mp3: {
87
88
  possible: import("./file-extensions").FileExtension[];
88
89
  default: import("./file-extensions").FileExtension;
89
90
  };
@@ -106,22 +107,22 @@ export declare const BrowserSafeApis: {
106
107
  };
107
108
  };
108
109
  };
109
- mp3: {
110
+ wav: {
110
111
  default: import("./file-extensions").FileExtension;
111
112
  forAudioCodec: {
112
- mp3: {
113
- possible: import("./file-extensions").FileExtension[];
114
- default: import("./file-extensions").FileExtension;
115
- };
116
113
  "pcm-16": {
117
114
  possible: import("./file-extensions").FileExtension[];
118
115
  default: import("./file-extensions").FileExtension;
119
116
  };
120
117
  };
121
118
  };
122
- wav: {
119
+ prores: {
123
120
  default: import("./file-extensions").FileExtension;
124
121
  forAudioCodec: {
122
+ aac: {
123
+ possible: import("./file-extensions").FileExtension[];
124
+ default: import("./file-extensions").FileExtension;
125
+ };
125
126
  "pcm-16": {
126
127
  possible: import("./file-extensions").FileExtension[];
127
128
  default: import("./file-extensions").FileExtension;
@@ -148,37 +149,37 @@ export declare const BrowserSafeApis: {
148
149
  };
149
150
  defaultAudioCodecs: {
150
151
  h264: {
151
- compressed: "aac" | "mp3" | "pcm-16" | null;
152
- lossless: "aac" | "mp3" | "pcm-16" | null;
152
+ compressed: "mp3" | "aac" | "pcm-16" | null;
153
+ lossless: "mp3" | "aac" | "pcm-16" | null;
153
154
  };
154
155
  h265: {
155
156
  compressed: "aac" | "pcm-16" | null;
156
157
  lossless: "aac" | "pcm-16" | null;
157
158
  };
158
159
  vp8: {
159
- compressed: "opus" | "pcm-16" | null;
160
- lossless: "opus" | "pcm-16" | null;
160
+ compressed: "pcm-16" | "opus" | null;
161
+ lossless: "pcm-16" | "opus" | null;
161
162
  };
162
163
  vp9: {
163
- compressed: "opus" | "pcm-16" | null;
164
- lossless: "opus" | "pcm-16" | null;
164
+ compressed: "pcm-16" | "opus" | null;
165
+ lossless: "pcm-16" | "opus" | null;
165
166
  };
166
- prores: {
167
- compressed: "aac" | "pcm-16" | null;
168
- lossless: "aac" | "pcm-16" | null;
167
+ mp3: {
168
+ compressed: "mp3" | "pcm-16" | null;
169
+ lossless: "mp3" | "pcm-16" | null;
169
170
  };
170
171
  aac: {
171
172
  compressed: "aac" | "pcm-16" | null;
172
173
  lossless: "aac" | "pcm-16" | null;
173
174
  };
174
- mp3: {
175
- compressed: "mp3" | "pcm-16" | null;
176
- lossless: "mp3" | "pcm-16" | null;
177
- };
178
175
  wav: {
179
176
  compressed: "pcm-16" | null;
180
177
  lossless: "pcm-16" | null;
181
178
  };
179
+ prores: {
180
+ compressed: "aac" | "pcm-16" | null;
181
+ lossless: "aac" | "pcm-16" | null;
182
+ };
182
183
  "h264-mkv": {
183
184
  compressed: "mp3" | "pcm-16" | null;
184
185
  lossless: "mp3" | "pcm-16" | null;
@@ -188,17 +189,17 @@ export declare const BrowserSafeApis: {
188
189
  lossless: null;
189
190
  };
190
191
  };
191
- defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "gif">;
192
- validateOutputFilename: <T_1 extends "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "gif">({ codec, audioCodec, extension, preferLossless, }: {
192
+ defaultCodecsForFileExtension: Record<import("./file-extensions").FileExtension, "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">;
193
+ validateOutputFilename: <T_1 extends "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif">({ codec, audioCodec, extension, preferLossless, }: {
193
194
  codec: T_1;
194
- audioCodec: "opus" | "aac" | "mp3" | "pcm-16" | null;
195
+ audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
195
196
  extension: string;
196
197
  preferLossless: boolean;
197
198
  }) => void;
198
199
  options: {
199
200
  scaleOption: {
200
201
  name: string;
201
- cliFlag: string;
202
+ cliFlag: "scale";
202
203
  description: () => JSX.Element;
203
204
  ssrName: string;
204
205
  docLink: string;
@@ -206,7 +207,7 @@ export declare const BrowserSafeApis: {
206
207
  };
207
208
  crfOption: {
208
209
  name: string;
209
- cliFlag: string;
210
+ cliFlag: "crf";
210
211
  description: () => JSX.Element;
211
212
  ssrName: string;
212
213
  docLink: string;
@@ -214,7 +215,7 @@ export declare const BrowserSafeApis: {
214
215
  };
215
216
  jpegQualityOption: {
216
217
  name: string;
217
- cliFlag: string;
218
+ cliFlag: "jpeg-quality";
218
219
  description: () => JSX.Element;
219
220
  ssrName: string;
220
221
  docLink: string;
@@ -226,11 +227,11 @@ export declare const BrowserSafeApis: {
226
227
  description: () => JSX.Element;
227
228
  ssrName: string;
228
229
  docLink: string;
229
- type: string;
230
+ type: string | null;
230
231
  };
231
232
  audioBitrateOption: {
232
233
  name: string;
233
- cliFlag: string;
234
+ cliFlag: "audio-bitrate";
234
235
  description: () => JSX.Element;
235
236
  ssrName: string;
236
237
  docLink: string;
@@ -238,7 +239,7 @@ export declare const BrowserSafeApis: {
238
239
  };
239
240
  enforceAudioOption: {
240
241
  name: string;
241
- cliFlag: string;
242
+ cliFlag: "enforce-audio-track";
242
243
  description: () => JSX.Element;
243
244
  ssrName: string;
244
245
  docLink: string;
@@ -254,13 +255,13 @@ export declare const BrowserSafeApis: {
254
255
  };
255
256
  videoCodecOption: {
256
257
  name: string;
257
- cliFlag: string;
258
+ cliFlag: "codec";
258
259
  description: () => JSX.Element;
259
260
  ssrName: string;
260
261
  docLink: string;
261
262
  type: string;
262
263
  };
263
- offthreadVideoCacheSizeInBytesOption: {
264
+ offthreadVideoCacheSizeInBytes: {
264
265
  name: string;
265
266
  cliFlag: "offthreadvideo-cache-size-in-bytes";
266
267
  description: () => JSX.Element;
@@ -282,7 +283,7 @@ export declare const BrowserSafeApis: {
282
283
  description: () => JSX.Element;
283
284
  docLink: string;
284
285
  ssrName: string;
285
- type: "bt709" | "default";
286
+ type: "default" | "bt709";
286
287
  };
287
288
  deleteAfterOption: {
288
289
  name: string;
@@ -309,7 +310,7 @@ export declare const BrowserSafeApis: {
309
310
  type: boolean;
310
311
  };
311
312
  glOption: {
312
- cliFlag: string;
313
+ cliFlag: "gl";
313
314
  docLink: string;
314
315
  name: string;
315
316
  type: "angle" | "swangle" | "egl" | "swiftshader" | "vulkan" | "angle-egl";
@@ -318,96 +319,148 @@ export declare const BrowserSafeApis: {
318
319
  };
319
320
  enableLambdaInsights: {
320
321
  name: string;
321
- cliFlag: string;
322
+ cliFlag: "enable-lambda-insights";
322
323
  description: () => JSX.Element;
323
324
  ssrName: string;
324
325
  docLink: string;
325
326
  type: boolean;
326
327
  };
327
- };
328
- validColorSpaces: readonly ["default", "bt709"];
329
- optionsMap: {
330
- readonly renderMedia: readonly [{
331
- name: string;
332
- cliFlag: "offthreadvideo-cache-size-in-bytes";
333
- description: () => JSX.Element;
334
- ssrName: "offthreadVideoCacheSizeInBytes";
335
- docLink: string;
336
- type: number | null;
337
- }];
338
- readonly renderStill: readonly [{
339
- name: string;
340
- cliFlag: "offthreadvideo-cache-size-in-bytes";
341
- description: () => JSX.Element;
342
- ssrName: "offthreadVideoCacheSizeInBytes";
343
- docLink: string;
344
- type: number | null;
345
- }];
346
- readonly getCompositions: readonly [{
347
- name: string;
348
- cliFlag: "offthreadvideo-cache-size-in-bytes";
349
- description: () => JSX.Element;
350
- ssrName: "offthreadVideoCacheSizeInBytes";
351
- docLink: string;
352
- type: number | null;
353
- }];
354
- readonly selectComposition: readonly [{
355
- name: string;
356
- cliFlag: "offthreadvideo-cache-size-in-bytes";
357
- description: () => JSX.Element;
358
- ssrName: "offthreadVideoCacheSizeInBytes";
359
- docLink: string;
360
- type: number | null;
361
- }];
362
- readonly renderFrames: readonly [{
328
+ encodingMaxRateOption: {
363
329
  name: string;
364
- cliFlag: "offthreadvideo-cache-size-in-bytes";
330
+ cliFlag: "max-rate";
365
331
  description: () => JSX.Element;
366
- ssrName: "offthreadVideoCacheSizeInBytes";
367
- docLink: string;
368
- type: number | null;
369
- }];
370
- readonly renderMediaOnLambda: readonly [{
371
- name: string;
372
- cliFlag: "offthreadvideo-cache-size-in-bytes";
373
- description: () => JSX.Element;
374
- ssrName: "offthreadVideoCacheSizeInBytes";
332
+ ssrName: "encodingMaxRate";
375
333
  docLink: string;
376
- type: number | null;
377
- }];
378
- readonly renderStillOnLambda: readonly [{
379
- name: string;
380
- cliFlag: "offthreadvideo-cache-size-in-bytes";
381
- description: () => JSX.Element;
382
- ssrName: "offthreadVideoCacheSizeInBytes";
383
- docLink: string;
384
- type: number | null;
385
- }];
386
- readonly getCompositionsOnLambda: readonly [{
387
- name: string;
388
- cliFlag: "offthreadvideo-cache-size-in-bytes";
389
- description: () => JSX.Element;
390
- ssrName: "offthreadVideoCacheSizeInBytes";
391
- docLink: string;
392
- type: number | null;
393
- }];
394
- readonly renderMediaOnCloudRun: readonly [{
395
- name: string;
396
- cliFlag: "offthreadvideo-cache-size-in-bytes";
397
- description: () => JSX.Element;
398
- ssrName: "offthreadVideoCacheSizeInBytes";
399
- docLink: string;
400
- type: number | null;
401
- }];
402
- readonly renderStillOnCloudRun: readonly [{
334
+ type: string | null;
335
+ };
336
+ encodingBufferSizeOption: {
403
337
  name: string;
404
- cliFlag: "offthreadvideo-cache-size-in-bytes";
338
+ cliFlag: "buffer-size";
405
339
  description: () => JSX.Element;
406
- ssrName: "offthreadVideoCacheSizeInBytes";
340
+ ssrName: "encodingBufferSize";
407
341
  docLink: string;
408
- type: number | null;
409
- }];
342
+ type: string | null;
343
+ };
344
+ };
345
+ validColorSpaces: readonly ["default", "bt709"];
346
+ optionsMap: {
347
+ readonly renderMedia: {
348
+ readonly offthreadVideoCacheSizeInBytes: {
349
+ name: string;
350
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
351
+ description: () => JSX.Element;
352
+ ssrName: "offthreadVideoCacheSizeInBytes";
353
+ docLink: string;
354
+ type: number | null;
355
+ };
356
+ readonly videoBitrate: {
357
+ name: string;
358
+ cliFlag: string;
359
+ description: () => JSX.Element;
360
+ ssrName: string;
361
+ docLink: string;
362
+ type: string | null;
363
+ };
364
+ };
365
+ readonly renderStill: {
366
+ readonly offthreadVideoCacheSizeInBytes: {
367
+ name: string;
368
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
369
+ description: () => JSX.Element;
370
+ ssrName: "offthreadVideoCacheSizeInBytes";
371
+ docLink: string;
372
+ type: number | null;
373
+ };
374
+ };
375
+ readonly getCompositions: {
376
+ readonly offthreadVideoCacheSizeInBytes: {
377
+ name: string;
378
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
379
+ description: () => JSX.Element;
380
+ ssrName: "offthreadVideoCacheSizeInBytes";
381
+ docLink: string;
382
+ type: number | null;
383
+ };
384
+ };
385
+ readonly selectComposition: {
386
+ readonly offthreadVideoCacheSizeInBytes: {
387
+ name: string;
388
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
389
+ description: () => JSX.Element;
390
+ ssrName: "offthreadVideoCacheSizeInBytes";
391
+ docLink: string;
392
+ type: number | null;
393
+ };
394
+ };
395
+ readonly renderFrames: {
396
+ readonly offthreadVideoCacheSizeInBytes: {
397
+ name: string;
398
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
399
+ description: () => JSX.Element;
400
+ ssrName: "offthreadVideoCacheSizeInBytes";
401
+ docLink: string;
402
+ type: number | null;
403
+ };
404
+ };
405
+ readonly renderMediaOnLambda: {
406
+ readonly offthreadVideoCacheSizeInBytes: {
407
+ name: string;
408
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
409
+ description: () => JSX.Element;
410
+ ssrName: "offthreadVideoCacheSizeInBytes";
411
+ docLink: string;
412
+ type: number | null;
413
+ };
414
+ readonly videoBitrate: {
415
+ name: string;
416
+ cliFlag: string;
417
+ description: () => JSX.Element;
418
+ ssrName: string;
419
+ docLink: string;
420
+ type: string | null;
421
+ };
422
+ };
423
+ readonly renderStillOnLambda: {
424
+ readonly offthreadVideoCacheSizeInBytes: {
425
+ name: string;
426
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
427
+ description: () => JSX.Element;
428
+ ssrName: "offthreadVideoCacheSizeInBytes";
429
+ docLink: string;
430
+ type: number | null;
431
+ };
432
+ };
433
+ readonly getCompositionsOnLambda: {
434
+ readonly offthreadVideoCacheSizeInBytes: {
435
+ name: string;
436
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
437
+ description: () => JSX.Element;
438
+ ssrName: "offthreadVideoCacheSizeInBytes";
439
+ docLink: string;
440
+ type: number | null;
441
+ };
442
+ };
443
+ readonly renderMediaOnCloudRun: {
444
+ readonly offthreadVideoCacheSizeInBytes: {
445
+ name: string;
446
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
447
+ description: () => JSX.Element;
448
+ ssrName: "offthreadVideoCacheSizeInBytes";
449
+ docLink: string;
450
+ type: number | null;
451
+ };
452
+ };
453
+ readonly renderStillOnCloudRun: {
454
+ readonly offthreadVideoCacheSizeInBytes: {
455
+ name: string;
456
+ cliFlag: "offthreadvideo-cache-size-in-bytes";
457
+ description: () => JSX.Element;
458
+ ssrName: "offthreadVideoCacheSizeInBytes";
459
+ docLink: string;
460
+ type: number | null;
461
+ };
462
+ };
410
463
  };
411
- codecSupportsCrf: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "gif") => boolean;
412
- codecSupportsVideoBitrate: (codec: "h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "wav" | "h264-mkv" | "gif") => boolean;
464
+ codecSupportsCrf: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => boolean;
465
+ codecSupportsVideoBitrate: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif") => boolean;
413
466
  };
@@ -38,6 +38,7 @@ export type VideoMetadata = {
38
38
  colorSpace: 'rgb' | 'bt601' | 'bt709' | 'bt2020-ncl' | 'bt2020-cl' | 'fcc' | 'bt470bg' | 'smpte170m' | 'smpte240m' | 'ycgco' | 'smpte2085' | 'chroma-derived-ncl' | 'chroma-derived-cl' | 'ictcp' | 'unknown';
39
39
  audioCodec: null | 'opus' | 'aac' | 'mp3' | 'pcm-f16le' | 'pcm-f24le' | 'pcm-f32be' | 'pcm-s16be' | 'pcm-s16le' | 'pcm-f32le' | 'pcm-s32be' | 'pcm-s32le' | 'pcm-s64be' | 'pcm-s64le' | 'pcm-u16be' | 'pcm-u16le' | 'pcm-u24be' | 'pcm-u24le' | 'pcm-u32be' | 'pcm-u32le' | 'pcm-u8' | 'pcm-f64be' | 'pcm-s24be' | 'pcm-s24le' | 'pcm-s8' | 'pcm-s16be-planar' | 'pcm-s8-planar' | 'pcm-s24le-planar' | 'pcm-s32le-planar' | 'unknown';
40
40
  audioFileExtension: string | null;
41
+ pixelFormat: null | 'yuv420p' | 'yuyv422' | 'rgb24' | 'bgr24' | 'yuv422p' | 'yuv444p' | 'yuv410p' | 'yuv411p' | 'yuvj420p' | 'yuvj422p' | 'yuvj444p' | 'argb' | 'rgba' | 'abgr' | 'bgra' | 'yuv440p' | 'yuvj440p' | 'yuva420p' | 'yuv420p16le' | 'yuv420p16be' | 'yuv422p16le' | 'yuv422p16be' | 'yuv444p16le' | 'yuv444p16be' | 'yuv420p9be' | 'yuv420p9le' | 'yuv420p10be' | 'yuv420p10le' | 'yuv422p10be' | 'yuv422p10le' | 'yuv444p9be' | 'yuv444p9le' | 'yuv444p10be' | 'yuv444p10le' | 'yuv422p9be' | 'yuv422p9le' | 'yuva420p9be' | 'yuva420p9le' | 'yuva422p9be' | 'yuva422p9le' | 'yuva444p9be' | 'yuva444p9le' | 'yuva420p10be' | 'yuva420p10le' | 'yuva422p10be' | 'yuva422p10le' | 'yuva444p10be' | 'yuva444p10le' | 'yuva420p16be' | 'yuva420p16le' | 'yuva422p16be' | 'yuva422p16le' | 'yuva444p16be' | 'yuva444p16le' | 'yuva444p' | 'yuva422p' | 'yuv420p12be' | 'yuv420p12le' | 'yuv420p14be' | 'yuv420p14le' | 'yuv422p12be' | 'yuv422p12le' | 'yuv422p14be' | 'yuv422p14le' | 'yuv444p12be' | 'yuv444p12le' | 'yuv444p14be' | 'yuv444p14le' | 'yuvj411p' | 'yuv440p10le' | 'yuv440p10be' | 'yuv440p12le' | 'yuv440p12be' | 'yuv420p9' | 'yuv422p9' | 'yuv444p9' | 'yuv420p10' | 'yuv422p10' | 'yuv440p10' | 'yuv444p10' | 'yuv420p12' | 'yuv422p12' | 'yuv440p12' | 'yuv444p12' | 'yuv420p14' | 'yuv422p14' | 'yuv444p14' | 'yuv420p16' | 'yuv422p16' | 'yuv444p16' | 'yuva420p9' | 'yuva422p9' | 'yuva444p9' | 'yuva420p10' | 'yuva422p10' | 'yuva444p10' | 'yuva420p16' | 'yuva422p16' | 'yuva444p16' | 'yuva422p12be' | 'yuva422p12le' | 'yuva444p12be' | 'yuva444p12le' | 'unknown';
41
42
  };
42
43
  type SilentPart = {
43
44
  startInSeconds: number;
package/dist/crf.d.ts CHANGED
@@ -2,8 +2,10 @@ import type { Codec } from './codec';
2
2
  export type Crf = number | undefined;
3
3
  export declare const getDefaultCrfForCodec: (codec: Codec) => number;
4
4
  export declare const getValidCrfRanges: (codec: Codec) => [number, number];
5
- export declare const validateQualitySettings: ({ codec, crf, videoBitrate, }: {
5
+ export declare const validateQualitySettings: ({ codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, }: {
6
6
  crf: unknown;
7
7
  codec: Codec;
8
- videoBitrate: string | null | undefined;
8
+ videoBitrate: string | null;
9
+ encodingMaxRate: string | null;
10
+ encodingBufferSize: string | null;
9
11
  }) => string[];
package/dist/crf.js CHANGED
@@ -52,10 +52,17 @@ const getValidCrfRanges = (codec) => {
52
52
  throw new TypeError(`Got unexpected codec "${codec}"`);
53
53
  };
54
54
  exports.getValidCrfRanges = getValidCrfRanges;
55
- const validateQualitySettings = ({ codec, crf, videoBitrate, }) => {
55
+ const validateQualitySettings = ({ codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, }) => {
56
56
  if (crf && videoBitrate) {
57
57
  throw new Error('"crf" and "videoBitrate" can not both be set. Choose one of either.');
58
58
  }
59
+ if (encodingMaxRate && !encodingBufferSize) {
60
+ throw new Error('"encodingMaxRate" can not be set without also setting "encodingBufferSize".');
61
+ }
62
+ const bufSizeArray = encodingBufferSize
63
+ ? ['-bufsize', encodingBufferSize]
64
+ : [];
65
+ const maxRateArray = encodingMaxRate ? ['-maxrate', encodingMaxRate] : [];
59
66
  if (videoBitrate) {
60
67
  if (codec === 'prores') {
61
68
  console.warn('ProRes does not support videoBitrate. Ignoring.');
@@ -65,11 +72,11 @@ const validateQualitySettings = ({ codec, crf, videoBitrate, }) => {
65
72
  console.warn(`${codec} does not support videoBitrate. Ignoring.`);
66
73
  return [];
67
74
  }
68
- return ['-b:v', videoBitrate];
75
+ return ['-b:v', videoBitrate, ...bufSizeArray, ...maxRateArray];
69
76
  }
70
77
  if (crf === null || typeof crf === 'undefined') {
71
78
  const actualCrf = (0, exports.getDefaultCrfForCodec)(codec);
72
- return ['-crf', String(actualCrf)];
79
+ return ['-crf', String(actualCrf), ...bufSizeArray, ...maxRateArray];
73
80
  }
74
81
  if (typeof crf !== 'number') {
75
82
  throw new TypeError('Expected CRF to be a number, but is ' + JSON.stringify(crf));
@@ -92,6 +99,6 @@ const validateQualitySettings = ({ codec, crf, videoBitrate, }) => {
92
99
  console.warn(`${codec} does not support the "crf" option. Ignoring.`);
93
100
  return [];
94
101
  }
95
- return ['-crf', String(crf)];
102
+ return ['-crf', String(crf), ...bufSizeArray, ...maxRateArray];
96
103
  };
97
104
  exports.validateQualitySettings = validateQualitySettings;
@@ -2,13 +2,15 @@ import type { Codec } from './codec';
2
2
  import type { ColorSpace } from './options/color-space';
3
3
  import type { PixelFormat } from './pixel-format';
4
4
  import type { X264Preset } from './x264-preset';
5
- export declare const generateFfmpegArgs: ({ hasPreencoded, proResProfileName, pixelFormat, x264Preset, codec, crf, videoBitrate, colorSpace, }: {
5
+ export declare const generateFfmpegArgs: ({ hasPreencoded, proResProfileName, pixelFormat, x264Preset, codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, colorSpace, }: {
6
6
  hasPreencoded: boolean;
7
7
  proResProfileName: string | null;
8
8
  pixelFormat: PixelFormat;
9
9
  x264Preset: X264Preset | null;
10
10
  crf: unknown;
11
11
  codec: Codec;
12
- videoBitrate: string | null | undefined;
12
+ videoBitrate: string | null;
13
+ encodingMaxRate: string | null;
14
+ encodingBufferSize: string | null;
13
15
  colorSpace: ColorSpace;
14
16
  }) => string[][];
@@ -4,7 +4,7 @@ exports.generateFfmpegArgs = void 0;
4
4
  const crf_1 = require("./crf");
5
5
  const get_codec_name_1 = require("./get-codec-name");
6
6
  const truthy_1 = require("./truthy");
7
- const firstEncodingStepOnly = ({ hasPreencoded, proResProfileName, pixelFormat, x264Preset, codec, crf, videoBitrate, }) => {
7
+ const firstEncodingStepOnly = ({ hasPreencoded, proResProfileName, pixelFormat, x264Preset, codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, }) => {
8
8
  if (hasPreencoded || codec === 'gif') {
9
9
  return [];
10
10
  }
@@ -19,10 +19,12 @@ const firstEncodingStepOnly = ({ hasPreencoded, proResProfileName, pixelFormat,
19
19
  crf,
20
20
  videoBitrate,
21
21
  codec,
22
+ encodingMaxRate,
23
+ encodingBufferSize,
22
24
  }),
23
25
  ].filter(truthy_1.truthy);
24
26
  };
25
- const generateFfmpegArgs = ({ hasPreencoded, proResProfileName, pixelFormat, x264Preset, codec, crf, videoBitrate, colorSpace, }) => {
27
+ const generateFfmpegArgs = ({ hasPreencoded, proResProfileName, pixelFormat, x264Preset, codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, colorSpace, }) => {
26
28
  const encoderName = (0, get_codec_name_1.getCodecName)(codec);
27
29
  if (encoderName === null) {
28
30
  throw new TypeError('encoderName is null: ' + JSON.stringify(codec));
@@ -47,6 +49,8 @@ const generateFfmpegArgs = ({ hasPreencoded, proResProfileName, pixelFormat, x26
47
49
  pixelFormat,
48
50
  proResProfileName,
49
51
  videoBitrate,
52
+ encodingMaxRate,
53
+ encodingBufferSize,
50
54
  x264Preset,
51
55
  }),
52
56
  ].filter(truthy_1.truthy);
@@ -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" | "aac" | "mp3" | "wav" | "h264-mkv" | "gif">(codec: T, audioCodec: AudioCodec | null) => FileExtension;
5
- export declare const makeFileExtensionMap: () => Record<string, ("h264" | "h265" | "vp8" | "vp9" | "prores" | "aac" | "mp3" | "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>;