@remotion/lambda 4.0.21 → 4.0.23

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 (44) hide show
  1. package/dist/api/estimate-price.d.ts +11 -3
  2. package/dist/api/estimate-price.js +14 -11
  3. package/dist/api/get-compositions-on-lambda.d.ts +4 -3
  4. package/dist/api/get-compositions-on-lambda.js +2 -1
  5. package/dist/api/make-lambda-payload.d.ts +1 -1
  6. package/dist/api/make-lambda-payload.js +3 -1
  7. package/dist/api/render-media-on-lambda.d.ts +4 -2
  8. package/dist/api/render-still-on-lambda.d.ts +4 -3
  9. package/dist/api/render-still-on-lambda.js +2 -1
  10. package/dist/cli/commands/functions/rm.js +3 -1
  11. package/dist/cli/commands/functions/rmall.js +3 -1
  12. package/dist/cli/commands/quotas/increase.js +4 -2
  13. package/dist/cli/commands/render/render.js +4 -2
  14. package/dist/cli/commands/sites/rm.js +4 -2
  15. package/dist/cli/commands/sites/rmall.js +4 -2
  16. package/dist/cli/commands/still.js +3 -1
  17. package/dist/cli/helpers/confirm.d.ts +1 -1
  18. package/dist/cli/helpers/confirm.js +2 -5
  19. package/dist/cli/log.d.ts +4 -4
  20. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
  21. package/dist/functions/compositions.js +1 -0
  22. package/dist/functions/helpers/calculate-price-from-bucket.js +1 -1
  23. package/dist/functions/helpers/create-post-render-data.js +1 -1
  24. package/dist/functions/helpers/get-current-region.d.ts +1 -1
  25. package/dist/functions/helpers/streaming-payloads.d.ts +3 -3
  26. package/dist/functions/helpers/validate-composition.d.ts +2 -1
  27. package/dist/functions/helpers/validate-composition.js +2 -1
  28. package/dist/functions/launch.js +3 -0
  29. package/dist/functions/renderer.js +3 -1
  30. package/dist/functions/start.js +2 -0
  31. package/dist/functions/still.js +4 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/internals.d.ts +1 -1
  34. package/dist/pricing/aws-regions.d.ts +1 -1
  35. package/dist/shared/constants.d.ts +9 -1
  36. package/dist/shared/deserialize-input-props.d.ts +8 -0
  37. package/dist/shared/deserialize-input-props.js +26 -0
  38. package/dist/shared/invoke-webhook.d.ts +0 -2
  39. package/dist/shared/read-dir.js +4 -2
  40. package/dist/shared/serialize-input-props.d.ts +14 -0
  41. package/dist/shared/serialize-input-props.js +63 -0
  42. package/dist/shared/validate-lambda-codec.d.ts +1 -1
  43. package/package.json +9 -9
  44. package/remotionlambda-arm64.zip +0 -0
@@ -1,15 +1,23 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
+ type Miliseconds = {
3
+ /**
4
+ * @deprecated Typo in property name. Use `durationInMilliseconds` instead.
5
+ */
6
+ durationInMiliseconds: number;
7
+ } | {
8
+ durationInMilliseconds: number;
9
+ };
2
10
  export type EstimatePriceInput = {
3
11
  region: AwsRegion;
4
- durationInMiliseconds: number;
5
12
  memorySizeInMb: number;
6
13
  diskSizeInMb: number;
7
14
  lambdasInvoked: number;
8
- };
15
+ } & Miliseconds;
9
16
  /**
10
17
  *
11
18
  * @description Calculates the AWS costs incurred for AWS Lambda given the region, execution duration and memory size.
12
19
  * @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
13
20
  * @returns {number} Price in USD
14
21
  */
15
- export declare const estimatePrice: ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, lambdasInvoked, }: EstimatePriceInput) => number;
22
+ export declare const estimatePrice: ({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked, ...other }: EstimatePriceInput) => number;
23
+ export {};
@@ -12,32 +12,35 @@ const validate_memory_size_1 = require("../shared/validate-memory-size");
12
12
  * @see [Documentation](https://remotion.dev/docs/lambda/estimateprice)
13
13
  * @returns {number} Price in USD
14
14
  */
15
- const estimatePrice = ({ region, durationInMiliseconds, memorySizeInMb, diskSizeInMb, lambdasInvoked, }) => {
15
+ const estimatePrice = ({ region, memorySizeInMb, diskSizeInMb, lambdasInvoked, ...other }) => {
16
16
  (0, validate_memory_size_1.validateMemorySize)(memorySizeInMb);
17
17
  (0, validate_aws_region_1.validateAwsRegion)(region);
18
18
  (0, validate_disk_size_in_mb_1.validateDiskSizeInMb)(diskSizeInMb);
19
- if (typeof durationInMiliseconds !== 'number') {
20
- throw new TypeError(`Parameter 'durationInMiliseconds' must be a number but got ${typeof durationInMiliseconds}`);
19
+ const durationInMilliseconds = 'durationInMiliseconds' in other
20
+ ? other.durationInMiliseconds
21
+ : other.durationInMilliseconds;
22
+ if (typeof durationInMilliseconds !== 'number') {
23
+ throw new TypeError(`Parameter 'durationInMilliseconds' must be a number but got ${typeof durationInMilliseconds}`);
21
24
  }
22
- if (Number.isNaN(durationInMiliseconds)) {
23
- throw new TypeError(`Parameter 'durationInMiliseconds' must not be NaN but it is.`);
25
+ if (Number.isNaN(durationInMilliseconds)) {
26
+ throw new TypeError(`Parameter 'durationInMilliseconds' must not be NaN but it is.`);
24
27
  }
25
- if (!Number.isFinite(durationInMiliseconds)) {
26
- throw new TypeError(`Parameter 'durationInMiliseconds' must be finite but it is ${durationInMiliseconds}`);
28
+ if (!Number.isFinite(durationInMilliseconds)) {
29
+ throw new TypeError(`Parameter 'durationInMilliseconds' must be finite but it is ${durationInMilliseconds}`);
27
30
  }
28
- if (durationInMiliseconds < 0) {
29
- throw new TypeError(`Parameter 'durationInMiliseconds' must be over 0 but it is ${durationInMiliseconds}.`);
31
+ if (durationInMilliseconds < 0) {
32
+ throw new TypeError(`Parameter 'durationInMilliseconds' must be over 0 but it is ${durationInMilliseconds}.`);
30
33
  }
31
34
  const durationPrice = price_per_1_s_1.pricing[region]['Lambda Duration-ARM'].price;
32
35
  // In GB-second
33
36
  const timeCostDollars = Number(durationPrice) *
34
- ((memorySizeInMb * durationInMiliseconds) / 1000 / 1024);
37
+ ((memorySizeInMb * durationInMilliseconds) / 1000 / 1024);
35
38
  const diskSizePrice = price_per_1_s_1.pricing[region]['Lambda Storage-Duration-ARM'].price;
36
39
  const chargedDiskSize = Math.max(0, diskSizeInMb - defaults_1.MIN_EPHEMERAL_STORAGE_IN_MB);
37
40
  // In GB-second
38
41
  const diskSizeDollars = chargedDiskSize *
39
42
  Number(diskSizePrice) *
40
- (durationInMiliseconds / 1000 / 1024);
43
+ (durationInMilliseconds / 1000 / 1024);
41
44
  const invocationCost = Number(price_per_1_s_1.pricing[region]['Lambda Requests'].price) * lambdasInvoked;
42
45
  return Number((timeCostDollars + diskSizeDollars + invocationCost).toFixed(5));
43
46
  };
@@ -1,4 +1,5 @@
1
- import type { ChromiumOptions, LogLevel } from '@remotion/renderer';
1
+ import type { ChromiumOptions, LogLevel, ToOptions } from '@remotion/renderer';
2
+ import type { BrowserSafeApis } from '@remotion/renderer/client';
2
3
  import type { VideoConfig } from 'remotion';
3
4
  import type { AwsRegion } from '../client';
4
5
  export type GetCompositionsOnLambdaInput = {
@@ -15,7 +16,7 @@ export type GetCompositionsOnLambdaInput = {
15
16
  * @deprecated in favor of `logLevel`: true
16
17
  */
17
18
  dumpBrowserLogs?: boolean;
18
- };
19
+ } & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
19
20
  export type GetCompositionsOnLambdaOutput = VideoConfig[];
20
21
  /**
21
22
  * @description Returns the compositions from a serveUrl
@@ -30,4 +31,4 @@ export type GetCompositionsOnLambdaOutput = VideoConfig[];
30
31
  * @param params.chromiumOptions The options to pass to Chromium
31
32
  * @returns The compositions
32
33
  */
33
- export declare const getCompositionsOnLambda: ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, dumpBrowserLogs, }: GetCompositionsOnLambdaInput) => Promise<GetCompositionsOnLambdaOutput>;
34
+ export declare const getCompositionsOnLambda: ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, dumpBrowserLogs, offthreadVideoCacheSizeInBytes, }: GetCompositionsOnLambdaInput) => Promise<GetCompositionsOnLambdaOutput>;
@@ -18,7 +18,7 @@ const compress_props_1 = require("../shared/compress-props");
18
18
  * @param params.chromiumOptions The options to pass to Chromium
19
19
  * @returns The compositions
20
20
  */
21
- const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, dumpBrowserLogs, }) => {
21
+ const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, dumpBrowserLogs, offthreadVideoCacheSizeInBytes, }) => {
22
22
  var _a;
23
23
  const stringifiedInputProps = (0, compress_props_1.serializeOrThrow)(inputProps, 'input-props');
24
24
  const serializedInputProps = await (0, compress_props_1.compressInputProps)({
@@ -43,6 +43,7 @@ const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inpu
43
43
  timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
44
44
  version: version_1.VERSION,
45
45
  bucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
46
+ offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
46
47
  },
47
48
  region,
48
49
  receivedStreamingPayload: () => undefined,
@@ -1,5 +1,5 @@
1
1
  import type { LambdaStartPayload, LambdaStatusPayload } from '../defaults';
2
2
  import type { GetRenderProgressInput } from './get-render-progress';
3
3
  import type { RenderMediaOnLambdaInput } from './render-media-on-lambda';
4
- export declare const makeLambdaRenderMediaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, downloadBehavior, muted, overwrite, dumpBrowserLogs, jpegQuality, quality, }: RenderMediaOnLambdaInput) => Promise<LambdaStartPayload>;
4
+ export declare const makeLambdaRenderMediaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, x264Preset, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, downloadBehavior, muted, overwrite, dumpBrowserLogs, jpegQuality, quality, offthreadVideoCacheSizeInBytes, }: RenderMediaOnLambdaInput) => Promise<LambdaStartPayload>;
5
5
  export declare const getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, }: GetRenderProgressInput) => LambdaStatusPayload;
@@ -8,7 +8,7 @@ const validate_download_behavior_1 = require("../shared/validate-download-behavi
8
8
  const validate_frames_per_lambda_1 = require("../shared/validate-frames-per-lambda");
9
9
  const validate_lambda_codec_1 = require("../shared/validate-lambda-codec");
10
10
  const validate_serveurl_1 = require("../shared/validate-serveurl");
11
- const makeLambdaRenderMediaPayload = async ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, downloadBehavior, muted, overwrite, dumpBrowserLogs, jpegQuality, quality, }) => {
11
+ const makeLambdaRenderMediaPayload = async ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, x264Preset, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, downloadBehavior, muted, overwrite, dumpBrowserLogs, jpegQuality, quality, offthreadVideoCacheSizeInBytes, }) => {
12
12
  if (quality) {
13
13
  throw new Error('quality has been renamed to jpegQuality. Please rename the option.');
14
14
  }
@@ -41,6 +41,7 @@ const makeLambdaRenderMediaPayload = async ({ rendererFunctionName, frameRange,
41
41
  envVariables,
42
42
  pixelFormat,
43
43
  proResProfile,
44
+ x264Preset: x264Preset !== null && x264Preset !== void 0 ? x264Preset : null,
44
45
  jpegQuality,
45
46
  maxRetries: maxRetries !== null && maxRetries !== void 0 ? maxRetries : 1,
46
47
  privacy: privacy !== null && privacy !== void 0 ? privacy : 'public',
@@ -65,6 +66,7 @@ const makeLambdaRenderMediaPayload = async ({ rendererFunctionName, frameRange,
65
66
  bucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
66
67
  audioCodec: audioCodec !== null && audioCodec !== void 0 ? audioCodec : null,
67
68
  type: defaults_1.LambdaRoutines.start,
69
+ offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
68
70
  };
69
71
  };
70
72
  exports.makeLambdaRenderMediaPayload = makeLambdaRenderMediaPayload;
@@ -1,4 +1,5 @@
1
- import type { AudioCodec, ChromiumOptions, FrameRange, LogLevel, PixelFormat, ProResProfile, VideoImageFormat } from '@remotion/renderer';
1
+ import type { AudioCodec, ChromiumOptions, FrameRange, LogLevel, PixelFormat, ProResProfile, ToOptions, VideoImageFormat, X264Preset } from '@remotion/renderer';
2
+ import type { BrowserSafeApis } from '@remotion/renderer/client';
2
3
  import type { AwsRegion } from '../pricing/aws-regions';
3
4
  import type { OutNameInput, Privacy } from '../shared/constants';
4
5
  import type { DownloadBehavior } from '../shared/content-disposition-header';
@@ -15,6 +16,7 @@ export type RenderMediaOnLambdaInput = {
15
16
  envVariables?: Record<string, string>;
16
17
  pixelFormat?: PixelFormat;
17
18
  proResProfile?: ProResProfile;
19
+ x264Preset?: X264Preset;
18
20
  privacy?: Privacy;
19
21
  /**
20
22
  * @deprecated Renamed to `jpegQuality`
@@ -50,7 +52,7 @@ export type RenderMediaOnLambdaInput = {
50
52
  * @deprecated in favor of `logLevel`: true
51
53
  */
52
54
  dumpBrowserLogs?: boolean;
53
- };
55
+ } & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
54
56
  export type RenderMediaOnLambdaOutput = {
55
57
  renderId: string;
56
58
  bucketName: string;
@@ -1,4 +1,5 @@
1
- import type { ChromiumOptions, LogLevel, StillImageFormat } from '@remotion/renderer';
1
+ import type { ChromiumOptions, LogLevel, StillImageFormat, ToOptions } from '@remotion/renderer';
2
+ import type { BrowserSafeApis } from '@remotion/renderer/client';
2
3
  import type { AwsRegion } from '../pricing/aws-regions';
3
4
  import type { CostsInfo, OutNameInput, Privacy } from '../shared/constants';
4
5
  import type { DownloadBehavior } from '../shared/content-disposition-header';
@@ -35,7 +36,7 @@ export type RenderStillOnLambdaInput = {
35
36
  renderId: string;
36
37
  cloudWatchLogs: string;
37
38
  }) => void;
38
- };
39
+ } & Partial<ToOptions<typeof BrowserSafeApis.optionsMap.renderMediaOnLambda>>;
39
40
  export type RenderStillOnLambdaOutput = {
40
41
  estimatedPrice: CostsInfo;
41
42
  url: string;
@@ -60,4 +61,4 @@ export type RenderStillOnLambdaOutput = {
60
61
  * @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`
61
62
  * @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
62
63
  */
63
- 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, dumpBrowserLogs, onInit, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
64
+ 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, dumpBrowserLogs, onInit, offthreadVideoCacheSizeInBytes, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
@@ -22,7 +22,7 @@ const get_aws_urls_1 = require("../shared/get-aws-urls");
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, jpegQuality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, dumpBrowserLogs, onInit, }) => {
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, dumpBrowserLogs, onInit, offthreadVideoCacheSizeInBytes, }) => {
26
26
  var _a;
27
27
  if (quality) {
28
28
  throw new Error('The `quality` option is deprecated. Use `jpegQuality` instead.');
@@ -60,6 +60,7 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
60
60
  forceHeight: forceHeight !== null && forceHeight !== void 0 ? forceHeight : null,
61
61
  forceWidth: forceWidth !== null && forceWidth !== void 0 ? forceWidth : null,
62
62
  bucketName: forceBucketName !== null && forceBucketName !== void 0 ? forceBucketName : null,
63
+ offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
63
64
  },
64
65
  region,
65
66
  receivedStreamingPayload: (payload) => {
@@ -45,7 +45,9 @@ const functionsRmCommand = async (args) => {
45
45
  'Timeout: '.padEnd(LEFT_COL, ' ') + ' ' + info.timeoutInSeconds + 'sec',
46
46
  'Version: '.padEnd(LEFT_COL, ' ') + ' ' + info.version,
47
47
  ].join('\n'), true);
48
- await (0, confirm_1.confirmCli)({ delMessage: 'Delete? (Y/n)', allowForceFlag: true });
48
+ if (!(await (0, confirm_1.confirmCli)({ delMessage: 'Delete? (Y/n)', allowForceFlag: true }))) {
49
+ (0, quit_1.quit)(1);
50
+ }
49
51
  const output = cli_1.CliInternals.createOverwriteableCliOutput({
50
52
  quiet: cli_1.CliInternals.quietFlagProvided(),
51
53
  cancelSignal: null,
@@ -35,7 +35,9 @@ const functionsRmallCommand = async () => {
35
35
  'Timeout: '.padEnd(LEFT_COL, ' ') + ' ' + info.timeoutInSeconds + 'sec',
36
36
  'Version: '.padEnd(LEFT_COL, ' ') + ' ' + info.version,
37
37
  ].join('\n'), true);
38
- await (0, confirm_1.confirmCli)({ delMessage: 'Delete? (Y/n)', allowForceFlag: true });
38
+ if (!(await (0, confirm_1.confirmCli)({ delMessage: 'Delete? (Y/n)', allowForceFlag: true }))) {
39
+ continue;
40
+ }
39
41
  const output = cli_1.CliInternals.createOverwriteableCliOutput({
40
42
  quiet: cli_1.CliInternals.quietFlagProvided(),
41
43
  cancelSignal: null,
@@ -50,10 +50,12 @@ const quotasIncreaseCommand = async () => {
50
50
  }
51
51
  const newLimit = Math.floor(concurrencyCurrent / 5000) * 5000 + 5000;
52
52
  log_1.Log.info(`Sending request to AWS to increase concurrency limit from ${concurrencyCurrent} to ${newLimit}.`);
53
- await (0, confirm_1.confirmCli)({
53
+ if (!(await (0, confirm_1.confirmCli)({
54
54
  allowForceFlag: true,
55
55
  delMessage: 'Send? (Y/n)',
56
- });
56
+ }))) {
57
+ (0, quit_1.quit)(1);
58
+ }
57
59
  try {
58
60
  await (0, aws_clients_1.getServiceQuotasClient)(region).send(new client_service_quotas_1.RequestServiceQuotaIncreaseCommand({
59
61
  QuotaCode: defaults_1.LAMBDA_CONCURRENCY_LIMIT_QUOTA,
@@ -32,7 +32,7 @@ const renderCommand = async (args, remotionRoot) => {
32
32
  (0, quit_1.quit)(1);
33
33
  }
34
34
  const region = (0, get_aws_region_1.getAwsRegion)();
35
- const { chromiumOptions, crf, envVariables, frameRange, inputProps, logLevel, pixelFormat, proResProfile, puppeteerTimeout, jpegQuality, scale, everyNthFrame, numberOfGifLoops, muted, overwrite, audioBitrate, videoBitrate, height, width, browserExecutable, port, } = await cli_1.CliInternals.getCliOptions({
35
+ const { chromiumOptions, crf, envVariables, frameRange, inputProps, logLevel, pixelFormat, proResProfile, puppeteerTimeout, jpegQuality, scale, everyNthFrame, numberOfGifLoops, muted, overwrite, audioBitrate, videoBitrate, height, width, browserExecutable, port, offthreadVideoCacheSizeInBytes, } = await cli_1.CliInternals.getCliOptions({
36
36
  type: 'series',
37
37
  isLambda: true,
38
38
  remotionRoot,
@@ -51,6 +51,7 @@ const renderCommand = async (args, remotionRoot) => {
51
51
  remotionRoot,
52
52
  logLevel,
53
53
  webpackConfigOrServeUrl: serveUrl,
54
+ offthreadVideoCacheSizeInBytes,
54
55
  });
55
56
  const { compositionId } = await cli_1.CliInternals.getCompositionWithDimensionOverride({
56
57
  args: args.slice(1),
@@ -72,6 +73,7 @@ const renderCommand = async (args, remotionRoot) => {
72
73
  logLevel,
73
74
  width,
74
75
  server,
76
+ offthreadVideoCacheSizeInBytes,
75
77
  });
76
78
  composition = compositionId;
77
79
  }
@@ -282,7 +284,7 @@ const renderCommand = async (args, remotionRoot) => {
282
284
  await cli_1.CliInternals.handleCommonError(errorWithStackFrame, logLevel);
283
285
  }
284
286
  log_1.Log.info();
285
- log_1.Log.verbose(`Accrued costs until error was thrown: ${newStatus.costs.displayCost}.`);
287
+ log_1.Log.info(`Accrued costs until error was thrown: ${newStatus.costs.displayCost}.`);
286
288
  log_1.Log.info('This is an estimate and continuing Lambda functions may incur additional costs.');
287
289
  (0, quit_1.quit)(1);
288
290
  }
@@ -33,10 +33,12 @@ const sitesRmSubcommand = async (args) => {
33
33
  log_1.Log.error(`No site ${siteName.trim()} was found in your bucket ${bucketName}.`);
34
34
  return (0, quit_1.quit)(1);
35
35
  }
36
- await (0, confirm_1.confirmCli)({
36
+ if (!(await (0, confirm_1.confirmCli)({
37
37
  delMessage: `Site ${site.id} in bucket ${site.bucketName} (${cli_1.CliInternals.formatBytes(site.sizeInBytes)}): Delete? (Y/n)`,
38
38
  allowForceFlag: true,
39
- });
39
+ }))) {
40
+ (0, quit_1.quit)(1);
41
+ }
40
42
  const { totalSizeInBytes: totalSize } = await (0, delete_site_1.deleteSite)({
41
43
  bucketName,
42
44
  siteName,
@@ -18,10 +18,12 @@ const sitesRmallSubcommand = async () => {
18
18
  });
19
19
  const bucketName = (_a = args_1.parsedLambdaCli['force-bucket-name']) !== null && _a !== void 0 ? _a : (await (0, get_or_create_bucket_1.getOrCreateBucket)({ region })).bucketName;
20
20
  for (const site of deployedSites.sites) {
21
- await (0, confirm_1.confirmCli)({
21
+ if (!(await (0, confirm_1.confirmCli)({
22
22
  delMessage: `Site ${site.id} in bucket ${site.bucketName} (${cli_1.CliInternals.formatBytes(site.sizeInBytes)}): Delete? (Y/n)`,
23
23
  allowForceFlag: true,
24
- });
24
+ }))) {
25
+ continue;
26
+ }
25
27
  const { totalSizeInBytes: totalSize } = await (0, delete_site_1.deleteSite)({
26
28
  bucketName,
27
29
  siteName: site.id,
@@ -27,7 +27,7 @@ const stillCommand = async (args, remotionRoot) => {
27
27
  log_1.Log.info(`${constants_1.BINARY_NAME} ${exports.STILL_COMMAND} <serve-url> <composition-id> [output-location]`);
28
28
  (0, quit_1.quit)(1);
29
29
  }
30
- const { chromiumOptions, envVariables, inputProps, logLevel, puppeteerTimeout, jpegQuality, stillFrame, scale, height, width, browserExecutable, port, } = await cli_1.CliInternals.getCliOptions({
30
+ const { chromiumOptions, envVariables, inputProps, logLevel, puppeteerTimeout, jpegQuality, stillFrame, scale, height, width, browserExecutable, port, offthreadVideoCacheSizeInBytes, } = await cli_1.CliInternals.getCliOptions({
31
31
  type: 'still',
32
32
  isLambda: true,
33
33
  remotionRoot,
@@ -47,6 +47,7 @@ const stillCommand = async (args, remotionRoot) => {
47
47
  remotionRoot,
48
48
  logLevel,
49
49
  webpackConfigOrServeUrl: serveUrl,
50
+ offthreadVideoCacheSizeInBytes,
50
51
  });
51
52
  const { compositionId } = await cli_1.CliInternals.getCompositionWithDimensionOverride({
52
53
  args: args.slice(1),
@@ -68,6 +69,7 @@ const stillCommand = async (args, remotionRoot) => {
68
69
  height,
69
70
  width,
70
71
  server,
72
+ offthreadVideoCacheSizeInBytes,
71
73
  });
72
74
  composition = compositionId;
73
75
  }
@@ -1,4 +1,4 @@
1
1
  export declare const confirmCli: ({ delMessage, allowForceFlag, }: {
2
2
  delMessage: string;
3
3
  allowForceFlag: boolean;
4
- }) => Promise<void>;
4
+ }) => Promise<boolean>;
@@ -2,15 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.confirmCli = void 0;
4
4
  const args_1 = require("../args");
5
- const quit_1 = require("./quit");
6
5
  const yes_or_no_1 = require("./yes-or-no");
7
6
  const confirmCli = async ({ delMessage, allowForceFlag, }) => {
8
7
  if (allowForceFlag && args_1.forceFlagProvided) {
9
- return;
8
+ return true;
10
9
  }
11
10
  const result = await (0, yes_or_no_1.yesOrNo)({ question: delMessage, defaultValue: true });
12
- if (result === false) {
13
- (0, quit_1.quit)(1);
14
- }
11
+ return result;
15
12
  };
16
13
  exports.confirmCli = confirmCli;
package/dist/cli/log.d.ts CHANGED
@@ -2,24 +2,24 @@ 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
  } & {
7
7
  tag?: string | undefined;
8
8
  }, message?: any, ...optionalParams: any[]) => void;
9
9
  info: (message?: any, ...optionalParams: any[]) => void;
10
10
  infoAdvanced: (options: {
11
11
  indent: boolean;
12
- logLevel: "error" | "verbose" | "info" | "warn";
12
+ logLevel: "verbose" | "info" | "warn" | "error";
13
13
  }, message?: any, ...optionalParams: any[]) => void;
14
14
  warn: (message?: any, ...optionalParams: any[]) => void;
15
15
  warnAdvanced: (options: {
16
16
  indent: boolean;
17
- logLevel: "error" | "verbose" | "info" | "warn";
17
+ logLevel: "verbose" | "info" | "warn" | "error";
18
18
  }, message?: any, ...optionalParams: any[]) => void;
19
19
  error: (message?: any, ...optionalParams: any[]) => void;
20
20
  errorAdvanced: (options: {
21
21
  indent: boolean;
22
- logLevel: "error" | "verbose" | "info" | "warn";
22
+ logLevel: "verbose" | "info" | "warn" | "error";
23
23
  } & {
24
24
  tag?: string | undefined;
25
25
  }, message?: any, ...optionalParams: any[]) => void;
@@ -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
  };
@@ -52,6 +52,7 @@ const compositionsHandler = async (lambdaParams, options) => {
52
52
  indent: false,
53
53
  browserExecutable: null,
54
54
  onBrowserLog: null,
55
+ offthreadVideoCacheSizeInBytes: lambdaParams.offthreadVideoCacheSizeInBytes,
55
56
  });
56
57
  return Promise.resolve({
57
58
  compositions,
@@ -29,7 +29,7 @@ const estimatePriceFromBucket = ({ contents, renderMetadata, memorySizeInMb, out
29
29
  .reduce((a, b) => a + b, 0);
30
30
  const accruedSoFar = Number((0, estimate_price_1.estimatePrice)({
31
31
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
32
- durationInMiliseconds: (0, calculate_chunk_times_1.calculateChunkTimes)({
32
+ durationInMilliseconds: (0, calculate_chunk_times_1.calculateChunkTimes)({
33
33
  contents,
34
34
  renderId: renderMetadata.renderId,
35
35
  type: 'combined-time-for-cost-calculation',
@@ -16,7 +16,7 @@ const createPostRenderData = ({ renderId, region, memorySizeInMb, renderMetadata
16
16
  .map((p) => p.rendered - p.start + get_most_expensive_chunks_1.OVERHEAD_TIME_PER_LAMBDA)
17
17
  .reduce((a, b) => a + b);
18
18
  const cost = (0, estimate_price_1.estimatePrice)({
19
- durationInMiliseconds: times,
19
+ durationInMilliseconds: times,
20
20
  memorySizeInMb,
21
21
  region,
22
22
  lambdasInvoked: renderMetadata.estimatedTotalLambdaInvokations,
@@ -1 +1 @@
1
- export declare const getCurrentRegionInFunction: () => "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-north-1" | "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "ap-south-1" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ca-central-1" | "sa-east-1" | "eu-south-1" | "af-south-1" | "ap-east-1" | "me-south-1";
1
+ export declare const getCurrentRegionInFunction: () => "eu-central-1" | "eu-west-1" | "eu-west-2" | "eu-west-3" | "eu-south-1" | "eu-north-1" | "us-east-1" | "us-east-2" | "us-west-1" | "us-west-2" | "af-south-1" | "ap-south-1" | "ap-east-1" | "ap-southeast-1" | "ap-southeast-2" | "ap-northeast-1" | "ap-northeast-2" | "ap-northeast-3" | "ca-central-1" | "me-south-1" | "sa-east-1";
@@ -4,16 +4,16 @@ declare const streamingPayloadSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObje
4
4
  type: z.ZodLiteral<"render-id-determined">;
5
5
  renderId: z.ZodString;
6
6
  }, "strip", z.ZodTypeAny, {
7
- renderId: string;
8
7
  type: "render-id-determined";
9
- }, {
10
8
  renderId: string;
9
+ }, {
11
10
  type: "render-id-determined";
11
+ renderId: string;
12
12
  }>]>;
13
13
  export type StreamingPayloads = z.infer<typeof streamingPayloadSchema>;
14
14
  export declare const isStreamingPayload: (str: string) => false | {
15
- renderId: string;
16
15
  type: "render-id-determined";
16
+ renderId: string;
17
17
  };
18
18
  export declare const sendProgressEvent: (responseStream: ResponseStream, payload: StreamingPayloads) => void;
19
19
  export {};
@@ -14,6 +14,7 @@ type ValidateCompositionOptions = {
14
14
  forceWidth: number | null;
15
15
  logLevel: LogLevel;
16
16
  server: RemotionServer | undefined;
17
+ offthreadVideoCacheSizeInBytes: number | null;
17
18
  };
18
- export declare const validateComposition: ({ serveUrl, composition, browserInstance, serializedInputPropsWithCustomSchema, envVariables, timeoutInMilliseconds, chromiumOptions, port, forceHeight, forceWidth, logLevel, server, }: ValidateCompositionOptions) => Promise<VideoConfig>;
19
+ export declare const validateComposition: ({ serveUrl, composition, browserInstance, serializedInputPropsWithCustomSchema, envVariables, timeoutInMilliseconds, chromiumOptions, port, forceHeight, forceWidth, logLevel, server, offthreadVideoCacheSizeInBytes, }: ValidateCompositionOptions) => Promise<VideoConfig>;
19
20
  export {};
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validateComposition = void 0;
4
4
  const renderer_1 = require("@remotion/renderer");
5
5
  const get_chromium_executable_path_1 = require("./get-chromium-executable-path");
6
- const validateComposition = async ({ serveUrl, composition, browserInstance, serializedInputPropsWithCustomSchema, envVariables, timeoutInMilliseconds, chromiumOptions, port, forceHeight, forceWidth, logLevel, server, }) => {
6
+ const validateComposition = async ({ serveUrl, composition, browserInstance, serializedInputPropsWithCustomSchema, envVariables, timeoutInMilliseconds, chromiumOptions, port, forceHeight, forceWidth, logLevel, server, offthreadVideoCacheSizeInBytes, }) => {
7
7
  const { metadata: comp } = await renderer_1.RenderInternals.internalSelectComposition({
8
8
  id: composition,
9
9
  puppeteerInstance: browserInstance,
@@ -18,6 +18,7 @@ const validateComposition = async ({ serveUrl, composition, browserInstance, ser
18
18
  indent: false,
19
19
  onBrowserLog: null,
20
20
  server,
21
+ offthreadVideoCacheSizeInBytes,
21
22
  });
22
23
  return {
23
24
  ...comp,
@@ -112,6 +112,7 @@ const innerLaunchHandler = async (params, options) => {
112
112
  forceWidth: params.forceWidth,
113
113
  logLevel: params.logLevel,
114
114
  server: undefined,
115
+ offthreadVideoCacheSizeInBytes: params.offthreadVideoCacheSizeInBytes,
115
116
  });
116
117
  renderer_1.RenderInternals.Log.info('Composition validated, resolved props', comp.props);
117
118
  remotion_1.Internals.validateDurationInFrames(comp.durationInFrames, {
@@ -181,6 +182,7 @@ const innerLaunchHandler = async (params, options) => {
181
182
  envVariables: params.envVariables,
182
183
  pixelFormat: params.pixelFormat,
183
184
  proResProfile: params.proResProfile,
185
+ x264Preset: params.x264Preset,
184
186
  jpegQuality: params.jpegQuality,
185
187
  privacy: params.privacy,
186
188
  logLevel: (_a = params.logLevel) !== null && _a !== void 0 ? _a : 'info',
@@ -197,6 +199,7 @@ const innerLaunchHandler = async (params, options) => {
197
199
  version: version_1.VERSION,
198
200
  },
199
201
  resolvedProps: serializedResolvedProps,
202
+ offthreadVideoCacheSizeInBytes: params.offthreadVideoCacheSizeInBytes,
200
203
  };
201
204
  return payload;
202
205
  });
@@ -68,7 +68,7 @@ const renderHandler = async (params, options, logs) => {
68
68
  const resolvedProps = await resolvedPropsPromise;
69
69
  const serializedInputPropsWithCustomSchema = await inputPropsPromise;
70
70
  await new Promise((resolve, reject) => {
71
- var _a, _b, _c, _d;
71
+ var _a, _b, _c, _d, _e;
72
72
  renderer_1.RenderInternals.internalRenderMedia({
73
73
  composition: {
74
74
  id: params.composition,
@@ -128,6 +128,7 @@ const renderHandler = async (params, options, logs) => {
128
128
  crf: (_c = params.crf) !== null && _c !== void 0 ? _c : null,
129
129
  pixelFormat: (_d = params.pixelFormat) !== null && _d !== void 0 ? _d : renderer_1.RenderInternals.DEFAULT_PIXEL_FORMAT,
130
130
  proResProfile: params.proResProfile,
131
+ x264Preset: (_e = params.x264Preset) !== null && _e !== void 0 ? _e : undefined,
131
132
  onDownload: (0, on_downloads_logger_1.onDownloadsHelper)(),
132
133
  overwrite: false,
133
134
  chromiumOptions: params.chromiumOptions,
@@ -153,6 +154,7 @@ const renderHandler = async (params, options, logs) => {
153
154
  onCtrlCExit: () => undefined,
154
155
  server: undefined,
155
156
  serializedResolvedPropsWithCustomSchema: resolvedProps,
157
+ offthreadVideoCacheSizeInBytes: params.offthreadVideoCacheSizeInBytes,
156
158
  })
157
159
  .then(({ slowestFrames }) => {
158
160
  console.log(`Slowest frames:`);
@@ -55,6 +55,7 @@ const startHandler = async (params, options) => {
55
55
  envVariables: params.envVariables,
56
56
  pixelFormat: params.pixelFormat,
57
57
  proResProfile: params.proResProfile,
58
+ x264Preset: params.x264Preset,
58
59
  jpegQuality: params.jpegQuality,
59
60
  maxRetries: params.maxRetries,
60
61
  privacy: params.privacy,
@@ -77,6 +78,7 @@ const startHandler = async (params, options) => {
77
78
  forceWidth: params.forceWidth,
78
79
  rendererFunctionName: params.rendererFunctionName,
79
80
  audioCodec: params.audioCodec,
81
+ offthreadVideoCacheSizeInBytes: params.offthreadVideoCacheSizeInBytes,
80
82
  };
81
83
  // Don't replace with callLambda(), we want to return before the render is snone
82
84
  await (0, aws_clients_1.getLambdaClient)((0, get_current_region_1.getCurrentRegionInFunction)()).send(new client_lambda_1.InvokeCommand({
@@ -73,6 +73,7 @@ const innerStillHandler = async ({ params: lambdaParams, expectedBucketOwner, re
73
73
  remotionRoot: process.cwd(),
74
74
  logLevel: lambdaParams.logLevel,
75
75
  webpackConfigOrServeUrl: serveUrl,
76
+ offthreadVideoCacheSizeInBytes: lambdaParams.offthreadVideoCacheSizeInBytes,
76
77
  });
77
78
  const composition = await (0, validate_composition_1.validateComposition)({
78
79
  serveUrl,
@@ -87,6 +88,7 @@ const innerStillHandler = async ({ params: lambdaParams, expectedBucketOwner, re
87
88
  forceWidth: lambdaParams.forceWidth,
88
89
  logLevel: lambdaParams.logLevel,
89
90
  server,
91
+ offthreadVideoCacheSizeInBytes: lambdaParams.offthreadVideoCacheSizeInBytes,
90
92
  });
91
93
  const renderMetadata = {
92
94
  startedDate: Date.now(),
@@ -151,6 +153,7 @@ const innerStillHandler = async ({ params: lambdaParams, expectedBucketOwner, re
151
153
  staticBase: null,
152
154
  data: composition.props,
153
155
  }).serializedString,
156
+ offthreadVideoCacheSizeInBytes: lambdaParams.offthreadVideoCacheSizeInBytes,
154
157
  });
155
158
  const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName, (0, expected_out_name_1.getCredentialsFromOutName)(lambdaParams.outName));
156
159
  const { size } = await node_fs_1.default.promises.stat(outputPath);
@@ -174,7 +177,7 @@ const innerStillHandler = async ({ params: lambdaParams, expectedBucketOwner, re
174
177
  server.closeServer(true),
175
178
  ]);
176
179
  const estimatedPrice = (0, estimate_price_1.estimatePrice)({
177
- durationInMiliseconds: Date.now() - start + 100,
180
+ durationInMilliseconds: Date.now() - start + 100,
178
181
  memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
179
182
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
180
183
  lambdasInvoked: 1,
package/dist/index.d.ts CHANGED
@@ -47,7 +47,7 @@ declare const renderMediaOnLambda: (input: RenderMediaOnLambdaInput) => Promise<
47
47
  /**
48
48
  * @deprecated Import this from `@remotion/lambda/client` instead
49
49
  */
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, dumpBrowserLogs, onInit, }: 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, dumpBrowserLogs, onInit, offthreadVideoCacheSizeInBytes, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
51
51
  /**
52
52
  * @deprecated Import this from `@remotion/lambda/client` instead
53
53
  */
@@ -1,5 +1,5 @@
1
1
  export declare const LambdaInternals: {
2
2
  executeCommand: (args: string[], remotionRoot: string) => Promise<void>;
3
- makeLambdaRenderMediaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, downloadBehavior, muted, overwrite, dumpBrowserLogs, jpegQuality, quality, }: import(".").RenderMediaOnLambdaInput) => Promise<import("./defaults").LambdaStartPayload>;
3
+ makeLambdaRenderMediaPayload: ({ rendererFunctionName, frameRange, framesPerLambda, forceBucketName: bucketName, codec, composition, serveUrl, imageFormat, inputProps, region, crf, envVariables, pixelFormat, proResProfile, x264Preset, maxRetries, privacy, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, everyNthFrame, numberOfGifLoops, audioBitrate, concurrencyPerLambda, audioCodec, forceHeight, forceWidth, webhook, videoBitrate, downloadBehavior, muted, overwrite, dumpBrowserLogs, jpegQuality, quality, offthreadVideoCacheSizeInBytes, }: import(".").RenderMediaOnLambdaInput) => Promise<import("./defaults").LambdaStartPayload>;
4
4
  getRenderProgressPayload: ({ bucketName, renderId, s3OutputProvider, }: import(".").GetRenderProgressInput) => import("./defaults").LambdaStatusPayload;
5
5
  };
@@ -1,3 +1,3 @@
1
1
  export declare const DEFAULT_AWS_REGIONS: readonly ["eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "eu-north-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ca-central-1", "sa-east-1"];
2
2
  export declare const AWS_REGIONS: readonly ["eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "eu-south-1", "eu-north-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "af-south-1", "ap-south-1", "ap-east-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ca-central-1", "me-south-1", "sa-east-1"];
3
- export type AwsRegion = typeof AWS_REGIONS[number];
3
+ export type AwsRegion = (typeof AWS_REGIONS)[number];
@@ -1,4 +1,4 @@
1
- import type { AudioCodec, ChromiumOptions, Codec, FrameRange, LogLevel, PixelFormat, ProResProfile, StillImageFormat, VideoImageFormat } from '@remotion/renderer';
1
+ import type { AudioCodec, ChromiumOptions, Codec, FrameRange, LogLevel, PixelFormat, ProResProfile, StillImageFormat, VideoImageFormat, X264Preset } from '@remotion/renderer';
2
2
  import type { VideoConfig } from 'remotion';
3
3
  import type { ChunkRetry } from '../functions/helpers/get-retry-stats';
4
4
  import type { EnhancedErrorInfo } from '../functions/helpers/write-lambda-error';
@@ -120,6 +120,7 @@ export type LambdaStartPayload = {
120
120
  envVariables: Record<string, string> | undefined;
121
121
  pixelFormat: PixelFormat | undefined;
122
122
  proResProfile: ProResProfile | undefined;
123
+ x264Preset: X264Preset | null;
123
124
  jpegQuality: number | undefined;
124
125
  maxRetries: number;
125
126
  privacy: Privacy;
@@ -142,6 +143,7 @@ export type LambdaStartPayload = {
142
143
  forceHeight: number | null;
143
144
  forceWidth: number | null;
144
145
  bucketName: string | null;
146
+ offthreadVideoCacheSizeInBytes: number | null;
145
147
  };
146
148
  export type LambdaStatusPayload = {
147
149
  type: LambdaRoutines.status;
@@ -171,6 +173,7 @@ export type LambdaPayloads = {
171
173
  envVariables: Record<string, string> | undefined;
172
174
  pixelFormat: PixelFormat | undefined;
173
175
  proResProfile: ProResProfile | undefined;
176
+ x264Preset: X264Preset | null;
174
177
  jpegQuality: number | undefined;
175
178
  maxRetries: number;
176
179
  privacy: Privacy;
@@ -191,6 +194,7 @@ export type LambdaPayloads = {
191
194
  webhook: WebhookOption;
192
195
  forceHeight: number | null;
193
196
  forceWidth: number | null;
197
+ offthreadVideoCacheSizeInBytes: number | null;
194
198
  };
195
199
  status: LambdaStatusPayload;
196
200
  renderer: {
@@ -212,6 +216,7 @@ export type LambdaPayloads = {
212
216
  codec: LambdaCodec;
213
217
  crf: number | undefined;
214
218
  proResProfile: ProResProfile | undefined;
219
+ x264Preset: X264Preset | null;
215
220
  pixelFormat: PixelFormat | undefined;
216
221
  jpegQuality: number | undefined;
217
222
  envVariables: Record<string, string> | undefined;
@@ -229,6 +234,7 @@ export type LambdaPayloads = {
229
234
  launchFunctionConfig: {
230
235
  version: string;
231
236
  };
237
+ offthreadVideoCacheSizeInBytes: number | null;
232
238
  };
233
239
  still: {
234
240
  type: LambdaRoutines.still;
@@ -252,6 +258,7 @@ export type LambdaPayloads = {
252
258
  forceHeight: number | null;
253
259
  forceWidth: number | null;
254
260
  bucketName: string | null;
261
+ offthreadVideoCacheSizeInBytes: number | null;
255
262
  };
256
263
  compositions: {
257
264
  type: LambdaRoutines.compositions;
@@ -263,6 +270,7 @@ export type LambdaPayloads = {
263
270
  timeoutInMilliseconds: number;
264
271
  serveUrl: string;
265
272
  bucketName: string | null;
273
+ offthreadVideoCacheSizeInBytes: number | null;
266
274
  };
267
275
  };
268
276
  export type LambdaPayload = LambdaPayloads[LambdaRoutines];
@@ -0,0 +1,8 @@
1
+ import type { AwsRegion } from '../client';
2
+ import type { SerializedInputProps } from './constants';
3
+ export declare const deserializeInputProps: ({ serialized, region, bucketName, expectedBucketOwner, }: {
4
+ serialized: SerializedInputProps;
5
+ region: AwsRegion;
6
+ bucketName: string;
7
+ expectedBucketOwner: string;
8
+ }) => Promise<Record<string, unknown>>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserializeInputProps = void 0;
4
+ const io_1 = require("../functions/helpers/io");
5
+ const constants_1 = require("./constants");
6
+ const stream_to_string_1 = require("./stream-to-string");
7
+ const deserializeInputProps = async ({ serialized, region, bucketName, expectedBucketOwner, }) => {
8
+ if (serialized.type === 'payload') {
9
+ return JSON.parse(serialized.payload);
10
+ }
11
+ try {
12
+ const response = await (0, io_1.lambdaReadFile)({
13
+ bucketName,
14
+ expectedBucketOwner,
15
+ key: (0, constants_1.inputPropsKey)(serialized.hash),
16
+ region,
17
+ });
18
+ const body = await (0, stream_to_string_1.streamToString)(response);
19
+ const payload = JSON.parse(body);
20
+ return payload;
21
+ }
22
+ catch (err) {
23
+ throw new Error(`Failed to parse input props that were serialized: ${err.stack}`);
24
+ }
25
+ };
26
+ exports.deserializeInputProps = deserializeInputProps;
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import https from 'https';
4
2
  import http from 'node:http';
5
3
  import type { EnhancedErrorInfo } from '../functions/helpers/write-lambda-error';
@@ -45,10 +45,12 @@ async function readDirectory({ dir, etags, originalDir, }) {
45
45
  // eslint-disable-next-line no-lonely-if
46
46
  if (fs.lstatSync(filePath).isSymbolicLink()) {
47
47
  const realPath = fs.realpathSync(filePath);
48
- etags[path.relative(originalDir, filePath)] = await (0, get_etag_1.getEtagOfFile)(realPath);
48
+ etags[path.relative(originalDir, filePath)] =
49
+ await (0, get_etag_1.getEtagOfFile)(realPath);
49
50
  }
50
51
  else {
51
- etags[path.relative(originalDir, filePath)] = await (0, get_etag_1.getEtagOfFile)(filePath);
52
+ etags[path.relative(originalDir, filePath)] =
53
+ await (0, get_etag_1.getEtagOfFile)(filePath);
52
54
  }
53
55
  }
54
56
  // Return the list of files with their etags and file names
@@ -0,0 +1,14 @@
1
+ import type { AwsRegion } from '../client';
2
+ import type { SerializedInputProps } from './constants';
3
+ export declare const serializeInputProps: ({ inputProps, region, type, userSpecifiedBucketName, }: {
4
+ inputProps: Record<string, unknown>;
5
+ region: AwsRegion;
6
+ type: 'still' | 'video-or-audio';
7
+ userSpecifiedBucketName: string | null;
8
+ }) => Promise<SerializedInputProps>;
9
+ export declare const deserializeInputProps: ({ serialized, region, bucketName, expectedBucketOwner, }: {
10
+ serialized: SerializedInputProps;
11
+ region: AwsRegion;
12
+ bucketName: string;
13
+ expectedBucketOwner: string;
14
+ }) => Promise<Record<string, unknown>>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deserializeInputProps = exports.serializeInputProps = void 0;
4
+ const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
5
+ const io_1 = require("../functions/helpers/io");
6
+ const constants_1 = require("./constants");
7
+ const random_hash_1 = require("./random-hash");
8
+ const stream_to_string_1 = require("./stream-to-string");
9
+ const serializeInputProps = async ({ inputProps, region, type, userSpecifiedBucketName, }) => {
10
+ try {
11
+ const payload = JSON.stringify(inputProps);
12
+ const hash = (0, random_hash_1.randomHash)();
13
+ const MAX_INLINE_PAYLOAD_SIZE = type === 'still' ? 5000000 : 200000;
14
+ if (payload.length > MAX_INLINE_PAYLOAD_SIZE) {
15
+ console.warn(`Warning: inputProps are over ${Math.round(MAX_INLINE_PAYLOAD_SIZE / 1000)}KB (${Math.ceil(payload.length / 1024)}KB) in size. Uploading them to S3 to circumvent AWS Lambda payload size.`);
16
+ const bucketName = userSpecifiedBucketName !== null && userSpecifiedBucketName !== void 0 ? userSpecifiedBucketName : (await (0, get_or_create_bucket_1.getOrCreateBucket)({
17
+ region,
18
+ })).bucketName;
19
+ await (0, io_1.lambdaWriteFile)({
20
+ body: payload,
21
+ bucketName,
22
+ region,
23
+ customCredentials: null,
24
+ downloadBehavior: null,
25
+ expectedBucketOwner: null,
26
+ key: (0, constants_1.inputPropsKey)(hash),
27
+ privacy: 'public',
28
+ });
29
+ return {
30
+ type: 'bucket-url',
31
+ hash,
32
+ };
33
+ }
34
+ return {
35
+ type: 'payload',
36
+ payload,
37
+ };
38
+ }
39
+ catch (err) {
40
+ throw new Error('Error serializing inputProps. Check it has no circular references or reduce the size if the object is big.');
41
+ }
42
+ };
43
+ exports.serializeInputProps = serializeInputProps;
44
+ const deserializeInputProps = async ({ serialized, region, bucketName, expectedBucketOwner, }) => {
45
+ if (serialized.type === 'payload') {
46
+ return JSON.parse(serialized.payload);
47
+ }
48
+ try {
49
+ const response = await (0, io_1.lambdaReadFile)({
50
+ bucketName,
51
+ expectedBucketOwner,
52
+ key: (0, constants_1.inputPropsKey)(serialized.hash),
53
+ region,
54
+ });
55
+ const body = await (0, stream_to_string_1.streamToString)(response);
56
+ const payload = JSON.parse(body);
57
+ return payload;
58
+ }
59
+ catch (err) {
60
+ throw new Error(`Failed to parse input props that were serialized: ${err.stack}`);
61
+ }
62
+ };
63
+ exports.deserializeInputProps = deserializeInputProps;
@@ -1,4 +1,4 @@
1
1
  declare const lambdaCodecs: readonly ["h264", "vp8", "vp9", "mp3", "aac", "wav", "gif", "prores"];
2
- export type LambdaCodec = typeof lambdaCodecs[number];
2
+ export type LambdaCodec = (typeof lambdaCodecs)[number];
3
3
  export declare const validateLambdaCodec: (codec: unknown) => LambdaCodec;
4
4
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "4.0.21",
3
+ "version": "4.0.23",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -26,10 +26,10 @@
26
26
  "aws-policies": "^1.0.1",
27
27
  "mime-types": "2.1.34",
28
28
  "zod": "3.21.4",
29
- "@remotion/bundler": "4.0.21",
30
- "@remotion/cli": "4.0.21",
31
- "remotion": "4.0.21",
32
- "@remotion/renderer": "4.0.21"
29
+ "@remotion/bundler": "4.0.23",
30
+ "remotion": "4.0.23",
31
+ "@remotion/renderer": "4.0.23",
32
+ "@remotion/cli": "4.0.23"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@jonny/eslint-config": "3.0.266",
@@ -38,16 +38,16 @@
38
38
  "@types/node": "18.14.6",
39
39
  "@types/prompt": "^1.1.0",
40
40
  "eslint": "8.42.0",
41
- "prettier": "^2.4.1",
41
+ "prettier": "3.0.2",
42
42
  "prettier-plugin-organize-imports": "^3.2.2",
43
43
  "ts-node": "^10.8.0",
44
44
  "vitest": "0.31.1",
45
45
  "zip-lib": "^0.7.2",
46
- "@remotion/bundler": "4.0.21",
47
- "@remotion/compositor-linux-arm64-gnu": "4.0.21"
46
+ "@remotion/bundler": "4.0.23",
47
+ "@remotion/compositor-linux-arm64-gnu": "4.0.23"
48
48
  },
49
49
  "peerDependencies": {
50
- "@remotion/bundler": "4.0.21"
50
+ "@remotion/bundler": "4.0.23"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public"
Binary file