@remotion/serverless-client 4.0.261
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/.turbo/turbo-make.log +6 -0
- package/LICENSE.md +49 -0
- package/README.md +5 -0
- package/bundle.ts +15 -0
- package/dist/await.d.ts +1 -0
- package/dist/await.js +2 -0
- package/dist/calculate-chunk-times.d.ts +5 -0
- package/dist/calculate-chunk-times.js +29 -0
- package/dist/compress-props.d.ts +30 -0
- package/dist/compress-props.js +97 -0
- package/dist/constants.d.ts +314 -0
- package/dist/constants.js +64 -0
- package/dist/docs-url.d.ts +1 -0
- package/dist/docs-url.js +4 -0
- package/dist/error-category.d.ts +3 -0
- package/dist/error-category.js +16 -0
- package/dist/esm/index.mjs +3467 -0
- package/dist/estimate-price-from-bucket.d.ts +15 -0
- package/dist/estimate-price-from-bucket.js +31 -0
- package/dist/expected-out-name.d.ts +10 -0
- package/dist/expected-out-name.js +53 -0
- package/dist/format-costs-info.d.ts +2 -0
- package/dist/format-costs-info.js +23 -0
- package/dist/get-custom-out-name.d.ts +7 -0
- package/dist/get-custom-out-name.js +33 -0
- package/dist/get-files-in-folder.d.ts +5 -0
- package/dist/get-files-in-folder.js +2 -0
- package/dist/get-or-create-bucket.d.ts +23 -0
- package/dist/get-or-create-bucket.js +44 -0
- package/dist/get-overall-progress-from-storage.d.ts +11 -0
- package/dist/get-overall-progress-from-storage.js +25 -0
- package/dist/get-overall-progress.d.ts +9 -0
- package/dist/get-overall-progress.js +23 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +105 -0
- package/dist/input-props-keys.d.ts +2 -0
- package/dist/input-props-keys.js +11 -0
- package/dist/inspect-error.d.ts +4 -0
- package/dist/inspect-error.js +39 -0
- package/dist/make-bucket-name.d.ts +3 -0
- package/dist/make-bucket-name.js +7 -0
- package/dist/make-timeout-error.d.ts +13 -0
- package/dist/make-timeout-error.js +32 -0
- package/dist/make-timeout-message.d.ts +12 -0
- package/dist/make-timeout-message.js +76 -0
- package/dist/min-max.d.ts +2 -0
- package/dist/min-max.js +33 -0
- package/dist/most-expensive-chunks.d.ts +13 -0
- package/dist/most-expensive-chunks.js +28 -0
- package/dist/overall-render-progress.d.ts +24 -0
- package/dist/overall-render-progress.js +2 -0
- package/dist/progress.d.ts +16 -0
- package/dist/progress.js +258 -0
- package/dist/provider-implementation.d.ts +193 -0
- package/dist/provider-implementation.js +2 -0
- package/dist/render-has-audio-video.d.ts +6 -0
- package/dist/render-has-audio-video.js +21 -0
- package/dist/render-metadata.d.ts +45 -0
- package/dist/render-metadata.js +2 -0
- package/dist/render-progress.d.ts +51 -0
- package/dist/render-progress.js +2 -0
- package/dist/return-values.d.ts +38 -0
- package/dist/return-values.js +2 -0
- package/dist/serialize-artifact.d.ts +9 -0
- package/dist/serialize-artifact.js +37 -0
- package/dist/stream-to-string.d.ts +2 -0
- package/dist/stream-to-string.js +14 -0
- package/dist/streaming/streaming.d.ts +101 -0
- package/dist/streaming/streaming.js +61 -0
- package/dist/test/dont-contain-forbidden.test.d.ts +1 -0
- package/dist/test/dont-contain-forbidden.test.js +18 -0
- package/dist/test/expected-out-name.test.d.ts +1 -0
- package/dist/test/expected-out-name.test.js +167 -0
- package/dist/test/min-max.test.d.ts +1 -0
- package/dist/test/min-max.test.js +24 -0
- package/dist/test/most-expensive-chunks.test.d.ts +1 -0
- package/dist/test/most-expensive-chunks.test.js +163 -0
- package/dist/truthy.d.ts +3 -0
- package/dist/truthy.js +6 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.js +2 -0
- package/dist/validate-bucket-name.d.ts +7 -0
- package/dist/validate-bucket-name.js +16 -0
- package/dist/validate-download-behavior.d.ts +1 -0
- package/dist/validate-download-behavior.js +21 -0
- package/dist/validate-frames-per-function.d.ts +4 -0
- package/dist/validate-frames-per-function.js +29 -0
- package/dist/validate-outname.d.ts +9 -0
- package/dist/validate-outname.js +43 -0
- package/dist/validate-privacy.d.ts +2 -0
- package/dist/validate-privacy.js +14 -0
- package/dist/validate-webhook.d.ts +3 -0
- package/dist/validate-webhook.js +16 -0
- package/dist/webhook-types.d.ts +29 -0
- package/dist/webhook-types.js +2 -0
- package/dist/write-error-to-storage.d.ts +24 -0
- package/dist/write-error-to-storage.js +2 -0
- package/eslint.config.mjs +5 -0
- package/package.json +41 -0
- package/src/await.ts +1 -0
- package/src/calculate-chunk-times.ts +42 -0
- package/src/compress-props.ts +171 -0
- package/src/constants.ts +403 -0
- package/src/docs-url.ts +1 -0
- package/src/error-category.ts +14 -0
- package/src/estimate-price-from-bucket.ts +59 -0
- package/src/expected-out-name.ts +83 -0
- package/src/format-costs-info.ts +24 -0
- package/src/get-custom-out-name.ts +44 -0
- package/src/get-files-in-folder.ts +6 -0
- package/src/get-or-create-bucket.ts +79 -0
- package/src/get-overall-progress-from-storage.ts +44 -0
- package/src/get-overall-progress.ts +42 -0
- package/src/index.ts +125 -0
- package/src/input-props-keys.ts +7 -0
- package/src/inspect-error.ts +60 -0
- package/src/make-bucket-name.ts +9 -0
- package/src/make-timeout-error.ts +51 -0
- package/src/make-timeout-message.ts +118 -0
- package/src/min-max.ts +34 -0
- package/src/most-expensive-chunks.ts +46 -0
- package/src/overall-render-progress.ts +30 -0
- package/src/progress.ts +327 -0
- package/src/provider-implementation.ts +261 -0
- package/src/render-has-audio-video.ts +28 -0
- package/src/render-metadata.ts +60 -0
- package/src/render-progress.ts +58 -0
- package/src/return-values.ts +45 -0
- package/src/serialize-artifact.ts +51 -0
- package/src/stream-to-string.ts +14 -0
- package/src/streaming/streaming.ts +148 -0
- package/src/test/dont-contain-forbidden.test.ts +14 -0
- package/src/test/expected-out-name.test.ts +197 -0
- package/src/test/min-max.test.ts +25 -0
- package/src/test/most-expensive-chunks.test.ts +167 -0
- package/src/truthy.ts +5 -0
- package/src/types.ts +77 -0
- package/src/validate-bucket-name.ts +34 -0
- package/src/validate-download-behavior.ts +26 -0
- package/src/validate-frames-per-function.ts +54 -0
- package/src/validate-outname.ts +63 -0
- package/src/validate-privacy.ts +20 -0
- package/src/validate-webhook.ts +18 -0
- package/src/webhook-types.ts +36 -0
- package/src/write-error-to-storage.ts +23 -0
- package/tsconfig.json +18 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,3467 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
8
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
|
+
for (let key of __getOwnPropNames(mod))
|
|
11
|
+
if (!__hasOwnProp.call(to, key))
|
|
12
|
+
__defProp(to, key, {
|
|
13
|
+
get: () => mod[key],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
19
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
20
|
+
|
|
21
|
+
// ../renderer/dist/chalk/is-color-supported.js
|
|
22
|
+
var require_is_color_supported = __commonJS((exports) => {
|
|
23
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined)
|
|
25
|
+
k2 = k;
|
|
26
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
27
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
28
|
+
desc = { enumerable: true, get: function() {
|
|
29
|
+
return m[k];
|
|
30
|
+
} };
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(o, k2, desc);
|
|
33
|
+
} : function(o, m, k, k2) {
|
|
34
|
+
if (k2 === undefined)
|
|
35
|
+
k2 = k;
|
|
36
|
+
o[k2] = m[k];
|
|
37
|
+
});
|
|
38
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
39
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
40
|
+
} : function(o, v) {
|
|
41
|
+
o["default"] = v;
|
|
42
|
+
});
|
|
43
|
+
var __importStar = exports && exports.__importStar || function(mod) {
|
|
44
|
+
if (mod && mod.__esModule)
|
|
45
|
+
return mod;
|
|
46
|
+
var result = {};
|
|
47
|
+
if (mod != null) {
|
|
48
|
+
for (var k in mod)
|
|
49
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
50
|
+
__createBinding(result, mod, k);
|
|
51
|
+
}
|
|
52
|
+
__setModuleDefault(result, mod);
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
+
exports.isColorSupported = undefined;
|
|
57
|
+
var tty = __importStar(__require("tty"));
|
|
58
|
+
var isColorSupported = () => {
|
|
59
|
+
var _a;
|
|
60
|
+
const env = process.env || {};
|
|
61
|
+
const isForceDisabled = "NO_COLOR" in env;
|
|
62
|
+
if (isForceDisabled) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const isForced = "FORCE_COLOR" in env;
|
|
66
|
+
if (isForced) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
const isWindows = process.platform === "win32";
|
|
70
|
+
const isCompatibleTerminal = ((_a = tty === null || tty === undefined ? undefined : tty.isatty) === null || _a === undefined ? undefined : _a.call(tty, 1)) && env.TERM && env.TERM !== "dumb";
|
|
71
|
+
const isCI = "CI" in env && (("GITHUB_ACTIONS" in env) || ("GITLAB_CI" in env) || ("CIRCLECI" in env));
|
|
72
|
+
return isWindows || isCompatibleTerminal || isCI;
|
|
73
|
+
};
|
|
74
|
+
exports.isColorSupported = isColorSupported;
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// ../renderer/dist/chalk/index.js
|
|
78
|
+
var require_chalk = __commonJS((exports) => {
|
|
79
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
80
|
+
exports.chalk = undefined;
|
|
81
|
+
var is_color_supported_1 = require_is_color_supported();
|
|
82
|
+
exports.chalk = (() => {
|
|
83
|
+
const colors = {
|
|
84
|
+
enabled: () => (0, is_color_supported_1.isColorSupported)(),
|
|
85
|
+
visible: true,
|
|
86
|
+
styles: {},
|
|
87
|
+
keys: {}
|
|
88
|
+
};
|
|
89
|
+
const ansi = (st) => {
|
|
90
|
+
const open = `\x1B[${st.codes[0]}m`;
|
|
91
|
+
const close = `\x1B[${st.codes[1]}m`;
|
|
92
|
+
const regex = new RegExp(`\\u001b\\[${st.codes[1]}m`, "g");
|
|
93
|
+
st.wrap = (input, newline) => {
|
|
94
|
+
if (input.includes(close))
|
|
95
|
+
input = input.replace(regex, close + open);
|
|
96
|
+
const output = open + input + close;
|
|
97
|
+
return newline ? output.replace(/\r*\n/g, `${close}$&${open}`) : output;
|
|
98
|
+
};
|
|
99
|
+
return st;
|
|
100
|
+
};
|
|
101
|
+
const wrap = (sty, input, newline) => {
|
|
102
|
+
var _a;
|
|
103
|
+
return (_a = sty.wrap) === null || _a === undefined ? undefined : _a.call(sty, input, newline);
|
|
104
|
+
};
|
|
105
|
+
const style = (input, stack) => {
|
|
106
|
+
if (input === "" || input === null || input === undefined)
|
|
107
|
+
return "";
|
|
108
|
+
if (colors.enabled() === false)
|
|
109
|
+
return input;
|
|
110
|
+
if (colors.visible === false)
|
|
111
|
+
return "";
|
|
112
|
+
let str = String(input);
|
|
113
|
+
const nl = str.includes(`
|
|
114
|
+
`);
|
|
115
|
+
let n = stack.length;
|
|
116
|
+
while (n-- > 0)
|
|
117
|
+
str = wrap(colors.styles[stack[n]], str, nl);
|
|
118
|
+
return str;
|
|
119
|
+
};
|
|
120
|
+
const define = (name, codes, type) => {
|
|
121
|
+
colors.styles[name] = ansi({ name, codes });
|
|
122
|
+
const keys = colors.keys[type] || (colors.keys[type] = []);
|
|
123
|
+
keys.push(name);
|
|
124
|
+
Reflect.defineProperty(colors, name, {
|
|
125
|
+
configurable: true,
|
|
126
|
+
enumerable: true,
|
|
127
|
+
set(value) {
|
|
128
|
+
var _a;
|
|
129
|
+
(_a = colors.alias) === null || _a === undefined || _a.call(colors, name, value);
|
|
130
|
+
},
|
|
131
|
+
get() {
|
|
132
|
+
const color = (input) => style(input, color.stack);
|
|
133
|
+
Reflect.setPrototypeOf(color, colors);
|
|
134
|
+
color.stack = this.stack ? this.stack.concat(name) : [name];
|
|
135
|
+
return color;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
define("reset", [0, 0], "modifier");
|
|
140
|
+
define("bold", [1, 22], "modifier");
|
|
141
|
+
define("dim", [2, 22], "modifier");
|
|
142
|
+
define("italic", [3, 23], "modifier");
|
|
143
|
+
define("underline", [4, 24], "modifier");
|
|
144
|
+
define("inverse", [7, 27], "modifier");
|
|
145
|
+
define("hidden", [8, 28], "modifier");
|
|
146
|
+
define("strikethrough", [9, 29], "modifier");
|
|
147
|
+
define("black", [30, 39], "color");
|
|
148
|
+
define("red", [31, 39], "color");
|
|
149
|
+
define("green", [32, 39], "color");
|
|
150
|
+
define("yellow", [33, 39], "color");
|
|
151
|
+
define("blue", [34, 39], "color");
|
|
152
|
+
define("magenta", [35, 39], "color");
|
|
153
|
+
define("cyan", [36, 39], "color");
|
|
154
|
+
define("white", [37, 39], "color");
|
|
155
|
+
define("gray", [90, 39], "color");
|
|
156
|
+
define("grey", [90, 39], "color");
|
|
157
|
+
define("bgBlack", [40, 49], "bg");
|
|
158
|
+
define("bgRed", [41, 49], "bg");
|
|
159
|
+
define("bgGreen", [42, 49], "bg");
|
|
160
|
+
define("bgYellow", [43, 49], "bg");
|
|
161
|
+
define("bgBlue", [44, 49], "bg");
|
|
162
|
+
define("bgMagenta", [45, 49], "bg");
|
|
163
|
+
define("bgWhite", [47, 49], "bg");
|
|
164
|
+
define("blackBright", [90, 39], "bright");
|
|
165
|
+
define("redBright", [91, 39], "bright");
|
|
166
|
+
define("greenBright", [92, 39], "bright");
|
|
167
|
+
define("yellowBright", [93, 39], "bright");
|
|
168
|
+
define("blueBright", [94, 39], "bright");
|
|
169
|
+
define("magentaBright", [95, 39], "bright");
|
|
170
|
+
define("whiteBright", [97, 39], "bright");
|
|
171
|
+
define("bgBlackBright", [100, 49], "bgBright");
|
|
172
|
+
define("bgRedBright", [101, 49], "bgBright");
|
|
173
|
+
define("bgGreenBright", [102, 49], "bgBright");
|
|
174
|
+
define("bgYellowBright", [103, 49], "bgBright");
|
|
175
|
+
define("bgBlueBright", [104, 49], "bgBright");
|
|
176
|
+
define("bgMagentaBright", [105, 49], "bgBright");
|
|
177
|
+
define("bgWhiteBright", [107, 49], "bgBright");
|
|
178
|
+
colors.alias = (name, color) => {
|
|
179
|
+
const fn = colors[color];
|
|
180
|
+
if (typeof fn !== "function") {
|
|
181
|
+
throw new TypeError("Expected alias to be the name of an existing color (string) or a function");
|
|
182
|
+
}
|
|
183
|
+
if (!fn.stack) {
|
|
184
|
+
Reflect.defineProperty(fn, "name", { value: name });
|
|
185
|
+
colors.styles[name] = fn;
|
|
186
|
+
fn.stack = [name];
|
|
187
|
+
}
|
|
188
|
+
Reflect.defineProperty(colors, name, {
|
|
189
|
+
configurable: true,
|
|
190
|
+
enumerable: true,
|
|
191
|
+
set(value) {
|
|
192
|
+
var _a;
|
|
193
|
+
(_a = colors.alias) === null || _a === undefined || _a.call(colors, name, value);
|
|
194
|
+
},
|
|
195
|
+
get() {
|
|
196
|
+
const col = (input) => style(input, col.stack);
|
|
197
|
+
Reflect.setPrototypeOf(col, colors);
|
|
198
|
+
col.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack;
|
|
199
|
+
return col;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
return colors;
|
|
204
|
+
})();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
// ../renderer/dist/log-level.js
|
|
208
|
+
var require_log_level = __commonJS((exports) => {
|
|
209
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
210
|
+
exports.isEqualOrBelowLogLevel = exports.isValidLogLevel = exports.logLevels = undefined;
|
|
211
|
+
exports.logLevels = ["trace", "verbose", "info", "warn", "error"];
|
|
212
|
+
var getNumberForLogLevel = (level) => {
|
|
213
|
+
return exports.logLevels.indexOf(level);
|
|
214
|
+
};
|
|
215
|
+
var isValidLogLevel = (level) => {
|
|
216
|
+
return getNumberForLogLevel(level) > -1;
|
|
217
|
+
};
|
|
218
|
+
exports.isValidLogLevel = isValidLogLevel;
|
|
219
|
+
var isEqualOrBelowLogLevel = (currentLevel, level) => {
|
|
220
|
+
return getNumberForLogLevel(currentLevel) <= getNumberForLogLevel(level);
|
|
221
|
+
};
|
|
222
|
+
exports.isEqualOrBelowLogLevel = isEqualOrBelowLogLevel;
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// ../core/dist/cjs/version.js
|
|
226
|
+
var require_version = __commonJS((exports) => {
|
|
227
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
228
|
+
exports.VERSION = undefined;
|
|
229
|
+
exports.VERSION = "4.0.261";
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// ../renderer/dist/find-closest-package-json.js
|
|
233
|
+
var require_find_closest_package_json = __commonJS((exports) => {
|
|
234
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
235
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
236
|
+
};
|
|
237
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
238
|
+
exports.findRemotionRoot = exports.findClosestPackageJson = undefined;
|
|
239
|
+
var node_fs_1 = __importDefault(__require("node:fs"));
|
|
240
|
+
var node_path_1 = __importDefault(__require("node:path"));
|
|
241
|
+
var recursionLimit = 5;
|
|
242
|
+
var findClosestPackageJson = () => {
|
|
243
|
+
let currentDir = process.cwd();
|
|
244
|
+
let possiblePackageJson = "";
|
|
245
|
+
for (let i = 0;i < recursionLimit; i++) {
|
|
246
|
+
possiblePackageJson = node_path_1.default.join(currentDir, "package.json");
|
|
247
|
+
const exists = node_fs_1.default.existsSync(possiblePackageJson);
|
|
248
|
+
if (exists) {
|
|
249
|
+
return possiblePackageJson;
|
|
250
|
+
}
|
|
251
|
+
currentDir = node_path_1.default.dirname(currentDir);
|
|
252
|
+
}
|
|
253
|
+
return null;
|
|
254
|
+
};
|
|
255
|
+
exports.findClosestPackageJson = findClosestPackageJson;
|
|
256
|
+
var findRemotionRoot = () => {
|
|
257
|
+
const closestPackageJson = (0, exports.findClosestPackageJson)();
|
|
258
|
+
if (closestPackageJson === null) {
|
|
259
|
+
return process.cwd();
|
|
260
|
+
}
|
|
261
|
+
return node_path_1.default.dirname(closestPackageJson);
|
|
262
|
+
};
|
|
263
|
+
exports.findRemotionRoot = findRemotionRoot;
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
// ../renderer/dist/is-serve-url.js
|
|
267
|
+
var require_is_serve_url = __commonJS((exports) => {
|
|
268
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
269
|
+
exports.isServeUrl = undefined;
|
|
270
|
+
var isServeUrl = (potentialUrl) => {
|
|
271
|
+
if (typeof potentialUrl === "undefined") {
|
|
272
|
+
throw new Error("serveUrl is undefined");
|
|
273
|
+
}
|
|
274
|
+
if (potentialUrl.startsWith("www.") || potentialUrl.includes("amazonaws.com")) {
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
return potentialUrl.startsWith("https://") || potentialUrl.startsWith("http://");
|
|
278
|
+
};
|
|
279
|
+
exports.isServeUrl = isServeUrl;
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// ../renderer/dist/repro.js
|
|
283
|
+
var require_repro = __commonJS((exports) => {
|
|
284
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
285
|
+
if (k2 === undefined)
|
|
286
|
+
k2 = k;
|
|
287
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
288
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
289
|
+
desc = { enumerable: true, get: function() {
|
|
290
|
+
return m[k];
|
|
291
|
+
} };
|
|
292
|
+
}
|
|
293
|
+
Object.defineProperty(o, k2, desc);
|
|
294
|
+
} : function(o, m, k, k2) {
|
|
295
|
+
if (k2 === undefined)
|
|
296
|
+
k2 = k;
|
|
297
|
+
o[k2] = m[k];
|
|
298
|
+
});
|
|
299
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
300
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
301
|
+
} : function(o, v) {
|
|
302
|
+
o["default"] = v;
|
|
303
|
+
});
|
|
304
|
+
var __importStar = exports && exports.__importStar || function(mod) {
|
|
305
|
+
if (mod && mod.__esModule)
|
|
306
|
+
return mod;
|
|
307
|
+
var result = {};
|
|
308
|
+
if (mod != null) {
|
|
309
|
+
for (var k in mod)
|
|
310
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
311
|
+
__createBinding(result, mod, k);
|
|
312
|
+
}
|
|
313
|
+
__setModuleDefault(result, mod);
|
|
314
|
+
return result;
|
|
315
|
+
};
|
|
316
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
317
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
318
|
+
};
|
|
319
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
320
|
+
exports.isReproEnabled = exports.disableRepro = exports.enableRepro = exports.writeInRepro = exports.getReproWriter = undefined;
|
|
321
|
+
var node_child_process_1 = __require("node:child_process");
|
|
322
|
+
var node_fs_1 = __importStar(__require("node:fs"));
|
|
323
|
+
var node_os_1 = __importDefault(__require("node:os"));
|
|
324
|
+
var node_path_1 = __importDefault(__require("node:path"));
|
|
325
|
+
var version_1 = require_version();
|
|
326
|
+
var chalk_1 = require_chalk();
|
|
327
|
+
var find_closest_package_json_1 = require_find_closest_package_json();
|
|
328
|
+
var is_serve_url_1 = require_is_serve_url();
|
|
329
|
+
var logger_1 = require_logger();
|
|
330
|
+
var REPRO_DIR = ".remotionrepro";
|
|
331
|
+
var LOG_FILE_NAME = "logs.txt";
|
|
332
|
+
var INPUT_DIR = "bundle";
|
|
333
|
+
var OUTPUT_DIR = "output";
|
|
334
|
+
var LINE_SPLIT = `
|
|
335
|
+
`;
|
|
336
|
+
var getZipFileName = (name) => `remotion-repro-${name}-${Date.now()}.zip`;
|
|
337
|
+
var readyDirSync = (dir) => {
|
|
338
|
+
let items;
|
|
339
|
+
try {
|
|
340
|
+
items = node_fs_1.default.readdirSync(dir);
|
|
341
|
+
} catch (_a) {
|
|
342
|
+
return node_fs_1.default.mkdirSync(dir, { recursive: true });
|
|
343
|
+
}
|
|
344
|
+
items.forEach((item) => {
|
|
345
|
+
item = node_path_1.default.join(dir, item);
|
|
346
|
+
node_fs_1.default.rmSync(item, { recursive: true, force: true });
|
|
347
|
+
});
|
|
348
|
+
};
|
|
349
|
+
var zipFolder = ({ sourceFolder, targetZip, indent, logLevel }) => {
|
|
350
|
+
const platform = node_os_1.default.platform();
|
|
351
|
+
try {
|
|
352
|
+
logger_1.Log.info({ indent, logLevel }, "+ Creating reproduction ZIP");
|
|
353
|
+
if (platform === "win32") {
|
|
354
|
+
(0, node_child_process_1.execSync)(`powershell.exe Compress-Archive -Path "${sourceFolder}" -DestinationPath "${targetZip}"`);
|
|
355
|
+
} else {
|
|
356
|
+
(0, node_child_process_1.execSync)(`zip -r "${targetZip}" "${sourceFolder}"`);
|
|
357
|
+
}
|
|
358
|
+
(0, node_fs_1.rmSync)(sourceFolder, { recursive: true });
|
|
359
|
+
logger_1.Log.info({ indent, logLevel }, `${chalk_1.chalk.blue(`+ Repro: ${targetZip}`)}`);
|
|
360
|
+
} catch (error) {
|
|
361
|
+
logger_1.Log.error({ indent, logLevel }, `Failed to zip repro folder, The repro folder is ${sourceFolder}. You can try manually zip it.`);
|
|
362
|
+
logger_1.Log.error({ indent, logLevel }, error);
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
var reproWriter = (name) => {
|
|
366
|
+
const root = (0, find_closest_package_json_1.findRemotionRoot)();
|
|
367
|
+
const reproFolder = node_path_1.default.join(root, REPRO_DIR);
|
|
368
|
+
const logPath = node_path_1.default.join(reproFolder, LOG_FILE_NAME);
|
|
369
|
+
const zipFile = node_path_1.default.join(root, getZipFileName(name));
|
|
370
|
+
readyDirSync(reproFolder);
|
|
371
|
+
const reproLogWriteStream = node_fs_1.default.createWriteStream(logPath, { flags: "a" });
|
|
372
|
+
const serializeArgs = (args) => JSON.stringify(args);
|
|
373
|
+
const writeLine = (level, ...args) => {
|
|
374
|
+
if (!args.length)
|
|
375
|
+
return;
|
|
376
|
+
const startTime = new Date().toISOString();
|
|
377
|
+
const line = `[${startTime}] ${level} ${serializeArgs(args)}`;
|
|
378
|
+
reproLogWriteStream.write(line + LINE_SPLIT);
|
|
379
|
+
};
|
|
380
|
+
const start = ({ serveUrl, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema }) => {
|
|
381
|
+
const isServe = (0, is_serve_url_1.isServeUrl)(serveUrl);
|
|
382
|
+
if (!isServe) {
|
|
383
|
+
const inputDir = node_path_1.default.resolve(reproFolder, INPUT_DIR);
|
|
384
|
+
readyDirSync(inputDir);
|
|
385
|
+
node_fs_1.default.cpSync(serveUrl, inputDir, { recursive: true });
|
|
386
|
+
}
|
|
387
|
+
const serializedProps = node_path_1.default.resolve(reproFolder, "input-props.json");
|
|
388
|
+
node_fs_1.default.writeFileSync(serializedProps, serializedInputPropsWithCustomSchema);
|
|
389
|
+
const serializedResolvedProps = node_path_1.default.resolve(reproFolder, "resolved-props.json");
|
|
390
|
+
node_fs_1.default.writeFileSync(serializedResolvedProps, serializedResolvedPropsWithCustomSchema);
|
|
391
|
+
writeLine("info", [`Args: ${JSON.stringify(process.argv)}`]);
|
|
392
|
+
writeLine("info", [`Node/Bun version: ${process.version}`]);
|
|
393
|
+
writeLine("info", [`OS: ${process.platform}-${process.arch}`]);
|
|
394
|
+
writeLine("info", [`Serve URL: ${serveUrl}`]);
|
|
395
|
+
writeLine("info", [`Remotion version: ${version_1.VERSION}`]);
|
|
396
|
+
};
|
|
397
|
+
const onRenderSucceed = ({ indent, logLevel, output }) => {
|
|
398
|
+
return new Promise((resolve, reject) => {
|
|
399
|
+
try {
|
|
400
|
+
if (output) {
|
|
401
|
+
const outputDir = node_path_1.default.resolve(reproFolder, OUTPUT_DIR);
|
|
402
|
+
readyDirSync(outputDir);
|
|
403
|
+
const fileName = node_path_1.default.basename(output);
|
|
404
|
+
const targetPath = node_path_1.default.join(outputDir, fileName);
|
|
405
|
+
node_fs_1.default.copyFileSync(output, targetPath);
|
|
406
|
+
}
|
|
407
|
+
(0, exports.disableRepro)();
|
|
408
|
+
reproLogWriteStream.end(() => {
|
|
409
|
+
reproLogWriteStream.close(() => {
|
|
410
|
+
zipFolder({
|
|
411
|
+
sourceFolder: reproFolder,
|
|
412
|
+
targetZip: zipFile,
|
|
413
|
+
indent,
|
|
414
|
+
logLevel
|
|
415
|
+
});
|
|
416
|
+
resolve();
|
|
417
|
+
});
|
|
418
|
+
});
|
|
419
|
+
} catch (error) {
|
|
420
|
+
logger_1.Log.error({ indent: false, logLevel }, `repro render success error:`);
|
|
421
|
+
logger_1.Log.error({ indent: false, logLevel }, error);
|
|
422
|
+
reject(error);
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
};
|
|
426
|
+
return {
|
|
427
|
+
start,
|
|
428
|
+
writeLine,
|
|
429
|
+
onRenderSucceed
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
var reproWriteInstance = null;
|
|
433
|
+
var getReproWriter = () => {
|
|
434
|
+
if (!reproWriteInstance) {
|
|
435
|
+
throw new Error("reproWriteInstance is not initialized");
|
|
436
|
+
}
|
|
437
|
+
return reproWriteInstance;
|
|
438
|
+
};
|
|
439
|
+
exports.getReproWriter = getReproWriter;
|
|
440
|
+
var writeInRepro = (level, ...args) => {
|
|
441
|
+
if ((0, exports.isReproEnabled)()) {
|
|
442
|
+
(0, exports.getReproWriter)().writeLine(level, ...args);
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
exports.writeInRepro = writeInRepro;
|
|
446
|
+
var shouldRepro = false;
|
|
447
|
+
var enableRepro = ({ serveUrl, compositionName, serializedInputPropsWithCustomSchema, serializedResolvedPropsWithCustomSchema }) => {
|
|
448
|
+
shouldRepro = true;
|
|
449
|
+
reproWriteInstance = reproWriter(compositionName);
|
|
450
|
+
(0, exports.getReproWriter)().start({
|
|
451
|
+
serveUrl,
|
|
452
|
+
serializedInputPropsWithCustomSchema,
|
|
453
|
+
serializedResolvedPropsWithCustomSchema
|
|
454
|
+
});
|
|
455
|
+
};
|
|
456
|
+
exports.enableRepro = enableRepro;
|
|
457
|
+
var disableRepro = () => {
|
|
458
|
+
shouldRepro = false;
|
|
459
|
+
};
|
|
460
|
+
exports.disableRepro = disableRepro;
|
|
461
|
+
var isReproEnabled = () => shouldRepro;
|
|
462
|
+
exports.isReproEnabled = isReproEnabled;
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
// ../renderer/dist/truthy.js
|
|
466
|
+
var require_truthy = __commonJS((exports) => {
|
|
467
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
468
|
+
exports.truthy = truthy2;
|
|
469
|
+
function truthy2(value) {
|
|
470
|
+
return Boolean(value);
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
// ../renderer/dist/logger.js
|
|
475
|
+
var require_logger = __commonJS((exports) => {
|
|
476
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
477
|
+
exports.Log = exports.secondverboseTag = exports.verboseTag = exports.INDENT_TOKEN = undefined;
|
|
478
|
+
var chalk_1 = require_chalk();
|
|
479
|
+
var is_color_supported_1 = require_is_color_supported();
|
|
480
|
+
var log_level_1 = require_log_level();
|
|
481
|
+
var repro_1 = require_repro();
|
|
482
|
+
var truthy_1 = require_truthy();
|
|
483
|
+
exports.INDENT_TOKEN = chalk_1.chalk.gray("│");
|
|
484
|
+
var verboseTag = (str) => {
|
|
485
|
+
return (0, is_color_supported_1.isColorSupported)() ? chalk_1.chalk.bgBlack(` ${str} `) : `[${str}]`;
|
|
486
|
+
};
|
|
487
|
+
exports.verboseTag = verboseTag;
|
|
488
|
+
var secondverboseTag = (str) => {
|
|
489
|
+
return (0, is_color_supported_1.isColorSupported)() ? chalk_1.chalk.bgWhite(` ${str} `) : `[${str}]`;
|
|
490
|
+
};
|
|
491
|
+
exports.secondverboseTag = secondverboseTag;
|
|
492
|
+
exports.Log = {
|
|
493
|
+
trace: (options, ...args) => {
|
|
494
|
+
(0, repro_1.writeInRepro)("trace", ...args);
|
|
495
|
+
if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, "trace")) {
|
|
496
|
+
if (args.length === 0) {
|
|
497
|
+
return process.stdout.write(`
|
|
498
|
+
`);
|
|
499
|
+
}
|
|
500
|
+
return console.log(...[
|
|
501
|
+
options.indent ? exports.INDENT_TOKEN : null,
|
|
502
|
+
options.tag ? (0, exports.verboseTag)(options.tag) : null
|
|
503
|
+
].filter(truthy_1.truthy).concat(args.map((a) => chalk_1.chalk.gray(a))));
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
verbose: (options, ...args) => {
|
|
507
|
+
(0, repro_1.writeInRepro)("verbose", ...args);
|
|
508
|
+
if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, "verbose")) {
|
|
509
|
+
if (args.length === 0) {
|
|
510
|
+
return process.stdout.write(`
|
|
511
|
+
`);
|
|
512
|
+
}
|
|
513
|
+
return console.log(...[
|
|
514
|
+
options.indent ? exports.INDENT_TOKEN : null,
|
|
515
|
+
options.tag ? (0, exports.verboseTag)(options.tag) : null
|
|
516
|
+
].filter(truthy_1.truthy).concat(args.map((a) => chalk_1.chalk.gray(a))));
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
info: (options, ...args) => {
|
|
520
|
+
(0, repro_1.writeInRepro)("info", ...args);
|
|
521
|
+
if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, "info")) {
|
|
522
|
+
if (args.length === 0) {
|
|
523
|
+
return process.stdout.write(`
|
|
524
|
+
`);
|
|
525
|
+
}
|
|
526
|
+
return console.log(...[options.indent ? exports.INDENT_TOKEN : null].filter(truthy_1.truthy).concat(args !== null && args !== undefined ? args : []));
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
warn: (options, ...args) => {
|
|
530
|
+
(0, repro_1.writeInRepro)("warn", ...args);
|
|
531
|
+
if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, "warn")) {
|
|
532
|
+
if (args.length === 0) {
|
|
533
|
+
return process.stdout.write(`
|
|
534
|
+
`);
|
|
535
|
+
}
|
|
536
|
+
return console.warn(...[options.indent ? chalk_1.chalk.yellow(exports.INDENT_TOKEN) : null].filter(truthy_1.truthy).concat(args.map((a) => chalk_1.chalk.yellow(a))));
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
error: (options, ...args) => {
|
|
540
|
+
(0, repro_1.writeInRepro)("error", ...args);
|
|
541
|
+
if ((0, log_level_1.isEqualOrBelowLogLevel)(options.logLevel, "error")) {
|
|
542
|
+
if (args.length === 0) {
|
|
543
|
+
return process.stdout.write(`
|
|
544
|
+
`);
|
|
545
|
+
}
|
|
546
|
+
return console.error(...[
|
|
547
|
+
options.indent ? exports.INDENT_TOKEN : null,
|
|
548
|
+
options.tag ? (0, exports.verboseTag)(options.tag) : null
|
|
549
|
+
].filter(truthy_1.truthy).concat(args.map((a) => chalk_1.chalk.red(a))));
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
// ../renderer/dist/print-useful-error-message.js
|
|
556
|
+
var require_print_useful_error_message = __commonJS((exports) => {
|
|
557
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
558
|
+
exports.printUsefulErrorMessage = undefined;
|
|
559
|
+
var logger_1 = require_logger();
|
|
560
|
+
var truthy_1 = require_truthy();
|
|
561
|
+
var alreadyPrintedCache = [];
|
|
562
|
+
var printUsefulErrorMessage = (err, logLevel, indent) => {
|
|
563
|
+
var _a, _b;
|
|
564
|
+
const errorStack = err.stack;
|
|
565
|
+
if (errorStack && alreadyPrintedCache.includes(errorStack)) {
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
if (errorStack) {
|
|
569
|
+
alreadyPrintedCache.push(errorStack);
|
|
570
|
+
alreadyPrintedCache = alreadyPrintedCache.slice(-10);
|
|
571
|
+
}
|
|
572
|
+
if (err.message.includes("Could not play video with")) {
|
|
573
|
+
logger_1.Log.info({ indent, logLevel });
|
|
574
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue at https://remotion.dev/docs/media-playback-error");
|
|
575
|
+
}
|
|
576
|
+
if (err.message.includes("A delayRender()") && err.message.includes("was called but not cleared after")) {
|
|
577
|
+
logger_1.Log.info({ indent, logLevel });
|
|
578
|
+
if (err.message.includes("/proxy")) {
|
|
579
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue at https://remotion.dev/docs/troubleshooting/delay-render-proxy");
|
|
580
|
+
}
|
|
581
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue at https://remotion.dev/docs/timeout");
|
|
582
|
+
}
|
|
583
|
+
if (err.message.includes("Target closed")) {
|
|
584
|
+
logger_1.Log.info({ indent, logLevel });
|
|
585
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue at https://remotion.dev/docs/target-closed");
|
|
586
|
+
}
|
|
587
|
+
if (err.message.includes("Timed out evaluating")) {
|
|
588
|
+
logger_1.Log.info({ indent, logLevel });
|
|
589
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue at https://remotion.dev/docs/troubleshooting/timed-out-page-function");
|
|
590
|
+
}
|
|
591
|
+
if (err.message.includes("ENAMETOOLONG")) {
|
|
592
|
+
logger_1.Log.info({ indent, logLevel });
|
|
593
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue at https://remotion.dev/docs/enametoolong");
|
|
594
|
+
}
|
|
595
|
+
if (err.message.includes("Member must have value less than or equal to 3008")) {
|
|
596
|
+
logger_1.Log.info({ indent, logLevel });
|
|
597
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 This error indicates that you have a AWS account on the free tier or have been limited by your organization. Often times this can be solved by adding a credit card. See also: https://repost.aws/questions/QUKruWYNDYTSmP17jCnIz6IQ/questions/QUKruWYNDYTSmP17jCnIz6IQ/unable-to-set-lambda-memory-over-3008mb");
|
|
598
|
+
}
|
|
599
|
+
if ((_a = err.stack) === null || _a === undefined ? undefined : _a.includes("TooManyRequestsException: Rate Exceeded.")) {
|
|
600
|
+
logger_1.Log.info({ indent, logLevel });
|
|
601
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 This error indicates that your Lambda concurrency limit is too low. See: https://www.remotion.dev/docs/lambda/troubleshooting/rate-limit");
|
|
602
|
+
}
|
|
603
|
+
if (err.message.includes("Error creating WebGL context")) {
|
|
604
|
+
logger_1.Log.info({ indent, logLevel });
|
|
605
|
+
logger_1.Log.warn({
|
|
606
|
+
indent,
|
|
607
|
+
logLevel
|
|
608
|
+
}, '\uD83D\uDCA1 You might need to set the OpenGL renderer to "angle-egl", "angle" (or "swangle" if rendering on lambda). Learn why at https://www.remotion.dev/docs/three');
|
|
609
|
+
logger_1.Log.warn({
|
|
610
|
+
indent,
|
|
611
|
+
logLevel
|
|
612
|
+
}, "\uD83D\uDCA1 Check how it's done at https://www.remotion.dev/docs/chromium-flags#--gl");
|
|
613
|
+
}
|
|
614
|
+
if (err.message.includes("The bucket does not allow ACLs")) {
|
|
615
|
+
logger_1.Log.info({ indent, logLevel });
|
|
616
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 Fix for this issue: https://remotion.dev/docs/lambda/troubleshooting/bucket-disallows-acl");
|
|
617
|
+
}
|
|
618
|
+
if (err.message.includes("Minified React error #306")) {
|
|
619
|
+
const componentName = (_b = err.message.match(/<\w+>/)) === null || _b === undefined ? undefined : _b[0];
|
|
620
|
+
logger_1.Log.info({ indent, logLevel }, [
|
|
621
|
+
"\uD83D\uDCA1 This error indicates that the component",
|
|
622
|
+
componentName ? `(${componentName})` : null,
|
|
623
|
+
"you are trying to render is not imported correctly."
|
|
624
|
+
].filter(truthy_1.truthy).join(" "));
|
|
625
|
+
logger_1.Log.info({ indent, logLevel });
|
|
626
|
+
logger_1.Log.info({ indent, logLevel }, " Check the root file and ensure that the component is not undefined.");
|
|
627
|
+
logger_1.Log.info({ indent, logLevel }, " Oftentimes, this happens if the component is missing the `export` keyword");
|
|
628
|
+
logger_1.Log.info({ indent, logLevel }, " or if the component was renamed and the import statement not properly adjusted.");
|
|
629
|
+
}
|
|
630
|
+
if (err.message.includes("GLIBC_")) {
|
|
631
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 Remotion requires at least Libc 2.35.");
|
|
632
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 Get help for this issue: https://github.com/remotion-dev/remotion/issues/2439");
|
|
633
|
+
}
|
|
634
|
+
if (err.message.includes("EBADF")) {
|
|
635
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 This error might be fixed by changing your Node version:");
|
|
636
|
+
logger_1.Log.info({ indent, logLevel }, " https://github.com/remotion-dev/remotion/issues/2452");
|
|
637
|
+
}
|
|
638
|
+
if (err.message.includes("routines::unsupported")) {
|
|
639
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 This error might happen if using Cloud Run with credentials that have a newline at the end or are otherwise badly encoded.");
|
|
640
|
+
logger_1.Log.info({ indent, logLevel }, " https://github.com/remotion-dev/remotion/issues/3864");
|
|
641
|
+
}
|
|
642
|
+
if (err.message.includes("Failed to fetch")) {
|
|
643
|
+
logger_1.Log.info({ indent, logLevel }, "\uD83D\uDCA1 On Lambda, one reason this could happen is that Chrome is rejecting an asset to be loaded when it is running low on disk space.");
|
|
644
|
+
logger_1.Log.info({ indent, logLevel }, "Try increasing the disk size of your Lambda function.");
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
exports.printUsefulErrorMessage = printUsefulErrorMessage;
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
// ../renderer/dist/wrap-with-error-handling.js
|
|
651
|
+
var require_wrap_with_error_handling = __commonJS((exports) => {
|
|
652
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
653
|
+
exports.wrapWithErrorHandling = undefined;
|
|
654
|
+
var print_useful_error_message_1 = require_print_useful_error_message();
|
|
655
|
+
var wrapWithErrorHandling = (fn) => {
|
|
656
|
+
return async (...args) => {
|
|
657
|
+
try {
|
|
658
|
+
return await fn(...args);
|
|
659
|
+
} catch (err) {
|
|
660
|
+
const { indent } = args[0];
|
|
661
|
+
const { logLevel } = args[0];
|
|
662
|
+
(0, print_useful_error_message_1.printUsefulErrorMessage)(err, logLevel, indent);
|
|
663
|
+
throw err;
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
};
|
|
667
|
+
exports.wrapWithErrorHandling = wrapWithErrorHandling;
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
// ../renderer/dist/error-handling.js
|
|
671
|
+
var require_error_handling = __commonJS((exports) => {
|
|
672
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
673
|
+
exports.wrapWithErrorHandling = undefined;
|
|
674
|
+
var wrap_with_error_handling_1 = require_wrap_with_error_handling();
|
|
675
|
+
Object.defineProperty(exports, "wrapWithErrorHandling", { enumerable: true, get: function() {
|
|
676
|
+
return wrap_with_error_handling_1.wrapWithErrorHandling;
|
|
677
|
+
} });
|
|
678
|
+
});
|
|
679
|
+
|
|
680
|
+
// ../streaming/dist/make-stream-payload-message.js
|
|
681
|
+
var require_make_stream_payload_message = __commonJS((exports) => {
|
|
682
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
683
|
+
exports.makeStreamPayloadMessage = exports.magicWordStr = undefined;
|
|
684
|
+
exports.magicWordStr = "remotion_buffer:";
|
|
685
|
+
var makeStreamPayloadMessage = ({ status, body, nonce }) => {
|
|
686
|
+
const nonceArr = new TextEncoder().encode(nonce);
|
|
687
|
+
const magicWordArr = new TextEncoder().encode(exports.magicWordStr);
|
|
688
|
+
const separatorArr = new TextEncoder().encode(":");
|
|
689
|
+
const bodyLengthArr = new TextEncoder().encode(body.length.toString());
|
|
690
|
+
const statusArr = new TextEncoder().encode(String(status));
|
|
691
|
+
const totalLength = nonceArr.length + magicWordArr.length + separatorArr.length * 3 + bodyLengthArr.length + statusArr.length + body.length;
|
|
692
|
+
const concat = new Uint8Array(totalLength);
|
|
693
|
+
let offset = 0;
|
|
694
|
+
const appendToConcat = (data) => {
|
|
695
|
+
concat.set(data, offset);
|
|
696
|
+
offset += data.length;
|
|
697
|
+
};
|
|
698
|
+
appendToConcat(magicWordArr);
|
|
699
|
+
appendToConcat(nonceArr);
|
|
700
|
+
appendToConcat(separatorArr);
|
|
701
|
+
appendToConcat(bodyLengthArr);
|
|
702
|
+
appendToConcat(separatorArr);
|
|
703
|
+
appendToConcat(statusArr);
|
|
704
|
+
appendToConcat(separatorArr);
|
|
705
|
+
appendToConcat(body);
|
|
706
|
+
return concat;
|
|
707
|
+
};
|
|
708
|
+
exports.makeStreamPayloadMessage = makeStreamPayloadMessage;
|
|
709
|
+
});
|
|
710
|
+
|
|
711
|
+
// ../streaming/dist/make-streamer.js
|
|
712
|
+
var require_make_streamer = __commonJS((exports) => {
|
|
713
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
714
|
+
exports.makeStreamPayloadMessage = exports.makeStreamer = exports.streamingKey = undefined;
|
|
715
|
+
exports.streamingKey = "remotion_buffer:";
|
|
716
|
+
var makeStreamer = (onMessage) => {
|
|
717
|
+
const separator = new Uint8Array(exports.streamingKey.length);
|
|
718
|
+
for (let i = 0;i < exports.streamingKey.length; i++) {
|
|
719
|
+
separator[i] = exports.streamingKey.charCodeAt(i);
|
|
720
|
+
}
|
|
721
|
+
let unprocessedBuffers = [];
|
|
722
|
+
let outputBuffer = new Uint8Array(0);
|
|
723
|
+
let missingData = null;
|
|
724
|
+
const findSeparatorIndex = () => {
|
|
725
|
+
let searchIndex = 0;
|
|
726
|
+
while (true) {
|
|
727
|
+
const separatorIndex = outputBuffer.indexOf(separator[0], searchIndex);
|
|
728
|
+
if (separatorIndex === -1) {
|
|
729
|
+
return -1;
|
|
730
|
+
}
|
|
731
|
+
if (outputBuffer.subarray(separatorIndex, separatorIndex + separator.length).toString() !== separator.toString()) {
|
|
732
|
+
searchIndex = separatorIndex + 1;
|
|
733
|
+
continue;
|
|
734
|
+
}
|
|
735
|
+
return separatorIndex;
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
const processInput = () => {
|
|
739
|
+
let separatorIndex = findSeparatorIndex();
|
|
740
|
+
if (separatorIndex === -1) {
|
|
741
|
+
return;
|
|
742
|
+
}
|
|
743
|
+
separatorIndex += separator.length;
|
|
744
|
+
let nonceString = "";
|
|
745
|
+
let lengthString = "";
|
|
746
|
+
let statusString = "";
|
|
747
|
+
while (true) {
|
|
748
|
+
if (separatorIndex > outputBuffer.length - 1) {
|
|
749
|
+
return;
|
|
750
|
+
}
|
|
751
|
+
const nextDigit = outputBuffer[separatorIndex];
|
|
752
|
+
separatorIndex++;
|
|
753
|
+
if (nextDigit === 58) {
|
|
754
|
+
break;
|
|
755
|
+
}
|
|
756
|
+
nonceString += String.fromCharCode(nextDigit);
|
|
757
|
+
}
|
|
758
|
+
while (true) {
|
|
759
|
+
if (separatorIndex > outputBuffer.length - 1) {
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
const nextDigit = outputBuffer[separatorIndex];
|
|
763
|
+
separatorIndex++;
|
|
764
|
+
if (nextDigit === 58) {
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
lengthString += String.fromCharCode(nextDigit);
|
|
768
|
+
}
|
|
769
|
+
while (true) {
|
|
770
|
+
if (separatorIndex > outputBuffer.length - 1) {
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
const nextDigit = outputBuffer[separatorIndex];
|
|
774
|
+
if (nextDigit === 58) {
|
|
775
|
+
break;
|
|
776
|
+
}
|
|
777
|
+
separatorIndex++;
|
|
778
|
+
statusString += String.fromCharCode(nextDigit);
|
|
779
|
+
}
|
|
780
|
+
const length = Number(lengthString);
|
|
781
|
+
const status = Number(statusString);
|
|
782
|
+
const dataLength = outputBuffer.length - separatorIndex - 1;
|
|
783
|
+
if (dataLength < length) {
|
|
784
|
+
missingData = {
|
|
785
|
+
dataMissing: length - dataLength
|
|
786
|
+
};
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
const data = outputBuffer.subarray(separatorIndex + 1, separatorIndex + 1 + Number(lengthString));
|
|
790
|
+
onMessage(status === 1 ? "error" : "success", nonceString, data);
|
|
791
|
+
missingData = null;
|
|
792
|
+
outputBuffer = outputBuffer.subarray(separatorIndex + Number(lengthString) + 1);
|
|
793
|
+
processInput();
|
|
794
|
+
};
|
|
795
|
+
const onData = (data) => {
|
|
796
|
+
unprocessedBuffers.push(data);
|
|
797
|
+
if (missingData) {
|
|
798
|
+
missingData.dataMissing -= data.length;
|
|
799
|
+
}
|
|
800
|
+
if (missingData && missingData.dataMissing > 0) {
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
const newBuffer = new Uint8Array(outputBuffer.length + unprocessedBuffers.reduce((acc, val) => acc + val.length, 0));
|
|
804
|
+
newBuffer.set(outputBuffer, 0);
|
|
805
|
+
let offset = outputBuffer.length;
|
|
806
|
+
for (const buf of unprocessedBuffers) {
|
|
807
|
+
newBuffer.set(buf, offset);
|
|
808
|
+
offset += buf.length;
|
|
809
|
+
}
|
|
810
|
+
outputBuffer = newBuffer;
|
|
811
|
+
unprocessedBuffers = [];
|
|
812
|
+
processInput();
|
|
813
|
+
};
|
|
814
|
+
return {
|
|
815
|
+
onData,
|
|
816
|
+
getOutputBuffer: () => outputBuffer,
|
|
817
|
+
clear: () => {
|
|
818
|
+
unprocessedBuffers = [];
|
|
819
|
+
outputBuffer = new Uint8Array(0);
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
};
|
|
823
|
+
exports.makeStreamer = makeStreamer;
|
|
824
|
+
var makeStreamPayloadMessage = ({ status, body, nonce }) => {
|
|
825
|
+
const nonceArr = new TextEncoder().encode(nonce);
|
|
826
|
+
const magicWordArr = new TextEncoder().encode(exports.streamingKey);
|
|
827
|
+
const separatorArr = new TextEncoder().encode(":");
|
|
828
|
+
const bodyLengthArr = new TextEncoder().encode(body.length.toString());
|
|
829
|
+
const statusArr = new TextEncoder().encode(String(status));
|
|
830
|
+
const totalLength = nonceArr.length + magicWordArr.length + separatorArr.length * 3 + bodyLengthArr.length + statusArr.length + body.length;
|
|
831
|
+
const concat = new Uint8Array(totalLength);
|
|
832
|
+
let offset = 0;
|
|
833
|
+
const appendToConcat = (data) => {
|
|
834
|
+
concat.set(data, offset);
|
|
835
|
+
offset += data.length;
|
|
836
|
+
};
|
|
837
|
+
appendToConcat(magicWordArr);
|
|
838
|
+
appendToConcat(nonceArr);
|
|
839
|
+
appendToConcat(separatorArr);
|
|
840
|
+
appendToConcat(bodyLengthArr);
|
|
841
|
+
appendToConcat(separatorArr);
|
|
842
|
+
appendToConcat(statusArr);
|
|
843
|
+
appendToConcat(separatorArr);
|
|
844
|
+
appendToConcat(body);
|
|
845
|
+
return concat;
|
|
846
|
+
};
|
|
847
|
+
exports.makeStreamPayloadMessage = makeStreamPayloadMessage;
|
|
848
|
+
});
|
|
849
|
+
|
|
850
|
+
// ../streaming/dist/index.js
|
|
851
|
+
var require_dist = __commonJS((exports) => {
|
|
852
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
853
|
+
exports.makeStreamer = exports.makeStreamPayloadMessage = undefined;
|
|
854
|
+
var make_stream_payload_message_1 = require_make_stream_payload_message();
|
|
855
|
+
Object.defineProperty(exports, "makeStreamPayloadMessage", { enumerable: true, get: function() {
|
|
856
|
+
return make_stream_payload_message_1.makeStreamPayloadMessage;
|
|
857
|
+
} });
|
|
858
|
+
var make_streamer_1 = require_make_streamer();
|
|
859
|
+
Object.defineProperty(exports, "makeStreamer", { enumerable: true, get: function() {
|
|
860
|
+
return make_streamer_1.makeStreamer;
|
|
861
|
+
} });
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
// ../renderer/dist/is-audio-codec.js
|
|
865
|
+
var require_is_audio_codec = __commonJS((exports) => {
|
|
866
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
867
|
+
exports.isAudioCodec = undefined;
|
|
868
|
+
var isAudioCodec = (codec) => {
|
|
869
|
+
return codec === "mp3" || codec === "aac" || codec === "wav";
|
|
870
|
+
};
|
|
871
|
+
exports.isAudioCodec = isAudioCodec;
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
// ../renderer/dist/crf.js
|
|
875
|
+
var require_crf = __commonJS((exports) => {
|
|
876
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
877
|
+
exports.validateQualitySettings = exports.getValidCrfRanges = exports.getDefaultCrfForCodec = undefined;
|
|
878
|
+
var is_audio_codec_1 = require_is_audio_codec();
|
|
879
|
+
var defaultCrfMap = {
|
|
880
|
+
h264: 18,
|
|
881
|
+
h265: 23,
|
|
882
|
+
vp8: 9,
|
|
883
|
+
vp9: 28,
|
|
884
|
+
prores: null,
|
|
885
|
+
gif: null,
|
|
886
|
+
"h264-mkv": 18,
|
|
887
|
+
"h264-ts": 18,
|
|
888
|
+
aac: null,
|
|
889
|
+
mp3: null,
|
|
890
|
+
wav: null
|
|
891
|
+
};
|
|
892
|
+
var getDefaultCrfForCodec = (codec) => {
|
|
893
|
+
const val = defaultCrfMap[codec];
|
|
894
|
+
if (val === undefined) {
|
|
895
|
+
throw new TypeError(`Got unexpected codec "${codec}"`);
|
|
896
|
+
}
|
|
897
|
+
return val;
|
|
898
|
+
};
|
|
899
|
+
exports.getDefaultCrfForCodec = getDefaultCrfForCodec;
|
|
900
|
+
var crfRanges = {
|
|
901
|
+
h264: [1, 51],
|
|
902
|
+
h265: [0, 51],
|
|
903
|
+
vp8: [4, 63],
|
|
904
|
+
vp9: [0, 63],
|
|
905
|
+
prores: [0, 0],
|
|
906
|
+
gif: [0, 0],
|
|
907
|
+
"h264-mkv": [1, 51],
|
|
908
|
+
"h264-ts": [1, 51],
|
|
909
|
+
aac: [0, 0],
|
|
910
|
+
mp3: [0, 0],
|
|
911
|
+
wav: [0, 0]
|
|
912
|
+
};
|
|
913
|
+
var getValidCrfRanges = (codec) => {
|
|
914
|
+
const val = crfRanges[codec];
|
|
915
|
+
if (val === undefined) {
|
|
916
|
+
throw new TypeError(`Got unexpected codec "${codec}"`);
|
|
917
|
+
}
|
|
918
|
+
return val;
|
|
919
|
+
};
|
|
920
|
+
exports.getValidCrfRanges = getValidCrfRanges;
|
|
921
|
+
var validateQualitySettings = ({ codec, crf, videoBitrate, encodingMaxRate, encodingBufferSize, hardwareAcceleration }) => {
|
|
922
|
+
if (crf && videoBitrate) {
|
|
923
|
+
throw new Error('"crf" and "videoBitrate" can not both be set. Choose one of either.');
|
|
924
|
+
}
|
|
925
|
+
if (crf && hardwareAcceleration === "required") {
|
|
926
|
+
throw new Error('"crf" option is not supported with hardware acceleration');
|
|
927
|
+
}
|
|
928
|
+
if (encodingMaxRate && !encodingBufferSize) {
|
|
929
|
+
throw new Error('"encodingMaxRate" can not be set without also setting "encodingBufferSize".');
|
|
930
|
+
}
|
|
931
|
+
const bufSizeArray = encodingBufferSize ? ["-bufsize", encodingBufferSize] : [];
|
|
932
|
+
const maxRateArray = encodingMaxRate ? ["-maxrate", encodingMaxRate] : [];
|
|
933
|
+
if (videoBitrate) {
|
|
934
|
+
if (codec === "prores") {
|
|
935
|
+
console.warn("ProRes does not support videoBitrate. Ignoring.");
|
|
936
|
+
return [];
|
|
937
|
+
}
|
|
938
|
+
if ((0, is_audio_codec_1.isAudioCodec)(codec)) {
|
|
939
|
+
console.warn(`${codec} does not support videoBitrate. Ignoring.`);
|
|
940
|
+
return [];
|
|
941
|
+
}
|
|
942
|
+
return ["-b:v", videoBitrate, ...bufSizeArray, ...maxRateArray];
|
|
943
|
+
}
|
|
944
|
+
if (crf === null || typeof crf === "undefined") {
|
|
945
|
+
const actualCrf = (0, exports.getDefaultCrfForCodec)(codec);
|
|
946
|
+
if (actualCrf === null) {
|
|
947
|
+
return [...bufSizeArray, ...maxRateArray];
|
|
948
|
+
}
|
|
949
|
+
return ["-crf", String(actualCrf), ...bufSizeArray, ...maxRateArray];
|
|
950
|
+
}
|
|
951
|
+
if (typeof crf !== "number") {
|
|
952
|
+
throw new TypeError("Expected CRF to be a number, but is " + JSON.stringify(crf));
|
|
953
|
+
}
|
|
954
|
+
const range = (0, exports.getValidCrfRanges)(codec);
|
|
955
|
+
if (crf === 0 && (codec === "h264" || codec === "h264-mkv" || codec === "h264-ts")) {
|
|
956
|
+
throw new TypeError("Setting the CRF to 0 with a H264 codec is not supported anymore because of it's inconsistencies between platforms. Videos with CRF 0 cannot be played on iOS/macOS. 0 is a extreme value with inefficient settings which you probably do not want. Set CRF to a higher value to fix this error.");
|
|
957
|
+
}
|
|
958
|
+
if (crf < range[0] || crf > range[1]) {
|
|
959
|
+
if (range[0] === 0 && range[1] === 0) {
|
|
960
|
+
throw new TypeError(`The "${codec}" codec does not support the --crf option.`);
|
|
961
|
+
}
|
|
962
|
+
throw new TypeError(`CRF must be between ${range[0]} and ${range[1]} for codec ${codec}. Passed: ${crf}`);
|
|
963
|
+
}
|
|
964
|
+
if (codec === "prores") {
|
|
965
|
+
console.warn('ProRes does not support the "crf" option. Ignoring.');
|
|
966
|
+
return [];
|
|
967
|
+
}
|
|
968
|
+
if ((0, is_audio_codec_1.isAudioCodec)(codec)) {
|
|
969
|
+
console.warn(`${codec} does not support the "crf" option. Ignoring.`);
|
|
970
|
+
return [];
|
|
971
|
+
}
|
|
972
|
+
return ["-crf", String(crf), ...bufSizeArray, ...maxRateArray];
|
|
973
|
+
};
|
|
974
|
+
exports.validateQualitySettings = validateQualitySettings;
|
|
975
|
+
});
|
|
976
|
+
|
|
977
|
+
// ../renderer/dist/codec-supports-media.js
|
|
978
|
+
var require_codec_supports_media = __commonJS((exports) => {
|
|
979
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
980
|
+
exports.codecSupportsVideoBitrate = exports.codecSupportsCrf = exports.codecSupportsMedia = undefined;
|
|
981
|
+
var crf_1 = require_crf();
|
|
982
|
+
var support = {
|
|
983
|
+
"h264-mkv": {
|
|
984
|
+
audio: true,
|
|
985
|
+
video: true
|
|
986
|
+
},
|
|
987
|
+
aac: {
|
|
988
|
+
audio: true,
|
|
989
|
+
video: false
|
|
990
|
+
},
|
|
991
|
+
gif: {
|
|
992
|
+
video: true,
|
|
993
|
+
audio: false
|
|
994
|
+
},
|
|
995
|
+
h264: {
|
|
996
|
+
video: true,
|
|
997
|
+
audio: true
|
|
998
|
+
},
|
|
999
|
+
"h264-ts": {
|
|
1000
|
+
video: true,
|
|
1001
|
+
audio: true
|
|
1002
|
+
},
|
|
1003
|
+
h265: {
|
|
1004
|
+
video: true,
|
|
1005
|
+
audio: true
|
|
1006
|
+
},
|
|
1007
|
+
mp3: {
|
|
1008
|
+
audio: true,
|
|
1009
|
+
video: false
|
|
1010
|
+
},
|
|
1011
|
+
prores: {
|
|
1012
|
+
audio: true,
|
|
1013
|
+
video: true
|
|
1014
|
+
},
|
|
1015
|
+
vp8: {
|
|
1016
|
+
audio: true,
|
|
1017
|
+
video: true
|
|
1018
|
+
},
|
|
1019
|
+
vp9: {
|
|
1020
|
+
audio: true,
|
|
1021
|
+
video: true
|
|
1022
|
+
},
|
|
1023
|
+
wav: {
|
|
1024
|
+
audio: true,
|
|
1025
|
+
video: false
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
var codecSupportsMedia = (codec) => {
|
|
1029
|
+
return support[codec];
|
|
1030
|
+
};
|
|
1031
|
+
exports.codecSupportsMedia = codecSupportsMedia;
|
|
1032
|
+
var codecSupportsVideoBitrateMap = {
|
|
1033
|
+
"h264-mkv": true,
|
|
1034
|
+
"h264-ts": true,
|
|
1035
|
+
aac: false,
|
|
1036
|
+
gif: false,
|
|
1037
|
+
h264: true,
|
|
1038
|
+
h265: true,
|
|
1039
|
+
mp3: false,
|
|
1040
|
+
prores: false,
|
|
1041
|
+
vp8: true,
|
|
1042
|
+
vp9: true,
|
|
1043
|
+
wav: false
|
|
1044
|
+
};
|
|
1045
|
+
var codecSupportsCrf = (codec) => {
|
|
1046
|
+
const range = (0, crf_1.getValidCrfRanges)(codec);
|
|
1047
|
+
return range[0] !== range[1];
|
|
1048
|
+
};
|
|
1049
|
+
exports.codecSupportsCrf = codecSupportsCrf;
|
|
1050
|
+
var codecSupportsVideoBitrate = (codec) => {
|
|
1051
|
+
return codecSupportsVideoBitrateMap[codec];
|
|
1052
|
+
};
|
|
1053
|
+
exports.codecSupportsVideoBitrate = codecSupportsVideoBitrate;
|
|
1054
|
+
});
|
|
1055
|
+
|
|
1056
|
+
// ../renderer/dist/get-duration-from-frame-range.js
|
|
1057
|
+
var require_get_duration_from_frame_range = __commonJS((exports) => {
|
|
1058
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1059
|
+
exports.getFramesToRender = undefined;
|
|
1060
|
+
var getFramesToRender = (frameRange, everyNthFrame) => {
|
|
1061
|
+
if (everyNthFrame === 0) {
|
|
1062
|
+
throw new Error("everyNthFrame cannot be 0");
|
|
1063
|
+
}
|
|
1064
|
+
return new Array(frameRange[1] - frameRange[0] + 1).fill(true).map((_, index) => {
|
|
1065
|
+
return index + frameRange[0];
|
|
1066
|
+
}).filter((index) => {
|
|
1067
|
+
return index % everyNthFrame === 0;
|
|
1068
|
+
});
|
|
1069
|
+
};
|
|
1070
|
+
exports.getFramesToRender = getFramesToRender;
|
|
1071
|
+
});
|
|
1072
|
+
|
|
1073
|
+
// ../renderer/dist/codec.js
|
|
1074
|
+
var require_codec = __commonJS((exports) => {
|
|
1075
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1076
|
+
exports.DEFAULT_CODEC = exports.validCodecs = undefined;
|
|
1077
|
+
exports.validCodecs = [
|
|
1078
|
+
"h264",
|
|
1079
|
+
"h265",
|
|
1080
|
+
"vp8",
|
|
1081
|
+
"vp9",
|
|
1082
|
+
"mp3",
|
|
1083
|
+
"aac",
|
|
1084
|
+
"wav",
|
|
1085
|
+
"prores",
|
|
1086
|
+
"h264-mkv",
|
|
1087
|
+
"h264-ts",
|
|
1088
|
+
"gif"
|
|
1089
|
+
];
|
|
1090
|
+
exports.DEFAULT_CODEC = "h264";
|
|
1091
|
+
});
|
|
1092
|
+
|
|
1093
|
+
// ../renderer/dist/file-extensions.js
|
|
1094
|
+
var require_file_extensions = __commonJS((exports) => {
|
|
1095
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1096
|
+
exports.defaultFileExtensionMap = undefined;
|
|
1097
|
+
exports.defaultFileExtensionMap = {
|
|
1098
|
+
"h264-mkv": {
|
|
1099
|
+
default: "mkv",
|
|
1100
|
+
forAudioCodec: {
|
|
1101
|
+
"pcm-16": { possible: ["mkv"], default: "mkv" },
|
|
1102
|
+
mp3: { possible: ["mkv"], default: "mkv" }
|
|
1103
|
+
}
|
|
1104
|
+
},
|
|
1105
|
+
"h264-ts": {
|
|
1106
|
+
default: "ts",
|
|
1107
|
+
forAudioCodec: {
|
|
1108
|
+
"pcm-16": { possible: ["ts"], default: "ts" },
|
|
1109
|
+
aac: { possible: ["ts"], default: "ts" }
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1112
|
+
aac: {
|
|
1113
|
+
default: "aac",
|
|
1114
|
+
forAudioCodec: {
|
|
1115
|
+
aac: {
|
|
1116
|
+
possible: ["aac", "3gp", "m4a", "m4b", "mpg", "mpeg"],
|
|
1117
|
+
default: "aac"
|
|
1118
|
+
},
|
|
1119
|
+
"pcm-16": {
|
|
1120
|
+
possible: ["wav"],
|
|
1121
|
+
default: "wav"
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
},
|
|
1125
|
+
gif: {
|
|
1126
|
+
default: "gif",
|
|
1127
|
+
forAudioCodec: {}
|
|
1128
|
+
},
|
|
1129
|
+
h264: {
|
|
1130
|
+
default: "mp4",
|
|
1131
|
+
forAudioCodec: {
|
|
1132
|
+
"pcm-16": { possible: ["mkv", "mov"], default: "mkv" },
|
|
1133
|
+
aac: { possible: ["mp4", "mkv", "mov"], default: "mp4" },
|
|
1134
|
+
mp3: { possible: ["mp4", "mkv", "mov"], default: "mp4" }
|
|
1135
|
+
}
|
|
1136
|
+
},
|
|
1137
|
+
h265: {
|
|
1138
|
+
default: "mp4",
|
|
1139
|
+
forAudioCodec: {
|
|
1140
|
+
aac: { possible: ["mp4", "mkv", "hevc"], default: "mp4" },
|
|
1141
|
+
"pcm-16": { possible: ["mkv"], default: "mkv" }
|
|
1142
|
+
}
|
|
1143
|
+
},
|
|
1144
|
+
mp3: {
|
|
1145
|
+
default: "mp3",
|
|
1146
|
+
forAudioCodec: {
|
|
1147
|
+
mp3: { possible: ["mp3"], default: "mp3" },
|
|
1148
|
+
"pcm-16": { possible: ["wav"], default: "wav" }
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
prores: {
|
|
1152
|
+
default: "mov",
|
|
1153
|
+
forAudioCodec: {
|
|
1154
|
+
aac: { possible: ["mov", "mkv", "mxf"], default: "mov" },
|
|
1155
|
+
"pcm-16": { possible: ["mov", "mkv", "mxf"], default: "mov" }
|
|
1156
|
+
}
|
|
1157
|
+
},
|
|
1158
|
+
vp8: {
|
|
1159
|
+
default: "webm",
|
|
1160
|
+
forAudioCodec: {
|
|
1161
|
+
"pcm-16": { possible: ["mkv"], default: "mkv" },
|
|
1162
|
+
opus: { possible: ["webm"], default: "webm" }
|
|
1163
|
+
}
|
|
1164
|
+
},
|
|
1165
|
+
vp9: {
|
|
1166
|
+
default: "webm",
|
|
1167
|
+
forAudioCodec: {
|
|
1168
|
+
"pcm-16": { possible: ["mkv"], default: "mkv" },
|
|
1169
|
+
opus: { possible: ["webm"], default: "webm" }
|
|
1170
|
+
}
|
|
1171
|
+
},
|
|
1172
|
+
wav: {
|
|
1173
|
+
default: "wav",
|
|
1174
|
+
forAudioCodec: {
|
|
1175
|
+
"pcm-16": { possible: ["wav"], default: "wav" }
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
};
|
|
1179
|
+
});
|
|
1180
|
+
|
|
1181
|
+
// ../renderer/dist/get-extension-from-codec.js
|
|
1182
|
+
var require_get_extension_from_codec = __commonJS((exports) => {
|
|
1183
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1184
|
+
exports.defaultCodecsForFileExtension = exports.makeFileExtensionMap = exports.getFileExtensionFromCodec = undefined;
|
|
1185
|
+
var codec_1 = require_codec();
|
|
1186
|
+
var file_extensions_1 = require_file_extensions();
|
|
1187
|
+
var getFileExtensionFromCodec = (codec, audioCodec) => {
|
|
1188
|
+
if (!codec_1.validCodecs.includes(codec)) {
|
|
1189
|
+
throw new Error(`Codec must be one of the following: ${codec_1.validCodecs.join(", ")}, but got ${codec}`);
|
|
1190
|
+
}
|
|
1191
|
+
const map = file_extensions_1.defaultFileExtensionMap[codec];
|
|
1192
|
+
if (audioCodec === null) {
|
|
1193
|
+
return map.default;
|
|
1194
|
+
}
|
|
1195
|
+
const typedAudioCodec = audioCodec;
|
|
1196
|
+
if (!(typedAudioCodec in map.forAudioCodec)) {
|
|
1197
|
+
throw new Error(`Audio codec ${typedAudioCodec} is not supported for codec ${codec}`);
|
|
1198
|
+
}
|
|
1199
|
+
return map.forAudioCodec[audioCodec].default;
|
|
1200
|
+
};
|
|
1201
|
+
exports.getFileExtensionFromCodec = getFileExtensionFromCodec;
|
|
1202
|
+
var makeFileExtensionMap = () => {
|
|
1203
|
+
const map = {};
|
|
1204
|
+
Object.keys(file_extensions_1.defaultFileExtensionMap).forEach((_codec) => {
|
|
1205
|
+
const codec = _codec;
|
|
1206
|
+
const fileExtMap = file_extensions_1.defaultFileExtensionMap[codec];
|
|
1207
|
+
const audioCodecs = Object.keys(fileExtMap.forAudioCodec);
|
|
1208
|
+
const possibleExtensionsForAudioCodec = audioCodecs.map((audioCodec) => fileExtMap.forAudioCodec[audioCodec].possible);
|
|
1209
|
+
const allPossibleExtensions = [
|
|
1210
|
+
fileExtMap.default,
|
|
1211
|
+
...possibleExtensionsForAudioCodec.flat(1)
|
|
1212
|
+
];
|
|
1213
|
+
for (const extension of allPossibleExtensions) {
|
|
1214
|
+
if (!map[extension]) {
|
|
1215
|
+
map[extension] = [];
|
|
1216
|
+
}
|
|
1217
|
+
if (!map[extension].includes(codec)) {
|
|
1218
|
+
map[extension].push(codec);
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
return map;
|
|
1223
|
+
};
|
|
1224
|
+
exports.makeFileExtensionMap = makeFileExtensionMap;
|
|
1225
|
+
exports.defaultCodecsForFileExtension = {
|
|
1226
|
+
"3gp": "aac",
|
|
1227
|
+
aac: "aac",
|
|
1228
|
+
gif: "gif",
|
|
1229
|
+
hevc: "h265",
|
|
1230
|
+
m4a: "aac",
|
|
1231
|
+
m4b: "aac",
|
|
1232
|
+
mkv: "h264-mkv",
|
|
1233
|
+
mov: "prores",
|
|
1234
|
+
mp3: "mp3",
|
|
1235
|
+
mp4: "h264",
|
|
1236
|
+
mpeg: "aac",
|
|
1237
|
+
mpg: "aac",
|
|
1238
|
+
mxf: "prores",
|
|
1239
|
+
wav: "wav",
|
|
1240
|
+
webm: "vp8",
|
|
1241
|
+
ts: "h264-ts"
|
|
1242
|
+
};
|
|
1243
|
+
});
|
|
1244
|
+
|
|
1245
|
+
// ../renderer/dist/path-normalize.js
|
|
1246
|
+
var require_path_normalize = __commonJS((exports) => {
|
|
1247
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1248
|
+
exports.pathNormalize = undefined;
|
|
1249
|
+
var SLASH = 47;
|
|
1250
|
+
var DOT = 46;
|
|
1251
|
+
var assertPath = (path) => {
|
|
1252
|
+
const t = typeof path;
|
|
1253
|
+
if (t !== "string") {
|
|
1254
|
+
throw new TypeError(`Expected a string, got a ${t}`);
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
var posixNormalize = (path, allowAboveRoot) => {
|
|
1258
|
+
let res = "";
|
|
1259
|
+
let lastSegmentLength = 0;
|
|
1260
|
+
let lastSlash = -1;
|
|
1261
|
+
let dots = 0;
|
|
1262
|
+
let code;
|
|
1263
|
+
for (let i = 0;i <= path.length; ++i) {
|
|
1264
|
+
if (i < path.length) {
|
|
1265
|
+
code = path.charCodeAt(i);
|
|
1266
|
+
} else if (code === SLASH) {
|
|
1267
|
+
break;
|
|
1268
|
+
} else {
|
|
1269
|
+
code = SLASH;
|
|
1270
|
+
}
|
|
1271
|
+
if (code === SLASH) {
|
|
1272
|
+
if (lastSlash === i - 1 || dots === 1) {
|
|
1273
|
+
} else if (lastSlash !== i - 1 && dots === 2) {
|
|
1274
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {
|
|
1275
|
+
if (res.length > 2) {
|
|
1276
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
1277
|
+
if (lastSlashIndex !== res.length - 1) {
|
|
1278
|
+
if (lastSlashIndex === -1) {
|
|
1279
|
+
res = "";
|
|
1280
|
+
lastSegmentLength = 0;
|
|
1281
|
+
} else {
|
|
1282
|
+
res = res.slice(0, lastSlashIndex);
|
|
1283
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
1284
|
+
}
|
|
1285
|
+
lastSlash = i;
|
|
1286
|
+
dots = 0;
|
|
1287
|
+
continue;
|
|
1288
|
+
}
|
|
1289
|
+
} else if (res.length === 2 || res.length === 1) {
|
|
1290
|
+
res = "";
|
|
1291
|
+
lastSegmentLength = 0;
|
|
1292
|
+
lastSlash = i;
|
|
1293
|
+
dots = 0;
|
|
1294
|
+
continue;
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
if (allowAboveRoot) {
|
|
1298
|
+
if (res.length > 0) {
|
|
1299
|
+
res += "/..";
|
|
1300
|
+
} else {
|
|
1301
|
+
res = "..";
|
|
1302
|
+
}
|
|
1303
|
+
lastSegmentLength = 2;
|
|
1304
|
+
}
|
|
1305
|
+
} else {
|
|
1306
|
+
if (res.length > 0) {
|
|
1307
|
+
res += "/" + path.slice(lastSlash + 1, i);
|
|
1308
|
+
} else {
|
|
1309
|
+
res = path.slice(lastSlash + 1, i);
|
|
1310
|
+
}
|
|
1311
|
+
lastSegmentLength = i - lastSlash - 1;
|
|
1312
|
+
}
|
|
1313
|
+
lastSlash = i;
|
|
1314
|
+
dots = 0;
|
|
1315
|
+
} else if (code === DOT && dots !== -1) {
|
|
1316
|
+
++dots;
|
|
1317
|
+
} else {
|
|
1318
|
+
dots = -1;
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
return res;
|
|
1322
|
+
};
|
|
1323
|
+
var decode = (s) => {
|
|
1324
|
+
try {
|
|
1325
|
+
return decodeURIComponent(s);
|
|
1326
|
+
} catch (_a) {
|
|
1327
|
+
return s;
|
|
1328
|
+
}
|
|
1329
|
+
};
|
|
1330
|
+
var pathNormalize = (p) => {
|
|
1331
|
+
assertPath(p);
|
|
1332
|
+
let path = p;
|
|
1333
|
+
if (path.length === 0) {
|
|
1334
|
+
return ".";
|
|
1335
|
+
}
|
|
1336
|
+
const isAbsolute = path.charCodeAt(0) === SLASH;
|
|
1337
|
+
const trailingSeparator = path.charCodeAt(path.length - 1) === SLASH;
|
|
1338
|
+
path = decode(path);
|
|
1339
|
+
path = posixNormalize(path, !isAbsolute);
|
|
1340
|
+
if (path.length === 0 && !isAbsolute) {
|
|
1341
|
+
path = ".";
|
|
1342
|
+
}
|
|
1343
|
+
if (path.length > 0 && trailingSeparator) {
|
|
1344
|
+
path += "/";
|
|
1345
|
+
}
|
|
1346
|
+
if (isAbsolute) {
|
|
1347
|
+
return "/" + path;
|
|
1348
|
+
}
|
|
1349
|
+
return path;
|
|
1350
|
+
};
|
|
1351
|
+
exports.pathNormalize = pathNormalize;
|
|
1352
|
+
});
|
|
1353
|
+
|
|
1354
|
+
// ../renderer/dist/get-extension-of-filename.js
|
|
1355
|
+
var require_get_extension_of_filename = __commonJS((exports) => {
|
|
1356
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1357
|
+
exports.getExtensionOfFilename = undefined;
|
|
1358
|
+
var path_normalize_1 = require_path_normalize();
|
|
1359
|
+
var getExtensionOfFilename = (filename) => {
|
|
1360
|
+
if (filename === null) {
|
|
1361
|
+
return null;
|
|
1362
|
+
}
|
|
1363
|
+
const filenameArr = (0, path_normalize_1.pathNormalize)(filename).split(".");
|
|
1364
|
+
const hasExtension = filenameArr.length >= 2;
|
|
1365
|
+
const filenameArrLength = filenameArr.length;
|
|
1366
|
+
const extension = hasExtension ? filenameArr[filenameArrLength - 1] : null;
|
|
1367
|
+
return extension;
|
|
1368
|
+
};
|
|
1369
|
+
exports.getExtensionOfFilename = getExtensionOfFilename;
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1372
|
+
// ../renderer/dist/options/separate-audio.js
|
|
1373
|
+
var require_separate_audio = __commonJS((exports) => {
|
|
1374
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1375
|
+
exports.separateAudioOption = undefined;
|
|
1376
|
+
var DEFAULT = null;
|
|
1377
|
+
var cliFlag = "separate-audio-to";
|
|
1378
|
+
exports.separateAudioOption = {
|
|
1379
|
+
cliFlag,
|
|
1380
|
+
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.`,
|
|
1381
|
+
docLink: "https://remotion.dev/docs/renderer/render-media",
|
|
1382
|
+
getValue: ({ commandLine }) => {
|
|
1383
|
+
if (commandLine[cliFlag]) {
|
|
1384
|
+
return {
|
|
1385
|
+
source: "cli",
|
|
1386
|
+
value: commandLine[cliFlag]
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
return {
|
|
1390
|
+
source: "default",
|
|
1391
|
+
value: DEFAULT
|
|
1392
|
+
};
|
|
1393
|
+
},
|
|
1394
|
+
name: "Separate audio to",
|
|
1395
|
+
setConfig: () => {
|
|
1396
|
+
throw new Error("Not implemented");
|
|
1397
|
+
},
|
|
1398
|
+
ssrName: "separateAudioTo",
|
|
1399
|
+
type: "string"
|
|
1400
|
+
};
|
|
1401
|
+
});
|
|
1402
|
+
|
|
1403
|
+
// ../renderer/dist/options/audio-codec.js
|
|
1404
|
+
var require_audio_codec = __commonJS((exports) => {
|
|
1405
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1406
|
+
exports.audioCodecOption = exports.getDefaultAudioCodec = exports.resolveAudioCodec = exports.getExtensionFromAudioCodec = exports.defaultAudioCodecs = exports.mapAudioCodecToFfmpegAudioCodecName = exports.supportedAudioCodecs = exports.validAudioCodecs = undefined;
|
|
1407
|
+
var separate_audio_1 = require_separate_audio();
|
|
1408
|
+
exports.validAudioCodecs = ["pcm-16", "aac", "mp3", "opus"];
|
|
1409
|
+
exports.supportedAudioCodecs = {
|
|
1410
|
+
h264: ["aac", "pcm-16", "mp3"],
|
|
1411
|
+
"h264-mkv": ["pcm-16", "mp3"],
|
|
1412
|
+
"h264-ts": ["pcm-16", "aac"],
|
|
1413
|
+
aac: ["aac", "pcm-16"],
|
|
1414
|
+
avi: [],
|
|
1415
|
+
gif: [],
|
|
1416
|
+
h265: ["aac", "pcm-16"],
|
|
1417
|
+
mp3: ["mp3", "pcm-16"],
|
|
1418
|
+
prores: ["aac", "pcm-16"],
|
|
1419
|
+
vp8: ["opus", "pcm-16"],
|
|
1420
|
+
vp9: ["opus", "pcm-16"],
|
|
1421
|
+
wav: ["pcm-16"]
|
|
1422
|
+
};
|
|
1423
|
+
var _satisfies = exports.supportedAudioCodecs;
|
|
1424
|
+
if (_satisfies) {
|
|
1425
|
+
}
|
|
1426
|
+
var mapAudioCodecToFfmpegAudioCodecName = (audioCodec) => {
|
|
1427
|
+
if (audioCodec === "aac") {
|
|
1428
|
+
return "libfdk_aac";
|
|
1429
|
+
}
|
|
1430
|
+
if (audioCodec === "mp3") {
|
|
1431
|
+
return "libmp3lame";
|
|
1432
|
+
}
|
|
1433
|
+
if (audioCodec === "opus") {
|
|
1434
|
+
return "libopus";
|
|
1435
|
+
}
|
|
1436
|
+
if (audioCodec === "pcm-16") {
|
|
1437
|
+
return "pcm_s16le";
|
|
1438
|
+
}
|
|
1439
|
+
throw new Error("unknown audio codec: " + audioCodec);
|
|
1440
|
+
};
|
|
1441
|
+
exports.mapAudioCodecToFfmpegAudioCodecName = mapAudioCodecToFfmpegAudioCodecName;
|
|
1442
|
+
var cliFlag = "audio-codec";
|
|
1443
|
+
var ssrName = "audioCodec";
|
|
1444
|
+
exports.defaultAudioCodecs = {
|
|
1445
|
+
"h264-mkv": {
|
|
1446
|
+
lossless: "pcm-16",
|
|
1447
|
+
compressed: "pcm-16"
|
|
1448
|
+
},
|
|
1449
|
+
"h264-ts": {
|
|
1450
|
+
lossless: "pcm-16",
|
|
1451
|
+
compressed: "aac"
|
|
1452
|
+
},
|
|
1453
|
+
aac: {
|
|
1454
|
+
lossless: "pcm-16",
|
|
1455
|
+
compressed: "aac"
|
|
1456
|
+
},
|
|
1457
|
+
gif: {
|
|
1458
|
+
lossless: null,
|
|
1459
|
+
compressed: null
|
|
1460
|
+
},
|
|
1461
|
+
h264: {
|
|
1462
|
+
lossless: "pcm-16",
|
|
1463
|
+
compressed: "aac"
|
|
1464
|
+
},
|
|
1465
|
+
h265: {
|
|
1466
|
+
lossless: "pcm-16",
|
|
1467
|
+
compressed: "aac"
|
|
1468
|
+
},
|
|
1469
|
+
mp3: {
|
|
1470
|
+
lossless: "pcm-16",
|
|
1471
|
+
compressed: "mp3"
|
|
1472
|
+
},
|
|
1473
|
+
prores: {
|
|
1474
|
+
lossless: "pcm-16",
|
|
1475
|
+
compressed: "pcm-16"
|
|
1476
|
+
},
|
|
1477
|
+
vp8: {
|
|
1478
|
+
lossless: "pcm-16",
|
|
1479
|
+
compressed: "opus"
|
|
1480
|
+
},
|
|
1481
|
+
vp9: {
|
|
1482
|
+
lossless: "pcm-16",
|
|
1483
|
+
compressed: "opus"
|
|
1484
|
+
},
|
|
1485
|
+
wav: {
|
|
1486
|
+
lossless: "pcm-16",
|
|
1487
|
+
compressed: "pcm-16"
|
|
1488
|
+
}
|
|
1489
|
+
};
|
|
1490
|
+
var extensionMap = {
|
|
1491
|
+
aac: "aac",
|
|
1492
|
+
mp3: "mp3",
|
|
1493
|
+
opus: "opus",
|
|
1494
|
+
"pcm-16": "wav"
|
|
1495
|
+
};
|
|
1496
|
+
var getExtensionFromAudioCodec = (audioCodec) => {
|
|
1497
|
+
if (extensionMap[audioCodec]) {
|
|
1498
|
+
return extensionMap[audioCodec];
|
|
1499
|
+
}
|
|
1500
|
+
throw new Error(`Unsupported audio codec: ${audioCodec}`);
|
|
1501
|
+
};
|
|
1502
|
+
exports.getExtensionFromAudioCodec = getExtensionFromAudioCodec;
|
|
1503
|
+
var resolveAudioCodec = ({ codec, setting, preferLossless, separateAudioTo }) => {
|
|
1504
|
+
let derivedFromSeparateAudioToExtension = null;
|
|
1505
|
+
if (separateAudioTo) {
|
|
1506
|
+
const extension = separateAudioTo.split(".").pop();
|
|
1507
|
+
for (const [key, value] of Object.entries(extensionMap)) {
|
|
1508
|
+
if (value === extension) {
|
|
1509
|
+
derivedFromSeparateAudioToExtension = key;
|
|
1510
|
+
if (!exports.supportedAudioCodecs[codec].includes(derivedFromSeparateAudioToExtension) && derivedFromSeparateAudioToExtension) {
|
|
1511
|
+
throw new Error(`The codec is ${codec} but the audio codec derived from --${separate_audio_1.separateAudioOption.cliFlag} is ${derivedFromSeparateAudioToExtension}. The only supported codecs are: ${exports.supportedAudioCodecs[codec].join(", ")}`);
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
if (preferLossless) {
|
|
1517
|
+
const selected = (0, exports.getDefaultAudioCodec)({ codec, preferLossless });
|
|
1518
|
+
if (derivedFromSeparateAudioToExtension && selected !== derivedFromSeparateAudioToExtension) {
|
|
1519
|
+
throw new Error(`The audio codec derived from --${separate_audio_1.separateAudioOption.cliFlag} is ${derivedFromSeparateAudioToExtension}, but does not match the audio codec derived from the "Prefer lossless" option (${selected}). Remove any conflicting options.`);
|
|
1520
|
+
}
|
|
1521
|
+
return selected;
|
|
1522
|
+
}
|
|
1523
|
+
if (setting === null) {
|
|
1524
|
+
if (derivedFromSeparateAudioToExtension) {
|
|
1525
|
+
return derivedFromSeparateAudioToExtension;
|
|
1526
|
+
}
|
|
1527
|
+
return (0, exports.getDefaultAudioCodec)({ codec, preferLossless });
|
|
1528
|
+
}
|
|
1529
|
+
if (derivedFromSeparateAudioToExtension !== setting && derivedFromSeparateAudioToExtension) {
|
|
1530
|
+
throw new Error(`The audio codec derived from --${separate_audio_1.separateAudioOption.cliFlag} is ${derivedFromSeparateAudioToExtension}, but does not match the audio codec derived from your ${exports.audioCodecOption.name} setting (${setting}). Remove any conflicting options.`);
|
|
1531
|
+
}
|
|
1532
|
+
return setting;
|
|
1533
|
+
};
|
|
1534
|
+
exports.resolveAudioCodec = resolveAudioCodec;
|
|
1535
|
+
var getDefaultAudioCodec = ({ codec, preferLossless }) => {
|
|
1536
|
+
return exports.defaultAudioCodecs[codec][preferLossless ? "lossless" : "compressed"];
|
|
1537
|
+
};
|
|
1538
|
+
exports.getDefaultAudioCodec = getDefaultAudioCodec;
|
|
1539
|
+
var _audioCodec = null;
|
|
1540
|
+
exports.audioCodecOption = {
|
|
1541
|
+
cliFlag,
|
|
1542
|
+
setConfig: (audioCodec) => {
|
|
1543
|
+
if (audioCodec === null) {
|
|
1544
|
+
_audioCodec = null;
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
if (!exports.validAudioCodecs.includes(audioCodec)) {
|
|
1548
|
+
throw new Error(`Audio codec must be one of the following: ${exports.validAudioCodecs.join(", ")}, but got ${audioCodec}`);
|
|
1549
|
+
}
|
|
1550
|
+
_audioCodec = audioCodec;
|
|
1551
|
+
},
|
|
1552
|
+
getValue: ({ commandLine }) => {
|
|
1553
|
+
if (commandLine[cliFlag]) {
|
|
1554
|
+
const codec = commandLine[cliFlag];
|
|
1555
|
+
if (!exports.validAudioCodecs.includes(commandLine[cliFlag])) {
|
|
1556
|
+
throw new Error(`Audio codec must be one of the following: ${exports.validAudioCodecs.join(", ")}, but got ${codec}`);
|
|
1557
|
+
}
|
|
1558
|
+
return {
|
|
1559
|
+
source: "cli",
|
|
1560
|
+
value: commandLine[cliFlag]
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
if (_audioCodec !== null) {
|
|
1564
|
+
return {
|
|
1565
|
+
source: "config",
|
|
1566
|
+
value: _audioCodec
|
|
1567
|
+
};
|
|
1568
|
+
}
|
|
1569
|
+
return {
|
|
1570
|
+
source: "default",
|
|
1571
|
+
value: null
|
|
1572
|
+
};
|
|
1573
|
+
},
|
|
1574
|
+
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.`,
|
|
1575
|
+
docLink: "https://www.remotion.dev/docs/encoding/#audio-codec",
|
|
1576
|
+
name: "Audio Codec",
|
|
1577
|
+
ssrName,
|
|
1578
|
+
type: "aac"
|
|
1579
|
+
};
|
|
1580
|
+
});
|
|
1581
|
+
|
|
1582
|
+
// ../renderer/dist/validate-output-filename.js
|
|
1583
|
+
var require_validate_output_filename = __commonJS((exports) => {
|
|
1584
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1585
|
+
exports.validateOutputFilename = undefined;
|
|
1586
|
+
var file_extensions_1 = require_file_extensions();
|
|
1587
|
+
var audio_codec_1 = require_audio_codec();
|
|
1588
|
+
var validateOutputFilename = ({ codec, audioCodecSetting, extension, preferLossless, separateAudioTo }) => {
|
|
1589
|
+
if (!file_extensions_1.defaultFileExtensionMap[codec]) {
|
|
1590
|
+
throw new TypeError(`The codec "${codec}" is not supported. Supported codecs are: ${Object.keys(file_extensions_1.defaultFileExtensionMap).join(", ")}`);
|
|
1591
|
+
}
|
|
1592
|
+
const map = file_extensions_1.defaultFileExtensionMap[codec];
|
|
1593
|
+
const resolvedAudioCodec = (0, audio_codec_1.resolveAudioCodec)({
|
|
1594
|
+
codec,
|
|
1595
|
+
preferLossless,
|
|
1596
|
+
setting: audioCodecSetting,
|
|
1597
|
+
separateAudioTo
|
|
1598
|
+
});
|
|
1599
|
+
if (resolvedAudioCodec === null) {
|
|
1600
|
+
if (extension !== map.default) {
|
|
1601
|
+
throw new TypeError(`When using the ${codec} codec, the output filename must end in .${map.default}.`);
|
|
1602
|
+
}
|
|
1603
|
+
return;
|
|
1604
|
+
}
|
|
1605
|
+
if (!(resolvedAudioCodec in map.forAudioCodec)) {
|
|
1606
|
+
throw new Error(`Audio codec ${resolvedAudioCodec} is not supported for codec ${codec}`);
|
|
1607
|
+
}
|
|
1608
|
+
const acceptableExtensions = map.forAudioCodec[resolvedAudioCodec].possible;
|
|
1609
|
+
if (!acceptableExtensions.includes(extension) && !separateAudioTo) {
|
|
1610
|
+
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(", ")}.`);
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
exports.validateOutputFilename = validateOutputFilename;
|
|
1614
|
+
});
|
|
1615
|
+
|
|
1616
|
+
// ../renderer/dist/pure.js
|
|
1617
|
+
var require_pure = __commonJS((exports) => {
|
|
1618
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1619
|
+
exports.NoReactAPIs = undefined;
|
|
1620
|
+
var codec_supports_media_1 = require_codec_supports_media();
|
|
1621
|
+
var get_duration_from_frame_range_1 = require_get_duration_from_frame_range();
|
|
1622
|
+
var get_extension_from_codec_1 = require_get_extension_from_codec();
|
|
1623
|
+
var get_extension_of_filename_1 = require_get_extension_of_filename();
|
|
1624
|
+
var is_audio_codec_1 = require_is_audio_codec();
|
|
1625
|
+
var validate_output_filename_1 = require_validate_output_filename();
|
|
1626
|
+
exports.NoReactAPIs = {
|
|
1627
|
+
getExtensionOfFilename: get_extension_of_filename_1.getExtensionOfFilename,
|
|
1628
|
+
getFileExtensionFromCodec: get_extension_from_codec_1.getFileExtensionFromCodec,
|
|
1629
|
+
validateOutputFilename: validate_output_filename_1.validateOutputFilename,
|
|
1630
|
+
getFramesToRender: get_duration_from_frame_range_1.getFramesToRender,
|
|
1631
|
+
codecSupportsMedia: codec_supports_media_1.codecSupportsMedia,
|
|
1632
|
+
isAudioCodec: is_audio_codec_1.isAudioCodec
|
|
1633
|
+
};
|
|
1634
|
+
});
|
|
1635
|
+
|
|
1636
|
+
// ../core/dist/esm/no-react.mjs
|
|
1637
|
+
function interpolateFunction(input, inputRange, outputRange, options) {
|
|
1638
|
+
const { extrapolateLeft, extrapolateRight, easing } = options;
|
|
1639
|
+
let result = input;
|
|
1640
|
+
const [inputMin, inputMax] = inputRange;
|
|
1641
|
+
const [outputMin, outputMax] = outputRange;
|
|
1642
|
+
if (result < inputMin) {
|
|
1643
|
+
if (extrapolateLeft === "identity") {
|
|
1644
|
+
return result;
|
|
1645
|
+
}
|
|
1646
|
+
if (extrapolateLeft === "clamp") {
|
|
1647
|
+
result = inputMin;
|
|
1648
|
+
} else if (extrapolateLeft === "wrap") {
|
|
1649
|
+
const range = inputMax - inputMin;
|
|
1650
|
+
result = ((result - inputMin) % range + range) % range + inputMin;
|
|
1651
|
+
} else if (extrapolateLeft === "extend") {
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
if (result > inputMax) {
|
|
1655
|
+
if (extrapolateRight === "identity") {
|
|
1656
|
+
return result;
|
|
1657
|
+
}
|
|
1658
|
+
if (extrapolateRight === "clamp") {
|
|
1659
|
+
result = inputMax;
|
|
1660
|
+
} else if (extrapolateRight === "wrap") {
|
|
1661
|
+
const range = inputMax - inputMin;
|
|
1662
|
+
result = ((result - inputMin) % range + range) % range + inputMin;
|
|
1663
|
+
} else if (extrapolateRight === "extend") {
|
|
1664
|
+
}
|
|
1665
|
+
}
|
|
1666
|
+
if (outputMin === outputMax) {
|
|
1667
|
+
return outputMin;
|
|
1668
|
+
}
|
|
1669
|
+
result = (result - inputMin) / (inputMax - inputMin);
|
|
1670
|
+
result = easing(result);
|
|
1671
|
+
result = result * (outputMax - outputMin) + outputMin;
|
|
1672
|
+
return result;
|
|
1673
|
+
}
|
|
1674
|
+
function findRange(input, inputRange) {
|
|
1675
|
+
let i;
|
|
1676
|
+
for (i = 1;i < inputRange.length - 1; ++i) {
|
|
1677
|
+
if (inputRange[i] >= input) {
|
|
1678
|
+
break;
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
return i - 1;
|
|
1682
|
+
}
|
|
1683
|
+
function checkValidInputRange(arr) {
|
|
1684
|
+
for (let i = 1;i < arr.length; ++i) {
|
|
1685
|
+
if (!(arr[i] > arr[i - 1])) {
|
|
1686
|
+
throw new Error(`inputRange must be strictly monotonically increasing but got [${arr.join(",")}]`);
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
function checkInfiniteRange(name, arr) {
|
|
1691
|
+
if (arr.length < 2) {
|
|
1692
|
+
throw new Error(name + " must have at least 2 elements");
|
|
1693
|
+
}
|
|
1694
|
+
for (const element of arr) {
|
|
1695
|
+
if (typeof element !== "number") {
|
|
1696
|
+
throw new Error(`${name} must contain only numbers`);
|
|
1697
|
+
}
|
|
1698
|
+
if (!Number.isFinite(element)) {
|
|
1699
|
+
throw new Error(`${name} must contain only finite numbers, but got [${arr.join(",")}]`);
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
function interpolate(input, inputRange, outputRange, options) {
|
|
1704
|
+
if (typeof input === "undefined") {
|
|
1705
|
+
throw new Error("input can not be undefined");
|
|
1706
|
+
}
|
|
1707
|
+
if (typeof inputRange === "undefined") {
|
|
1708
|
+
throw new Error("inputRange can not be undefined");
|
|
1709
|
+
}
|
|
1710
|
+
if (typeof outputRange === "undefined") {
|
|
1711
|
+
throw new Error("outputRange can not be undefined");
|
|
1712
|
+
}
|
|
1713
|
+
if (inputRange.length !== outputRange.length) {
|
|
1714
|
+
throw new Error("inputRange (" + inputRange.length + ") and outputRange (" + outputRange.length + ") must have the same length");
|
|
1715
|
+
}
|
|
1716
|
+
checkInfiniteRange("inputRange", inputRange);
|
|
1717
|
+
checkInfiniteRange("outputRange", outputRange);
|
|
1718
|
+
checkValidInputRange(inputRange);
|
|
1719
|
+
const easing = options?.easing ?? ((num) => num);
|
|
1720
|
+
let extrapolateLeft = "extend";
|
|
1721
|
+
if (options?.extrapolateLeft !== undefined) {
|
|
1722
|
+
extrapolateLeft = options.extrapolateLeft;
|
|
1723
|
+
}
|
|
1724
|
+
let extrapolateRight = "extend";
|
|
1725
|
+
if (options?.extrapolateRight !== undefined) {
|
|
1726
|
+
extrapolateRight = options.extrapolateRight;
|
|
1727
|
+
}
|
|
1728
|
+
if (typeof input !== "number") {
|
|
1729
|
+
throw new TypeError("Cannot interpolate an input which is not a number");
|
|
1730
|
+
}
|
|
1731
|
+
const range = findRange(input, inputRange);
|
|
1732
|
+
return interpolateFunction(input, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
|
|
1733
|
+
easing,
|
|
1734
|
+
extrapolateLeft,
|
|
1735
|
+
extrapolateRight
|
|
1736
|
+
});
|
|
1737
|
+
}
|
|
1738
|
+
function mulberry32(a) {
|
|
1739
|
+
let t = a + 1831565813;
|
|
1740
|
+
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
1741
|
+
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
1742
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
1743
|
+
}
|
|
1744
|
+
function hashCode(str) {
|
|
1745
|
+
let i = 0;
|
|
1746
|
+
let chr = 0;
|
|
1747
|
+
let hash = 0;
|
|
1748
|
+
for (i = 0;i < str.length; i++) {
|
|
1749
|
+
chr = str.charCodeAt(i);
|
|
1750
|
+
hash = (hash << 5) - hash + chr;
|
|
1751
|
+
hash |= 0;
|
|
1752
|
+
}
|
|
1753
|
+
return hash;
|
|
1754
|
+
}
|
|
1755
|
+
var random = (seed, dummy) => {
|
|
1756
|
+
if (dummy !== undefined) {
|
|
1757
|
+
throw new TypeError("random() takes only one argument");
|
|
1758
|
+
}
|
|
1759
|
+
if (seed === null) {
|
|
1760
|
+
return Math.random();
|
|
1761
|
+
}
|
|
1762
|
+
if (typeof seed === "string") {
|
|
1763
|
+
return mulberry32(hashCode(seed));
|
|
1764
|
+
}
|
|
1765
|
+
if (typeof seed === "number") {
|
|
1766
|
+
return mulberry32(seed * 10000000000);
|
|
1767
|
+
}
|
|
1768
|
+
throw new Error("random() argument must be a number or a string");
|
|
1769
|
+
};
|
|
1770
|
+
function truthy(value) {
|
|
1771
|
+
return Boolean(value);
|
|
1772
|
+
}
|
|
1773
|
+
if (typeof window !== "undefined") {
|
|
1774
|
+
window.remotion_renderReady = false;
|
|
1775
|
+
}
|
|
1776
|
+
if (typeof window !== "undefined") {
|
|
1777
|
+
window.remotion_delayRenderTimeouts = {};
|
|
1778
|
+
}
|
|
1779
|
+
var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
|
|
1780
|
+
var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
|
|
1781
|
+
var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
|
|
1782
|
+
var DATE_TOKEN = "remotion-date:";
|
|
1783
|
+
var FILE_TOKEN = "remotion-file:";
|
|
1784
|
+
var serializeJSONWithDate = ({
|
|
1785
|
+
data,
|
|
1786
|
+
indent,
|
|
1787
|
+
staticBase
|
|
1788
|
+
}) => {
|
|
1789
|
+
let customDateUsed = false;
|
|
1790
|
+
let customFileUsed = false;
|
|
1791
|
+
let mapUsed = false;
|
|
1792
|
+
let setUsed = false;
|
|
1793
|
+
try {
|
|
1794
|
+
const serializedString = JSON.stringify(data, function(key, value) {
|
|
1795
|
+
const item = this[key];
|
|
1796
|
+
if (item instanceof Date) {
|
|
1797
|
+
customDateUsed = true;
|
|
1798
|
+
return `${DATE_TOKEN}${item.toISOString()}`;
|
|
1799
|
+
}
|
|
1800
|
+
if (item instanceof Map) {
|
|
1801
|
+
mapUsed = true;
|
|
1802
|
+
return value;
|
|
1803
|
+
}
|
|
1804
|
+
if (item instanceof Set) {
|
|
1805
|
+
setUsed = true;
|
|
1806
|
+
return value;
|
|
1807
|
+
}
|
|
1808
|
+
if (typeof item === "string" && staticBase !== null && item.startsWith(staticBase)) {
|
|
1809
|
+
customFileUsed = true;
|
|
1810
|
+
return `${FILE_TOKEN}${item.replace(staticBase + "/", "")}`;
|
|
1811
|
+
}
|
|
1812
|
+
return value;
|
|
1813
|
+
}, indent);
|
|
1814
|
+
return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
|
|
1815
|
+
} catch (err) {
|
|
1816
|
+
throw new Error("Could not serialize the passed input props to JSON: " + err.message);
|
|
1817
|
+
}
|
|
1818
|
+
};
|
|
1819
|
+
var deserializeJSONWithCustomFields = (data) => {
|
|
1820
|
+
return JSON.parse(data, (_, value) => {
|
|
1821
|
+
if (typeof value === "string" && value.startsWith(DATE_TOKEN)) {
|
|
1822
|
+
return new Date(value.replace(DATE_TOKEN, ""));
|
|
1823
|
+
}
|
|
1824
|
+
if (typeof value === "string" && value.startsWith(FILE_TOKEN)) {
|
|
1825
|
+
return `${window.remotion_staticBase}/${value.replace(FILE_TOKEN, "")}`;
|
|
1826
|
+
}
|
|
1827
|
+
return value;
|
|
1828
|
+
});
|
|
1829
|
+
};
|
|
1830
|
+
var NUMBER = "[-+]?\\d*\\.?\\d+";
|
|
1831
|
+
var PERCENTAGE = NUMBER + "%";
|
|
1832
|
+
function call(...args) {
|
|
1833
|
+
return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
|
|
1834
|
+
}
|
|
1835
|
+
function getMatchers() {
|
|
1836
|
+
const cachedMatchers = {
|
|
1837
|
+
rgb: undefined,
|
|
1838
|
+
rgba: undefined,
|
|
1839
|
+
hsl: undefined,
|
|
1840
|
+
hsla: undefined,
|
|
1841
|
+
hex3: undefined,
|
|
1842
|
+
hex4: undefined,
|
|
1843
|
+
hex5: undefined,
|
|
1844
|
+
hex6: undefined,
|
|
1845
|
+
hex8: undefined
|
|
1846
|
+
};
|
|
1847
|
+
if (cachedMatchers.rgb === undefined) {
|
|
1848
|
+
cachedMatchers.rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
|
|
1849
|
+
cachedMatchers.rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER));
|
|
1850
|
+
cachedMatchers.hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE));
|
|
1851
|
+
cachedMatchers.hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
|
|
1852
|
+
cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
1853
|
+
cachedMatchers.hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
|
|
1854
|
+
cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
|
|
1855
|
+
cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
|
|
1856
|
+
}
|
|
1857
|
+
return cachedMatchers;
|
|
1858
|
+
}
|
|
1859
|
+
function hue2rgb(p, q, t) {
|
|
1860
|
+
if (t < 0) {
|
|
1861
|
+
t += 1;
|
|
1862
|
+
}
|
|
1863
|
+
if (t > 1) {
|
|
1864
|
+
t -= 1;
|
|
1865
|
+
}
|
|
1866
|
+
if (t < 1 / 6) {
|
|
1867
|
+
return p + (q - p) * 6 * t;
|
|
1868
|
+
}
|
|
1869
|
+
if (t < 1 / 2) {
|
|
1870
|
+
return q;
|
|
1871
|
+
}
|
|
1872
|
+
if (t < 2 / 3) {
|
|
1873
|
+
return p + (q - p) * (2 / 3 - t) * 6;
|
|
1874
|
+
}
|
|
1875
|
+
return p;
|
|
1876
|
+
}
|
|
1877
|
+
function hslToRgb(h, s, l) {
|
|
1878
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
1879
|
+
const p = 2 * l - q;
|
|
1880
|
+
const r = hue2rgb(p, q, h + 1 / 3);
|
|
1881
|
+
const g = hue2rgb(p, q, h);
|
|
1882
|
+
const b = hue2rgb(p, q, h - 1 / 3);
|
|
1883
|
+
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
|
|
1884
|
+
}
|
|
1885
|
+
function parse255(str) {
|
|
1886
|
+
const int = Number.parseInt(str, 10);
|
|
1887
|
+
if (int < 0) {
|
|
1888
|
+
return 0;
|
|
1889
|
+
}
|
|
1890
|
+
if (int > 255) {
|
|
1891
|
+
return 255;
|
|
1892
|
+
}
|
|
1893
|
+
return int;
|
|
1894
|
+
}
|
|
1895
|
+
function parse360(str) {
|
|
1896
|
+
const int = Number.parseFloat(str);
|
|
1897
|
+
return (int % 360 + 360) % 360 / 360;
|
|
1898
|
+
}
|
|
1899
|
+
function parse1(str) {
|
|
1900
|
+
const num = Number.parseFloat(str);
|
|
1901
|
+
if (num < 0) {
|
|
1902
|
+
return 0;
|
|
1903
|
+
}
|
|
1904
|
+
if (num > 1) {
|
|
1905
|
+
return 255;
|
|
1906
|
+
}
|
|
1907
|
+
return Math.round(num * 255);
|
|
1908
|
+
}
|
|
1909
|
+
function parsePercentage(str) {
|
|
1910
|
+
const int = Number.parseFloat(str);
|
|
1911
|
+
if (int < 0) {
|
|
1912
|
+
return 0;
|
|
1913
|
+
}
|
|
1914
|
+
if (int > 100) {
|
|
1915
|
+
return 1;
|
|
1916
|
+
}
|
|
1917
|
+
return int / 100;
|
|
1918
|
+
}
|
|
1919
|
+
var colorNames = {
|
|
1920
|
+
transparent: 0,
|
|
1921
|
+
aliceblue: 4042850303,
|
|
1922
|
+
antiquewhite: 4209760255,
|
|
1923
|
+
aqua: 16777215,
|
|
1924
|
+
aquamarine: 2147472639,
|
|
1925
|
+
azure: 4043309055,
|
|
1926
|
+
beige: 4126530815,
|
|
1927
|
+
bisque: 4293182719,
|
|
1928
|
+
black: 255,
|
|
1929
|
+
blanchedalmond: 4293643775,
|
|
1930
|
+
blue: 65535,
|
|
1931
|
+
blueviolet: 2318131967,
|
|
1932
|
+
brown: 2771004159,
|
|
1933
|
+
burlywood: 3736635391,
|
|
1934
|
+
burntsienna: 3934150143,
|
|
1935
|
+
cadetblue: 1604231423,
|
|
1936
|
+
chartreuse: 2147418367,
|
|
1937
|
+
chocolate: 3530104575,
|
|
1938
|
+
coral: 4286533887,
|
|
1939
|
+
cornflowerblue: 1687547391,
|
|
1940
|
+
cornsilk: 4294499583,
|
|
1941
|
+
crimson: 3692313855,
|
|
1942
|
+
cyan: 16777215,
|
|
1943
|
+
darkblue: 35839,
|
|
1944
|
+
darkcyan: 9145343,
|
|
1945
|
+
darkgoldenrod: 3095792639,
|
|
1946
|
+
darkgray: 2846468607,
|
|
1947
|
+
darkgreen: 6553855,
|
|
1948
|
+
darkgrey: 2846468607,
|
|
1949
|
+
darkkhaki: 3182914559,
|
|
1950
|
+
darkmagenta: 2332068863,
|
|
1951
|
+
darkolivegreen: 1433087999,
|
|
1952
|
+
darkorange: 4287365375,
|
|
1953
|
+
darkorchid: 2570243327,
|
|
1954
|
+
darkred: 2332033279,
|
|
1955
|
+
darksalmon: 3918953215,
|
|
1956
|
+
darkseagreen: 2411499519,
|
|
1957
|
+
darkslateblue: 1211993087,
|
|
1958
|
+
darkslategray: 793726975,
|
|
1959
|
+
darkslategrey: 793726975,
|
|
1960
|
+
darkturquoise: 13554175,
|
|
1961
|
+
darkviolet: 2483082239,
|
|
1962
|
+
deeppink: 4279538687,
|
|
1963
|
+
deepskyblue: 12582911,
|
|
1964
|
+
dimgray: 1768516095,
|
|
1965
|
+
dimgrey: 1768516095,
|
|
1966
|
+
dodgerblue: 512819199,
|
|
1967
|
+
firebrick: 2988581631,
|
|
1968
|
+
floralwhite: 4294635775,
|
|
1969
|
+
forestgreen: 579543807,
|
|
1970
|
+
fuchsia: 4278255615,
|
|
1971
|
+
gainsboro: 3705462015,
|
|
1972
|
+
ghostwhite: 4177068031,
|
|
1973
|
+
gold: 4292280575,
|
|
1974
|
+
goldenrod: 3668254975,
|
|
1975
|
+
gray: 2155905279,
|
|
1976
|
+
green: 8388863,
|
|
1977
|
+
greenyellow: 2919182335,
|
|
1978
|
+
grey: 2155905279,
|
|
1979
|
+
honeydew: 4043305215,
|
|
1980
|
+
hotpink: 4285117695,
|
|
1981
|
+
indianred: 3445382399,
|
|
1982
|
+
indigo: 1258324735,
|
|
1983
|
+
ivory: 4294963455,
|
|
1984
|
+
khaki: 4041641215,
|
|
1985
|
+
lavender: 3873897215,
|
|
1986
|
+
lavenderblush: 4293981695,
|
|
1987
|
+
lawngreen: 2096890111,
|
|
1988
|
+
lemonchiffon: 4294626815,
|
|
1989
|
+
lightblue: 2916673279,
|
|
1990
|
+
lightcoral: 4034953471,
|
|
1991
|
+
lightcyan: 3774873599,
|
|
1992
|
+
lightgoldenrodyellow: 4210742015,
|
|
1993
|
+
lightgray: 3553874943,
|
|
1994
|
+
lightgreen: 2431553791,
|
|
1995
|
+
lightgrey: 3553874943,
|
|
1996
|
+
lightpink: 4290167295,
|
|
1997
|
+
lightsalmon: 4288707327,
|
|
1998
|
+
lightseagreen: 548580095,
|
|
1999
|
+
lightskyblue: 2278488831,
|
|
2000
|
+
lightslategray: 2005441023,
|
|
2001
|
+
lightslategrey: 2005441023,
|
|
2002
|
+
lightsteelblue: 2965692159,
|
|
2003
|
+
lightyellow: 4294959359,
|
|
2004
|
+
lime: 16711935,
|
|
2005
|
+
limegreen: 852308735,
|
|
2006
|
+
linen: 4210091775,
|
|
2007
|
+
magenta: 4278255615,
|
|
2008
|
+
maroon: 2147483903,
|
|
2009
|
+
mediumaquamarine: 1724754687,
|
|
2010
|
+
mediumblue: 52735,
|
|
2011
|
+
mediumorchid: 3126187007,
|
|
2012
|
+
mediumpurple: 2473647103,
|
|
2013
|
+
mediumseagreen: 1018393087,
|
|
2014
|
+
mediumslateblue: 2070474495,
|
|
2015
|
+
mediumspringgreen: 16423679,
|
|
2016
|
+
mediumturquoise: 1221709055,
|
|
2017
|
+
mediumvioletred: 3340076543,
|
|
2018
|
+
midnightblue: 421097727,
|
|
2019
|
+
mintcream: 4127193855,
|
|
2020
|
+
mistyrose: 4293190143,
|
|
2021
|
+
moccasin: 4293178879,
|
|
2022
|
+
navajowhite: 4292783615,
|
|
2023
|
+
navy: 33023,
|
|
2024
|
+
oldlace: 4260751103,
|
|
2025
|
+
olive: 2155872511,
|
|
2026
|
+
olivedrab: 1804477439,
|
|
2027
|
+
orange: 4289003775,
|
|
2028
|
+
orangered: 4282712319,
|
|
2029
|
+
orchid: 3664828159,
|
|
2030
|
+
palegoldenrod: 4008225535,
|
|
2031
|
+
palegreen: 2566625535,
|
|
2032
|
+
paleturquoise: 2951671551,
|
|
2033
|
+
palevioletred: 3681588223,
|
|
2034
|
+
papayawhip: 4293907967,
|
|
2035
|
+
peachpuff: 4292524543,
|
|
2036
|
+
peru: 3448061951,
|
|
2037
|
+
pink: 4290825215,
|
|
2038
|
+
plum: 3718307327,
|
|
2039
|
+
powderblue: 2967529215,
|
|
2040
|
+
purple: 2147516671,
|
|
2041
|
+
rebeccapurple: 1714657791,
|
|
2042
|
+
red: 4278190335,
|
|
2043
|
+
rosybrown: 3163525119,
|
|
2044
|
+
royalblue: 1097458175,
|
|
2045
|
+
saddlebrown: 2336560127,
|
|
2046
|
+
salmon: 4202722047,
|
|
2047
|
+
sandybrown: 4104413439,
|
|
2048
|
+
seagreen: 780883967,
|
|
2049
|
+
seashell: 4294307583,
|
|
2050
|
+
sienna: 2689740287,
|
|
2051
|
+
silver: 3233857791,
|
|
2052
|
+
skyblue: 2278484991,
|
|
2053
|
+
slateblue: 1784335871,
|
|
2054
|
+
slategray: 1887473919,
|
|
2055
|
+
slategrey: 1887473919,
|
|
2056
|
+
snow: 4294638335,
|
|
2057
|
+
springgreen: 16744447,
|
|
2058
|
+
steelblue: 1182971135,
|
|
2059
|
+
tan: 3535047935,
|
|
2060
|
+
teal: 8421631,
|
|
2061
|
+
thistle: 3636451583,
|
|
2062
|
+
tomato: 4284696575,
|
|
2063
|
+
turquoise: 1088475391,
|
|
2064
|
+
violet: 4001558271,
|
|
2065
|
+
wheat: 4125012991,
|
|
2066
|
+
white: 4294967295,
|
|
2067
|
+
whitesmoke: 4126537215,
|
|
2068
|
+
yellow: 4294902015,
|
|
2069
|
+
yellowgreen: 2597139199
|
|
2070
|
+
};
|
|
2071
|
+
function normalizeColor(color) {
|
|
2072
|
+
const matchers = getMatchers();
|
|
2073
|
+
let match;
|
|
2074
|
+
if (matchers.hex6) {
|
|
2075
|
+
if (match = matchers.hex6.exec(color)) {
|
|
2076
|
+
return Number.parseInt(match[1] + "ff", 16) >>> 0;
|
|
2077
|
+
}
|
|
2078
|
+
}
|
|
2079
|
+
if (colorNames[color] !== undefined) {
|
|
2080
|
+
return colorNames[color];
|
|
2081
|
+
}
|
|
2082
|
+
if (matchers.rgb) {
|
|
2083
|
+
if (match = matchers.rgb.exec(color)) {
|
|
2084
|
+
return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | 255) >>> 0;
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
if (matchers.rgba) {
|
|
2088
|
+
if (match = matchers.rgba.exec(color)) {
|
|
2089
|
+
return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | parse1(match[4])) >>> 0;
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
if (matchers.hex3) {
|
|
2093
|
+
if (match = matchers.hex3.exec(color)) {
|
|
2094
|
+
return Number.parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + "ff", 16) >>> 0;
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
if (matchers.hex8) {
|
|
2098
|
+
if (match = matchers.hex8.exec(color)) {
|
|
2099
|
+
return Number.parseInt(match[1], 16) >>> 0;
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
if (matchers.hex4) {
|
|
2103
|
+
if (match = matchers.hex4.exec(color)) {
|
|
2104
|
+
return Number.parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], 16) >>> 0;
|
|
2105
|
+
}
|
|
2106
|
+
}
|
|
2107
|
+
if (matchers.hsl) {
|
|
2108
|
+
if (match = matchers.hsl.exec(color)) {
|
|
2109
|
+
return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | 255) >>> 0;
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
if (matchers.hsla) {
|
|
2113
|
+
if (match = matchers.hsla.exec(color)) {
|
|
2114
|
+
return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0;
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
throw new Error(`invalid color string ${color} provided`);
|
|
2118
|
+
}
|
|
2119
|
+
function processColor(color) {
|
|
2120
|
+
const normalizedColor = normalizeColor(color);
|
|
2121
|
+
return (normalizedColor << 24 | normalizedColor >>> 8) >>> 0;
|
|
2122
|
+
}
|
|
2123
|
+
var ENABLE_V5_BREAKING_CHANGES = false;
|
|
2124
|
+
var validateFrame = ({
|
|
2125
|
+
allowFloats,
|
|
2126
|
+
durationInFrames,
|
|
2127
|
+
frame
|
|
2128
|
+
}) => {
|
|
2129
|
+
if (typeof frame === "undefined") {
|
|
2130
|
+
throw new TypeError(`Argument missing for parameter "frame"`);
|
|
2131
|
+
}
|
|
2132
|
+
if (typeof frame !== "number") {
|
|
2133
|
+
throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
|
|
2134
|
+
}
|
|
2135
|
+
if (!Number.isFinite(frame)) {
|
|
2136
|
+
throw new RangeError(`Frame ${frame} is not finite`);
|
|
2137
|
+
}
|
|
2138
|
+
if (frame % 1 !== 0 && !allowFloats) {
|
|
2139
|
+
throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
|
|
2140
|
+
}
|
|
2141
|
+
if (frame < 0 && frame < -durationInFrames) {
|
|
2142
|
+
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
|
|
2143
|
+
}
|
|
2144
|
+
if (frame > durationInFrames - 1) {
|
|
2145
|
+
throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
|
|
2146
|
+
}
|
|
2147
|
+
};
|
|
2148
|
+
var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
|
|
2149
|
+
if (!defaultProps) {
|
|
2150
|
+
return;
|
|
2151
|
+
}
|
|
2152
|
+
if (typeof defaultProps !== "object") {
|
|
2153
|
+
throw new Error(`"${name}" must be an object, but you passed a value of type ${typeof defaultProps}`);
|
|
2154
|
+
}
|
|
2155
|
+
if (Array.isArray(defaultProps)) {
|
|
2156
|
+
throw new Error(`"${name}" must be an object, an array was passed ${compositionId ? `for composition "${compositionId}"` : ""}`);
|
|
2157
|
+
}
|
|
2158
|
+
};
|
|
2159
|
+
function validateDimension(amount, nameOfProp, location) {
|
|
2160
|
+
if (typeof amount !== "number") {
|
|
2161
|
+
throw new Error(`The "${nameOfProp}" prop ${location} must be a number, but you passed a value of type ${typeof amount}`);
|
|
2162
|
+
}
|
|
2163
|
+
if (isNaN(amount)) {
|
|
2164
|
+
throw new TypeError(`The "${nameOfProp}" prop ${location} must not be NaN, but is NaN.`);
|
|
2165
|
+
}
|
|
2166
|
+
if (!Number.isFinite(amount)) {
|
|
2167
|
+
throw new TypeError(`The "${nameOfProp}" prop ${location} must be finite, but is ${amount}.`);
|
|
2168
|
+
}
|
|
2169
|
+
if (amount % 1 !== 0) {
|
|
2170
|
+
throw new TypeError(`The "${nameOfProp}" prop ${location} must be an integer, but is ${amount}.`);
|
|
2171
|
+
}
|
|
2172
|
+
if (amount <= 0) {
|
|
2173
|
+
throw new TypeError(`The "${nameOfProp}" prop ${location} must be positive, but got ${amount}.`);
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
function validateDurationInFrames(durationInFrames, options) {
|
|
2177
|
+
const { allowFloats, component } = options;
|
|
2178
|
+
if (typeof durationInFrames === "undefined") {
|
|
2179
|
+
throw new Error(`The "durationInFrames" prop ${component} is missing.`);
|
|
2180
|
+
}
|
|
2181
|
+
if (typeof durationInFrames !== "number") {
|
|
2182
|
+
throw new Error(`The "durationInFrames" prop ${component} must be a number, but you passed a value of type ${typeof durationInFrames}`);
|
|
2183
|
+
}
|
|
2184
|
+
if (durationInFrames <= 0) {
|
|
2185
|
+
throw new TypeError(`The "durationInFrames" prop ${component} must be positive, but got ${durationInFrames}.`);
|
|
2186
|
+
}
|
|
2187
|
+
if (!allowFloats && durationInFrames % 1 !== 0) {
|
|
2188
|
+
throw new TypeError(`The "durationInFrames" prop ${component} must be an integer, but got ${durationInFrames}.`);
|
|
2189
|
+
}
|
|
2190
|
+
if (!Number.isFinite(durationInFrames)) {
|
|
2191
|
+
throw new TypeError(`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`);
|
|
2192
|
+
}
|
|
2193
|
+
}
|
|
2194
|
+
function validateFps(fps, location, isGif) {
|
|
2195
|
+
if (typeof fps !== "number") {
|
|
2196
|
+
throw new Error(`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`);
|
|
2197
|
+
}
|
|
2198
|
+
if (!Number.isFinite(fps)) {
|
|
2199
|
+
throw new Error(`"fps" must be a finite, but you passed ${fps} ${location}`);
|
|
2200
|
+
}
|
|
2201
|
+
if (isNaN(fps)) {
|
|
2202
|
+
throw new Error(`"fps" must not be NaN, but got ${fps} ${location}`);
|
|
2203
|
+
}
|
|
2204
|
+
if (fps <= 0) {
|
|
2205
|
+
throw new TypeError(`"fps" must be positive, but got ${fps} ${location}`);
|
|
2206
|
+
}
|
|
2207
|
+
if (isGif && fps > 50) {
|
|
2208
|
+
throw new TypeError(`The FPS for a GIF cannot be higher than 50. Use the --every-nth-frame option to lower the FPS: https://remotion.dev/docs/render-as-gif`);
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2211
|
+
var getExpectedMediaFrameUncorrected = ({
|
|
2212
|
+
frame,
|
|
2213
|
+
playbackRate,
|
|
2214
|
+
startFrom
|
|
2215
|
+
}) => {
|
|
2216
|
+
return interpolate(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
|
|
2217
|
+
};
|
|
2218
|
+
var getAbsoluteSrc = (relativeSrc) => {
|
|
2219
|
+
if (typeof window === "undefined") {
|
|
2220
|
+
return relativeSrc;
|
|
2221
|
+
}
|
|
2222
|
+
return new URL(relativeSrc, window.origin).href;
|
|
2223
|
+
};
|
|
2224
|
+
var getOffthreadVideoSource = ({
|
|
2225
|
+
src,
|
|
2226
|
+
transparent,
|
|
2227
|
+
currentTime,
|
|
2228
|
+
toneMapped
|
|
2229
|
+
}) => {
|
|
2230
|
+
return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(getAbsoluteSrc(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}&toneMapped=${String(toneMapped)}`;
|
|
2231
|
+
};
|
|
2232
|
+
var NoReactInternals = {
|
|
2233
|
+
processColor,
|
|
2234
|
+
truthy,
|
|
2235
|
+
validateFps,
|
|
2236
|
+
validateDimension,
|
|
2237
|
+
validateDurationInFrames,
|
|
2238
|
+
validateDefaultAndInputProps,
|
|
2239
|
+
validateFrame,
|
|
2240
|
+
serializeJSONWithDate,
|
|
2241
|
+
bundleName: "bundle.js",
|
|
2242
|
+
bundleMapName: "bundle.js.map",
|
|
2243
|
+
deserializeJSONWithCustomFields,
|
|
2244
|
+
DELAY_RENDER_CALLSTACK_TOKEN,
|
|
2245
|
+
DELAY_RENDER_RETRY_TOKEN,
|
|
2246
|
+
DELAY_RENDER_ATTEMPT_TOKEN: DELAY_RENDER_RETRIES_LEFT,
|
|
2247
|
+
getOffthreadVideoSource,
|
|
2248
|
+
getExpectedMediaFrameUncorrected,
|
|
2249
|
+
ENABLE_V5_BREAKING_CHANGES,
|
|
2250
|
+
MIN_NODE_VERSION: ENABLE_V5_BREAKING_CHANGES ? 18 : 16,
|
|
2251
|
+
MIN_BUN_VERSION: ENABLE_V5_BREAKING_CHANGES ? "1.1.3" : "1.0.3",
|
|
2252
|
+
colorNames,
|
|
2253
|
+
DATE_TOKEN,
|
|
2254
|
+
FILE_TOKEN
|
|
2255
|
+
};
|
|
2256
|
+
|
|
2257
|
+
// src/constants.ts
|
|
2258
|
+
var COMMAND_NOT_FOUND = "Command not found";
|
|
2259
|
+
var expiryDays = {
|
|
2260
|
+
"1-day": 1,
|
|
2261
|
+
"3-days": 3,
|
|
2262
|
+
"7-days": 7,
|
|
2263
|
+
"30-days": 30
|
|
2264
|
+
};
|
|
2265
|
+
var ServerlessRoutines;
|
|
2266
|
+
((ServerlessRoutines2) => {
|
|
2267
|
+
ServerlessRoutines2["info"] = "info";
|
|
2268
|
+
ServerlessRoutines2["start"] = "start";
|
|
2269
|
+
ServerlessRoutines2["launch"] = "launch";
|
|
2270
|
+
ServerlessRoutines2["status"] = "status";
|
|
2271
|
+
ServerlessRoutines2["renderer"] = "renderer";
|
|
2272
|
+
ServerlessRoutines2["still"] = "still";
|
|
2273
|
+
ServerlessRoutines2["compositions"] = "compositions";
|
|
2274
|
+
})(ServerlessRoutines ||= {});
|
|
2275
|
+
var serverlessCodecs = [
|
|
2276
|
+
"h264",
|
|
2277
|
+
"h265",
|
|
2278
|
+
"vp8",
|
|
2279
|
+
"vp9",
|
|
2280
|
+
"mp3",
|
|
2281
|
+
"aac",
|
|
2282
|
+
"wav",
|
|
2283
|
+
"gif",
|
|
2284
|
+
"prores"
|
|
2285
|
+
];
|
|
2286
|
+
var rendersPrefix = (renderId) => `renders/${renderId}`;
|
|
2287
|
+
var outStillName = (renderId, imageFormat) => `${rendersPrefix(renderId)}/out.${imageFormat}`;
|
|
2288
|
+
var outName = (renderId, extension) => `${rendersPrefix(renderId)}/out.${extension}`;
|
|
2289
|
+
var customOutName = (renderId, bucketName, name) => {
|
|
2290
|
+
if (typeof name === "string") {
|
|
2291
|
+
return {
|
|
2292
|
+
renderBucketName: bucketName,
|
|
2293
|
+
key: `${rendersPrefix(renderId)}/${name}`,
|
|
2294
|
+
customCredentials: null
|
|
2295
|
+
};
|
|
2296
|
+
}
|
|
2297
|
+
return {
|
|
2298
|
+
key: name.key,
|
|
2299
|
+
renderBucketName: name.bucketName,
|
|
2300
|
+
customCredentials: name.s3OutputProvider ?? null
|
|
2301
|
+
};
|
|
2302
|
+
};
|
|
2303
|
+
var overallProgressKey = (renderId) => `${rendersPrefix(renderId)}/progress.json`;
|
|
2304
|
+
var artifactName = (renderId, name) => `${rendersPrefix(renderId)}/artifacts/${name}`;
|
|
2305
|
+
var CONCAT_FOLDER_TOKEN = "remotion-concat";
|
|
2306
|
+
var MAX_FUNCTIONS_PER_RENDER = 200;
|
|
2307
|
+
var MINIMUM_FRAMES_PER_FUNCTIONS = 4;
|
|
2308
|
+
var REMOTION_CONCATENATED_TOKEN = "remotion-concatenated-token";
|
|
2309
|
+
var REMOTION_FILELIST_TOKEN = "remotion-filelist";
|
|
2310
|
+
var RENDERER_PATH_TOKEN = "remotion-bucket";
|
|
2311
|
+
// src/serialize-artifact.ts
|
|
2312
|
+
var deserializeArtifact = (serializedArtifact) => {
|
|
2313
|
+
if (serializedArtifact.binary) {
|
|
2314
|
+
const content = new TextEncoder().encode(atob(serializedArtifact.stringContent));
|
|
2315
|
+
return {
|
|
2316
|
+
filename: serializedArtifact.filename,
|
|
2317
|
+
content,
|
|
2318
|
+
frame: serializedArtifact.frame
|
|
2319
|
+
};
|
|
2320
|
+
}
|
|
2321
|
+
return {
|
|
2322
|
+
filename: serializedArtifact.filename,
|
|
2323
|
+
content: serializedArtifact.stringContent,
|
|
2324
|
+
frame: serializedArtifact.frame
|
|
2325
|
+
};
|
|
2326
|
+
};
|
|
2327
|
+
var serializeArtifact = (artifact) => {
|
|
2328
|
+
if (artifact.content instanceof Uint8Array) {
|
|
2329
|
+
const b64encoded = btoa(new TextDecoder("utf8").decode(artifact.content));
|
|
2330
|
+
return {
|
|
2331
|
+
filename: artifact.filename,
|
|
2332
|
+
stringContent: b64encoded,
|
|
2333
|
+
frame: artifact.frame,
|
|
2334
|
+
binary: true
|
|
2335
|
+
};
|
|
2336
|
+
}
|
|
2337
|
+
return {
|
|
2338
|
+
filename: artifact.filename,
|
|
2339
|
+
stringContent: artifact.content,
|
|
2340
|
+
frame: artifact.frame,
|
|
2341
|
+
binary: false
|
|
2342
|
+
};
|
|
2343
|
+
};
|
|
2344
|
+
// src/validate-download-behavior.ts
|
|
2345
|
+
var validateDownloadBehavior = (downloadBehavior) => {
|
|
2346
|
+
if (downloadBehavior === null || downloadBehavior === undefined) {
|
|
2347
|
+
return null;
|
|
2348
|
+
}
|
|
2349
|
+
if (typeof downloadBehavior !== "object") {
|
|
2350
|
+
throw new Error("downloadBehavior must be null or an object");
|
|
2351
|
+
}
|
|
2352
|
+
const behavior = downloadBehavior;
|
|
2353
|
+
if (behavior.type !== "download" && behavior.type !== "play-in-browser") {
|
|
2354
|
+
throw new Error('Download behavior must be either "download" or "play-in-browser"');
|
|
2355
|
+
}
|
|
2356
|
+
if (behavior.type === "download") {
|
|
2357
|
+
if (typeof behavior.fileName !== "string" && behavior.fileName !== null) {
|
|
2358
|
+
throw new Error('If "downloadBehavior.type" is "download", then fileName must be "null" or a string');
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
};
|
|
2362
|
+
// src/validate-frames-per-function.ts
|
|
2363
|
+
var validateFramesPerFunction = ({
|
|
2364
|
+
framesPerFunction,
|
|
2365
|
+
durationInFrames
|
|
2366
|
+
}) => {
|
|
2367
|
+
if (framesPerFunction === null) {
|
|
2368
|
+
return;
|
|
2369
|
+
}
|
|
2370
|
+
if (framesPerFunction === undefined) {
|
|
2371
|
+
return;
|
|
2372
|
+
}
|
|
2373
|
+
if (typeof framesPerFunction !== "number") {
|
|
2374
|
+
throw new TypeError(`'framesPerLambda' needs to be a number, passed ${JSON.stringify(framesPerFunction)}`);
|
|
2375
|
+
}
|
|
2376
|
+
if (!Number.isFinite(framesPerFunction)) {
|
|
2377
|
+
throw new TypeError(`'framesPerLambda' needs to be finite, passed ${framesPerFunction}`);
|
|
2378
|
+
}
|
|
2379
|
+
if (Number.isNaN(framesPerFunction)) {
|
|
2380
|
+
throw new TypeError(`'framesPerLambda' needs to be NaN, passed ${framesPerFunction}`);
|
|
2381
|
+
}
|
|
2382
|
+
if (framesPerFunction % 1 !== 0) {
|
|
2383
|
+
throw new TypeError(`'framesPerLambda' needs to be an integer, passed ${framesPerFunction}`);
|
|
2384
|
+
}
|
|
2385
|
+
const effectiveMinimum = Math.min(MINIMUM_FRAMES_PER_FUNCTIONS, durationInFrames);
|
|
2386
|
+
if (framesPerFunction < effectiveMinimum) {
|
|
2387
|
+
throw new TypeError(`The framesPerLambda needs to be at least ${effectiveMinimum}, but is ${framesPerFunction}`);
|
|
2388
|
+
}
|
|
2389
|
+
};
|
|
2390
|
+
|
|
2391
|
+
// src/index.ts
|
|
2392
|
+
var import_error_handling = __toESM(require_error_handling(), 1);
|
|
2393
|
+
var import_streaming2 = __toESM(require_dist(), 1);
|
|
2394
|
+
|
|
2395
|
+
// ../core/dist/esm/version.mjs
|
|
2396
|
+
var VERSION = "4.0.261";
|
|
2397
|
+
// src/min-max.ts
|
|
2398
|
+
var min = (arr) => {
|
|
2399
|
+
if (arr.length === 0) {
|
|
2400
|
+
throw new Error("Array of 0 length");
|
|
2401
|
+
}
|
|
2402
|
+
let smallest = arr[0];
|
|
2403
|
+
for (let i = 0;i < arr.length; i++) {
|
|
2404
|
+
const elem = arr[i];
|
|
2405
|
+
if (elem < smallest) {
|
|
2406
|
+
smallest = elem;
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
return smallest;
|
|
2410
|
+
};
|
|
2411
|
+
var max = (arr) => {
|
|
2412
|
+
if (arr.length === 0) {
|
|
2413
|
+
throw new Error("Array of 0 length");
|
|
2414
|
+
}
|
|
2415
|
+
let biggest = arr[0];
|
|
2416
|
+
for (let i = 0;i < arr.length; i++) {
|
|
2417
|
+
const elem = arr[i];
|
|
2418
|
+
if (elem > biggest) {
|
|
2419
|
+
biggest = elem;
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
return biggest;
|
|
2423
|
+
};
|
|
2424
|
+
|
|
2425
|
+
// src/calculate-chunk-times.ts
|
|
2426
|
+
var getAbsoluteTime = (parsedTimings) => {
|
|
2427
|
+
if (parsedTimings.length === 0) {
|
|
2428
|
+
return 0;
|
|
2429
|
+
}
|
|
2430
|
+
const allEnds = parsedTimings.map((p) => p.rendered);
|
|
2431
|
+
const allStarts = parsedTimings.map((p) => p.start);
|
|
2432
|
+
const biggestEnd = max(allEnds);
|
|
2433
|
+
const smallestStart = min(allStarts);
|
|
2434
|
+
return Math.max(0, biggestEnd - smallestStart);
|
|
2435
|
+
};
|
|
2436
|
+
var calculateChunkTimes = ({
|
|
2437
|
+
type,
|
|
2438
|
+
timings
|
|
2439
|
+
}) => {
|
|
2440
|
+
const parsedTimings = timings;
|
|
2441
|
+
const absoluteTime = getAbsoluteTime(parsedTimings);
|
|
2442
|
+
if (type === "combined-time-for-cost-calculation") {
|
|
2443
|
+
const totalEncodingTimings = parsedTimings.map((p) => Math.max(0, p.rendered - p.start)).reduce((a, b) => a + b, 0);
|
|
2444
|
+
return totalEncodingTimings + absoluteTime;
|
|
2445
|
+
}
|
|
2446
|
+
if (type === "absolute-time") {
|
|
2447
|
+
return absoluteTime;
|
|
2448
|
+
}
|
|
2449
|
+
throw new Error("invalid time for calculate chunk times");
|
|
2450
|
+
};
|
|
2451
|
+
// src/make-bucket-name.ts
|
|
2452
|
+
var makeBucketName = (region, providerSpecifics) => {
|
|
2453
|
+
return `${providerSpecifics.getBucketPrefix()}${region.replace(/-/g, "")}-${providerSpecifics.randomHash()}`;
|
|
2454
|
+
};
|
|
2455
|
+
|
|
2456
|
+
// src/get-or-create-bucket.ts
|
|
2457
|
+
var internalGetOrCreateBucket = async (params) => {
|
|
2458
|
+
const remotionBuckets = await params.providerSpecifics.getBuckets({
|
|
2459
|
+
region: params.region,
|
|
2460
|
+
forceBucketName: null,
|
|
2461
|
+
forcePathStyle: params.forcePathStyle
|
|
2462
|
+
});
|
|
2463
|
+
if (remotionBuckets.length > 1) {
|
|
2464
|
+
throw new Error(`You have multiple buckets (${remotionBuckets.map((b) => b.name)}) in your S3 region (${params.region}) starting with "${params.providerSpecifics.getBucketPrefix()}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`);
|
|
2465
|
+
}
|
|
2466
|
+
const { enableFolderExpiry, region } = params;
|
|
2467
|
+
if (remotionBuckets.length === 1) {
|
|
2468
|
+
const existingBucketName = remotionBuckets[0].name;
|
|
2469
|
+
await params.providerSpecifics.applyLifeCycle({
|
|
2470
|
+
enableFolderExpiry: enableFolderExpiry ?? null,
|
|
2471
|
+
bucketName: existingBucketName,
|
|
2472
|
+
region,
|
|
2473
|
+
customCredentials: params.customCredentials,
|
|
2474
|
+
forcePathStyle: params.forcePathStyle
|
|
2475
|
+
});
|
|
2476
|
+
return { bucketName: remotionBuckets[0].name, alreadyExisted: true };
|
|
2477
|
+
}
|
|
2478
|
+
const bucketName = makeBucketName(params.region, params.providerSpecifics);
|
|
2479
|
+
await params.providerSpecifics.createBucket({
|
|
2480
|
+
bucketName,
|
|
2481
|
+
region: params.region,
|
|
2482
|
+
forcePathStyle: params.forcePathStyle,
|
|
2483
|
+
skipPutAcl: params.skipPutAcl
|
|
2484
|
+
});
|
|
2485
|
+
await params.providerSpecifics.applyLifeCycle({
|
|
2486
|
+
enableFolderExpiry: enableFolderExpiry ?? null,
|
|
2487
|
+
bucketName,
|
|
2488
|
+
region,
|
|
2489
|
+
customCredentials: params.customCredentials,
|
|
2490
|
+
forcePathStyle: params.forcePathStyle
|
|
2491
|
+
});
|
|
2492
|
+
return { bucketName, alreadyExisted: false };
|
|
2493
|
+
};
|
|
2494
|
+
|
|
2495
|
+
// src/input-props-keys.ts
|
|
2496
|
+
var inputPropsKey = (hash) => {
|
|
2497
|
+
return `input-props/${hash}.json`;
|
|
2498
|
+
};
|
|
2499
|
+
var resolvedPropsKey = (hash) => {
|
|
2500
|
+
return `resolved-props/${hash}.json`;
|
|
2501
|
+
};
|
|
2502
|
+
|
|
2503
|
+
// src/stream-to-string.ts
|
|
2504
|
+
function streamToString(stream) {
|
|
2505
|
+
if (Buffer.isBuffer(stream)) {
|
|
2506
|
+
return stream.toString("utf-8");
|
|
2507
|
+
}
|
|
2508
|
+
const chunks = [];
|
|
2509
|
+
return new Promise((resolve, reject) => {
|
|
2510
|
+
stream.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
|
|
2511
|
+
stream.on("error", (err) => reject(err));
|
|
2512
|
+
stream.on("end", () => resolve(Buffer.concat(chunks).toString("utf8")));
|
|
2513
|
+
});
|
|
2514
|
+
}
|
|
2515
|
+
|
|
2516
|
+
// src/validate-webhook.ts
|
|
2517
|
+
var MAX_WEBHOOK_CUSTOM_DATA_SIZE = 1024;
|
|
2518
|
+
var validateWebhook = (webhook) => {
|
|
2519
|
+
if (typeof webhook === "undefined" || webhook === null) {
|
|
2520
|
+
return;
|
|
2521
|
+
}
|
|
2522
|
+
if (webhook.customData) {
|
|
2523
|
+
const size = JSON.stringify(webhook.customData).length;
|
|
2524
|
+
if (size > MAX_WEBHOOK_CUSTOM_DATA_SIZE) {
|
|
2525
|
+
throw new Error(`Webhook "customData" must be less than ${MAX_WEBHOOK_CUSTOM_DATA_SIZE} bytes. Current size: ${size} bytes.`);
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
};
|
|
2529
|
+
|
|
2530
|
+
// src/compress-props.ts
|
|
2531
|
+
var makeKey = (type, hash) => {
|
|
2532
|
+
if (type === "input-props") {
|
|
2533
|
+
return inputPropsKey(hash);
|
|
2534
|
+
}
|
|
2535
|
+
return resolvedPropsKey(hash);
|
|
2536
|
+
};
|
|
2537
|
+
var serializeOrThrow = (inputProps, propsType) => {
|
|
2538
|
+
try {
|
|
2539
|
+
const payload = NoReactInternals.serializeJSONWithDate({
|
|
2540
|
+
indent: undefined,
|
|
2541
|
+
staticBase: null,
|
|
2542
|
+
data: inputProps
|
|
2543
|
+
});
|
|
2544
|
+
return payload.serializedString;
|
|
2545
|
+
} catch {
|
|
2546
|
+
throw new Error(`Error serializing ${propsType}. Check it has no circular references or reduce the size if the object is big.`);
|
|
2547
|
+
}
|
|
2548
|
+
};
|
|
2549
|
+
var getNeedsToUpload = ({
|
|
2550
|
+
type,
|
|
2551
|
+
sizes,
|
|
2552
|
+
providerSpecifics
|
|
2553
|
+
}) => {
|
|
2554
|
+
const MARGIN = 5000 + MAX_WEBHOOK_CUSTOM_DATA_SIZE;
|
|
2555
|
+
const MAX_INLINE_PAYLOAD_SIZE = (type === "still" ? providerSpecifics.getMaxStillInlinePayloadSize() : providerSpecifics.getMaxNonInlinePayloadSizePerFunction()) - MARGIN;
|
|
2556
|
+
const sizesAlreadyUsed = sizes.reduce((a, b) => a + b);
|
|
2557
|
+
if (sizesAlreadyUsed > MAX_INLINE_PAYLOAD_SIZE) {
|
|
2558
|
+
console.warn(`Warning: The props are over ${Math.round(MAX_INLINE_PAYLOAD_SIZE / 1000)}KB (${Math.ceil(sizesAlreadyUsed / 1024)}KB) in size. Uploading them to ${providerSpecifics.serverStorageProductName()} to circumvent AWS Lambda payload size, which may lead to slowdown.`);
|
|
2559
|
+
return true;
|
|
2560
|
+
}
|
|
2561
|
+
return false;
|
|
2562
|
+
};
|
|
2563
|
+
var compressInputProps = async ({
|
|
2564
|
+
stringifiedInputProps,
|
|
2565
|
+
region,
|
|
2566
|
+
userSpecifiedBucketName,
|
|
2567
|
+
propsType,
|
|
2568
|
+
needsToUpload,
|
|
2569
|
+
providerSpecifics,
|
|
2570
|
+
forcePathStyle,
|
|
2571
|
+
skipPutAcl
|
|
2572
|
+
}) => {
|
|
2573
|
+
const hash = providerSpecifics.randomHash();
|
|
2574
|
+
if (needsToUpload) {
|
|
2575
|
+
const bucketName = userSpecifiedBucketName ?? (await internalGetOrCreateBucket({
|
|
2576
|
+
region,
|
|
2577
|
+
enableFolderExpiry: null,
|
|
2578
|
+
customCredentials: null,
|
|
2579
|
+
providerSpecifics,
|
|
2580
|
+
forcePathStyle,
|
|
2581
|
+
skipPutAcl
|
|
2582
|
+
})).bucketName;
|
|
2583
|
+
await providerSpecifics.writeFile({
|
|
2584
|
+
body: stringifiedInputProps,
|
|
2585
|
+
bucketName,
|
|
2586
|
+
region,
|
|
2587
|
+
customCredentials: null,
|
|
2588
|
+
downloadBehavior: null,
|
|
2589
|
+
expectedBucketOwner: null,
|
|
2590
|
+
key: makeKey(propsType, hash),
|
|
2591
|
+
privacy: "private",
|
|
2592
|
+
forcePathStyle
|
|
2593
|
+
});
|
|
2594
|
+
return {
|
|
2595
|
+
type: "bucket-url",
|
|
2596
|
+
hash,
|
|
2597
|
+
bucketName
|
|
2598
|
+
};
|
|
2599
|
+
}
|
|
2600
|
+
return {
|
|
2601
|
+
type: "payload",
|
|
2602
|
+
payload: stringifiedInputProps
|
|
2603
|
+
};
|
|
2604
|
+
};
|
|
2605
|
+
var decompressInputProps = async ({
|
|
2606
|
+
serialized,
|
|
2607
|
+
region,
|
|
2608
|
+
bucketName,
|
|
2609
|
+
expectedBucketOwner,
|
|
2610
|
+
propsType,
|
|
2611
|
+
providerSpecifics,
|
|
2612
|
+
forcePathStyle
|
|
2613
|
+
}) => {
|
|
2614
|
+
if (serialized.type === "payload") {
|
|
2615
|
+
return serialized.payload;
|
|
2616
|
+
}
|
|
2617
|
+
try {
|
|
2618
|
+
const response = await providerSpecifics.readFile({
|
|
2619
|
+
bucketName,
|
|
2620
|
+
expectedBucketOwner,
|
|
2621
|
+
key: makeKey(propsType, serialized.hash),
|
|
2622
|
+
region,
|
|
2623
|
+
forcePathStyle
|
|
2624
|
+
});
|
|
2625
|
+
const body = await streamToString(response);
|
|
2626
|
+
const payload = body;
|
|
2627
|
+
return payload;
|
|
2628
|
+
} catch (err) {
|
|
2629
|
+
throw new Error(`Failed to parse input props that were serialized: ${err.stack}`);
|
|
2630
|
+
}
|
|
2631
|
+
};
|
|
2632
|
+
// src/docs-url.ts
|
|
2633
|
+
var DOCS_URL = "https://remotion.dev";
|
|
2634
|
+
// src/error-category.ts
|
|
2635
|
+
var errorIsOutOfSpaceError = (err) => {
|
|
2636
|
+
return err.includes("ENOSPC") || err.toLowerCase().includes("no space left on device");
|
|
2637
|
+
};
|
|
2638
|
+
var isErrInsufficientResourcesErr = (err) => {
|
|
2639
|
+
return err.includes("net::ERR_INSUFFICIENT_RESOURCES");
|
|
2640
|
+
};
|
|
2641
|
+
var isBrowserCrashedError = (err) => {
|
|
2642
|
+
return err.includes("Target closed.") || err.includes("Session closed");
|
|
2643
|
+
};
|
|
2644
|
+
// src/estimate-price-from-bucket.ts
|
|
2645
|
+
var estimatePriceFromMetadata = ({
|
|
2646
|
+
renderMetadata,
|
|
2647
|
+
memorySizeInMb,
|
|
2648
|
+
diskSizeInMb,
|
|
2649
|
+
functionsInvoked,
|
|
2650
|
+
timings,
|
|
2651
|
+
region,
|
|
2652
|
+
providerSpecifics
|
|
2653
|
+
}) => {
|
|
2654
|
+
if (!renderMetadata) {
|
|
2655
|
+
return null;
|
|
2656
|
+
}
|
|
2657
|
+
const elapsedTime = Math.max(0, Date.now() - (renderMetadata?.startedDate ?? 0));
|
|
2658
|
+
const unfinished = Math.max(0, (renderMetadata?.totalChunks ?? 0) - timings.length);
|
|
2659
|
+
const timeElapsedOfUnfinished = new Array(unfinished).fill(true).map(() => elapsedTime).reduce((a, b) => a + b, 0);
|
|
2660
|
+
const estimatedBillingDurationInMilliseconds = calculateChunkTimes({
|
|
2661
|
+
type: "combined-time-for-cost-calculation",
|
|
2662
|
+
timings
|
|
2663
|
+
}) + timeElapsedOfUnfinished;
|
|
2664
|
+
const accruedSoFar = Number(providerSpecifics.estimatePrice({
|
|
2665
|
+
region,
|
|
2666
|
+
durationInMilliseconds: estimatedBillingDurationInMilliseconds,
|
|
2667
|
+
memorySizeInMb,
|
|
2668
|
+
diskSizeInMb,
|
|
2669
|
+
lambdasInvoked: functionsInvoked
|
|
2670
|
+
}).toPrecision(5));
|
|
2671
|
+
return { accruedSoFar, estimatedBillingDurationInMilliseconds };
|
|
2672
|
+
};
|
|
2673
|
+
// src/expected-out-name.ts
|
|
2674
|
+
var import_pure2 = __toESM(require_pure(), 1);
|
|
2675
|
+
|
|
2676
|
+
// src/get-custom-out-name.ts
|
|
2677
|
+
var getCustomOutName = ({
|
|
2678
|
+
renderMetadata,
|
|
2679
|
+
customCredentials
|
|
2680
|
+
}) => {
|
|
2681
|
+
if (!renderMetadata.outName) {
|
|
2682
|
+
return null;
|
|
2683
|
+
}
|
|
2684
|
+
if (typeof renderMetadata.outName === "string") {
|
|
2685
|
+
return renderMetadata.outName;
|
|
2686
|
+
}
|
|
2687
|
+
if (renderMetadata.outName.s3OutputProvider) {
|
|
2688
|
+
if (!customCredentials && renderMetadata.privacy === "private") {
|
|
2689
|
+
throw new TypeError(`The file was rendered with a custom S3 implementation and is not public, but no custom credentials were passed to downloadMedia().`);
|
|
2690
|
+
}
|
|
2691
|
+
return {
|
|
2692
|
+
bucketName: renderMetadata.outName.bucketName,
|
|
2693
|
+
key: renderMetadata.outName.key,
|
|
2694
|
+
s3OutputProvider: {
|
|
2695
|
+
endpoint: renderMetadata.outName.s3OutputProvider.endpoint,
|
|
2696
|
+
accessKeyId: customCredentials?.accessKeyId ?? null,
|
|
2697
|
+
secretAccessKey: customCredentials?.secretAccessKey ?? null,
|
|
2698
|
+
region: customCredentials?.region,
|
|
2699
|
+
forcePathStyle: customCredentials?.forcePathStyle ?? false
|
|
2700
|
+
}
|
|
2701
|
+
};
|
|
2702
|
+
}
|
|
2703
|
+
return {
|
|
2704
|
+
bucketName: renderMetadata.outName.bucketName,
|
|
2705
|
+
key: renderMetadata.outName.key
|
|
2706
|
+
};
|
|
2707
|
+
};
|
|
2708
|
+
|
|
2709
|
+
// src/validate-outname.ts
|
|
2710
|
+
var import_pure = __toESM(require_pure(), 1);
|
|
2711
|
+
|
|
2712
|
+
// src/validate-bucket-name.ts
|
|
2713
|
+
var validateBucketName = ({
|
|
2714
|
+
bucketName,
|
|
2715
|
+
bucketNamePrefix,
|
|
2716
|
+
options
|
|
2717
|
+
}) => {
|
|
2718
|
+
if (typeof bucketName !== "string") {
|
|
2719
|
+
throw new TypeError(`'bucketName' must be a string, but is ${JSON.stringify(bucketName)}`);
|
|
2720
|
+
}
|
|
2721
|
+
if (options.mustStartWithRemotion && !bucketName.startsWith(bucketNamePrefix)) {
|
|
2722
|
+
throw new Error(`The bucketName parameter must start with ${bucketNamePrefix}.`);
|
|
2723
|
+
}
|
|
2724
|
+
if (!bucketName.match(/^(?=^.{3,63}$)(?!^(\d+\.)+\d+$)(^(([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])$)/)) {
|
|
2725
|
+
throw new Error(`The bucket ${bucketName} `);
|
|
2726
|
+
}
|
|
2727
|
+
};
|
|
2728
|
+
|
|
2729
|
+
// src/validate-outname.ts
|
|
2730
|
+
var validateS3Key = (s3Key) => {
|
|
2731
|
+
if (typeof s3Key !== "string") {
|
|
2732
|
+
throw new TypeError("The S3 key must be a string. Passed an object of type " + typeof s3Key);
|
|
2733
|
+
}
|
|
2734
|
+
if (!s3Key.match(/^([0-9a-zA-Z-!_.*'()/:&$@=;+,?]+)/g)) {
|
|
2735
|
+
throw new Error("The S3 Key must match the RegExp `/^([0-9a-zA-Z-!_.*'()/:&$@=;+,?]+)/g`. You passed: " + s3Key + ". Check for invalid characters.");
|
|
2736
|
+
}
|
|
2737
|
+
};
|
|
2738
|
+
var validateOutname = ({
|
|
2739
|
+
outName: outName2,
|
|
2740
|
+
codec,
|
|
2741
|
+
audioCodecSetting,
|
|
2742
|
+
separateAudioTo,
|
|
2743
|
+
bucketNamePrefix
|
|
2744
|
+
}) => {
|
|
2745
|
+
if (typeof outName2 === "undefined" || outName2 === null) {
|
|
2746
|
+
return;
|
|
2747
|
+
}
|
|
2748
|
+
if (typeof outName2 !== "string") {
|
|
2749
|
+
validateS3Key(outName2.key);
|
|
2750
|
+
validateBucketName({
|
|
2751
|
+
bucketName: outName2.bucketName,
|
|
2752
|
+
bucketNamePrefix,
|
|
2753
|
+
options: {
|
|
2754
|
+
mustStartWithRemotion: false
|
|
2755
|
+
}
|
|
2756
|
+
});
|
|
2757
|
+
return;
|
|
2758
|
+
}
|
|
2759
|
+
if (codec) {
|
|
2760
|
+
import_pure.NoReactAPIs.validateOutputFilename({
|
|
2761
|
+
codec,
|
|
2762
|
+
audioCodecSetting,
|
|
2763
|
+
extension: import_pure.NoReactAPIs.getExtensionOfFilename(outName2),
|
|
2764
|
+
preferLossless: false,
|
|
2765
|
+
separateAudioTo
|
|
2766
|
+
});
|
|
2767
|
+
}
|
|
2768
|
+
validateS3Key(outName2);
|
|
2769
|
+
};
|
|
2770
|
+
|
|
2771
|
+
// src/expected-out-name.ts
|
|
2772
|
+
var getCredentialsFromOutName = (name) => {
|
|
2773
|
+
if (typeof name === "string") {
|
|
2774
|
+
return null;
|
|
2775
|
+
}
|
|
2776
|
+
if (name === null) {
|
|
2777
|
+
return null;
|
|
2778
|
+
}
|
|
2779
|
+
if (typeof name === "undefined") {
|
|
2780
|
+
return null;
|
|
2781
|
+
}
|
|
2782
|
+
return name.s3OutputProvider ?? null;
|
|
2783
|
+
};
|
|
2784
|
+
var getExpectedOutName = ({
|
|
2785
|
+
renderMetadata,
|
|
2786
|
+
bucketName,
|
|
2787
|
+
customCredentials,
|
|
2788
|
+
bucketNamePrefix
|
|
2789
|
+
}) => {
|
|
2790
|
+
const outNameValue = getCustomOutName({
|
|
2791
|
+
customCredentials,
|
|
2792
|
+
renderMetadata
|
|
2793
|
+
});
|
|
2794
|
+
if (outNameValue) {
|
|
2795
|
+
validateOutname({
|
|
2796
|
+
outName: outNameValue,
|
|
2797
|
+
codec: renderMetadata.codec,
|
|
2798
|
+
audioCodecSetting: renderMetadata.audioCodec,
|
|
2799
|
+
separateAudioTo: null,
|
|
2800
|
+
bucketNamePrefix
|
|
2801
|
+
});
|
|
2802
|
+
return customOutName(renderMetadata.renderId, bucketName, outNameValue);
|
|
2803
|
+
}
|
|
2804
|
+
if (renderMetadata.type === "still") {
|
|
2805
|
+
return {
|
|
2806
|
+
renderBucketName: bucketName,
|
|
2807
|
+
key: outStillName(renderMetadata.renderId, renderMetadata.imageFormat),
|
|
2808
|
+
customCredentials: null
|
|
2809
|
+
};
|
|
2810
|
+
}
|
|
2811
|
+
if (renderMetadata.type === "video") {
|
|
2812
|
+
return {
|
|
2813
|
+
renderBucketName: bucketName,
|
|
2814
|
+
key: outName(renderMetadata.renderId, import_pure2.NoReactAPIs.getFileExtensionFromCodec(renderMetadata.codec, renderMetadata.audioCodec)),
|
|
2815
|
+
customCredentials: null
|
|
2816
|
+
};
|
|
2817
|
+
}
|
|
2818
|
+
throw new TypeError("no type passed");
|
|
2819
|
+
};
|
|
2820
|
+
// src/format-costs-info.ts
|
|
2821
|
+
var display = (accrued) => {
|
|
2822
|
+
if (accrued < 0.001) {
|
|
2823
|
+
return "<$0.001";
|
|
2824
|
+
}
|
|
2825
|
+
return new Intl.NumberFormat("en-US", {
|
|
2826
|
+
currency: "USD",
|
|
2827
|
+
style: "currency",
|
|
2828
|
+
currencyDisplay: "narrowSymbol",
|
|
2829
|
+
minimumFractionDigits: 3
|
|
2830
|
+
}).format(accrued);
|
|
2831
|
+
};
|
|
2832
|
+
var formatCostsInfo = (accrued) => {
|
|
2833
|
+
return {
|
|
2834
|
+
accruedSoFar: accrued,
|
|
2835
|
+
displayCost: display(accrued),
|
|
2836
|
+
currency: "USD",
|
|
2837
|
+
disclaimer: "Estimated cost only. Does not include charges for other AWS services."
|
|
2838
|
+
};
|
|
2839
|
+
};
|
|
2840
|
+
// src/get-overall-progress-from-storage.ts
|
|
2841
|
+
var getOverallProgressFromStorage = async ({
|
|
2842
|
+
renderId,
|
|
2843
|
+
bucketName,
|
|
2844
|
+
expectedBucketOwner,
|
|
2845
|
+
region,
|
|
2846
|
+
providerSpecifics,
|
|
2847
|
+
forcePathStyle
|
|
2848
|
+
}) => {
|
|
2849
|
+
try {
|
|
2850
|
+
const Body = await providerSpecifics.readFile({
|
|
2851
|
+
bucketName,
|
|
2852
|
+
key: overallProgressKey(renderId),
|
|
2853
|
+
expectedBucketOwner,
|
|
2854
|
+
region,
|
|
2855
|
+
forcePathStyle
|
|
2856
|
+
});
|
|
2857
|
+
const str = await streamToString(Body);
|
|
2858
|
+
return JSON.parse(str);
|
|
2859
|
+
} catch (err) {
|
|
2860
|
+
if (err.name === "NotFound") {
|
|
2861
|
+
throw new TypeError(`No render with ID "${renderId}" found in bucket ${bucketName} and region ${region}`);
|
|
2862
|
+
}
|
|
2863
|
+
throw err;
|
|
2864
|
+
}
|
|
2865
|
+
};
|
|
2866
|
+
// src/inspect-error.ts
|
|
2867
|
+
var FAILED_TO_LAUNCH_TOKEN = "Failed to launch browser.";
|
|
2868
|
+
var getExplanation = (stack) => {
|
|
2869
|
+
if (stack.includes("FATAL:zygote_communication_linux.cc")) {
|
|
2870
|
+
return FAILED_TO_LAUNCH_TOKEN + " Will be retried - you can probably ignore this error.";
|
|
2871
|
+
}
|
|
2872
|
+
if (stack.includes("error while loading shared libraries: libnss3.so")) {
|
|
2873
|
+
return FAILED_TO_LAUNCH_TOKEN + " Will be retried - you can probably ignore this error.";
|
|
2874
|
+
}
|
|
2875
|
+
if (stack.includes("TooManyRequestsException")) {
|
|
2876
|
+
return `AWS returned an "TooManyRequestsException" error message which could mean you reached the concurrency limit of AWS Lambda. You can increase the limit - read this troubleshooting page: ${DOCS_URL}/docs/lambda/troubleshooting/rate-limit`;
|
|
2877
|
+
}
|
|
2878
|
+
if (errorIsOutOfSpaceError(stack)) {
|
|
2879
|
+
return `Your lambda function reached the storage limit. Reduce the amount of space needed per lambda function or increase the storage limit: ${DOCS_URL}/docs/lambda/disk-size.`;
|
|
2880
|
+
}
|
|
2881
|
+
if (isErrInsufficientResourcesErr(stack)) {
|
|
2882
|
+
return "The lambda ran out of memory. Deploy a new function with more memory.";
|
|
2883
|
+
}
|
|
2884
|
+
if (isBrowserCrashedError(stack)) {
|
|
2885
|
+
return "The browser crashed while rendering the video. Deploy a new function with memory to give the browser more resources.";
|
|
2886
|
+
}
|
|
2887
|
+
return null;
|
|
2888
|
+
};
|
|
2889
|
+
var inspectErrors = ({
|
|
2890
|
+
errors
|
|
2891
|
+
}) => {
|
|
2892
|
+
return errors.map((e) => {
|
|
2893
|
+
return {
|
|
2894
|
+
...e,
|
|
2895
|
+
explanation: getExplanation(e.stack),
|
|
2896
|
+
s3Location: ""
|
|
2897
|
+
};
|
|
2898
|
+
});
|
|
2899
|
+
};
|
|
2900
|
+
// src/most-expensive-chunks.ts
|
|
2901
|
+
var OVERHEAD_TIME_PER_LAMBDA = 100;
|
|
2902
|
+
var getMostExpensiveChunks = ({
|
|
2903
|
+
parsedTimings,
|
|
2904
|
+
framesPerFunction: framesPerLambda,
|
|
2905
|
+
firstFrame,
|
|
2906
|
+
lastFrame
|
|
2907
|
+
}) => {
|
|
2908
|
+
const mostExpensiveChunks = parsedTimings.slice(0).sort((a, b) => {
|
|
2909
|
+
const durA = a.rendered - a.start;
|
|
2910
|
+
const durB = b.rendered - b.start;
|
|
2911
|
+
return durB - durA;
|
|
2912
|
+
}).slice(0, 5);
|
|
2913
|
+
return mostExpensiveChunks.map((c) => {
|
|
2914
|
+
const isLastChunk = c.chunk === parsedTimings.length - 1;
|
|
2915
|
+
return {
|
|
2916
|
+
timeInMilliseconds: c.rendered - c.start,
|
|
2917
|
+
chunk: c.chunk,
|
|
2918
|
+
frameRange: [
|
|
2919
|
+
framesPerLambda * c.chunk + firstFrame,
|
|
2920
|
+
isLastChunk ? lastFrame : framesPerLambda * (c.chunk + 1) - 1 + firstFrame
|
|
2921
|
+
]
|
|
2922
|
+
};
|
|
2923
|
+
});
|
|
2924
|
+
};
|
|
2925
|
+
// src/progress.ts
|
|
2926
|
+
var import_pure4 = __toESM(require_pure(), 1);
|
|
2927
|
+
|
|
2928
|
+
// src/get-overall-progress.ts
|
|
2929
|
+
var weights = {
|
|
2930
|
+
evaluating: 0.1,
|
|
2931
|
+
encoding: 0.1,
|
|
2932
|
+
frames: 0.6,
|
|
2933
|
+
invoking: 0.1,
|
|
2934
|
+
combining: 0.1
|
|
2935
|
+
};
|
|
2936
|
+
var getOverallProgress = ({
|
|
2937
|
+
encoding,
|
|
2938
|
+
invoking,
|
|
2939
|
+
frames,
|
|
2940
|
+
invokedLambda,
|
|
2941
|
+
visitedServeUrl,
|
|
2942
|
+
gotComposition,
|
|
2943
|
+
combining
|
|
2944
|
+
}) => {
|
|
2945
|
+
const evaluationProgress = [
|
|
2946
|
+
Boolean(invokedLambda),
|
|
2947
|
+
Boolean(visitedServeUrl),
|
|
2948
|
+
Boolean(gotComposition)
|
|
2949
|
+
].reduce((a, b) => Number(a) + Number(b), 0) / 3;
|
|
2950
|
+
return evaluationProgress * weights.evaluating + encoding * weights.encoding + invoking * weights.invoking + frames * weights.frames + combining * weights.combining;
|
|
2951
|
+
};
|
|
2952
|
+
|
|
2953
|
+
// src/make-timeout-message.ts
|
|
2954
|
+
var MAX_MISSING_CHUNKS = 5;
|
|
2955
|
+
var makeChunkMissingMessage = ({
|
|
2956
|
+
missingChunks,
|
|
2957
|
+
renderMetadata,
|
|
2958
|
+
region,
|
|
2959
|
+
providerSpecifics,
|
|
2960
|
+
functionName
|
|
2961
|
+
}) => {
|
|
2962
|
+
if (missingChunks.length === 0) {
|
|
2963
|
+
return "All chunks have been successfully rendered, but the main function has timed out.";
|
|
2964
|
+
}
|
|
2965
|
+
return [
|
|
2966
|
+
`The following chunks are missing (showing ${Math.min(MAX_MISSING_CHUNKS, missingChunks.length)} out of ${missingChunks.length}):`,
|
|
2967
|
+
...missingChunks.map((ch) => {
|
|
2968
|
+
const isLastChunk = ch === renderMetadata.totalChunks - 1;
|
|
2969
|
+
const start = ch * renderMetadata.framesPerLambda;
|
|
2970
|
+
const end = renderMetadata.type === "still" ? 0 : isLastChunk ? renderMetadata.frameRange[1] : (ch + 1) * renderMetadata.framesPerLambda - 1;
|
|
2971
|
+
const msg = `Chunk ${ch} (Frames ${start} - ${end})`;
|
|
2972
|
+
return [
|
|
2973
|
+
msg,
|
|
2974
|
+
`▸ Logs for chunk ${ch}: ${providerSpecifics.getLoggingUrlForRendererFunction({
|
|
2975
|
+
functionName,
|
|
2976
|
+
region,
|
|
2977
|
+
rendererFunctionName: null,
|
|
2978
|
+
renderId: renderMetadata.renderId,
|
|
2979
|
+
chunk: ch
|
|
2980
|
+
})}`
|
|
2981
|
+
].join(`
|
|
2982
|
+
`);
|
|
2983
|
+
}).slice(0, 5)
|
|
2984
|
+
].join(`
|
|
2985
|
+
`);
|
|
2986
|
+
};
|
|
2987
|
+
var makeTimeoutMessage = ({
|
|
2988
|
+
timeoutInMilliseconds,
|
|
2989
|
+
missingChunks,
|
|
2990
|
+
renderMetadata,
|
|
2991
|
+
renderId,
|
|
2992
|
+
functionName,
|
|
2993
|
+
region,
|
|
2994
|
+
providerSpecifics
|
|
2995
|
+
}) => {
|
|
2996
|
+
const cloudWatchRendererUrl = providerSpecifics.getLoggingUrlForRendererFunction({
|
|
2997
|
+
renderId,
|
|
2998
|
+
functionName,
|
|
2999
|
+
region,
|
|
3000
|
+
rendererFunctionName: functionName,
|
|
3001
|
+
chunk: null
|
|
3002
|
+
});
|
|
3003
|
+
const cloudWatchLaunchUrl = providerSpecifics.getLoggingUrlForMethod({
|
|
3004
|
+
renderId,
|
|
3005
|
+
functionName,
|
|
3006
|
+
method: "launch" /* launch */,
|
|
3007
|
+
region,
|
|
3008
|
+
rendererFunctionName: functionName
|
|
3009
|
+
});
|
|
3010
|
+
const message = [
|
|
3011
|
+
`The main function timed out after ${timeoutInMilliseconds}ms.`,
|
|
3012
|
+
makeChunkMissingMessage({
|
|
3013
|
+
missingChunks,
|
|
3014
|
+
renderMetadata,
|
|
3015
|
+
region,
|
|
3016
|
+
providerSpecifics,
|
|
3017
|
+
functionName
|
|
3018
|
+
}),
|
|
3019
|
+
"",
|
|
3020
|
+
`Consider increasing the timeout of your function.`,
|
|
3021
|
+
`▸ You can use the "--timeout" parameter when deploying a function via CLI, or the "timeoutInSeconds" parameter when using the deployFunction() API.`,
|
|
3022
|
+
`${DOCS_URL}/docs/lambda/cli/functions#deploy`,
|
|
3023
|
+
"",
|
|
3024
|
+
"▸ Visit the logs for the main function:",
|
|
3025
|
+
cloudWatchLaunchUrl,
|
|
3026
|
+
"▸ Visit the logs for the renderer functions:",
|
|
3027
|
+
cloudWatchRendererUrl,
|
|
3028
|
+
"",
|
|
3029
|
+
"▸ Get help on debugging this error:",
|
|
3030
|
+
`${DOCS_URL}/docs/lambda/troubleshooting/debug`
|
|
3031
|
+
].join(`
|
|
3032
|
+
`);
|
|
3033
|
+
return message;
|
|
3034
|
+
};
|
|
3035
|
+
|
|
3036
|
+
// src/make-timeout-error.ts
|
|
3037
|
+
var makeTimeoutError = ({
|
|
3038
|
+
timeoutInMilliseconds,
|
|
3039
|
+
missingChunks,
|
|
3040
|
+
renderMetadata,
|
|
3041
|
+
renderId,
|
|
3042
|
+
functionName,
|
|
3043
|
+
region,
|
|
3044
|
+
providerSpecifics
|
|
3045
|
+
}) => {
|
|
3046
|
+
const message = makeTimeoutMessage({
|
|
3047
|
+
missingChunks,
|
|
3048
|
+
renderMetadata,
|
|
3049
|
+
timeoutInMilliseconds,
|
|
3050
|
+
renderId,
|
|
3051
|
+
functionName,
|
|
3052
|
+
region,
|
|
3053
|
+
providerSpecifics
|
|
3054
|
+
});
|
|
3055
|
+
const error = new Error(message);
|
|
3056
|
+
return {
|
|
3057
|
+
attempt: 1,
|
|
3058
|
+
chunk: null,
|
|
3059
|
+
explanation: null,
|
|
3060
|
+
frame: null,
|
|
3061
|
+
isFatal: true,
|
|
3062
|
+
s3Location: "",
|
|
3063
|
+
stack: error.stack,
|
|
3064
|
+
tmpDir: null,
|
|
3065
|
+
totalAttempts: 1,
|
|
3066
|
+
type: "stitcher",
|
|
3067
|
+
willRetry: false,
|
|
3068
|
+
message,
|
|
3069
|
+
name: "TimeoutError"
|
|
3070
|
+
};
|
|
3071
|
+
};
|
|
3072
|
+
|
|
3073
|
+
// src/render-has-audio-video.ts
|
|
3074
|
+
var import_pure3 = __toESM(require_pure(), 1);
|
|
3075
|
+
var lambdaRenderHasAudioVideo = (renderMetadata) => {
|
|
3076
|
+
if (renderMetadata.type === "still") {
|
|
3077
|
+
throw new Error("Cannot merge stills");
|
|
3078
|
+
}
|
|
3079
|
+
const support = import_pure3.NoReactAPIs.codecSupportsMedia(renderMetadata.codec);
|
|
3080
|
+
const hasVideo = renderMetadata ? !import_pure3.NoReactAPIs.isAudioCodec(renderMetadata.codec) : false;
|
|
3081
|
+
const hasAudio = renderMetadata ? !renderMetadata.muted && support.audio : false;
|
|
3082
|
+
return {
|
|
3083
|
+
hasAudio,
|
|
3084
|
+
hasVideo
|
|
3085
|
+
};
|
|
3086
|
+
};
|
|
3087
|
+
|
|
3088
|
+
// src/truthy.ts
|
|
3089
|
+
function truthy2(value) {
|
|
3090
|
+
return Boolean(value);
|
|
3091
|
+
}
|
|
3092
|
+
|
|
3093
|
+
// src/progress.ts
|
|
3094
|
+
var getProgress = async ({
|
|
3095
|
+
bucketName,
|
|
3096
|
+
renderId,
|
|
3097
|
+
expectedBucketOwner,
|
|
3098
|
+
region,
|
|
3099
|
+
memorySizeInMb,
|
|
3100
|
+
timeoutInMilliseconds,
|
|
3101
|
+
customCredentials,
|
|
3102
|
+
providerSpecifics,
|
|
3103
|
+
forcePathStyle,
|
|
3104
|
+
functionName
|
|
3105
|
+
}) => {
|
|
3106
|
+
const overallProgress = await getOverallProgressFromStorage({
|
|
3107
|
+
renderId,
|
|
3108
|
+
bucketName,
|
|
3109
|
+
expectedBucketOwner,
|
|
3110
|
+
region,
|
|
3111
|
+
providerSpecifics,
|
|
3112
|
+
forcePathStyle
|
|
3113
|
+
});
|
|
3114
|
+
if (overallProgress.postRenderData) {
|
|
3115
|
+
if (!overallProgress.renderMetadata) {
|
|
3116
|
+
throw new Error("No render metadata found even though render is finished");
|
|
3117
|
+
}
|
|
3118
|
+
if (overallProgress.renderMetadata.type === "still") {
|
|
3119
|
+
throw new Error("You don't need to call getRenderProgress() on a still render. Once you have obtained the `renderId`, the render is already done! \uD83D\uDE09");
|
|
3120
|
+
}
|
|
3121
|
+
const outData = getExpectedOutName({
|
|
3122
|
+
renderMetadata: overallProgress.renderMetadata,
|
|
3123
|
+
bucketName,
|
|
3124
|
+
customCredentials,
|
|
3125
|
+
bucketNamePrefix: providerSpecifics.getBucketPrefix()
|
|
3126
|
+
});
|
|
3127
|
+
const totalFrameCount = import_pure4.NoReactAPIs.getFramesToRender(overallProgress.renderMetadata.frameRange, overallProgress.renderMetadata.everyNthFrame).length;
|
|
3128
|
+
return {
|
|
3129
|
+
framesRendered: totalFrameCount,
|
|
3130
|
+
bucket: bucketName,
|
|
3131
|
+
renderSize: overallProgress.postRenderData.renderSize,
|
|
3132
|
+
chunks: overallProgress.renderMetadata.totalChunks,
|
|
3133
|
+
cleanup: {
|
|
3134
|
+
doneIn: overallProgress.postRenderData.timeToCleanUp,
|
|
3135
|
+
filesDeleted: overallProgress.postRenderData.filesCleanedUp,
|
|
3136
|
+
minFilesToDelete: overallProgress.postRenderData.filesCleanedUp
|
|
3137
|
+
},
|
|
3138
|
+
costs: {
|
|
3139
|
+
accruedSoFar: overallProgress.postRenderData.cost.estimatedCost,
|
|
3140
|
+
displayCost: overallProgress.postRenderData.cost.estimatedDisplayCost,
|
|
3141
|
+
currency: overallProgress.postRenderData.cost.currency,
|
|
3142
|
+
disclaimer: overallProgress.postRenderData.cost.disclaimer
|
|
3143
|
+
},
|
|
3144
|
+
currentTime: Date.now(),
|
|
3145
|
+
done: true,
|
|
3146
|
+
encodingStatus: {
|
|
3147
|
+
framesEncoded: totalFrameCount,
|
|
3148
|
+
combinedFrames: totalFrameCount,
|
|
3149
|
+
timeToCombine: overallProgress.postRenderData.timeToCombine
|
|
3150
|
+
},
|
|
3151
|
+
errors: overallProgress.postRenderData.errors,
|
|
3152
|
+
fatalErrorEncountered: false,
|
|
3153
|
+
lambdasInvoked: overallProgress.renderMetadata.totalChunks,
|
|
3154
|
+
outputFile: overallProgress.postRenderData.outputFile,
|
|
3155
|
+
renderId,
|
|
3156
|
+
timeToFinish: overallProgress.postRenderData.timeToFinish,
|
|
3157
|
+
timeToFinishChunks: overallProgress.postRenderData.timeToRenderChunks,
|
|
3158
|
+
timeToRenderFrames: overallProgress.postRenderData.timeToRenderFrames,
|
|
3159
|
+
overallProgress: 1,
|
|
3160
|
+
retriesInfo: overallProgress.postRenderData.retriesInfo,
|
|
3161
|
+
outKey: outData.key,
|
|
3162
|
+
outBucket: outData.renderBucketName,
|
|
3163
|
+
mostExpensiveFrameRanges: overallProgress.postRenderData.mostExpensiveFrameRanges ?? null,
|
|
3164
|
+
timeToEncode: overallProgress.postRenderData.timeToEncode,
|
|
3165
|
+
outputSizeInBytes: overallProgress.postRenderData.outputSize,
|
|
3166
|
+
type: "success",
|
|
3167
|
+
estimatedBillingDurationInMilliseconds: overallProgress.postRenderData.estimatedBillingDurationInMilliseconds,
|
|
3168
|
+
timeToCombine: overallProgress.postRenderData.timeToCombine,
|
|
3169
|
+
combinedFrames: totalFrameCount,
|
|
3170
|
+
renderMetadata: overallProgress.renderMetadata,
|
|
3171
|
+
timeoutTimestamp: overallProgress.timeoutTimestamp,
|
|
3172
|
+
compositionValidated: overallProgress.compositionValidated,
|
|
3173
|
+
functionLaunched: overallProgress.functionLaunched,
|
|
3174
|
+
serveUrlOpened: overallProgress.serveUrlOpened,
|
|
3175
|
+
artifacts: overallProgress.receivedArtifact
|
|
3176
|
+
};
|
|
3177
|
+
}
|
|
3178
|
+
const { renderMetadata } = overallProgress;
|
|
3179
|
+
const errorExplanations = inspectErrors({
|
|
3180
|
+
errors: overallProgress.errors
|
|
3181
|
+
});
|
|
3182
|
+
const { hasAudio, hasVideo } = renderMetadata ? lambdaRenderHasAudioVideo(renderMetadata) : { hasAudio: false, hasVideo: false };
|
|
3183
|
+
const chunkCount = overallProgress.chunks.length ?? 0;
|
|
3184
|
+
const cleanup = {
|
|
3185
|
+
doneIn: null,
|
|
3186
|
+
minFilesToDelete: 0,
|
|
3187
|
+
filesDeleted: 0
|
|
3188
|
+
};
|
|
3189
|
+
if (renderMetadata === null) {
|
|
3190
|
+
return {
|
|
3191
|
+
framesRendered: overallProgress.framesRendered ?? 0,
|
|
3192
|
+
chunks: chunkCount,
|
|
3193
|
+
done: false,
|
|
3194
|
+
encodingStatus: {
|
|
3195
|
+
framesEncoded: overallProgress.framesEncoded,
|
|
3196
|
+
combinedFrames: overallProgress.combinedFrames,
|
|
3197
|
+
timeToCombine: overallProgress.timeToCombine
|
|
3198
|
+
},
|
|
3199
|
+
timeToRenderFrames: overallProgress.timeToRenderFrames,
|
|
3200
|
+
costs: formatCostsInfo(0),
|
|
3201
|
+
renderId,
|
|
3202
|
+
renderMetadata,
|
|
3203
|
+
bucket: bucketName,
|
|
3204
|
+
outputFile: null,
|
|
3205
|
+
timeToFinish: null,
|
|
3206
|
+
errors: errorExplanations,
|
|
3207
|
+
fatalErrorEncountered: errorExplanations.some((f) => f.isFatal && !f.willRetry),
|
|
3208
|
+
currentTime: Date.now(),
|
|
3209
|
+
renderSize: 0,
|
|
3210
|
+
lambdasInvoked: overallProgress.lambdasInvoked ?? 0,
|
|
3211
|
+
cleanup,
|
|
3212
|
+
timeToFinishChunks: null,
|
|
3213
|
+
overallProgress: getOverallProgress({
|
|
3214
|
+
encoding: 0,
|
|
3215
|
+
invoking: 0,
|
|
3216
|
+
frames: 0,
|
|
3217
|
+
gotComposition: overallProgress.compositionValidated,
|
|
3218
|
+
visitedServeUrl: overallProgress.serveUrlOpened,
|
|
3219
|
+
invokedLambda: overallProgress.lambdasInvoked,
|
|
3220
|
+
combining: 0
|
|
3221
|
+
}),
|
|
3222
|
+
retriesInfo: overallProgress.retries ?? [],
|
|
3223
|
+
outKey: null,
|
|
3224
|
+
outBucket: null,
|
|
3225
|
+
mostExpensiveFrameRanges: null,
|
|
3226
|
+
timeToEncode: overallProgress.timeToEncode,
|
|
3227
|
+
outputSizeInBytes: null,
|
|
3228
|
+
estimatedBillingDurationInMilliseconds: null,
|
|
3229
|
+
combinedFrames: overallProgress.combinedFrames ?? 0,
|
|
3230
|
+
timeToCombine: overallProgress.timeToCombine ?? null,
|
|
3231
|
+
timeoutTimestamp: overallProgress.timeoutTimestamp,
|
|
3232
|
+
type: "success",
|
|
3233
|
+
compositionValidated: overallProgress.compositionValidated,
|
|
3234
|
+
functionLaunched: overallProgress.functionLaunched,
|
|
3235
|
+
serveUrlOpened: overallProgress.serveUrlOpened,
|
|
3236
|
+
artifacts: overallProgress.receivedArtifact
|
|
3237
|
+
};
|
|
3238
|
+
}
|
|
3239
|
+
const priceFromBucket = estimatePriceFromMetadata({
|
|
3240
|
+
renderMetadata,
|
|
3241
|
+
memorySizeInMb: providerSpecifics.parseFunctionName(renderMetadata.rendererFunctionName)?.memorySizeInMb ?? memorySizeInMb,
|
|
3242
|
+
functionsInvoked: renderMetadata.estimatedRenderLambdaInvokations ?? 0,
|
|
3243
|
+
diskSizeInMb: providerSpecifics.getEphemeralStorageForPriceCalculation(),
|
|
3244
|
+
timings: overallProgress.timings ?? [],
|
|
3245
|
+
region,
|
|
3246
|
+
providerSpecifics
|
|
3247
|
+
});
|
|
3248
|
+
const chunkMultiplier = [hasAudio, hasVideo].filter(truthy2).length;
|
|
3249
|
+
if (renderMetadata.type === "still") {
|
|
3250
|
+
throw new Error("You don't need to call getRenderProgress() on a still render. Once you have obtained the `renderId`, the render is already done! \uD83D\uDE09");
|
|
3251
|
+
}
|
|
3252
|
+
const allChunks = (overallProgress.chunks ?? []).length / chunkMultiplier === (renderMetadata.totalChunks ?? Infinity);
|
|
3253
|
+
const frameCount = import_pure4.NoReactAPIs.getFramesToRender(renderMetadata.frameRange, renderMetadata.everyNthFrame).length;
|
|
3254
|
+
const missingChunks = new Array(renderMetadata.totalChunks).fill(true).map((_, i) => i).filter((index) => {
|
|
3255
|
+
return typeof (overallProgress.chunks ?? []).find((c) => c === index) === "undefined";
|
|
3256
|
+
});
|
|
3257
|
+
const isBeyondTimeoutAndMissingChunks = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds + 20000 && missingChunks && missingChunks.length > 0;
|
|
3258
|
+
const isBeyondTimeoutAndHasStitchTimeout = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds * 2 + 20000;
|
|
3259
|
+
const allErrors = [
|
|
3260
|
+
isBeyondTimeoutAndMissingChunks || isBeyondTimeoutAndHasStitchTimeout ? makeTimeoutError({
|
|
3261
|
+
timeoutInMilliseconds,
|
|
3262
|
+
renderMetadata,
|
|
3263
|
+
renderId,
|
|
3264
|
+
missingChunks: missingChunks ?? [],
|
|
3265
|
+
region,
|
|
3266
|
+
functionName,
|
|
3267
|
+
providerSpecifics
|
|
3268
|
+
}) : null,
|
|
3269
|
+
...errorExplanations
|
|
3270
|
+
].filter(truthy2);
|
|
3271
|
+
return {
|
|
3272
|
+
framesRendered: overallProgress.framesRendered ?? 0,
|
|
3273
|
+
chunks: chunkCount,
|
|
3274
|
+
done: false,
|
|
3275
|
+
encodingStatus: {
|
|
3276
|
+
framesEncoded: overallProgress.framesEncoded,
|
|
3277
|
+
combinedFrames: overallProgress.combinedFrames,
|
|
3278
|
+
timeToCombine: overallProgress.timeToCombine
|
|
3279
|
+
},
|
|
3280
|
+
timeToRenderFrames: overallProgress.timeToRenderFrames,
|
|
3281
|
+
costs: priceFromBucket ? formatCostsInfo(priceFromBucket.accruedSoFar) : formatCostsInfo(0),
|
|
3282
|
+
renderId,
|
|
3283
|
+
renderMetadata,
|
|
3284
|
+
bucket: bucketName,
|
|
3285
|
+
outputFile: null,
|
|
3286
|
+
timeToFinish: null,
|
|
3287
|
+
errors: allErrors,
|
|
3288
|
+
fatalErrorEncountered: allErrors.some((f) => f.isFatal && !f.willRetry),
|
|
3289
|
+
currentTime: Date.now(),
|
|
3290
|
+
renderSize: 0,
|
|
3291
|
+
lambdasInvoked: overallProgress.lambdasInvoked ?? 0,
|
|
3292
|
+
cleanup,
|
|
3293
|
+
timeToFinishChunks: allChunks && overallProgress ? calculateChunkTimes({
|
|
3294
|
+
type: "absolute-time",
|
|
3295
|
+
timings: overallProgress.timings
|
|
3296
|
+
}) : null,
|
|
3297
|
+
overallProgress: getOverallProgress({
|
|
3298
|
+
encoding: frameCount ? (overallProgress.framesEncoded ?? 0) / frameCount : 0,
|
|
3299
|
+
invoking: (overallProgress.lambdasInvoked ?? 0) / renderMetadata.estimatedRenderLambdaInvokations,
|
|
3300
|
+
frames: (overallProgress.framesRendered ?? 0) / (frameCount ?? 1),
|
|
3301
|
+
gotComposition: overallProgress.compositionValidated,
|
|
3302
|
+
visitedServeUrl: overallProgress.serveUrlOpened,
|
|
3303
|
+
invokedLambda: overallProgress.lambdasInvoked,
|
|
3304
|
+
combining: overallProgress.combinedFrames / (frameCount ?? 1)
|
|
3305
|
+
}),
|
|
3306
|
+
retriesInfo: overallProgress.retries ?? [],
|
|
3307
|
+
outKey: null,
|
|
3308
|
+
outBucket: null,
|
|
3309
|
+
mostExpensiveFrameRanges: null,
|
|
3310
|
+
timeToEncode: overallProgress.timeToEncode,
|
|
3311
|
+
outputSizeInBytes: null,
|
|
3312
|
+
estimatedBillingDurationInMilliseconds: priceFromBucket ? priceFromBucket.estimatedBillingDurationInMilliseconds : null,
|
|
3313
|
+
combinedFrames: overallProgress.combinedFrames ?? 0,
|
|
3314
|
+
timeToCombine: overallProgress.timeToCombine ?? null,
|
|
3315
|
+
timeoutTimestamp: overallProgress.timeoutTimestamp,
|
|
3316
|
+
type: "success",
|
|
3317
|
+
compositionValidated: overallProgress.compositionValidated,
|
|
3318
|
+
functionLaunched: overallProgress.functionLaunched,
|
|
3319
|
+
serveUrlOpened: overallProgress.serveUrlOpened,
|
|
3320
|
+
artifacts: overallProgress.receivedArtifact
|
|
3321
|
+
};
|
|
3322
|
+
};
|
|
3323
|
+
// src/streaming/streaming.ts
|
|
3324
|
+
var import_streaming = __toESM(require_dist(), 1);
|
|
3325
|
+
var framesRendered = "frames-rendered";
|
|
3326
|
+
var errorOccurred = "error-occurred";
|
|
3327
|
+
var renderIdDetermined = "render-id-determined";
|
|
3328
|
+
var videoChunkRendered = "video-chunk-rendered";
|
|
3329
|
+
var audioChunkRendered = "audio-chunk-rendered";
|
|
3330
|
+
var chunkComplete = "chunk-complete";
|
|
3331
|
+
var stillRendered = "still-rendered";
|
|
3332
|
+
var functionInvoked = "lambda-invoked";
|
|
3333
|
+
var artifactEmitted = "artifact-emitted";
|
|
3334
|
+
var messageTypes = {
|
|
3335
|
+
"1": { type: framesRendered },
|
|
3336
|
+
"2": { type: errorOccurred },
|
|
3337
|
+
"3": { type: renderIdDetermined },
|
|
3338
|
+
"4": { type: videoChunkRendered },
|
|
3339
|
+
"5": { type: audioChunkRendered },
|
|
3340
|
+
"6": { type: stillRendered },
|
|
3341
|
+
"7": { type: chunkComplete },
|
|
3342
|
+
"8": { type: functionInvoked },
|
|
3343
|
+
"9": { type: artifactEmitted }
|
|
3344
|
+
};
|
|
3345
|
+
var formatMap = {
|
|
3346
|
+
[framesRendered]: "json",
|
|
3347
|
+
[errorOccurred]: "json",
|
|
3348
|
+
[renderIdDetermined]: "json",
|
|
3349
|
+
[videoChunkRendered]: "binary",
|
|
3350
|
+
[audioChunkRendered]: "binary",
|
|
3351
|
+
[stillRendered]: "json",
|
|
3352
|
+
[chunkComplete]: "json",
|
|
3353
|
+
[functionInvoked]: "json",
|
|
3354
|
+
[artifactEmitted]: "json"
|
|
3355
|
+
};
|
|
3356
|
+
var messageTypeIdToMessageType = (messageTypeId) => {
|
|
3357
|
+
const types = messageTypes[messageTypeId];
|
|
3358
|
+
if (!types) {
|
|
3359
|
+
throw new Error(`Unknown message type id ${messageTypeId}`);
|
|
3360
|
+
}
|
|
3361
|
+
return types.type;
|
|
3362
|
+
};
|
|
3363
|
+
var messageTypeToMessageId = (messageType) => {
|
|
3364
|
+
const id = Object.keys(messageTypes).find((key) => messageTypes[key].type === messageType);
|
|
3365
|
+
if (!id) {
|
|
3366
|
+
throw new Error(`Unknown message type ${messageType}`);
|
|
3367
|
+
}
|
|
3368
|
+
return id;
|
|
3369
|
+
};
|
|
3370
|
+
var makeStreamPayload = ({
|
|
3371
|
+
message
|
|
3372
|
+
}) => {
|
|
3373
|
+
const body = formatMap[message.type] === "json" ? new TextEncoder().encode(JSON.stringify(message.payload)) : message.payload;
|
|
3374
|
+
return import_streaming.makeStreamPayloadMessage({
|
|
3375
|
+
body,
|
|
3376
|
+
nonce: messageTypeToMessageId(message.type),
|
|
3377
|
+
status: 0
|
|
3378
|
+
});
|
|
3379
|
+
};
|
|
3380
|
+
// src/validate-privacy.ts
|
|
3381
|
+
function validatePrivacy(privacy, allowPrivate) {
|
|
3382
|
+
if (typeof privacy !== "string") {
|
|
3383
|
+
throw new TypeError("Privacy must be a string");
|
|
3384
|
+
}
|
|
3385
|
+
if (!allowPrivate && privacy === "private") {
|
|
3386
|
+
throw new TypeError('Privacy must be either "public" or "no-acl"');
|
|
3387
|
+
}
|
|
3388
|
+
if (privacy !== "private" && privacy !== "public" && privacy !== "no-acl") {
|
|
3389
|
+
throw new TypeError('Privacy must be either "private", "public" or "no-acl"');
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
// src/index.ts
|
|
3393
|
+
var {
|
|
3394
|
+
ENABLE_V5_BREAKING_CHANGES: ENABLE_V5_BREAKING_CHANGES2,
|
|
3395
|
+
serializeJSONWithDate: serializeJSONWithDate2,
|
|
3396
|
+
validateFps: validateFps2,
|
|
3397
|
+
validateDimension: validateDimension2,
|
|
3398
|
+
validateDurationInFrames: validateDurationInFrames2
|
|
3399
|
+
} = NoReactInternals;
|
|
3400
|
+
var export_wrapWithErrorHandling = import_error_handling.wrapWithErrorHandling;
|
|
3401
|
+
var export_makeStreamer = import_streaming2.makeStreamer;
|
|
3402
|
+
var export_makeStreamPayloadMessage = import_streaming2.makeStreamPayloadMessage;
|
|
3403
|
+
|
|
3404
|
+
export {
|
|
3405
|
+
export_wrapWithErrorHandling as wrapWithErrorHandling,
|
|
3406
|
+
validateWebhook,
|
|
3407
|
+
validatePrivacy,
|
|
3408
|
+
validateOutname,
|
|
3409
|
+
validateFramesPerFunction,
|
|
3410
|
+
validateFps2 as validateFps,
|
|
3411
|
+
validateDurationInFrames2 as validateDurationInFrames,
|
|
3412
|
+
validateDownloadBehavior,
|
|
3413
|
+
validateDimension2 as validateDimension,
|
|
3414
|
+
validateBucketName,
|
|
3415
|
+
truthy2 as truthy,
|
|
3416
|
+
streamToString,
|
|
3417
|
+
serverlessCodecs,
|
|
3418
|
+
serializeOrThrow,
|
|
3419
|
+
serializeJSONWithDate2 as serializeJSONWithDate,
|
|
3420
|
+
serializeArtifact,
|
|
3421
|
+
resolvedPropsKey,
|
|
3422
|
+
rendersPrefix,
|
|
3423
|
+
random,
|
|
3424
|
+
overallProgressKey,
|
|
3425
|
+
outStillName,
|
|
3426
|
+
outName,
|
|
3427
|
+
messageTypeIdToMessageType,
|
|
3428
|
+
export_makeStreamer as makeStreamer,
|
|
3429
|
+
export_makeStreamPayloadMessage as makeStreamPayloadMessage,
|
|
3430
|
+
makeStreamPayload,
|
|
3431
|
+
makeBucketName,
|
|
3432
|
+
isErrInsufficientResourcesErr,
|
|
3433
|
+
isBrowserCrashedError,
|
|
3434
|
+
interpolate,
|
|
3435
|
+
internalGetOrCreateBucket,
|
|
3436
|
+
inspectErrors,
|
|
3437
|
+
inputPropsKey,
|
|
3438
|
+
getProgress,
|
|
3439
|
+
getOverallProgressFromStorage,
|
|
3440
|
+
getNeedsToUpload,
|
|
3441
|
+
getMostExpensiveChunks,
|
|
3442
|
+
getExpectedOutName,
|
|
3443
|
+
getCredentialsFromOutName,
|
|
3444
|
+
formatMap,
|
|
3445
|
+
formatCostsInfo,
|
|
3446
|
+
expiryDays,
|
|
3447
|
+
estimatePriceFromMetadata,
|
|
3448
|
+
errorIsOutOfSpaceError,
|
|
3449
|
+
deserializeArtifact,
|
|
3450
|
+
decompressInputProps,
|
|
3451
|
+
customOutName,
|
|
3452
|
+
compressInputProps,
|
|
3453
|
+
calculateChunkTimes,
|
|
3454
|
+
artifactName,
|
|
3455
|
+
VERSION,
|
|
3456
|
+
ServerlessRoutines,
|
|
3457
|
+
RENDERER_PATH_TOKEN,
|
|
3458
|
+
REMOTION_FILELIST_TOKEN,
|
|
3459
|
+
REMOTION_CONCATENATED_TOKEN,
|
|
3460
|
+
OVERHEAD_TIME_PER_LAMBDA,
|
|
3461
|
+
MINIMUM_FRAMES_PER_FUNCTIONS,
|
|
3462
|
+
MAX_FUNCTIONS_PER_RENDER,
|
|
3463
|
+
ENABLE_V5_BREAKING_CHANGES2 as ENABLE_V5_BREAKING_CHANGES,
|
|
3464
|
+
DOCS_URL,
|
|
3465
|
+
CONCAT_FOLDER_TOKEN,
|
|
3466
|
+
COMMAND_NOT_FOUND
|
|
3467
|
+
};
|