@remotion/renderer 4.0.266 → 4.0.268
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/bundle.ts +27 -0
- package/dist/assets/download-map.js +7 -2
- package/dist/browser/Browser.d.ts +7 -3
- package/dist/browser/Browser.js +12 -4
- package/dist/browser/BrowserPage.d.ts +7 -3
- package/dist/browser/BrowserPage.js +68 -57
- package/dist/browser/Target.d.ts +3 -1
- package/dist/browser/Target.js +2 -1
- package/dist/esm/client.mjs +3095 -0
- package/dist/esm/error-handling.mjs +341 -0
- package/dist/esm/index.mjs +22662 -0
- package/dist/esm/pure.mjs +528 -0
- package/dist/get-browser-instance.d.ts +3 -1
- package/dist/get-browser-instance.js +3 -1
- package/dist/get-compositions.js +4 -12
- package/dist/make-page.d.ts +1 -1
- package/dist/make-page.js +4 -13
- package/dist/options/offthreadvideo-threads.d.ts +1 -1
- package/dist/options/offthreadvideo-threads.js +1 -1
- package/dist/render-frame-and-retry-target-close.js +1 -0
- package/dist/render-still.js +4 -12
- package/dist/select-composition.js +4 -12
- package/dist/test-gpu.js +1 -0
- package/package.json +53 -13
- package/dist/compositor/compose.d.ts +0 -4
- package/dist/compositor/compose.js +0 -79
|
@@ -0,0 +1,528 @@
|
|
|
1
|
+
// src/is-audio-codec.ts
|
|
2
|
+
var isAudioCodec = (codec) => {
|
|
3
|
+
return codec === "mp3" || codec === "aac" || codec === "wav";
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
// src/codec-supports-media.ts
|
|
7
|
+
var support = {
|
|
8
|
+
"h264-mkv": {
|
|
9
|
+
audio: true,
|
|
10
|
+
video: true
|
|
11
|
+
},
|
|
12
|
+
aac: {
|
|
13
|
+
audio: true,
|
|
14
|
+
video: false
|
|
15
|
+
},
|
|
16
|
+
gif: {
|
|
17
|
+
video: true,
|
|
18
|
+
audio: false
|
|
19
|
+
},
|
|
20
|
+
h264: {
|
|
21
|
+
video: true,
|
|
22
|
+
audio: true
|
|
23
|
+
},
|
|
24
|
+
"h264-ts": {
|
|
25
|
+
video: true,
|
|
26
|
+
audio: true
|
|
27
|
+
},
|
|
28
|
+
h265: {
|
|
29
|
+
video: true,
|
|
30
|
+
audio: true
|
|
31
|
+
},
|
|
32
|
+
mp3: {
|
|
33
|
+
audio: true,
|
|
34
|
+
video: false
|
|
35
|
+
},
|
|
36
|
+
prores: {
|
|
37
|
+
audio: true,
|
|
38
|
+
video: true
|
|
39
|
+
},
|
|
40
|
+
vp8: {
|
|
41
|
+
audio: true,
|
|
42
|
+
video: true
|
|
43
|
+
},
|
|
44
|
+
vp9: {
|
|
45
|
+
audio: true,
|
|
46
|
+
video: true
|
|
47
|
+
},
|
|
48
|
+
wav: {
|
|
49
|
+
audio: true,
|
|
50
|
+
video: false
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var codecSupportsMedia = (codec) => {
|
|
54
|
+
return support[codec];
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// src/get-duration-from-frame-range.ts
|
|
58
|
+
var getFramesToRender = (frameRange, everyNthFrame) => {
|
|
59
|
+
if (everyNthFrame === 0) {
|
|
60
|
+
throw new Error("everyNthFrame cannot be 0");
|
|
61
|
+
}
|
|
62
|
+
return new Array(frameRange[1] - frameRange[0] + 1).fill(true).map((_, index) => {
|
|
63
|
+
return index + frameRange[0];
|
|
64
|
+
}).filter((index) => {
|
|
65
|
+
return index % everyNthFrame === 0;
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/codec.ts
|
|
70
|
+
var validCodecs = [
|
|
71
|
+
"h264",
|
|
72
|
+
"h265",
|
|
73
|
+
"vp8",
|
|
74
|
+
"vp9",
|
|
75
|
+
"mp3",
|
|
76
|
+
"aac",
|
|
77
|
+
"wav",
|
|
78
|
+
"prores",
|
|
79
|
+
"h264-mkv",
|
|
80
|
+
"h264-ts",
|
|
81
|
+
"gif"
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
// src/file-extensions.ts
|
|
85
|
+
var defaultFileExtensionMap = {
|
|
86
|
+
"h264-mkv": {
|
|
87
|
+
default: "mkv",
|
|
88
|
+
forAudioCodec: {
|
|
89
|
+
"pcm-16": { possible: ["mkv"], default: "mkv" },
|
|
90
|
+
mp3: { possible: ["mkv"], default: "mkv" }
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"h264-ts": {
|
|
94
|
+
default: "ts",
|
|
95
|
+
forAudioCodec: {
|
|
96
|
+
"pcm-16": { possible: ["ts"], default: "ts" },
|
|
97
|
+
aac: { possible: ["ts"], default: "ts" }
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
aac: {
|
|
101
|
+
default: "aac",
|
|
102
|
+
forAudioCodec: {
|
|
103
|
+
aac: {
|
|
104
|
+
possible: ["aac", "3gp", "m4a", "m4b", "mpg", "mpeg"],
|
|
105
|
+
default: "aac"
|
|
106
|
+
},
|
|
107
|
+
"pcm-16": {
|
|
108
|
+
possible: ["wav"],
|
|
109
|
+
default: "wav"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
gif: {
|
|
114
|
+
default: "gif",
|
|
115
|
+
forAudioCodec: {}
|
|
116
|
+
},
|
|
117
|
+
h264: {
|
|
118
|
+
default: "mp4",
|
|
119
|
+
forAudioCodec: {
|
|
120
|
+
"pcm-16": { possible: ["mkv", "mov"], default: "mkv" },
|
|
121
|
+
aac: { possible: ["mp4", "mkv", "mov"], default: "mp4" },
|
|
122
|
+
mp3: { possible: ["mp4", "mkv", "mov"], default: "mp4" }
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
h265: {
|
|
126
|
+
default: "mp4",
|
|
127
|
+
forAudioCodec: {
|
|
128
|
+
aac: { possible: ["mp4", "mkv", "hevc"], default: "mp4" },
|
|
129
|
+
"pcm-16": { possible: ["mkv"], default: "mkv" }
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
mp3: {
|
|
133
|
+
default: "mp3",
|
|
134
|
+
forAudioCodec: {
|
|
135
|
+
mp3: { possible: ["mp3"], default: "mp3" },
|
|
136
|
+
"pcm-16": { possible: ["wav"], default: "wav" }
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
prores: {
|
|
140
|
+
default: "mov",
|
|
141
|
+
forAudioCodec: {
|
|
142
|
+
aac: { possible: ["mov", "mkv", "mxf"], default: "mov" },
|
|
143
|
+
"pcm-16": { possible: ["mov", "mkv", "mxf"], default: "mov" }
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
vp8: {
|
|
147
|
+
default: "webm",
|
|
148
|
+
forAudioCodec: {
|
|
149
|
+
"pcm-16": { possible: ["mkv"], default: "mkv" },
|
|
150
|
+
opus: { possible: ["webm"], default: "webm" }
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
vp9: {
|
|
154
|
+
default: "webm",
|
|
155
|
+
forAudioCodec: {
|
|
156
|
+
"pcm-16": { possible: ["mkv"], default: "mkv" },
|
|
157
|
+
opus: { possible: ["webm"], default: "webm" }
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
wav: {
|
|
161
|
+
default: "wav",
|
|
162
|
+
forAudioCodec: {
|
|
163
|
+
"pcm-16": { possible: ["wav"], default: "wav" }
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// src/get-extension-from-codec.ts
|
|
169
|
+
var getFileExtensionFromCodec = (codec, audioCodec) => {
|
|
170
|
+
if (!validCodecs.includes(codec)) {
|
|
171
|
+
throw new Error(`Codec must be one of the following: ${validCodecs.join(", ")}, but got ${codec}`);
|
|
172
|
+
}
|
|
173
|
+
const map = defaultFileExtensionMap[codec];
|
|
174
|
+
if (audioCodec === null) {
|
|
175
|
+
return map.default;
|
|
176
|
+
}
|
|
177
|
+
const typedAudioCodec = audioCodec;
|
|
178
|
+
if (!(typedAudioCodec in map.forAudioCodec)) {
|
|
179
|
+
throw new Error(`Audio codec ${typedAudioCodec} is not supported for codec ${codec}`);
|
|
180
|
+
}
|
|
181
|
+
return map.forAudioCodec[audioCodec].default;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
// src/path-normalize.ts
|
|
185
|
+
var SLASH = 47;
|
|
186
|
+
var DOT = 46;
|
|
187
|
+
var assertPath = (path) => {
|
|
188
|
+
const t = typeof path;
|
|
189
|
+
if (t !== "string") {
|
|
190
|
+
throw new TypeError(`Expected a string, got a ${t}`);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
var posixNormalize = (path, allowAboveRoot) => {
|
|
194
|
+
let res = "";
|
|
195
|
+
let lastSegmentLength = 0;
|
|
196
|
+
let lastSlash = -1;
|
|
197
|
+
let dots = 0;
|
|
198
|
+
let code;
|
|
199
|
+
for (let i = 0;i <= path.length; ++i) {
|
|
200
|
+
if (i < path.length) {
|
|
201
|
+
code = path.charCodeAt(i);
|
|
202
|
+
} else if (code === SLASH) {
|
|
203
|
+
break;
|
|
204
|
+
} else {
|
|
205
|
+
code = SLASH;
|
|
206
|
+
}
|
|
207
|
+
if (code === SLASH) {
|
|
208
|
+
if (lastSlash === i - 1 || dots === 1) {
|
|
209
|
+
} else if (lastSlash !== i - 1 && dots === 2) {
|
|
210
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {
|
|
211
|
+
if (res.length > 2) {
|
|
212
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
213
|
+
if (lastSlashIndex !== res.length - 1) {
|
|
214
|
+
if (lastSlashIndex === -1) {
|
|
215
|
+
res = "";
|
|
216
|
+
lastSegmentLength = 0;
|
|
217
|
+
} else {
|
|
218
|
+
res = res.slice(0, lastSlashIndex);
|
|
219
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
220
|
+
}
|
|
221
|
+
lastSlash = i;
|
|
222
|
+
dots = 0;
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
} else if (res.length === 2 || res.length === 1) {
|
|
226
|
+
res = "";
|
|
227
|
+
lastSegmentLength = 0;
|
|
228
|
+
lastSlash = i;
|
|
229
|
+
dots = 0;
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (allowAboveRoot) {
|
|
234
|
+
if (res.length > 0) {
|
|
235
|
+
res += "/..";
|
|
236
|
+
} else {
|
|
237
|
+
res = "..";
|
|
238
|
+
}
|
|
239
|
+
lastSegmentLength = 2;
|
|
240
|
+
}
|
|
241
|
+
} else {
|
|
242
|
+
if (res.length > 0) {
|
|
243
|
+
res += "/" + path.slice(lastSlash + 1, i);
|
|
244
|
+
} else {
|
|
245
|
+
res = path.slice(lastSlash + 1, i);
|
|
246
|
+
}
|
|
247
|
+
lastSegmentLength = i - lastSlash - 1;
|
|
248
|
+
}
|
|
249
|
+
lastSlash = i;
|
|
250
|
+
dots = 0;
|
|
251
|
+
} else if (code === DOT && dots !== -1) {
|
|
252
|
+
++dots;
|
|
253
|
+
} else {
|
|
254
|
+
dots = -1;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return res;
|
|
258
|
+
};
|
|
259
|
+
var decode = (s) => {
|
|
260
|
+
try {
|
|
261
|
+
return decodeURIComponent(s);
|
|
262
|
+
} catch {
|
|
263
|
+
return s;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
var pathNormalize = (p) => {
|
|
267
|
+
assertPath(p);
|
|
268
|
+
let path = p;
|
|
269
|
+
if (path.length === 0) {
|
|
270
|
+
return ".";
|
|
271
|
+
}
|
|
272
|
+
const isAbsolute = path.charCodeAt(0) === SLASH;
|
|
273
|
+
const trailingSeparator = path.charCodeAt(path.length - 1) === SLASH;
|
|
274
|
+
path = decode(path);
|
|
275
|
+
path = posixNormalize(path, !isAbsolute);
|
|
276
|
+
if (path.length === 0 && !isAbsolute) {
|
|
277
|
+
path = ".";
|
|
278
|
+
}
|
|
279
|
+
if (path.length > 0 && trailingSeparator) {
|
|
280
|
+
path += "/";
|
|
281
|
+
}
|
|
282
|
+
if (isAbsolute) {
|
|
283
|
+
return "/" + path;
|
|
284
|
+
}
|
|
285
|
+
return path;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
// src/get-extension-of-filename.ts
|
|
289
|
+
var getExtensionOfFilename = (filename) => {
|
|
290
|
+
if (filename === null) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
const filenameArr = pathNormalize(filename).split(".");
|
|
294
|
+
const hasExtension = filenameArr.length >= 2;
|
|
295
|
+
const filenameArrLength = filenameArr.length;
|
|
296
|
+
const extension = hasExtension ? filenameArr[filenameArrLength - 1] : null;
|
|
297
|
+
return extension;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// src/options/separate-audio.tsx
|
|
301
|
+
var DEFAULT = null;
|
|
302
|
+
var cliFlag = "separate-audio-to";
|
|
303
|
+
var separateAudioOption = {
|
|
304
|
+
cliFlag,
|
|
305
|
+
description: () => `If set, the audio will not be included in the main output but rendered as a separate file at the location you pass. It is recommended to use an absolute path. If a relative path is passed, it is relative to the Remotion Root.`,
|
|
306
|
+
docLink: "https://remotion.dev/docs/renderer/render-media",
|
|
307
|
+
getValue: ({ commandLine }) => {
|
|
308
|
+
if (commandLine[cliFlag]) {
|
|
309
|
+
return {
|
|
310
|
+
source: "cli",
|
|
311
|
+
value: commandLine[cliFlag]
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
return {
|
|
315
|
+
source: "default",
|
|
316
|
+
value: DEFAULT
|
|
317
|
+
};
|
|
318
|
+
},
|
|
319
|
+
name: "Separate audio to",
|
|
320
|
+
setConfig: () => {
|
|
321
|
+
throw new Error("Not implemented");
|
|
322
|
+
},
|
|
323
|
+
ssrName: "separateAudioTo",
|
|
324
|
+
type: "string"
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
// src/options/audio-codec.tsx
|
|
328
|
+
var validAudioCodecs = ["pcm-16", "aac", "mp3", "opus"];
|
|
329
|
+
var supportedAudioCodecs = {
|
|
330
|
+
h264: ["aac", "pcm-16", "mp3"],
|
|
331
|
+
"h264-mkv": ["pcm-16", "mp3"],
|
|
332
|
+
"h264-ts": ["pcm-16", "aac"],
|
|
333
|
+
aac: ["aac", "pcm-16"],
|
|
334
|
+
avi: [],
|
|
335
|
+
gif: [],
|
|
336
|
+
h265: ["aac", "pcm-16"],
|
|
337
|
+
mp3: ["mp3", "pcm-16"],
|
|
338
|
+
prores: ["aac", "pcm-16"],
|
|
339
|
+
vp8: ["opus", "pcm-16"],
|
|
340
|
+
vp9: ["opus", "pcm-16"],
|
|
341
|
+
wav: ["pcm-16"]
|
|
342
|
+
};
|
|
343
|
+
var _satisfies = supportedAudioCodecs;
|
|
344
|
+
if (_satisfies) {
|
|
345
|
+
}
|
|
346
|
+
var cliFlag2 = "audio-codec";
|
|
347
|
+
var ssrName = "audioCodec";
|
|
348
|
+
var defaultAudioCodecs = {
|
|
349
|
+
"h264-mkv": {
|
|
350
|
+
lossless: "pcm-16",
|
|
351
|
+
compressed: "pcm-16"
|
|
352
|
+
},
|
|
353
|
+
"h264-ts": {
|
|
354
|
+
lossless: "pcm-16",
|
|
355
|
+
compressed: "aac"
|
|
356
|
+
},
|
|
357
|
+
aac: {
|
|
358
|
+
lossless: "pcm-16",
|
|
359
|
+
compressed: "aac"
|
|
360
|
+
},
|
|
361
|
+
gif: {
|
|
362
|
+
lossless: null,
|
|
363
|
+
compressed: null
|
|
364
|
+
},
|
|
365
|
+
h264: {
|
|
366
|
+
lossless: "pcm-16",
|
|
367
|
+
compressed: "aac"
|
|
368
|
+
},
|
|
369
|
+
h265: {
|
|
370
|
+
lossless: "pcm-16",
|
|
371
|
+
compressed: "aac"
|
|
372
|
+
},
|
|
373
|
+
mp3: {
|
|
374
|
+
lossless: "pcm-16",
|
|
375
|
+
compressed: "mp3"
|
|
376
|
+
},
|
|
377
|
+
prores: {
|
|
378
|
+
lossless: "pcm-16",
|
|
379
|
+
compressed: "pcm-16"
|
|
380
|
+
},
|
|
381
|
+
vp8: {
|
|
382
|
+
lossless: "pcm-16",
|
|
383
|
+
compressed: "opus"
|
|
384
|
+
},
|
|
385
|
+
vp9: {
|
|
386
|
+
lossless: "pcm-16",
|
|
387
|
+
compressed: "opus"
|
|
388
|
+
},
|
|
389
|
+
wav: {
|
|
390
|
+
lossless: "pcm-16",
|
|
391
|
+
compressed: "pcm-16"
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
var extensionMap = {
|
|
395
|
+
aac: "aac",
|
|
396
|
+
mp3: "mp3",
|
|
397
|
+
opus: "opus",
|
|
398
|
+
"pcm-16": "wav"
|
|
399
|
+
};
|
|
400
|
+
var resolveAudioCodec = ({
|
|
401
|
+
codec,
|
|
402
|
+
setting,
|
|
403
|
+
preferLossless,
|
|
404
|
+
separateAudioTo
|
|
405
|
+
}) => {
|
|
406
|
+
let derivedFromSeparateAudioToExtension = null;
|
|
407
|
+
if (separateAudioTo) {
|
|
408
|
+
const extension = separateAudioTo.split(".").pop();
|
|
409
|
+
for (const [key, value] of Object.entries(extensionMap)) {
|
|
410
|
+
if (value === extension) {
|
|
411
|
+
derivedFromSeparateAudioToExtension = key;
|
|
412
|
+
if (!supportedAudioCodecs[codec].includes(derivedFromSeparateAudioToExtension) && derivedFromSeparateAudioToExtension) {
|
|
413
|
+
throw new Error(`The codec is ${codec} but the audio codec derived from --${separateAudioOption.cliFlag} is ${derivedFromSeparateAudioToExtension}. The only supported codecs are: ${supportedAudioCodecs[codec].join(", ")}`);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (preferLossless) {
|
|
419
|
+
const selected = getDefaultAudioCodec({ codec, preferLossless });
|
|
420
|
+
if (derivedFromSeparateAudioToExtension && selected !== derivedFromSeparateAudioToExtension) {
|
|
421
|
+
throw new Error(`The audio codec derived from --${separateAudioOption.cliFlag} is ${derivedFromSeparateAudioToExtension}, but does not match the audio codec derived from the "Prefer lossless" option (${selected}). Remove any conflicting options.`);
|
|
422
|
+
}
|
|
423
|
+
return selected;
|
|
424
|
+
}
|
|
425
|
+
if (setting === null) {
|
|
426
|
+
if (derivedFromSeparateAudioToExtension) {
|
|
427
|
+
return derivedFromSeparateAudioToExtension;
|
|
428
|
+
}
|
|
429
|
+
return getDefaultAudioCodec({ codec, preferLossless });
|
|
430
|
+
}
|
|
431
|
+
if (derivedFromSeparateAudioToExtension !== setting && derivedFromSeparateAudioToExtension) {
|
|
432
|
+
throw new Error(`The audio codec derived from --${separateAudioOption.cliFlag} is ${derivedFromSeparateAudioToExtension}, but does not match the audio codec derived from your ${audioCodecOption.name} setting (${setting}). Remove any conflicting options.`);
|
|
433
|
+
}
|
|
434
|
+
return setting;
|
|
435
|
+
};
|
|
436
|
+
var getDefaultAudioCodec = ({
|
|
437
|
+
codec,
|
|
438
|
+
preferLossless
|
|
439
|
+
}) => {
|
|
440
|
+
return defaultAudioCodecs[codec][preferLossless ? "lossless" : "compressed"];
|
|
441
|
+
};
|
|
442
|
+
var _audioCodec = null;
|
|
443
|
+
var audioCodecOption = {
|
|
444
|
+
cliFlag: cliFlag2,
|
|
445
|
+
setConfig: (audioCodec) => {
|
|
446
|
+
if (audioCodec === null) {
|
|
447
|
+
_audioCodec = null;
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
if (!validAudioCodecs.includes(audioCodec)) {
|
|
451
|
+
throw new Error(`Audio codec must be one of the following: ${validAudioCodecs.join(", ")}, but got ${audioCodec}`);
|
|
452
|
+
}
|
|
453
|
+
_audioCodec = audioCodec;
|
|
454
|
+
},
|
|
455
|
+
getValue: ({ commandLine }) => {
|
|
456
|
+
if (commandLine[cliFlag2]) {
|
|
457
|
+
const codec = commandLine[cliFlag2];
|
|
458
|
+
if (!validAudioCodecs.includes(commandLine[cliFlag2])) {
|
|
459
|
+
throw new Error(`Audio codec must be one of the following: ${validAudioCodecs.join(", ")}, but got ${codec}`);
|
|
460
|
+
}
|
|
461
|
+
return {
|
|
462
|
+
source: "cli",
|
|
463
|
+
value: commandLine[cliFlag2]
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
if (_audioCodec !== null) {
|
|
467
|
+
return {
|
|
468
|
+
source: "config",
|
|
469
|
+
value: _audioCodec
|
|
470
|
+
};
|
|
471
|
+
}
|
|
472
|
+
return {
|
|
473
|
+
source: "default",
|
|
474
|
+
value: null
|
|
475
|
+
};
|
|
476
|
+
},
|
|
477
|
+
description: () => `Set the format of the audio that is embedded in the video. Not all codec and audio codec combinations are supported and certain combinations require a certain file extension and container format. See the table in the docs to see possible combinations.`,
|
|
478
|
+
docLink: "https://www.remotion.dev/docs/encoding/#audio-codec",
|
|
479
|
+
name: "Audio Codec",
|
|
480
|
+
ssrName,
|
|
481
|
+
type: "aac"
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
// src/validate-output-filename.ts
|
|
485
|
+
var validateOutputFilename = ({
|
|
486
|
+
codec,
|
|
487
|
+
audioCodecSetting,
|
|
488
|
+
extension,
|
|
489
|
+
preferLossless,
|
|
490
|
+
separateAudioTo
|
|
491
|
+
}) => {
|
|
492
|
+
if (!defaultFileExtensionMap[codec]) {
|
|
493
|
+
throw new TypeError(`The codec "${codec}" is not supported. Supported codecs are: ${Object.keys(defaultFileExtensionMap).join(", ")}`);
|
|
494
|
+
}
|
|
495
|
+
const map = defaultFileExtensionMap[codec];
|
|
496
|
+
const resolvedAudioCodec = resolveAudioCodec({
|
|
497
|
+
codec,
|
|
498
|
+
preferLossless,
|
|
499
|
+
setting: audioCodecSetting,
|
|
500
|
+
separateAudioTo
|
|
501
|
+
});
|
|
502
|
+
if (resolvedAudioCodec === null) {
|
|
503
|
+
if (extension !== map.default) {
|
|
504
|
+
throw new TypeError(`When using the ${codec} codec, the output filename must end in .${map.default}.`);
|
|
505
|
+
}
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
if (!(resolvedAudioCodec in map.forAudioCodec)) {
|
|
509
|
+
throw new Error(`Audio codec ${resolvedAudioCodec} is not supported for codec ${codec}`);
|
|
510
|
+
}
|
|
511
|
+
const acceptableExtensions = map.forAudioCodec[resolvedAudioCodec].possible;
|
|
512
|
+
if (!acceptableExtensions.includes(extension) && !separateAudioTo) {
|
|
513
|
+
throw new TypeError(`When using the ${codec} codec with the ${resolvedAudioCodec} audio codec, the output filename must end in one of the following: ${acceptableExtensions.join(", ")}.`);
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
// src/pure.ts
|
|
518
|
+
var NoReactAPIs = {
|
|
519
|
+
getExtensionOfFilename,
|
|
520
|
+
getFileExtensionFromCodec,
|
|
521
|
+
validateOutputFilename,
|
|
522
|
+
getFramesToRender,
|
|
523
|
+
codecSupportsMedia,
|
|
524
|
+
isAudioCodec
|
|
525
|
+
};
|
|
526
|
+
export {
|
|
527
|
+
NoReactAPIs
|
|
528
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { BrowserExecutable } from './browser-executable';
|
|
2
|
+
import type { BrowserLog } from './browser-log';
|
|
2
3
|
import type { HeadlessBrowser } from './browser/Browser';
|
|
3
4
|
import type { Page } from './browser/BrowserPage';
|
|
4
5
|
import type { LogLevel } from './log-level';
|
|
5
6
|
import type { ChromiumOptions } from './open-browser';
|
|
6
7
|
import type { ChromeMode } from './options/chrome-mode';
|
|
7
8
|
import type { OnBrowserDownload } from './options/on-browser-download';
|
|
8
|
-
export declare const getPageAndCleanupFn: ({ passedInInstance, browserExecutable, chromiumOptions, forceDeviceScaleFactor, indent, logLevel, onBrowserDownload, chromeMode, pageIndex, }: {
|
|
9
|
+
export declare const getPageAndCleanupFn: ({ passedInInstance, browserExecutable, chromiumOptions, forceDeviceScaleFactor, indent, logLevel, onBrowserDownload, chromeMode, pageIndex, onBrowserLog, }: {
|
|
9
10
|
passedInInstance: HeadlessBrowser | undefined;
|
|
10
11
|
browserExecutable: BrowserExecutable | null;
|
|
11
12
|
chromiumOptions: ChromiumOptions;
|
|
@@ -15,6 +16,7 @@ export declare const getPageAndCleanupFn: ({ passedInInstance, browserExecutable
|
|
|
15
16
|
onBrowserDownload: OnBrowserDownload;
|
|
16
17
|
chromeMode: ChromeMode;
|
|
17
18
|
pageIndex: number;
|
|
19
|
+
onBrowserLog: null | ((log: BrowserLog) => void);
|
|
18
20
|
}) => Promise<{
|
|
19
21
|
cleanupPage: () => Promise<void>;
|
|
20
22
|
page: Page;
|
|
@@ -4,13 +4,14 @@ exports.getPageAndCleanupFn = void 0;
|
|
|
4
4
|
const browser_1 = require("./browser");
|
|
5
5
|
const logger_1 = require("./logger");
|
|
6
6
|
const open_browser_1 = require("./open-browser");
|
|
7
|
-
const getPageAndCleanupFn = async ({ passedInInstance, browserExecutable, chromiumOptions, forceDeviceScaleFactor, indent, logLevel, onBrowserDownload, chromeMode, pageIndex, }) => {
|
|
7
|
+
const getPageAndCleanupFn = async ({ passedInInstance, browserExecutable, chromiumOptions, forceDeviceScaleFactor, indent, logLevel, onBrowserDownload, chromeMode, pageIndex, onBrowserLog, }) => {
|
|
8
8
|
if (passedInInstance) {
|
|
9
9
|
const page = await passedInInstance.newPage({
|
|
10
10
|
context: () => null,
|
|
11
11
|
logLevel,
|
|
12
12
|
indent,
|
|
13
13
|
pageIndex,
|
|
14
|
+
onBrowserLog,
|
|
14
15
|
});
|
|
15
16
|
return {
|
|
16
17
|
page,
|
|
@@ -42,6 +43,7 @@ const getPageAndCleanupFn = async ({ passedInInstance, browserExecutable, chromi
|
|
|
42
43
|
logLevel,
|
|
43
44
|
indent,
|
|
44
45
|
pageIndex,
|
|
46
|
+
onBrowserLog,
|
|
45
47
|
});
|
|
46
48
|
return {
|
|
47
49
|
page: browserPage,
|
package/dist/get-compositions.js
CHANGED
|
@@ -14,16 +14,7 @@ const seek_to_frame_1 = require("./seek-to-frame");
|
|
|
14
14
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
15
15
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
16
16
|
const wrap_with_error_handling_1 = require("./wrap-with-error-handling");
|
|
17
|
-
const innerGetCompositions = async ({ envVariables, serializedInputPropsWithCustomSchema,
|
|
18
|
-
if (onBrowserLog) {
|
|
19
|
-
page.on('console', (log) => {
|
|
20
|
-
onBrowserLog({
|
|
21
|
-
stackTrace: log.stackTrace(),
|
|
22
|
-
text: log.text,
|
|
23
|
-
type: log.type,
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
}
|
|
17
|
+
const innerGetCompositions = async ({ envVariables, serializedInputPropsWithCustomSchema, page, proxyPort, serveUrl, timeoutInMilliseconds, indent, logLevel, }) => {
|
|
27
18
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
28
19
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
29
20
|
serializedInputPropsWithCustomSchema,
|
|
@@ -69,7 +60,7 @@ const innerGetCompositions = async ({ envVariables, serializedInputPropsWithCust
|
|
|
69
60
|
});
|
|
70
61
|
const res = result;
|
|
71
62
|
return res.map((r) => {
|
|
72
|
-
const { width, durationInFrames, fps, height, id, defaultCodec } = r;
|
|
63
|
+
const { width, durationInFrames, fps, height, id, defaultCodec, defaultOutName, } = r;
|
|
73
64
|
return {
|
|
74
65
|
id,
|
|
75
66
|
width,
|
|
@@ -79,6 +70,7 @@ const innerGetCompositions = async ({ envVariables, serializedInputPropsWithCust
|
|
|
79
70
|
props: no_react_1.NoReactInternals.deserializeJSONWithCustomFields(r.serializedResolvedPropsWithCustomSchema),
|
|
80
71
|
defaultProps: no_react_1.NoReactInternals.deserializeJSONWithCustomFields(r.serializedDefaultPropsWithCustomSchema),
|
|
81
72
|
defaultCodec,
|
|
73
|
+
defaultOutName,
|
|
82
74
|
};
|
|
83
75
|
});
|
|
84
76
|
};
|
|
@@ -93,6 +85,7 @@ const internalGetCompositionsRaw = async ({ browserExecutable, chromiumOptions,
|
|
|
93
85
|
onBrowserDownload,
|
|
94
86
|
chromeMode,
|
|
95
87
|
pageIndex: 0,
|
|
88
|
+
onBrowserLog,
|
|
96
89
|
});
|
|
97
90
|
const cleanup = [cleanupPage];
|
|
98
91
|
return new Promise((resolve, reject) => {
|
|
@@ -123,7 +116,6 @@ const internalGetCompositionsRaw = async ({ browserExecutable, chromiumOptions,
|
|
|
123
116
|
return innerGetCompositions({
|
|
124
117
|
envVariables,
|
|
125
118
|
serializedInputPropsWithCustomSchema,
|
|
126
|
-
onBrowserLog,
|
|
127
119
|
page,
|
|
128
120
|
proxyPort: offthreadPort,
|
|
129
121
|
serveUrl,
|
package/dist/make-page.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const makePage: ({ context, initialFrame, browserReplacer, logLev
|
|
|
12
12
|
logLevel: LogLevel;
|
|
13
13
|
indent: boolean;
|
|
14
14
|
pagesArray: Page[];
|
|
15
|
-
onBrowserLog: ((log: BrowserLog) => void) |
|
|
15
|
+
onBrowserLog: ((log: BrowserLog) => void) | null;
|
|
16
16
|
scale: number;
|
|
17
17
|
timeoutInMilliseconds: number;
|
|
18
18
|
composition: Omit<VideoConfig, "defaultProps" | "props">;
|
package/dist/make-page.js
CHANGED
|
@@ -6,23 +6,13 @@ const set_props_and_env_1 = require("./set-props-and-env");
|
|
|
6
6
|
const makePage = async ({ context, initialFrame, browserReplacer, logLevel, indent, pagesArray, onBrowserLog, scale, timeoutInMilliseconds, composition, proxyPort, serveUrl, muted, envVariables, serializedInputPropsWithCustomSchema, imageFormat, serializedResolvedPropsWithCustomSchema, pageIndex, }) => {
|
|
7
7
|
const page = await browserReplacer
|
|
8
8
|
.getBrowser()
|
|
9
|
-
.newPage({ context, logLevel, indent, pageIndex });
|
|
9
|
+
.newPage({ context, logLevel, indent, pageIndex, onBrowserLog });
|
|
10
10
|
pagesArray.push(page);
|
|
11
11
|
await page.setViewport({
|
|
12
12
|
width: composition.width,
|
|
13
13
|
height: composition.height,
|
|
14
14
|
deviceScaleFactor: scale,
|
|
15
15
|
});
|
|
16
|
-
const logCallback = (log) => {
|
|
17
|
-
onBrowserLog === null || onBrowserLog === void 0 ? void 0 : onBrowserLog({
|
|
18
|
-
stackTrace: log.stackTrace(),
|
|
19
|
-
text: log.text,
|
|
20
|
-
type: log.type,
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
if (onBrowserLog) {
|
|
24
|
-
page.on('console', logCallback);
|
|
25
|
-
}
|
|
26
16
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
27
17
|
serializedInputPropsWithCustomSchema,
|
|
28
18
|
envVariables,
|
|
@@ -40,7 +30,7 @@ const makePage = async ({ context, initialFrame, browserReplacer, logLevel, inde
|
|
|
40
30
|
});
|
|
41
31
|
await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
42
32
|
// eslint-disable-next-line max-params
|
|
43
|
-
pageFunction: (id, props, durationInFrames, fps, height, width, defaultCodec) => {
|
|
33
|
+
pageFunction: (id, props, durationInFrames, fps, height, width, defaultCodec, defaultOutName) => {
|
|
44
34
|
window.remotion_setBundleMode({
|
|
45
35
|
type: 'composition',
|
|
46
36
|
compositionName: id,
|
|
@@ -50,6 +40,7 @@ const makePage = async ({ context, initialFrame, browserReplacer, logLevel, inde
|
|
|
50
40
|
compositionHeight: height,
|
|
51
41
|
compositionWidth: width,
|
|
52
42
|
compositionDefaultCodec: defaultCodec,
|
|
43
|
+
compositionDefaultOutName: defaultOutName,
|
|
53
44
|
});
|
|
54
45
|
},
|
|
55
46
|
args: [
|
|
@@ -60,12 +51,12 @@ const makePage = async ({ context, initialFrame, browserReplacer, logLevel, inde
|
|
|
60
51
|
composition.height,
|
|
61
52
|
composition.width,
|
|
62
53
|
composition.defaultCodec,
|
|
54
|
+
composition.defaultOutName,
|
|
63
55
|
],
|
|
64
56
|
frame: null,
|
|
65
57
|
page,
|
|
66
58
|
timeoutInMilliseconds,
|
|
67
59
|
});
|
|
68
|
-
page.off('console', logCallback);
|
|
69
60
|
return page;
|
|
70
61
|
};
|
|
71
62
|
exports.makePage = makePage;
|