@remotion/lambda 4.0.0-alpha.130 → 4.0.0-alpha.185

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/admin/bundle-lambda.js +1 -2
  2. package/dist/api/deploy-site.js +3 -8
  3. package/dist/api/get-or-create-bucket.d.ts +0 -1
  4. package/dist/api/get-or-create-bucket.js +0 -3
  5. package/dist/api/render-media-on-lambda.d.ts +8 -4
  6. package/dist/api/render-media-on-lambda.js +6 -3
  7. package/dist/api/render-still-on-lambda.d.ts +7 -3
  8. package/dist/api/render-still-on-lambda.js +6 -3
  9. package/dist/cli/commands/render/render.js +2 -2
  10. package/dist/cli/commands/sites/create.js +0 -5
  11. package/dist/cli/commands/still.js +2 -2
  12. package/dist/cli/helpers/progress-bar.d.ts +1 -2
  13. package/dist/cli/helpers/progress-bar.js +3 -7
  14. package/dist/cli/log.d.ts +3 -3
  15. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
  16. package/dist/functions/chunk-optimization/plan-frame-ranges.js +1 -1
  17. package/dist/functions/helpers/concat-videos.js +1 -2
  18. package/dist/functions/helpers/get-current-architecture.d.ts +2 -0
  19. package/dist/functions/helpers/get-current-architecture.js +11 -0
  20. package/dist/functions/helpers/make-timeout-error.js +6 -19
  21. package/dist/functions/helpers/make-timeout-message.d.ts +6 -0
  22. package/dist/functions/helpers/make-timeout-message.js +31 -0
  23. package/dist/functions/index.d.ts +9 -9
  24. package/dist/functions/launch.js +3 -3
  25. package/dist/functions/renderer.js +1 -1
  26. package/dist/functions/start.js +1 -1
  27. package/dist/functions/still.js +1 -1
  28. package/dist/index.d.ts +2 -2
  29. package/dist/shared/constants.d.ts +4 -4
  30. package/dist/shared/invoke-webhook.d.ts +0 -2
  31. package/dist/shared/validate-architecture.d.ts +4 -0
  32. package/dist/shared/validate-architecture.js +14 -0
  33. package/package.json +7 -7
  34. package/remotionlambda-arm64.zip +0 -0
  35. package/remotionlambda-x64.zip +0 -0
@@ -11,13 +11,12 @@ const quit_1 = require("../cli/helpers/quit");
11
11
  const function_zip_path_1 = require("../shared/function-zip-path");
12
12
  const zl = require("zip-lib");
13
13
  const bundleLambda = async () => {
14
- var _a;
15
14
  const outdir = path_1.default.join(__dirname, '..', `build-render`);
16
15
  fs_1.default.mkdirSync(outdir, {
17
16
  recursive: true,
18
17
  });
19
18
  const outfile = path_1.default.join(outdir, 'index.js');
20
- ((_a = fs_1.default.rmSync) !== null && _a !== void 0 ? _a : fs_1.default.rmdirSync)(outdir, { recursive: true });
19
+ fs_1.default.rmSync(outdir, { recursive: true });
21
20
  fs_1.default.mkdirSync(outdir, { recursive: true });
22
21
  const template = require.resolve(path_1.default.join(__dirname, '..', 'functions', 'index'));
23
22
  await bundler_1.BundlerInternals.esbuild.build({
@@ -87,14 +87,9 @@ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }
87
87
  })),
88
88
  ]);
89
89
  if (!process.env.VITEST) {
90
- if (fs_1.default.rmSync) {
91
- fs_1.default.rmSync(bundled, {
92
- recursive: true,
93
- });
94
- }
95
- else {
96
- fs_1.default.rmdirSync(bundled, { recursive: true });
97
- }
90
+ fs_1.default.rmSync(bundled, {
91
+ recursive: true,
92
+ });
98
93
  }
99
94
  return {
100
95
  serveUrl: (0, make_s3_url_1.makeS3ServeUrl)({ bucketName, subFolder, region }),
@@ -1,7 +1,6 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
2
  export declare type GetOrCreateBucketInput = {
3
3
  region: AwsRegion;
4
- onBucketEnsured?: () => void;
5
4
  };
6
5
  export declare type GetOrCreateBucketOutput = {
7
6
  bucketName: string;
@@ -12,13 +12,11 @@ const get_buckets_1 = require("./get-buckets");
12
12
  * @returns {Promise<GetOrCreateBucketOutput>} An object containing the `bucketName`.
13
13
  */
14
14
  const getOrCreateBucket = async (options) => {
15
- var _a, _b;
16
15
  const { remotionBuckets } = await (0, get_buckets_1.getRemotionS3Buckets)(options.region);
17
16
  if (remotionBuckets.length > 1) {
18
17
  throw new Error(`You have multiple buckets (${remotionBuckets.map((b) => b.name)}) in your S3 region (${options.region}) starting with "${constants_1.REMOTION_BUCKET_PREFIX}". Please see https://remotion.dev/docs/lambda/multiple-buckets.`);
19
18
  }
20
19
  if (remotionBuckets.length === 1) {
21
- (_a = options.onBucketEnsured) === null || _a === void 0 ? void 0 : _a.call(options);
22
20
  return { bucketName: remotionBuckets[0].name, alreadyExisted: true };
23
21
  }
24
22
  const bucketName = (0, validate_bucketname_1.makeBucketName)(options.region);
@@ -26,7 +24,6 @@ const getOrCreateBucket = async (options) => {
26
24
  bucketName,
27
25
  region: options.region,
28
26
  });
29
- (_b = options.onBucketEnsured) === null || _b === void 0 ? void 0 : _b.call(options);
30
27
  return { bucketName, alreadyExisted: false };
31
28
  };
32
29
  exports.getOrCreateBucket = getOrCreateBucket;
@@ -16,7 +16,11 @@ export declare type RenderMediaOnLambdaInput = {
16
16
  pixelFormat?: PixelFormat;
17
17
  proResProfile?: ProResProfile;
18
18
  privacy?: Privacy;
19
- quality?: number;
19
+ /**
20
+ * @deprecated Renamed to `jpegQuality`
21
+ */
22
+ quality?: never;
23
+ jpegQuality?: number;
20
24
  maxRetries?: number;
21
25
  framesPerLambda?: number;
22
26
  logLevel?: LogLevel;
@@ -61,15 +65,15 @@ export declare type RenderMediaOnLambdaOutput = {
61
65
  * @param params.crf The constant rate factor to be used during encoding.
62
66
  * @param params.envVariables Object containing environment variables to be inserted into the video environment
63
67
  * @param params.proResProfile The ProRes profile if rendering a ProRes video
64
- * @param params.quality JPEG quality if JPEG was selected as the image format.
68
+ * @param params.jpegQuality JPEG quality if JPEG was selected as the image format.
65
69
  * @param params.region The AWS region in which the media should be rendered.
66
70
  * @param params.maxRetries How often rendering a chunk may fail before the media render gets aborted. Default "1"
67
71
  * @param params.logLevel Level of logging that Lambda function should perform. Default "info".
68
72
  * @param params.webhook Configuration for webhook called upon completion or timeout of the render.
69
73
  * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
70
74
  */
71
- export declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
75
+ export declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, jpegQuality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
72
76
  /**
73
77
  * @deprecated Renamed to renderMediaOnLambda()
74
78
  */
75
- export declare const renderVideoOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
79
+ export declare const renderVideoOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, jpegQuality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
@@ -22,15 +22,18 @@ const validate_serveurl_1 = require("../shared/validate-serveurl");
22
22
  * @param params.crf The constant rate factor to be used during encoding.
23
23
  * @param params.envVariables Object containing environment variables to be inserted into the video environment
24
24
  * @param params.proResProfile The ProRes profile if rendering a ProRes video
25
- * @param params.quality JPEG quality if JPEG was selected as the image format.
25
+ * @param params.jpegQuality JPEG quality if JPEG was selected as the image format.
26
26
  * @param params.region The AWS region in which the media should be rendered.
27
27
  * @param params.maxRetries How often rendering a chunk may fail before the media render gets aborted. Default "1"
28
28
  * @param params.logLevel Level of logging that Lambda function should perform. Default "info".
29
29
  * @param params.webhook Configuration for webhook called upon completion or timeout of the render.
30
30
  * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
31
31
  */
32
- const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, }) => {
32
+ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, jpegQuality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, }) => {
33
33
  var _a;
34
+ if (quality) {
35
+ throw new Error(`"quality" has been renamed. Use "jpegQuality" instead.`);
36
+ }
34
37
  const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
35
38
  (0, validate_serveurl_1.validateServeUrl)(serveUrl);
36
39
  (0, validate_frames_per_lambda_1.validateFramesPerLambda)({
@@ -60,7 +63,7 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
60
63
  envVariables,
61
64
  pixelFormat,
62
65
  proResProfile,
63
- quality,
66
+ jpegQuality,
64
67
  maxRetries: maxRetries !== null && maxRetries !== void 0 ? maxRetries : 1,
65
68
  privacy: privacy !== null && privacy !== void 0 ? privacy : 'public',
66
69
  logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
@@ -12,7 +12,11 @@ export declare type RenderStillOnLambdaInput = {
12
12
  privacy: Privacy;
13
13
  maxRetries?: number;
14
14
  envVariables?: Record<string, string>;
15
- quality?: number;
15
+ /**
16
+ * @deprecated Renamed to `jpegQuality`
17
+ */
18
+ quality?: never;
19
+ jpegQuality?: number;
16
20
  frame?: number;
17
21
  logLevel?: LogLevel;
18
22
  outName?: OutNameInput;
@@ -41,11 +45,11 @@ export declare type RenderStillOnLambdaOutput = {
41
45
  * @param params.inputProps The input props that should be passed to the composition.
42
46
  * @param params.imageFormat In which image format the frames should be rendered.
43
47
  * @param params.envVariables Object containing environment variables to be inserted into the video environment
44
- * @param params.quality JPEG quality if JPEG was selected as the image format.
48
+ * @param params.jpegQuality JPEG quality if JPEG was selected as the image format.
45
49
  * @param params.region The AWS region in which the video should be rendered.
46
50
  * @param params.maxRetries How often rendering a chunk may fail before the video render gets aborted.
47
51
  * @param params.frame Which frame should be used for the still image. Default 0.
48
52
  * @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`
49
53
  * @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
50
54
  */
51
- export declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
55
+ export declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
@@ -15,15 +15,18 @@ const serialize_input_props_1 = require("../shared/serialize-input-props");
15
15
  * @param params.inputProps The input props that should be passed to the composition.
16
16
  * @param params.imageFormat In which image format the frames should be rendered.
17
17
  * @param params.envVariables Object containing environment variables to be inserted into the video environment
18
- * @param params.quality JPEG quality if JPEG was selected as the image format.
18
+ * @param params.jpegQuality JPEG quality if JPEG was selected as the image format.
19
19
  * @param params.region The AWS region in which the video should be rendered.
20
20
  * @param params.maxRetries How often rendering a chunk may fail before the video render gets aborted.
21
21
  * @param params.frame Which frame should be used for the still image. Default 0.
22
22
  * @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`
23
23
  * @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
24
24
  */
25
- const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, }) => {
25
+ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, }) => {
26
26
  var _a;
27
+ if (quality) {
28
+ throw new Error('The `quality` option is deprecated. Use `jpegQuality` instead.');
29
+ }
27
30
  const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
28
31
  inputProps,
29
32
  region,
@@ -40,7 +43,7 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
40
43
  inputProps: serializedInputProps,
41
44
  imageFormat,
42
45
  envVariables,
43
- quality,
46
+ jpegQuality,
44
47
  maxRetries: maxRetries !== null && maxRetries !== void 0 ? maxRetries : constants_1.DEFAULT_MAX_RETRIES,
45
48
  frame: frame !== null && frame !== void 0 ? frame : 0,
46
49
  privacy,
@@ -48,7 +48,7 @@ const renderCommand = async (args, remotionRoot) => {
48
48
  configFile: (_b = config_1.ConfigInternals.getOutputCodecOrUndefined()) !== null && _b !== void 0 ? _b : null,
49
49
  uiCodec: null,
50
50
  });
51
- const { chromiumOptions, crf, envVariables, frameRange, inputProps, logLevel, pixelFormat, proResProfile, puppeteerTimeout, quality, scale, everyNthFrame, numberOfGifLoops, muted, overwrite, audioBitrate, videoBitrate, height, width, } = await cli_1.CliInternals.getCliOptions({
51
+ const { chromiumOptions, crf, envVariables, frameRange, inputProps, logLevel, pixelFormat, proResProfile, puppeteerTimeout, jpegQuality, scale, everyNthFrame, numberOfGifLoops, muted, overwrite, audioBitrate, videoBitrate, height, width, } = await cli_1.CliInternals.getCliOptions({
52
52
  type: 'series',
53
53
  isLambda: true,
54
54
  remotionRoot,
@@ -74,7 +74,7 @@ const renderCommand = async (args, remotionRoot) => {
74
74
  envVariables,
75
75
  pixelFormat,
76
76
  proResProfile,
77
- quality,
77
+ jpegQuality,
78
78
  region,
79
79
  maxRetries,
80
80
  composition,
@@ -40,7 +40,6 @@ const sitesCreateSubcommand = async (args, remotionRoot) => {
40
40
  progress: 0,
41
41
  },
42
42
  bucketProgress: {
43
- bucketCreated: false,
44
43
  doneIn: null,
45
44
  },
46
45
  deployProgress: {
@@ -61,10 +60,6 @@ const sitesCreateSubcommand = async (args, remotionRoot) => {
61
60
  const cliBucketName = (_b = args_1.parsedLambdaCli['force-bucket-name']) !== null && _b !== void 0 ? _b : null;
62
61
  const bucketName = cliBucketName !== null && cliBucketName !== void 0 ? cliBucketName : (await (0, get_or_create_bucket_1.getOrCreateBucket)({
63
62
  region: (0, get_aws_region_1.getAwsRegion)(),
64
- onBucketEnsured: () => {
65
- multiProgress.bucketProgress.bucketCreated = true;
66
- updateProgress();
67
- },
68
63
  })).bucketName;
69
64
  multiProgress.bucketProgress.doneIn = Date.now() - bucketStart;
70
65
  updateProgress();
@@ -37,7 +37,7 @@ const stillCommand = async (args, remotionRoot) => {
37
37
  }
38
38
  const downloadName = (_a = args[2]) !== null && _a !== void 0 ? _a : null;
39
39
  const outName = args_1.parsedLambdaCli['out-name'];
40
- const { chromiumOptions, envVariables, inputProps, logLevel, puppeteerTimeout, quality, stillFrame, scale, height, width, } = await cli_1.CliInternals.getCliOptions({
40
+ const { chromiumOptions, envVariables, inputProps, logLevel, puppeteerTimeout, jpegQuality, stillFrame, scale, height, width, } = await cli_1.CliInternals.getCliOptions({
41
41
  type: 'still',
42
42
  isLambda: true,
43
43
  remotionRoot,
@@ -68,7 +68,7 @@ const stillCommand = async (args, remotionRoot) => {
68
68
  maxRetries,
69
69
  envVariables,
70
70
  frame: stillFrame,
71
- quality,
71
+ jpegQuality,
72
72
  logLevel,
73
73
  outName,
74
74
  chromiumOptions,
@@ -4,10 +4,9 @@ export declare type BundleProgress = {
4
4
  };
5
5
  export declare const makeBundleProgress: ({ progress, doneIn }: BundleProgress) => string;
6
6
  export declare type BucketCreationProgress = {
7
- bucketCreated: boolean;
8
7
  doneIn: number | null;
9
8
  };
10
- export declare const makeBucketProgress: ({ bucketCreated, doneIn, }: BucketCreationProgress) => string;
9
+ export declare const makeBucketProgress: ({ doneIn }: BucketCreationProgress) => string;
11
10
  declare type UploadStats = {
12
11
  addedFiles: number;
13
12
  removedFiles: number;
@@ -14,17 +14,13 @@ const makeBundleProgress = ({ progress, doneIn }) => {
14
14
  ].join(' ');
15
15
  };
16
16
  exports.makeBundleProgress = makeBundleProgress;
17
- const makeBucketProgress = ({ bucketCreated, doneIn, }) => {
18
- const states = [bucketCreated];
19
- const statesFinished = states.filter(Boolean).map((p) => p).length;
20
- const progress = statesFinished / states.length;
17
+ const makeBucketProgress = ({ doneIn }) => {
18
+ const progress = doneIn === null ? 0 : 1;
21
19
  return [
22
20
  `(2/3)`,
23
21
  cli_1.CliInternals.makeProgressBar(progress),
24
22
  `${doneIn === null ? 'Creating' : 'Created'} bucket`,
25
- doneIn === null
26
- ? `${statesFinished} / ${states.length}`
27
- : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
23
+ doneIn === null ? `0/1` : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
28
24
  ].join(' ');
29
25
  };
30
26
  exports.makeBucketProgress = makeBucketProgress;
package/dist/cli/log.d.ts CHANGED
@@ -2,17 +2,17 @@ export declare const Log: {
2
2
  verbose: (message?: any, ...optionalParams: any[]) => void;
3
3
  verboseAdvanced: (options: {
4
4
  indent: boolean;
5
- logLevel: "error" | "verbose" | "info" | "warn";
5
+ logLevel: "verbose" | "info" | "warn" | "error";
6
6
  }, message?: any, ...optionalParams: any[]) => void;
7
7
  info: (message?: any, ...optionalParams: any[]) => void;
8
8
  infoAdvanced: (options: {
9
9
  indent: boolean;
10
- logLevel: "error" | "verbose" | "info" | "warn";
10
+ logLevel: "verbose" | "info" | "warn" | "error";
11
11
  }, message?: any, ...optionalParams: any[]) => void;
12
12
  warn: (message?: any, ...optionalParams: any[]) => void;
13
13
  warnAdvanced: (options: {
14
14
  indent: boolean;
15
- logLevel: "error" | "verbose" | "info" | "warn";
15
+ logLevel: "verbose" | "info" | "warn" | "error";
16
16
  }, message?: any, ...optionalParams: any[]) => void;
17
17
  error: (message?: any, ...optionalParams: any[]) => void;
18
18
  };
@@ -3,5 +3,8 @@ export declare const planFrameRanges: ({ framesPerLambda, frameRange, everyNthFr
3
3
  frameRange: [number, number];
4
4
  everyNthFrame: number;
5
5
  }) => {
6
- chunks: [number, number][];
6
+ chunks: [
7
+ number,
8
+ number
9
+ ][];
7
10
  };
@@ -9,7 +9,7 @@ const planFrameRanges = ({ framesPerLambda, frameRange, everyNthFrame, }) => {
9
9
  return {
10
10
  chunks: new Array(chunkCount).fill(1).map((_, i) => {
11
11
  const start = i * framesPerLambda * everyNthFrame + firstFrame;
12
- const end = Math.min(framesToRender[framesToRender.length - 1], (i + 1) * framesPerLambda * everyNthFrame - 1) + firstFrame;
12
+ const end = Math.min(framesToRender[framesToRender.length - 1], (i + 1) * framesPerLambda * everyNthFrame - 1 + firstFrame);
13
13
  return [start, end];
14
14
  }),
15
15
  };
@@ -129,7 +129,6 @@ const getAllFilesS3 = ({ bucket, expectedFiles, outdir, renderId, region, expect
129
129
  };
130
130
  exports.getAllFilesS3 = getAllFilesS3;
131
131
  const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, files, outdir, audioCodec, }) => {
132
- var _a;
133
132
  const outfile = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_CONCATED_TOKEN), 'concat.' + renderer_1.RenderInternals.getFileExtensionFromCodec(codec, audioCodec));
134
133
  const combine = (0, timer_1.timer)('Combine videos');
135
134
  const filelistDir = renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_FILELIST_TOKEN);
@@ -145,7 +144,7 @@ const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOf
145
144
  audioCodec,
146
145
  });
147
146
  combine.end();
148
- const cleanupChunksProm = ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(outdir, {
147
+ const cleanupChunksProm = fs_1.default.promises.rm(outdir, {
149
148
  recursive: true,
150
149
  });
151
150
  return { outfile, cleanupChunksProm };
@@ -0,0 +1,2 @@
1
+ import type { LambdaArchitecture } from '../../shared/validate-architecture';
2
+ export declare const getCurrentArchitecture: () => LambdaArchitecture;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCurrentArchitecture = void 0;
4
+ const is_in_lambda_1 = require("../../shared/is-in-lambda");
5
+ const getCurrentArchitecture = () => {
6
+ if (!(0, is_in_lambda_1.isInsideLambda)()) {
7
+ throw new Error('Should not call getCurrentArchitecture() if not inside a lambda function');
8
+ }
9
+ return process.arch.includes('arm') ? 'arm64' : 'x86_64';
10
+ };
11
+ exports.getCurrentArchitecture = getCurrentArchitecture;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeTimeoutError = void 0;
4
- const docs_url_1 = require("../../shared/docs-url");
5
4
  const parse_chunk_key_1 = require("../../shared/parse-chunk-key");
5
+ const make_timeout_message_1 = require("./make-timeout-message");
6
6
  const makeTimeoutError = ({ timeoutInMilliseconds, chunks, renderMetadata, }) => {
7
7
  const availableChunks = chunks.map((c) => (0, parse_chunk_key_1.parseLambdaChunkKey)(c.Key));
8
8
  const missingChunks = new Array(renderMetadata.totalChunks)
@@ -11,24 +11,11 @@ const makeTimeoutError = ({ timeoutInMilliseconds, chunks, renderMetadata, }) =>
11
11
  return !availableChunks.find((c) => c.chunk === i);
12
12
  })
13
13
  .map((_, i) => i);
14
- const missingChunksMessageList = missingChunks
15
- .map((ch) => {
16
- const isLastChunk = ch === renderMetadata.totalChunks - 1;
17
- const start = ch * renderMetadata.framesPerLambda;
18
- const end = isLastChunk
19
- ? renderMetadata.frameRange[1]
20
- : (ch + 1) * renderMetadata.framesPerLambda - 1;
21
- return `Chunk ${ch} (Frames ${start} - ${end})`;
22
- })
23
- .slice(0, 5)
24
- .join(', ');
25
- const message = [
26
- `The main function timed out after ${timeoutInMilliseconds}ms.`,
27
- `Consider increasing the timeout of your function.`,
28
- `The following chunks are missing (showing up to 5): ${missingChunksMessageList}.`,
29
- `You can use the "--timeout" parameter when deploying a function via CLI, or the "timeoutInSeconds" parameter when using the deployFunction() API.`,
30
- `${docs_url_1.DOCS_URL}/docs/lambda/cli/functions#deploy`,
31
- ].join('\n');
14
+ const message = (0, make_timeout_message_1.makeTimeoutMessage)({
15
+ missingChunks,
16
+ renderMetadata,
17
+ timeoutInMilliseconds,
18
+ });
32
19
  return {
33
20
  attempt: 1,
34
21
  chunk: null,
@@ -0,0 +1,6 @@
1
+ import type { RenderMetadata } from '../../defaults';
2
+ export declare const makeTimeoutMessage: ({ timeoutInMilliseconds, missingChunks, renderMetadata, }: {
3
+ timeoutInMilliseconds: number;
4
+ missingChunks: number[];
5
+ renderMetadata: RenderMetadata;
6
+ }) => string;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeTimeoutMessage = void 0;
4
+ const docs_url_1 = require("../../shared/docs-url");
5
+ const makeChunkMissingMessage = ({ missingChunks, renderMetadata, }) => {
6
+ const missingChunksMessageList = missingChunks
7
+ .map((ch) => {
8
+ const isLastChunk = ch === renderMetadata.totalChunks - 1;
9
+ const start = ch * renderMetadata.framesPerLambda;
10
+ const end = isLastChunk
11
+ ? renderMetadata.frameRange[1]
12
+ : (ch + 1) * renderMetadata.framesPerLambda - 1;
13
+ return `Chunk ${ch} (Frames ${start} - ${end})`;
14
+ })
15
+ .slice(0, 5);
16
+ if (missingChunksMessageList.length === 0) {
17
+ return 'All chunks have been successfully rendered, but the main function has timed out.';
18
+ }
19
+ return `The following chunks are missing (showing ${missingChunksMessageList.length} out of ${missingChunks.length}): ${missingChunksMessageList.join(', ')}.`;
20
+ };
21
+ const makeTimeoutMessage = ({ timeoutInMilliseconds, missingChunks, renderMetadata, }) => {
22
+ const message = [
23
+ `The main function timed out after ${timeoutInMilliseconds}ms.`,
24
+ `Consider increasing the timeout of your function.`,
25
+ makeChunkMissingMessage({ missingChunks, renderMetadata }),
26
+ `You can use the "--timeout" parameter when deploying a function via CLI, or the "timeoutInSeconds" parameter when using the deployFunction() API.`,
27
+ `${docs_url_1.DOCS_URL}/docs/lambda/cli/functions#deploy`,
28
+ ].join('\n');
29
+ return message;
30
+ };
31
+ exports.makeTimeoutMessage = makeTimeoutMessage;
@@ -2,17 +2,17 @@ import type { LambdaPayload } from '../shared/constants';
2
2
  export declare const handler: (params: LambdaPayload, context: {
3
3
  invokedFunctionArn: string;
4
4
  getRemainingTimeInMillis: () => number;
5
- }) => Promise<void> | Promise<import("../shared/constants").RenderProgress> | Promise<{
6
- compositions: import("remotion").AnyCompMetadata[];
7
- }> | Promise<{
8
- version: string;
9
- }> | Promise<{
10
- bucketName: string;
11
- renderId: string;
12
- }> | Promise<Promise<{
5
+ }) => Promise<void> | Promise<Promise<{
13
6
  output: string;
14
7
  size: number;
15
8
  bucketName: string;
16
9
  estimatedPrice: import("../shared/constants").CostsInfo;
17
10
  renderId: string;
18
- }>>;
11
+ }>> | Promise<{
12
+ bucketName: string;
13
+ renderId: string;
14
+ }> | Promise<import("../shared/constants").RenderProgress> | Promise<{
15
+ version: string;
16
+ }> | Promise<{
17
+ compositions: import("remotion").AnyCompMetadata[];
18
+ }>;
@@ -210,7 +210,7 @@ const innerLaunchHandler = async (params, options) => {
210
210
  envVariables: params.envVariables,
211
211
  pixelFormat: params.pixelFormat,
212
212
  proResProfile: params.proResProfile,
213
- quality: params.quality,
213
+ jpegQuality: params.jpegQuality,
214
214
  privacy: params.privacy,
215
215
  logLevel: (_a = params.logLevel) !== null && _a !== void 0 ? _a : 'info',
216
216
  attempt: 1,
@@ -228,7 +228,7 @@ const innerLaunchHandler = async (params, options) => {
228
228
  };
229
229
  return payload;
230
230
  });
231
- console.log('Render plan: ', chunks.map((c, i) => `Chunk ${i} (Frames ${c[0] - c[1]})`).join(', '));
231
+ console.log('Render plan: ', chunks.map((c, i) => `Chunk ${i} (Frames ${c[0]} - ${c[1]})`).join(', '));
232
232
  const renderMetadata = {
233
233
  startedDate,
234
234
  videoConfig: comp,
@@ -362,7 +362,7 @@ const innerLaunchHandler = async (params, options) => {
362
362
  const fps = comp.fps / params.everyNthFrame;
363
363
  const outdir = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.CONCAT_FOLDER_TOKEN), 'bucket');
364
364
  if ((0, fs_1.existsSync)(outdir)) {
365
- (fs_1.rmSync !== null && fs_1.rmSync !== void 0 ? fs_1.rmSync : fs_1.rmdirSync)(outdir, {
365
+ (0, fs_1.rmSync)(outdir, {
366
366
  recursive: true,
367
367
  });
368
368
  }
@@ -103,7 +103,7 @@ const renderHandler = async (params, options, logs) => {
103
103
  },
104
104
  puppeteerInstance: browserInstance,
105
105
  serveUrl: params.serveUrl,
106
- quality: params.quality,
106
+ jpegQuality: params.jpegQuality,
107
107
  envVariables: params.envVariables,
108
108
  dumpBrowserLogs: renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'),
109
109
  verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'),
@@ -55,7 +55,7 @@ const startHandler = async (params, options) => {
55
55
  envVariables: params.envVariables,
56
56
  pixelFormat: params.pixelFormat,
57
57
  proResProfile: params.proResProfile,
58
- quality: params.quality,
58
+ jpegQuality: params.jpegQuality,
59
59
  maxRetries: params.maxRetries,
60
60
  privacy: params.privacy,
61
61
  logLevel: (_b = params.logLevel) !== null && _b !== void 0 ? _b : 'info',
@@ -126,7 +126,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
126
126
  inputProps,
127
127
  overwrite: false,
128
128
  puppeteerInstance: browserInstance,
129
- quality: lambdaParams.quality,
129
+ jpegQuality: lambdaParams.jpegQuality,
130
130
  chromiumOptions: lambdaParams.chromiumOptions,
131
131
  scale: lambdaParams.scale,
132
132
  timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
package/dist/index.d.ts CHANGED
@@ -43,11 +43,11 @@ import type { WebhookPayload } from './shared/invoke-webhook';
43
43
  /**
44
44
  * @deprecated Import this from `@remotion/lambda/client` instead
45
45
  */
46
- declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
46
+ declare const renderMediaOnLambda: ({ functionName, serveUrl, inputProps, codec, imageFormat, crf, envVariables, pixelFormat, proResProfile, quality, jpegQuality, region, maxRetries, composition, framesPerLambda, privacy, logLevel, frameRange, outName, timeoutInMilliseconds, chromiumOptions, scale, numberOfGifLoops, everyNthFrame, concurrencyPerLambda, downloadBehavior, muted, overwrite, audioBitrate, videoBitrate, webhook, forceHeight, forceWidth, rendererFunctionName, forceBucketName: bucketName, audioCodec, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
47
47
  /**
48
48
  * @deprecated Import this from `@remotion/lambda/client` instead
49
49
  */
50
- declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
50
+ declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
51
51
  /**
52
52
  * @deprecated Import this from `@remotion/lambda/client` instead
53
53
  */
@@ -122,7 +122,7 @@ export declare type LambdaPayloads = {
122
122
  envVariables: Record<string, string> | undefined;
123
123
  pixelFormat: PixelFormat | undefined;
124
124
  proResProfile: ProResProfile | undefined;
125
- quality: number | undefined;
125
+ jpegQuality: number | undefined;
126
126
  maxRetries: number;
127
127
  privacy: Privacy;
128
128
  logLevel: LogLevel;
@@ -161,7 +161,7 @@ export declare type LambdaPayloads = {
161
161
  envVariables: Record<string, string> | undefined;
162
162
  pixelFormat: PixelFormat | undefined;
163
163
  proResProfile: ProResProfile | undefined;
164
- quality: number | undefined;
164
+ jpegQuality: number | undefined;
165
165
  maxRetries: number;
166
166
  privacy: Privacy;
167
167
  logLevel: LogLevel;
@@ -209,7 +209,7 @@ export declare type LambdaPayloads = {
209
209
  crf: number | undefined;
210
210
  proResProfile: ProResProfile | undefined;
211
211
  pixelFormat: PixelFormat | undefined;
212
- quality: number | undefined;
212
+ jpegQuality: number | undefined;
213
213
  envVariables: Record<string, string> | undefined;
214
214
  privacy: Privacy;
215
215
  attempt: number;
@@ -233,7 +233,7 @@ export declare type LambdaPayloads = {
233
233
  imageFormat: StillImageFormat;
234
234
  envVariables: Record<string, string> | undefined;
235
235
  attempt: number;
236
- quality: number | undefined;
236
+ jpegQuality: number | undefined;
237
237
  maxRetries: number;
238
238
  frame: number;
239
239
  privacy: Privacy;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import http from 'http';
4
2
  import https from 'https';
5
3
  import type { EnhancedErrorInfo } from '../functions/helpers/write-lambda-error';
@@ -0,0 +1,4 @@
1
+ declare const validArchitectures: readonly ["arm64", "x86_64"];
2
+ export declare type LambdaArchitecture = typeof validArchitectures[number];
3
+ export declare const validateArchitecture: (architecture: unknown) => void;
4
+ export {};
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateArchitecture = void 0;
4
+ const validArchitectures = ['arm64', 'x86_64'];
5
+ const validateArchitecture = (architecture) => {
6
+ if (typeof architecture !== 'string') {
7
+ throw new TypeError('You must pass an architecture when deploying: One of ' +
8
+ validArchitectures.join(', '));
9
+ }
10
+ if (!validArchitectures.find((a) => a === architecture)) {
11
+ throw new TypeError(`You must pass an "architecture" when deploying a function: either "arm64" or "x86_64"`);
12
+ }
13
+ };
14
+ exports.validateArchitecture = validateArchitecture;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "4.0.0-alpha.130+167d9bb7f",
3
+ "version": "4.0.0-alpha.185+1b8f0e746",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -33,17 +33,17 @@
33
33
  "@aws-sdk/credential-providers": "3.272.0",
34
34
  "@aws-sdk/lib-storage": "3.272.0",
35
35
  "@aws-sdk/s3-request-presigner": "3.272.0",
36
- "@remotion/bundler": "4.0.0-alpha.130+167d9bb7f",
37
- "@remotion/cli": "4.0.0-alpha.130+167d9bb7f",
38
- "@remotion/renderer": "4.0.0-alpha.130+167d9bb7f",
36
+ "@remotion/bundler": "4.0.0-alpha.185+1b8f0e746",
37
+ "@remotion/cli": "4.0.0-alpha.185+1b8f0e746",
38
+ "@remotion/renderer": "4.0.0-alpha.185+1b8f0e746",
39
39
  "aws-policies": "^1.0.1",
40
40
  "mime-types": "2.1.34",
41
- "remotion": "4.0.0-alpha.130+167d9bb7f"
41
+ "remotion": "4.0.0-alpha.185+1b8f0e746"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@jonny/eslint-config": "3.0.266",
45
45
  "@remotion/bundler": "workspace:*",
46
- "@remotion/compositor-linux-arm64-musl": "4.0.0-alpha.130+167d9bb7f",
46
+ "@remotion/compositor-linux-arm64-musl": "4.0.0-alpha.185+1b8f0e746",
47
47
  "@types/mime-types": "2.1.1",
48
48
  "@types/minimist": "1.2.2",
49
49
  "@types/node": "^14.14.14",
@@ -87,5 +87,5 @@
87
87
  ]
88
88
  }
89
89
  },
90
- "gitHead": "167d9bb7fc36e3cb939dec0e904be7a19a8eebb2"
90
+ "gitHead": "1b8f0e746ea4aa1153c4ecc7bc1063752c405f25"
91
91
  }
Binary file
Binary file