@remotion/renderer 4.0.209 → 4.0.211

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.
@@ -6,9 +6,9 @@ const to_megabytes_1 = require("../to-megabytes");
6
6
  const defaultBrowserDownloadProgress = ({ indent, logLevel, api, }) => () => {
7
7
  logger_1.Log.info({ indent, logLevel }, 'Downloading Chrome Headless Shell https://www.remotion.dev/docs/miscellaneous/chrome-headless-shell');
8
8
  logger_1.Log.info({ indent, logLevel }, `Customize this behavior by adding a onBrowserDownload function to ${api}.`);
9
+ let lastProgress = 0;
9
10
  return {
10
11
  onProgress: (progress) => {
11
- let lastProgress = 0;
12
12
  if (progress.downloadedBytes > lastProgress + 10000000) {
13
13
  lastProgress = progress.downloadedBytes;
14
14
  logger_1.Log.info({ indent, logLevel }, `Downloading Chrome Headless Shell - ${(0, to_megabytes_1.toMegabytes)(progress.downloadedBytes)}/${(0, to_megabytes_1.toMegabytes)(progress.totalSizeInBytes)}`);
@@ -30,4 +30,5 @@ export declare const exampleVideos: {
30
30
  matroskaH265Aac: string;
31
31
  opusWebm: string;
32
32
  avi: string;
33
+ opus51Webm: string;
33
34
  };
@@ -39,4 +39,5 @@ exports.exampleVideos = {
39
39
  matroskaH265Aac: node_path_1.default.join(examplePackage, 'public', 'matroska-h265-aac.mkv'),
40
40
  opusWebm: node_path_1.default.join(examplePackage, 'public', 'opus.webm'),
41
41
  avi: node_path_1.default.join(examplePackage, 'public', 'example.avi'),
42
+ opus51Webm: node_path_1.default.join(examplePackage, 'public', 'vp8-opus-5-1-channels.webm'),
42
43
  };
package/dist/index.d.ts CHANGED
@@ -990,6 +990,7 @@ export declare const RenderInternals: {
990
990
  matroskaH265Aac: string;
991
991
  opusWebm: string;
992
992
  avi: string;
993
+ opus51Webm: string;
993
994
  };
994
995
  printUsefulErrorMessage: (err: Error, logLevel: "verbose" | "info" | "warn" | "error", indent: boolean) => void;
995
996
  };
@@ -3104,6 +3104,7 @@ var downloadBrowser = async ({
3104
3104
  indent,
3105
3105
  logLevel
3106
3106
  });
3107
+ Log.info({ indent, logLevel });
3107
3108
  await import_extract_zip.default(archivePath, { dir: outputPath });
3108
3109
  const chromePath = path3.join(outputPath, "chrome-linux", "chrome");
3109
3110
  const chromeHeadlessShellPath = path3.join(outputPath, "chrome-linux", "chrome-headless-shell");
@@ -3159,6 +3160,7 @@ var defaultBrowserDownloadProgress = ({
3159
3160
  logLevel,
3160
3161
  api
3161
3162
  }) => () => {
3163
+ Log.info({ indent, logLevel }, "No local browser could be found.");
3162
3164
  Log.info({ indent, logLevel }, "Downloading Chrome Headless Shell https://www.remotion.dev/docs/miscellaneous/chrome-headless-shell");
3163
3165
  Log.info({ indent, logLevel }, `Customize this behavior by adding a onBrowserDownload function to ${api}.`);
3164
3166
  return {
@@ -3175,8 +3177,698 @@ var defaultBrowserDownloadProgress = ({
3175
3177
 
3176
3178
  // src/get-local-browser.ts
3177
3179
  import fs4 from "fs";
3180
+ import {homedir} from "node:os";
3181
+
3182
+ // /Users/jonathanburger/remotion/packages/renderer/node_modules/remotion/dist/esm/no-react.mjs
3183
+ var interpolate = function(input, inputRange, outputRange, options) {
3184
+ if (typeof input === "undefined") {
3185
+ throw new Error("input can not be undefined");
3186
+ }
3187
+ if (typeof inputRange === "undefined") {
3188
+ throw new Error("inputRange can not be undefined");
3189
+ }
3190
+ if (typeof outputRange === "undefined") {
3191
+ throw new Error("outputRange can not be undefined");
3192
+ }
3193
+ if (inputRange.length !== outputRange.length) {
3194
+ throw new Error("inputRange (" + inputRange.length + ") and outputRange (" + outputRange.length + ") must have the same length");
3195
+ }
3196
+ checkInfiniteRange("inputRange", inputRange);
3197
+ checkInfiniteRange("outputRange", outputRange);
3198
+ checkValidInputRange(inputRange);
3199
+ const easing = options?.easing ?? ((num) => num);
3200
+ let extrapolateLeft = "extend";
3201
+ if (options?.extrapolateLeft !== undefined) {
3202
+ extrapolateLeft = options.extrapolateLeft;
3203
+ }
3204
+ let extrapolateRight = "extend";
3205
+ if (options?.extrapolateRight !== undefined) {
3206
+ extrapolateRight = options.extrapolateRight;
3207
+ }
3208
+ if (typeof input !== "number") {
3209
+ throw new TypeError("Cannot interpolate an input which is not a number");
3210
+ }
3211
+ const range = findRange(input, inputRange);
3212
+ return interpolateFunction(input, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
3213
+ easing,
3214
+ extrapolateLeft,
3215
+ extrapolateRight
3216
+ });
3217
+ };
3218
+ var truthy4 = function(value) {
3219
+ return Boolean(value);
3220
+ };
3221
+ var processColor = function(color) {
3222
+ const normalizedColor = normalizeColor(color);
3223
+ return (normalizedColor << 24 | normalizedColor >>> 8) >>> 0;
3224
+ };
3225
+ var validateDimension = function(amount, nameOfProp, location) {
3226
+ if (typeof amount !== "number") {
3227
+ throw new Error(`The "${nameOfProp}" prop ${location} must be a number, but you passed a value of type ${typeof amount}`);
3228
+ }
3229
+ if (isNaN(amount)) {
3230
+ throw new TypeError(`The "${nameOfProp}" prop ${location} must not be NaN, but is NaN.`);
3231
+ }
3232
+ if (!Number.isFinite(amount)) {
3233
+ throw new TypeError(`The "${nameOfProp}" prop ${location} must be finite, but is ${amount}.`);
3234
+ }
3235
+ if (amount % 1 !== 0) {
3236
+ throw new TypeError(`The "${nameOfProp}" prop ${location} must be an integer, but is ${amount}.`);
3237
+ }
3238
+ if (amount <= 0) {
3239
+ throw new TypeError(`The "${nameOfProp}" prop ${location} must be positive, but got ${amount}.`);
3240
+ }
3241
+ };
3242
+ var validateDurationInFrames = function(durationInFrames, options) {
3243
+ const { allowFloats, component } = options;
3244
+ if (typeof durationInFrames === "undefined") {
3245
+ throw new Error(`The "durationInFrames" prop ${component} is missing.`);
3246
+ }
3247
+ if (typeof durationInFrames !== "number") {
3248
+ throw new Error(`The "durationInFrames" prop ${component} must be a number, but you passed a value of type ${typeof durationInFrames}`);
3249
+ }
3250
+ if (durationInFrames <= 0) {
3251
+ throw new TypeError(`The "durationInFrames" prop ${component} must be positive, but got ${durationInFrames}.`);
3252
+ }
3253
+ if (!allowFloats && durationInFrames % 1 !== 0) {
3254
+ throw new TypeError(`The "durationInFrames" prop ${component} must be an integer, but got ${durationInFrames}.`);
3255
+ }
3256
+ if (!Number.isFinite(durationInFrames)) {
3257
+ throw new TypeError(`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`);
3258
+ }
3259
+ };
3260
+ var validateFps = function(fps, location, isGif) {
3261
+ if (typeof fps !== "number") {
3262
+ throw new Error(`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`);
3263
+ }
3264
+ if (!Number.isFinite(fps)) {
3265
+ throw new Error(`"fps" must be a finite, but you passed ${fps} ${location}`);
3266
+ }
3267
+ if (isNaN(fps)) {
3268
+ throw new Error(`"fps" must not be NaN, but got ${fps} ${location}`);
3269
+ }
3270
+ if (fps <= 0) {
3271
+ throw new TypeError(`"fps" must be positive, but got ${fps} ${location}`);
3272
+ }
3273
+ if (isGif && fps > 50) {
3274
+ 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`);
3275
+ }
3276
+ };
3277
+ var interpolateFunction = function(input, inputRange, outputRange, options) {
3278
+ const { extrapolateLeft, extrapolateRight, easing } = options;
3279
+ let result = input;
3280
+ const [inputMin, inputMax] = inputRange;
3281
+ const [outputMin, outputMax] = outputRange;
3282
+ if (result < inputMin) {
3283
+ if (extrapolateLeft === "identity") {
3284
+ return result;
3285
+ }
3286
+ if (extrapolateLeft === "clamp") {
3287
+ result = inputMin;
3288
+ } else if (extrapolateLeft === "wrap") {
3289
+ const range = inputMax - inputMin;
3290
+ result = ((result - inputMin) % range + range) % range + inputMin;
3291
+ } else if (extrapolateLeft === "extend") {
3292
+ }
3293
+ }
3294
+ if (result > inputMax) {
3295
+ if (extrapolateRight === "identity") {
3296
+ return result;
3297
+ }
3298
+ if (extrapolateRight === "clamp") {
3299
+ result = inputMax;
3300
+ } else if (extrapolateRight === "wrap") {
3301
+ const range = inputMax - inputMin;
3302
+ result = ((result - inputMin) % range + range) % range + inputMin;
3303
+ } else if (extrapolateRight === "extend") {
3304
+ }
3305
+ }
3306
+ if (outputMin === outputMax) {
3307
+ return outputMin;
3308
+ }
3309
+ result = (result - inputMin) / (inputMax - inputMin);
3310
+ result = easing(result);
3311
+ result = result * (outputMax - outputMin) + outputMin;
3312
+ return result;
3313
+ };
3314
+ var findRange = function(input, inputRange) {
3315
+ let i;
3316
+ for (i = 1;i < inputRange.length - 1; ++i) {
3317
+ if (inputRange[i] >= input) {
3318
+ break;
3319
+ }
3320
+ }
3321
+ return i - 1;
3322
+ };
3323
+ var checkValidInputRange = function(arr) {
3324
+ for (let i = 1;i < arr.length; ++i) {
3325
+ if (!(arr[i] > arr[i - 1])) {
3326
+ throw new Error(`inputRange must be strictly monotonically increasing but got [${arr.join(",")}]`);
3327
+ }
3328
+ }
3329
+ };
3330
+ var checkInfiniteRange = function(name, arr) {
3331
+ if (arr.length < 2) {
3332
+ throw new Error(name + " must have at least 2 elements");
3333
+ }
3334
+ for (const element of arr) {
3335
+ if (typeof element !== "number") {
3336
+ throw new Error(`${name} must contain only numbers`);
3337
+ }
3338
+ if (!Number.isFinite(element)) {
3339
+ throw new Error(`${name} must contain only finite numbers, but got [${arr.join(",")}]`);
3340
+ }
3341
+ }
3342
+ };
3343
+ if (typeof window !== "undefined") {
3344
+ window.remotion_renderReady = false;
3345
+ }
3346
+ if (typeof window !== "undefined") {
3347
+ window.remotion_delayRenderTimeouts = {};
3348
+ }
3349
+ var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
3350
+ var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
3351
+ var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
3352
+ var problematicCharacters = {
3353
+ "%3A": ":",
3354
+ "%2F": "/",
3355
+ "%3F": "?",
3356
+ "%23": "#",
3357
+ "%5B": "[",
3358
+ "%5D": "]",
3359
+ "%40": "@",
3360
+ "%21": "!",
3361
+ "%24": "$",
3362
+ "%26": "&",
3363
+ "%27": "'",
3364
+ "%28": "(",
3365
+ "%29": ")",
3366
+ "%2A": "*",
3367
+ "%2B": "+",
3368
+ "%2C": ",",
3369
+ "%3B": ";"
3370
+ };
3371
+ var didWarn = {};
3372
+ var warnOnce = (message) => {
3373
+ if (didWarn[message]) {
3374
+ return;
3375
+ }
3376
+ console.warn(message);
3377
+ didWarn[message] = true;
3378
+ };
3379
+ var includesHexOfUnsafeChar = (path4) => {
3380
+ for (const key of Object.keys(problematicCharacters)) {
3381
+ if (path4.includes(key)) {
3382
+ return { containsHex: true, hexCode: key };
3383
+ }
3384
+ }
3385
+ return { containsHex: false };
3386
+ };
3387
+ var trimLeadingSlash = (path4) => {
3388
+ if (path4.startsWith("/")) {
3389
+ return trimLeadingSlash(path4.substring(1));
3390
+ }
3391
+ return path4;
3392
+ };
3393
+ var inner = (path4) => {
3394
+ if (typeof window !== "undefined" && window.remotion_staticBase) {
3395
+ if (path4.startsWith(window.remotion_staticBase)) {
3396
+ throw new Error(`The value "${path4}" is already prefixed with the static base ${window.remotion_staticBase}. You don't need to call staticFile() on it.`);
3397
+ }
3398
+ return `${window.remotion_staticBase}/${trimLeadingSlash(path4)}`;
3399
+ }
3400
+ return `/${trimLeadingSlash(path4)}`;
3401
+ };
3402
+ var encodeBySplitting = (path4) => {
3403
+ const splitBySlash = path4.split("/");
3404
+ const encodedArray = splitBySlash.map((element) => {
3405
+ return encodeURIComponent(element);
3406
+ });
3407
+ const merged = encodedArray.join("/");
3408
+ return merged;
3409
+ };
3410
+ var staticFile = (path4) => {
3411
+ if (path4.startsWith("http://") || path4.startsWith("https://")) {
3412
+ throw new TypeError(`staticFile() does not support remote URLs - got "${path4}". Instead, pass the URL without wrapping it in staticFile(). See: https://remotion.dev/docs/staticfile-remote-urls`);
3413
+ }
3414
+ if (path4.startsWith("..") || path4.startsWith("./")) {
3415
+ throw new TypeError(`staticFile() does not support relative paths - got "${path4}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);
3416
+ }
3417
+ if (path4.startsWith("/Users") || path4.startsWith("/home") || path4.startsWith("/tmp") || path4.startsWith("/etc") || path4.startsWith("/opt") || path4.startsWith("/var") || path4.startsWith("C:") || path4.startsWith("D:") || path4.startsWith("E:")) {
3418
+ throw new TypeError(`staticFile() does not support absolute paths - got "${path4}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);
3419
+ }
3420
+ if (path4.startsWith("public/")) {
3421
+ throw new TypeError(`Do not include the public/ prefix when using staticFile() - got "${path4}". See: https://remotion.dev/docs/staticfile-relative-paths`);
3422
+ }
3423
+ const includesHex = includesHexOfUnsafeChar(path4);
3424
+ if (includesHex.containsHex) {
3425
+ warnOnce(`WARNING: You seem to pass an already encoded path (path contains ${includesHex.hexCode}). Since Remotion 4.0, the encoding is done by staticFile() itself. You may want to remove a encodeURIComponent() wrapping.`);
3426
+ }
3427
+ const preprocessed = encodeBySplitting(path4);
3428
+ const preparsed = inner(preprocessed);
3429
+ if (!preparsed.startsWith("/")) {
3430
+ return `/${preparsed}`;
3431
+ }
3432
+ return preparsed;
3433
+ };
3434
+ var DATE_TOKEN = "remotion-date:";
3435
+ var FILE_TOKEN = "remotion-file:";
3436
+ var serializeJSONWithDate = ({
3437
+ data,
3438
+ indent,
3439
+ staticBase
3440
+ }) => {
3441
+ let customDateUsed = false;
3442
+ let customFileUsed = false;
3443
+ let mapUsed = false;
3444
+ let setUsed = false;
3445
+ try {
3446
+ const serializedString = JSON.stringify(data, function(key, value) {
3447
+ const item = this[key];
3448
+ if (item instanceof Date) {
3449
+ customDateUsed = true;
3450
+ return `${DATE_TOKEN}${item.toISOString()}`;
3451
+ }
3452
+ if (item instanceof Map) {
3453
+ mapUsed = true;
3454
+ return value;
3455
+ }
3456
+ if (item instanceof Set) {
3457
+ setUsed = true;
3458
+ return value;
3459
+ }
3460
+ if (typeof item === "string" && staticBase !== null && item.startsWith(staticBase)) {
3461
+ customFileUsed = true;
3462
+ return `${FILE_TOKEN}${item.replace(staticBase + "/", "")}`;
3463
+ }
3464
+ return value;
3465
+ }, indent);
3466
+ return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
3467
+ } catch (err) {
3468
+ throw new Error("Could not serialize the passed input props to JSON: " + err.message);
3469
+ }
3470
+ };
3471
+ var deserializeJSONWithCustomFields = (data) => {
3472
+ return JSON.parse(data, (_, value) => {
3473
+ if (typeof value === "string" && value.startsWith(DATE_TOKEN)) {
3474
+ return new Date(value.replace(DATE_TOKEN, ""));
3475
+ }
3476
+ if (typeof value === "string" && value.startsWith(FILE_TOKEN)) {
3477
+ return staticFile(value.replace(FILE_TOKEN, ""));
3478
+ }
3479
+ return value;
3480
+ });
3481
+ };
3482
+ var call = function(...args) {
3483
+ return "\\(\\s*(" + args.join(")\\s*,\\s*(") + ")\\s*\\)";
3484
+ };
3485
+ var getMatchers = function() {
3486
+ const cachedMatchers = {
3487
+ rgb: undefined,
3488
+ rgba: undefined,
3489
+ hsl: undefined,
3490
+ hsla: undefined,
3491
+ hex3: undefined,
3492
+ hex4: undefined,
3493
+ hex5: undefined,
3494
+ hex6: undefined,
3495
+ hex8: undefined
3496
+ };
3497
+ if (cachedMatchers.rgb === undefined) {
3498
+ cachedMatchers.rgb = new RegExp("rgb" + call(NUMBER, NUMBER, NUMBER));
3499
+ cachedMatchers.rgba = new RegExp("rgba" + call(NUMBER, NUMBER, NUMBER, NUMBER));
3500
+ cachedMatchers.hsl = new RegExp("hsl" + call(NUMBER, PERCENTAGE, PERCENTAGE));
3501
+ cachedMatchers.hsla = new RegExp("hsla" + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
3502
+ cachedMatchers.hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
3503
+ cachedMatchers.hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
3504
+ cachedMatchers.hex6 = /^#([0-9a-fA-F]{6})$/;
3505
+ cachedMatchers.hex8 = /^#([0-9a-fA-F]{8})$/;
3506
+ }
3507
+ return cachedMatchers;
3508
+ };
3509
+ var hue2rgb = function(p, q, t) {
3510
+ if (t < 0) {
3511
+ t += 1;
3512
+ }
3513
+ if (t > 1) {
3514
+ t -= 1;
3515
+ }
3516
+ if (t < 1 / 6) {
3517
+ return p + (q - p) * 6 * t;
3518
+ }
3519
+ if (t < 1 / 2) {
3520
+ return q;
3521
+ }
3522
+ if (t < 2 / 3) {
3523
+ return p + (q - p) * (2 / 3 - t) * 6;
3524
+ }
3525
+ return p;
3526
+ };
3527
+ var hslToRgb = function(h, s, l) {
3528
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
3529
+ const p = 2 * l - q;
3530
+ const r = hue2rgb(p, q, h + 1 / 3);
3531
+ const g = hue2rgb(p, q, h);
3532
+ const b = hue2rgb(p, q, h - 1 / 3);
3533
+ return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
3534
+ };
3535
+ var parse255 = function(str) {
3536
+ const int = Number.parseInt(str, 10);
3537
+ if (int < 0) {
3538
+ return 0;
3539
+ }
3540
+ if (int > 255) {
3541
+ return 255;
3542
+ }
3543
+ return int;
3544
+ };
3545
+ var parse360 = function(str) {
3546
+ const int = Number.parseFloat(str);
3547
+ return (int % 360 + 360) % 360 / 360;
3548
+ };
3549
+ var parse1 = function(str) {
3550
+ const num = Number.parseFloat(str);
3551
+ if (num < 0) {
3552
+ return 0;
3553
+ }
3554
+ if (num > 1) {
3555
+ return 255;
3556
+ }
3557
+ return Math.round(num * 255);
3558
+ };
3559
+ var parsePercentage = function(str) {
3560
+ const int = Number.parseFloat(str);
3561
+ if (int < 0) {
3562
+ return 0;
3563
+ }
3564
+ if (int > 100) {
3565
+ return 1;
3566
+ }
3567
+ return int / 100;
3568
+ };
3569
+ var normalizeColor = function(color) {
3570
+ const matchers = getMatchers();
3571
+ let match;
3572
+ if (matchers.hex6) {
3573
+ if (match = matchers.hex6.exec(color)) {
3574
+ return Number.parseInt(match[1] + "ff", 16) >>> 0;
3575
+ }
3576
+ }
3577
+ if (colorNames[color] !== undefined) {
3578
+ return colorNames[color];
3579
+ }
3580
+ if (matchers.rgb) {
3581
+ if (match = matchers.rgb.exec(color)) {
3582
+ return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | 255) >>> 0;
3583
+ }
3584
+ }
3585
+ if (matchers.rgba) {
3586
+ if (match = matchers.rgba.exec(color)) {
3587
+ return (parse255(match[1]) << 24 | parse255(match[2]) << 16 | parse255(match[3]) << 8 | parse1(match[4])) >>> 0;
3588
+ }
3589
+ }
3590
+ if (matchers.hex3) {
3591
+ if (match = matchers.hex3.exec(color)) {
3592
+ return Number.parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + "ff", 16) >>> 0;
3593
+ }
3594
+ }
3595
+ if (matchers.hex8) {
3596
+ if (match = matchers.hex8.exec(color)) {
3597
+ return Number.parseInt(match[1], 16) >>> 0;
3598
+ }
3599
+ }
3600
+ if (matchers.hex4) {
3601
+ if (match = matchers.hex4.exec(color)) {
3602
+ return Number.parseInt(match[1] + match[1] + match[2] + match[2] + match[3] + match[3] + match[4] + match[4], 16) >>> 0;
3603
+ }
3604
+ }
3605
+ if (matchers.hsl) {
3606
+ if (match = matchers.hsl.exec(color)) {
3607
+ return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | 255) >>> 0;
3608
+ }
3609
+ }
3610
+ if (matchers.hsla) {
3611
+ if (match = matchers.hsla.exec(color)) {
3612
+ return (hslToRgb(parse360(match[1]), parsePercentage(match[2]), parsePercentage(match[3])) | parse1(match[4])) >>> 0;
3613
+ }
3614
+ }
3615
+ throw new Error(`invalid color string ${color} provided`);
3616
+ };
3617
+ var NUMBER = "[-+]?\\d*\\.?\\d+";
3618
+ var PERCENTAGE = NUMBER + "%";
3619
+ var colorNames = {
3620
+ transparent: 0,
3621
+ aliceblue: 4042850303,
3622
+ antiquewhite: 4209760255,
3623
+ aqua: 16777215,
3624
+ aquamarine: 2147472639,
3625
+ azure: 4043309055,
3626
+ beige: 4126530815,
3627
+ bisque: 4293182719,
3628
+ black: 255,
3629
+ blanchedalmond: 4293643775,
3630
+ blue: 65535,
3631
+ blueviolet: 2318131967,
3632
+ brown: 2771004159,
3633
+ burlywood: 3736635391,
3634
+ burntsienna: 3934150143,
3635
+ cadetblue: 1604231423,
3636
+ chartreuse: 2147418367,
3637
+ chocolate: 3530104575,
3638
+ coral: 4286533887,
3639
+ cornflowerblue: 1687547391,
3640
+ cornsilk: 4294499583,
3641
+ crimson: 3692313855,
3642
+ cyan: 16777215,
3643
+ darkblue: 35839,
3644
+ darkcyan: 9145343,
3645
+ darkgoldenrod: 3095792639,
3646
+ darkgray: 2846468607,
3647
+ darkgreen: 6553855,
3648
+ darkgrey: 2846468607,
3649
+ darkkhaki: 3182914559,
3650
+ darkmagenta: 2332068863,
3651
+ darkolivegreen: 1433087999,
3652
+ darkorange: 4287365375,
3653
+ darkorchid: 2570243327,
3654
+ darkred: 2332033279,
3655
+ darksalmon: 3918953215,
3656
+ darkseagreen: 2411499519,
3657
+ darkslateblue: 1211993087,
3658
+ darkslategray: 793726975,
3659
+ darkslategrey: 793726975,
3660
+ darkturquoise: 13554175,
3661
+ darkviolet: 2483082239,
3662
+ deeppink: 4279538687,
3663
+ deepskyblue: 12582911,
3664
+ dimgray: 1768516095,
3665
+ dimgrey: 1768516095,
3666
+ dodgerblue: 512819199,
3667
+ firebrick: 2988581631,
3668
+ floralwhite: 4294635775,
3669
+ forestgreen: 579543807,
3670
+ fuchsia: 4278255615,
3671
+ gainsboro: 3705462015,
3672
+ ghostwhite: 4177068031,
3673
+ gold: 4292280575,
3674
+ goldenrod: 3668254975,
3675
+ gray: 2155905279,
3676
+ green: 8388863,
3677
+ greenyellow: 2919182335,
3678
+ grey: 2155905279,
3679
+ honeydew: 4043305215,
3680
+ hotpink: 4285117695,
3681
+ indianred: 3445382399,
3682
+ indigo: 1258324735,
3683
+ ivory: 4294963455,
3684
+ khaki: 4041641215,
3685
+ lavender: 3873897215,
3686
+ lavenderblush: 4293981695,
3687
+ lawngreen: 2096890111,
3688
+ lemonchiffon: 4294626815,
3689
+ lightblue: 2916673279,
3690
+ lightcoral: 4034953471,
3691
+ lightcyan: 3774873599,
3692
+ lightgoldenrodyellow: 4210742015,
3693
+ lightgray: 3553874943,
3694
+ lightgreen: 2431553791,
3695
+ lightgrey: 3553874943,
3696
+ lightpink: 4290167295,
3697
+ lightsalmon: 4288707327,
3698
+ lightseagreen: 548580095,
3699
+ lightskyblue: 2278488831,
3700
+ lightslategray: 2005441023,
3701
+ lightslategrey: 2005441023,
3702
+ lightsteelblue: 2965692159,
3703
+ lightyellow: 4294959359,
3704
+ lime: 16711935,
3705
+ limegreen: 852308735,
3706
+ linen: 4210091775,
3707
+ magenta: 4278255615,
3708
+ maroon: 2147483903,
3709
+ mediumaquamarine: 1724754687,
3710
+ mediumblue: 52735,
3711
+ mediumorchid: 3126187007,
3712
+ mediumpurple: 2473647103,
3713
+ mediumseagreen: 1018393087,
3714
+ mediumslateblue: 2070474495,
3715
+ mediumspringgreen: 16423679,
3716
+ mediumturquoise: 1221709055,
3717
+ mediumvioletred: 3340076543,
3718
+ midnightblue: 421097727,
3719
+ mintcream: 4127193855,
3720
+ mistyrose: 4293190143,
3721
+ moccasin: 4293178879,
3722
+ navajowhite: 4292783615,
3723
+ navy: 33023,
3724
+ oldlace: 4260751103,
3725
+ olive: 2155872511,
3726
+ olivedrab: 1804477439,
3727
+ orange: 4289003775,
3728
+ orangered: 4282712319,
3729
+ orchid: 3664828159,
3730
+ palegoldenrod: 4008225535,
3731
+ palegreen: 2566625535,
3732
+ paleturquoise: 2951671551,
3733
+ palevioletred: 3681588223,
3734
+ papayawhip: 4293907967,
3735
+ peachpuff: 4292524543,
3736
+ peru: 3448061951,
3737
+ pink: 4290825215,
3738
+ plum: 3718307327,
3739
+ powderblue: 2967529215,
3740
+ purple: 2147516671,
3741
+ rebeccapurple: 1714657791,
3742
+ red: 4278190335,
3743
+ rosybrown: 3163525119,
3744
+ royalblue: 1097458175,
3745
+ saddlebrown: 2336560127,
3746
+ salmon: 4202722047,
3747
+ sandybrown: 4104413439,
3748
+ seagreen: 780883967,
3749
+ seashell: 4294307583,
3750
+ sienna: 2689740287,
3751
+ silver: 3233857791,
3752
+ skyblue: 2278484991,
3753
+ slateblue: 1784335871,
3754
+ slategray: 1887473919,
3755
+ slategrey: 1887473919,
3756
+ snow: 4294638335,
3757
+ springgreen: 16744447,
3758
+ steelblue: 1182971135,
3759
+ tan: 3535047935,
3760
+ teal: 8421631,
3761
+ thistle: 3636451583,
3762
+ tomato: 4284696575,
3763
+ turquoise: 1088475391,
3764
+ violet: 4001558271,
3765
+ wheat: 4125012991,
3766
+ white: 4294967295,
3767
+ whitesmoke: 4126537215,
3768
+ yellow: 4294902015,
3769
+ yellowgreen: 2597139199
3770
+ };
3771
+ var ENABLE_V5_BREAKING_CHANGES = false;
3772
+ var validateFrame = ({
3773
+ allowFloats,
3774
+ durationInFrames,
3775
+ frame
3776
+ }) => {
3777
+ if (typeof frame === "undefined") {
3778
+ throw new TypeError(`Argument missing for parameter "frame"`);
3779
+ }
3780
+ if (typeof frame !== "number") {
3781
+ throw new TypeError(`Argument passed for "frame" is not a number: ${frame}`);
3782
+ }
3783
+ if (!Number.isFinite(frame)) {
3784
+ throw new RangeError(`Frame ${frame} is not finite`);
3785
+ }
3786
+ if (frame % 1 !== 0 && !allowFloats) {
3787
+ throw new RangeError(`Argument for frame must be an integer, but got ${frame}`);
3788
+ }
3789
+ if (frame < 0 && frame < -durationInFrames) {
3790
+ throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`);
3791
+ }
3792
+ if (frame > durationInFrames - 1) {
3793
+ throw new RangeError(`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1}`);
3794
+ }
3795
+ };
3796
+ var validateDefaultAndInputProps = (defaultProps, name, compositionId) => {
3797
+ if (!defaultProps) {
3798
+ return;
3799
+ }
3800
+ if (typeof defaultProps !== "object") {
3801
+ throw new Error(`"${name}" must be an object, but you passed a value of type ${typeof defaultProps}`);
3802
+ }
3803
+ if (Array.isArray(defaultProps)) {
3804
+ throw new Error(`"${name}" must be an object, an array was passed ${compositionId ? `for composition "${compositionId}"` : ""}`);
3805
+ }
3806
+ };
3807
+ var getExpectedMediaFrameUncorrected = ({
3808
+ frame,
3809
+ playbackRate,
3810
+ startFrom
3811
+ }) => {
3812
+ return interpolate(frame, [-1, startFrom, startFrom + 1], [-1, startFrom, startFrom + playbackRate]);
3813
+ };
3814
+ var getAbsoluteSrc = (relativeSrc) => {
3815
+ if (typeof window === "undefined") {
3816
+ return relativeSrc;
3817
+ }
3818
+ return new URL(relativeSrc, window.origin).href;
3819
+ };
3820
+ var getOffthreadVideoSource = ({
3821
+ src,
3822
+ transparent,
3823
+ currentTime,
3824
+ toneMapped
3825
+ }) => {
3826
+ return `http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(getAbsoluteSrc(src))}&time=${encodeURIComponent(currentTime)}&transparent=${String(transparent)}&toneMapped=${String(toneMapped)}`;
3827
+ };
3828
+ var NoReactInternals = {
3829
+ processColor,
3830
+ truthy: truthy4,
3831
+ validateFps,
3832
+ validateDimension,
3833
+ validateDurationInFrames,
3834
+ validateDefaultAndInputProps,
3835
+ validateFrame,
3836
+ serializeJSONWithDate,
3837
+ bundleName: "bundle.js",
3838
+ bundleMapName: "bundle.js.map",
3839
+ deserializeJSONWithCustomFields,
3840
+ DELAY_RENDER_CALLSTACK_TOKEN,
3841
+ DELAY_RENDER_RETRY_TOKEN,
3842
+ DELAY_RENDER_ATTEMPT_TOKEN: DELAY_RENDER_RETRIES_LEFT,
3843
+ getOffthreadVideoSource,
3844
+ getExpectedMediaFrameUncorrected,
3845
+ ENABLE_V5_BREAKING_CHANGES,
3846
+ MIN_NODE_VERSION: ENABLE_V5_BREAKING_CHANGES ? 18 : 16,
3847
+ MIN_BUN_VERSION: ENABLE_V5_BREAKING_CHANGES ? "1.1.3" : "1.0.3",
3848
+ colorNames,
3849
+ DATE_TOKEN,
3850
+ FILE_TOKEN
3851
+ };
3852
+
3853
+ // src/get-local-browser.ts
3178
3854
  var getSearchPathsForProduct = () => {
3179
- return [];
3855
+ if (NoReactInternals.ENABLE_V5_BREAKING_CHANGES) {
3856
+ return [];
3857
+ }
3858
+ return [
3859
+ process.env.PUPPETEER_EXECUTABLE_PATH ?? null,
3860
+ process.platform === "darwin" ? "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" : null,
3861
+ process.platform === "linux" ? "/usr/bin/google-chrome" : null,
3862
+ process.platform === "linux" ? "/usr/bin/chromium-browser" : null,
3863
+ process.platform === "linux" ? "/usr/bin/chromium" : null,
3864
+ process.platform === "linux" ? "/app/.apt/usr/bin/google-chrome-stable" : null,
3865
+ process.platform === "win32" ? "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" : null,
3866
+ process.platform === "win32" ? "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe" : null,
3867
+ process.platform === "win32" ? homedir() + "\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe" : null,
3868
+ process.platform === "win32" ? "C:\\Program Files\\Google\\Chrome SxS\\Application\\chrome.exe" : null,
3869
+ process.platform === "win32" ? "C:\\Program Files (x86)\\Google\\Chrome SxS\\Application\\chrome.exe" : null,
3870
+ process.platform === "win32" ? homedir() + "\\AppData\\Local\\Google\\Chrome SxS\\Application\\chrome.exe" : null
3871
+ ].filter(Boolean);
3180
3872
  };
3181
3873
  var getLocalBrowser = () => {
3182
3874
  for (const p of getSearchPathsForProduct()) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/renderer"
4
4
  },
5
5
  "name": "@remotion/renderer",
6
- "version": "4.0.209",
6
+ "version": "4.0.211",
7
7
  "description": "Render Remotion videos using Node.js or Bun",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "extract-zip": "2.0.1",
19
19
  "source-map": "^0.8.0-beta.0",
20
20
  "ws": "8.17.1",
21
- "@remotion/streaming": "4.0.209",
22
- "remotion": "4.0.209"
21
+ "remotion": "4.0.211",
22
+ "@remotion/streaming": "4.0.211"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": ">=16.8.0",
@@ -34,13 +34,13 @@
34
34
  "@types/ws": "8.5.10"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@remotion/compositor-darwin-arm64": "4.0.209",
38
- "@remotion/compositor-linux-arm64-gnu": "4.0.209",
39
- "@remotion/compositor-darwin-x64": "4.0.209",
40
- "@remotion/compositor-linux-x64-musl": "4.0.209",
41
- "@remotion/compositor-linux-x64-gnu": "4.0.209",
42
- "@remotion/compositor-win32-x64-msvc": "4.0.209",
43
- "@remotion/compositor-linux-arm64-musl": "4.0.209"
37
+ "@remotion/compositor-darwin-arm64": "4.0.211",
38
+ "@remotion/compositor-darwin-x64": "4.0.211",
39
+ "@remotion/compositor-linux-arm64-gnu": "4.0.211",
40
+ "@remotion/compositor-linux-x64-musl": "4.0.211",
41
+ "@remotion/compositor-linux-x64-gnu": "4.0.211",
42
+ "@remotion/compositor-linux-arm64-musl": "4.0.211",
43
+ "@remotion/compositor-win32-x64-msvc": "4.0.211"
44
44
  },
45
45
  "keywords": [
46
46
  "remotion",
@@ -1,11 +0,0 @@
1
- export declare const streamingKey = "remotion_buffer:";
2
- export declare const makeStreamer: (onMessage: (statusType: 'success' | 'error', nonce: string, data: Uint8Array) => void) => {
3
- onData: (data: Uint8Array) => void;
4
- getOutputBuffer: () => Uint8Array;
5
- clear: () => void;
6
- };
7
- export declare const makeStreamPayloadMessage: ({ status, body, nonce, }: {
8
- nonce: string;
9
- status: 0 | 1;
10
- body: Uint8Array;
11
- }) => Uint8Array;
package/dist/streaming.js DELETED
@@ -1,140 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeStreamPayloadMessage = exports.makeStreamer = exports.streamingKey = void 0;
4
- exports.streamingKey = 'remotion_buffer:';
5
- const magicWordStr = 'remotion_buffer:';
6
- const makeStreamer = (onMessage) => {
7
- const separator = new Uint8Array(magicWordStr.length);
8
- for (let i = 0; i < magicWordStr.length; i++) {
9
- separator[i] = magicWordStr.charCodeAt(i);
10
- }
11
- let unprocessedBuffers = [];
12
- let outputBuffer = new Uint8Array(0);
13
- let missingData = null;
14
- const processInput = () => {
15
- let separatorIndex = outputBuffer.indexOf(separator[0]); // Start checking for the first byte of the separator
16
- if (separatorIndex === -1 ||
17
- outputBuffer
18
- .subarray(separatorIndex, separatorIndex + separator.length)
19
- .toString() !== separator.toString()) {
20
- return;
21
- }
22
- separatorIndex += separator.length;
23
- let nonceString = '';
24
- let lengthString = '';
25
- let statusString = '';
26
- // eslint-disable-next-line no-constant-condition
27
- while (true) {
28
- if (separatorIndex > outputBuffer.length - 1) {
29
- return;
30
- }
31
- const nextDigit = outputBuffer[separatorIndex];
32
- separatorIndex++;
33
- if (nextDigit === 0x3a) {
34
- break;
35
- }
36
- nonceString += String.fromCharCode(nextDigit);
37
- }
38
- // eslint-disable-next-line no-constant-condition
39
- while (true) {
40
- if (separatorIndex > outputBuffer.length - 1) {
41
- return;
42
- }
43
- const nextDigit = outputBuffer[separatorIndex];
44
- separatorIndex++;
45
- if (nextDigit === 0x3a) {
46
- break;
47
- }
48
- lengthString += String.fromCharCode(nextDigit);
49
- }
50
- // eslint-disable-next-line no-constant-condition
51
- while (true) {
52
- if (separatorIndex > outputBuffer.length - 1) {
53
- return;
54
- }
55
- const nextDigit = outputBuffer[separatorIndex];
56
- if (nextDigit === 0x3a) {
57
- break;
58
- }
59
- separatorIndex++;
60
- statusString += String.fromCharCode(nextDigit);
61
- }
62
- const length = Number(lengthString);
63
- const status = Number(statusString);
64
- const dataLength = outputBuffer.length - separatorIndex - 1;
65
- if (dataLength < length) {
66
- missingData = {
67
- dataMissing: length - dataLength,
68
- };
69
- return;
70
- }
71
- const data = outputBuffer.subarray(separatorIndex + 1, separatorIndex + 1 + Number(lengthString));
72
- onMessage(status === 1 ? 'error' : 'success', nonceString, data);
73
- missingData = null;
74
- outputBuffer = outputBuffer.subarray(separatorIndex + Number(lengthString) + 1);
75
- processInput();
76
- };
77
- const onData = (data) => {
78
- unprocessedBuffers.push(data);
79
- const separatorIndex = data.indexOf(separator[0]);
80
- if (separatorIndex === -1) {
81
- if (missingData) {
82
- missingData.dataMissing -= data.length;
83
- }
84
- if (!missingData || missingData.dataMissing > 0) {
85
- return;
86
- }
87
- }
88
- unprocessedBuffers.unshift(outputBuffer);
89
- outputBuffer = new Uint8Array(unprocessedBuffers.reduce((acc, val) => acc + val.length, 0));
90
- let offset = 0;
91
- for (const buf of unprocessedBuffers) {
92
- outputBuffer.set(buf, offset);
93
- offset += buf.length;
94
- }
95
- unprocessedBuffers = [];
96
- processInput();
97
- };
98
- return {
99
- onData,
100
- getOutputBuffer: () => outputBuffer,
101
- clear: () => {
102
- unprocessedBuffers = [];
103
- outputBuffer = new Uint8Array(0);
104
- },
105
- };
106
- };
107
- exports.makeStreamer = makeStreamer;
108
- const makeStreamPayloadMessage = ({ status, body, nonce, }) => {
109
- const nonceArr = new TextEncoder().encode(nonce);
110
- const magicWordArr = new TextEncoder().encode(magicWordStr);
111
- const separatorArr = new TextEncoder().encode(':');
112
- const bodyLengthArr = new TextEncoder().encode(body.length.toString());
113
- const statusArr = new TextEncoder().encode(String(status));
114
- // Calculate total length of new Uint8Array
115
- const totalLength = nonceArr.length +
116
- magicWordArr.length +
117
- separatorArr.length * 3 +
118
- bodyLengthArr.length +
119
- statusArr.length +
120
- body.length;
121
- // Create a new Uint8Array to hold all combined parts
122
- const concat = new Uint8Array(totalLength);
123
- let offset = 0;
124
- // Function to append data to concat
125
- const appendToConcat = (data) => {
126
- concat.set(data, offset);
127
- offset += data.length;
128
- };
129
- // Building the final Uint8Array
130
- appendToConcat(magicWordArr);
131
- appendToConcat(nonceArr);
132
- appendToConcat(separatorArr);
133
- appendToConcat(bodyLengthArr);
134
- appendToConcat(separatorArr);
135
- appendToConcat(statusArr);
136
- appendToConcat(separatorArr);
137
- appendToConcat(body);
138
- return concat;
139
- };
140
- exports.makeStreamPayloadMessage = makeStreamPayloadMessage;