@remotion/lambda 3.3.41 → 3.3.42

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 (40) hide show
  1. package/dist/api/deploy-site.d.ts +1 -0
  2. package/dist/api/deploy-site.js +3 -1
  3. package/dist/api/get-compositions-on-lambda.d.ts +2 -1
  4. package/dist/api/get-compositions-on-lambda.js +3 -1
  5. package/dist/api/get-or-create-bucket.js +1 -1
  6. package/dist/api/get-sites.d.ts +1 -0
  7. package/dist/api/presign-url.d.ts +3 -4
  8. package/dist/api/presign-url.js +2 -2
  9. package/dist/api/render-media-on-lambda.d.ts +5 -3
  10. package/dist/api/render-media-on-lambda.js +4 -1
  11. package/dist/api/render-still-on-lambda.d.ts +2 -1
  12. package/dist/api/render-still-on-lambda.js +3 -1
  13. package/dist/cli/args.d.ts +1 -0
  14. package/dist/cli/commands/compositions/index.js +2 -0
  15. package/dist/cli/commands/render/render.js +2 -0
  16. package/dist/cli/commands/sites/create.js +5 -4
  17. package/dist/cli/commands/sites/rm.js +6 -16
  18. package/dist/cli/commands/sites/rmall.js +5 -16
  19. package/dist/client.d.ts +5 -2
  20. package/dist/client.js +5 -1
  21. package/dist/functions/compositions.js +5 -5
  22. package/dist/functions/helpers/concat-videos.d.ts +3 -2
  23. package/dist/functions/helpers/concat-videos.js +3 -2
  24. package/dist/functions/helpers/expected-out-name.js +2 -2
  25. package/dist/functions/launch.js +3 -1
  26. package/dist/functions/renderer.js +9 -1
  27. package/dist/functions/start.js +5 -4
  28. package/dist/functions/still.js +11 -9
  29. package/dist/index.d.ts +10 -4
  30. package/dist/index.js +10 -2
  31. package/dist/shared/constants.d.ts +7 -1
  32. package/dist/shared/serialize-input-props.d.ts +2 -1
  33. package/dist/shared/serialize-input-props.js +3 -3
  34. package/dist/shared/validate-lambda-codec.d.ts +1 -1
  35. package/dist/shared/validate-lambda-codec.js +1 -0
  36. package/dist/shared/validate-outname.d.ts +2 -2
  37. package/dist/shared/validate-outname.js +7 -2
  38. package/package.json +8 -8
  39. package/remotionlambda-arm64.zip +0 -0
  40. package/remotionlambda-x64.zip +0 -0
@@ -13,6 +13,7 @@ export declare type DeploySiteInput = {
13
13
  enableCaching?: boolean;
14
14
  publicDir?: string | null;
15
15
  rootDir?: string;
16
+ bypassBucketNameValidation?: boolean;
16
17
  };
17
18
  };
18
19
  export declare type DeploySiteOutput = Promise<{
@@ -25,7 +25,9 @@ const upload_dir_1 = require("./upload-dir");
25
25
  const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }) => {
26
26
  var _a, _b, _c, _d;
27
27
  (0, validate_aws_region_1.validateAwsRegion)(region);
28
- (0, validate_bucketname_1.validateBucketName)(bucketName, { mustStartWithRemotion: true });
28
+ (0, validate_bucketname_1.validateBucketName)(bucketName, {
29
+ mustStartWithRemotion: !(options === null || options === void 0 ? void 0 : options.bypassBucketNameValidation),
30
+ });
29
31
  const siteId = siteName !== null && siteName !== void 0 ? siteName : (0, random_hash_1.randomHash)();
30
32
  (0, validate_site_name_1.validateSiteName)(siteId);
31
33
  const accountId = await (0, get_account_id_1.getAccountId)({ region });
@@ -10,6 +10,7 @@ export declare type GetCompositionsOnLambdaInput = {
10
10
  envVariables?: Record<string, string>;
11
11
  logLevel?: LogLevel;
12
12
  timeoutInMilliseconds?: number;
13
+ forceBucketName?: string;
13
14
  };
14
15
  export declare type GetCompositionsOnLambdaOutput = TCompMetadata[];
15
16
  /**
@@ -25,4 +26,4 @@ export declare type GetCompositionsOnLambdaOutput = TCompMetadata[];
25
26
  * @param params.chromiumOptions The options to pass to Chromium
26
27
  * @returns The compositions
27
28
  */
28
- export declare const getCompositionsOnLambda: ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, }: GetCompositionsOnLambdaInput) => Promise<GetCompositionsOnLambdaOutput>;
29
+ export declare const getCompositionsOnLambda: ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, }: GetCompositionsOnLambdaInput) => Promise<GetCompositionsOnLambdaOutput>;
@@ -18,12 +18,13 @@ const serialize_input_props_1 = require("../shared/serialize-input-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, }) => {
21
+ const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inputProps, functionName, envVariables, logLevel, timeoutInMilliseconds, forceBucketName: bucketName, }) => {
22
22
  var _a;
23
23
  const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
24
24
  inputProps,
25
25
  region,
26
26
  type: 'still',
27
+ userSpecifiedBucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
27
28
  });
28
29
  try {
29
30
  const res = await (0, call_lambda_1.callLambda)({
@@ -37,6 +38,7 @@ const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inpu
37
38
  logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
38
39
  timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
39
40
  version: version_1.VERSION,
41
+ bucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
40
42
  },
41
43
  region,
42
44
  });
@@ -15,7 +15,7 @@ const getOrCreateBucket = async (options) => {
15
15
  var _a, _b;
16
16
  const { remotionBuckets } = await (0, get_buckets_1.getRemotionS3Buckets)(options.region);
17
17
  if (remotionBuckets.length > 1) {
18
- 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}". This is an error, please delete buckets so that you have one maximum.`);
18
+ 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
19
  }
20
20
  if (remotionBuckets.length === 1) {
21
21
  (_a = options.onBucketEnsured) === null || _a === void 0 ? void 0 : _a.call(options);
@@ -9,6 +9,7 @@ declare type Site = {
9
9
  };
10
10
  export declare type GetSitesInput = {
11
11
  region: AwsRegion;
12
+ bucketName?: string;
12
13
  };
13
14
  export declare type GetSitesOutput = {
14
15
  sites: Site[];
@@ -1,9 +1,9 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- declare type PresignURLInput = {
2
+ export declare type PresignUrlInput<CheckIfObjectExists extends boolean = boolean> = {
3
3
  region: AwsRegion;
4
4
  bucketName: string;
5
5
  objectKey: string;
6
- checkIfObjectExists?: boolean;
6
+ checkIfObjectExists?: CheckIfObjectExists;
7
7
  expiresInSeconds: number;
8
8
  };
9
9
  /**
@@ -16,5 +16,4 @@ declare type PresignURLInput = {
16
16
  * @param {boolean} params.checkIfObjectExists Whether the function should check if the object exists in the bucket before generating the presigned url.
17
17
  * @returns {Promise<string | null>} The public url of an object or `null` if `checkIfObjectExists=true` & object does not exist.
18
18
  */
19
- export declare const presignUrl: ({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, }: PresignURLInput) => Promise<string | null>;
20
- export {};
19
+ export declare const presignUrl: <CheckIfObjectExists extends boolean = false>({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, }: PresignUrlInput<CheckIfObjectExists>) => Promise<CheckIfObjectExists extends true ? string | null : string>;
@@ -16,11 +16,11 @@ const validate_presign_expiration_1 = require("../shared/validate-presign-expira
16
16
  * @param {boolean} params.checkIfObjectExists Whether the function should check if the object exists in the bucket before generating the presigned url.
17
17
  * @returns {Promise<string | null>} The public url of an object or `null` if `checkIfObjectExists=true` & object does not exist.
18
18
  */
19
- const presignUrl = async ({ region, bucketName, objectKey, checkIfObjectExists = false, expiresInSeconds, }) => {
19
+ const presignUrl = async ({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, }) => {
20
20
  (0, validate_bucketname_1.validateBucketName)(bucketName, { mustStartWithRemotion: false });
21
21
  (0, validate_presign_expiration_1.validatePresignExpiration)(expiresInSeconds);
22
22
  const s3Client = (0, aws_clients_1.getS3Client)(region, null);
23
- if (checkIfObjectExists) {
23
+ if (checkIfObjectExists === true) {
24
24
  try {
25
25
  await s3Client.send(new client_s3_1.HeadObjectCommand({
26
26
  Bucket: bucketName,
@@ -1,4 +1,4 @@
1
- import type { ChromiumOptions, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from '@remotion/renderer';
1
+ import type { AudioCodec, ChromiumOptions, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from '@remotion/renderer';
2
2
  import type { AwsRegion } from '../pricing/aws-regions';
3
3
  import type { OutNameInput, Privacy } from '../shared/constants';
4
4
  import type { DownloadBehavior } from '../shared/content-disposition-header';
@@ -40,6 +40,8 @@ export declare type RenderMediaOnLambdaInput = {
40
40
  forceWidth?: number | null;
41
41
  forceHeight?: number | null;
42
42
  rendererFunctionName?: string | null;
43
+ forceBucketName?: string;
44
+ audioCodec?: AudioCodec | null;
43
45
  };
44
46
  export declare type RenderMediaOnLambdaOutput = {
45
47
  renderId: string;
@@ -66,8 +68,8 @@ export declare type RenderMediaOnLambdaOutput = {
66
68
  * @param params.webhook Configuration for webhook called upon completion or timeout of the render.
67
69
  * @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
68
70
  */
69
- 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, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
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>;
70
72
  /**
71
73
  * @deprecated Renamed to renderMediaOnLambda()
72
74
  */
73
- 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, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
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>;
@@ -29,7 +29,7 @@ const validate_serveurl_1 = require("../shared/validate-serveurl");
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, }) => {
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, }) => {
33
33
  var _a;
34
34
  const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
35
35
  (0, validate_serveurl_1.validateServeUrl)(serveUrl);
@@ -42,6 +42,7 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
42
42
  inputProps,
43
43
  region,
44
44
  type: 'video-or-audio',
45
+ userSpecifiedBucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
45
46
  });
46
47
  try {
47
48
  const res = await (0, call_lambda_1.callLambda)({
@@ -80,6 +81,8 @@ const renderMediaOnLambda = async ({ functionName, serveUrl, inputProps, codec,
80
81
  webhook: webhook !== null && webhook !== void 0 ? webhook : null,
81
82
  forceHeight: forceHeight !== null && forceHeight !== void 0 ? forceHeight : null,
82
83
  forceWidth: forceWidth !== null && forceWidth !== void 0 ? forceWidth : null,
84
+ bucketName: bucketName !== null && bucketName !== void 0 ? bucketName : null,
85
+ audioCodec: audioCodec !== null && audioCodec !== void 0 ? audioCodec : null,
83
86
  },
84
87
  region,
85
88
  });
@@ -22,6 +22,7 @@ export declare type RenderStillOnLambdaInput = {
22
22
  downloadBehavior?: DownloadBehavior;
23
23
  forceWidth?: number | null;
24
24
  forceHeight?: number | null;
25
+ forceBucketName?: string;
25
26
  };
26
27
  export declare type RenderStillOnLambdaOutput = {
27
28
  estimatedPrice: CostsInfo;
@@ -47,4 +48,4 @@ export declare type RenderStillOnLambdaOutput = {
47
48
  * @param params.privacy Whether the item in the S3 bucket should be public. Possible values: `"private"` and `"public"`
48
49
  * @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
49
50
  */
50
- export declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
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>;
@@ -22,12 +22,13 @@ const serialize_input_props_1 = require("../shared/serialize-input-props");
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, }) => {
25
+ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, }) => {
26
26
  var _a;
27
27
  const serializedInputProps = await (0, serialize_input_props_1.serializeInputProps)({
28
28
  inputProps,
29
29
  region,
30
30
  type: 'still',
31
+ userSpecifiedBucketName: forceBucketName !== null && forceBucketName !== void 0 ? forceBucketName : null,
31
32
  });
32
33
  try {
33
34
  const res = await (0, call_lambda_1.callLambda)({
@@ -53,6 +54,7 @@ const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFo
53
54
  version: version_1.VERSION,
54
55
  forceHeight: forceHeight !== null && forceHeight !== void 0 ? forceHeight : null,
55
56
  forceWidth: forceWidth !== null && forceWidth !== void 0 ? forceWidth : null,
57
+ bucketName: forceBucketName !== null && forceBucketName !== void 0 ? forceBucketName : null,
56
58
  },
57
59
  region,
58
60
  });
@@ -29,6 +29,7 @@ declare type LambdaCommandLineOptions = {
29
29
  ['webhook-secret']: string | undefined;
30
30
  ['renderer-function-name']: string | undefined;
31
31
  ['function-name']: string | undefined;
32
+ ['force-bucket-name']: string | undefined;
32
33
  };
33
34
  export declare const parsedLambdaCli: LambdaCommandLineOptions & import("minimist").ParsedArgs;
34
35
  export declare const forceFlagProvided: boolean;
@@ -5,6 +5,7 @@ const cli_1 = require("@remotion/cli");
5
5
  const __1 = require("../../..");
6
6
  const constants_1 = require("../../../shared/constants");
7
7
  const validate_serveurl_1 = require("../../../shared/validate-serveurl");
8
+ const args_1 = require("../../args");
8
9
  const get_aws_region_1 = require("../../get-aws-region");
9
10
  const find_function_name_1 = require("../../helpers/find-function-name");
10
11
  const quit_1 = require("../../helpers/quit");
@@ -36,6 +37,7 @@ const compositionsCommand = async (args, remotionRoot) => {
36
37
  envVariables,
37
38
  logLevel,
38
39
  timeoutInMilliseconds: puppeteerTimeout,
40
+ forceBucketName: args_1.parsedLambdaCli['force-bucket-name'],
39
41
  });
40
42
  cli_1.CliInternals.printCompositions(comps);
41
43
  };
@@ -95,6 +95,8 @@ const renderCommand = async (args, remotionRoot) => {
95
95
  }
96
96
  : undefined,
97
97
  rendererFunctionName: (_f = args_1.parsedLambdaCli['renderer-function-name']) !== null && _f !== void 0 ? _f : null,
98
+ forceBucketName: args_1.parsedLambdaCli['force-bucket-name'],
99
+ audioCodec: cli_1.CliInternals.parsedCli['audio-codec'],
98
100
  });
99
101
  const totalSteps = downloadName ? 6 : 5;
100
102
  const progressBar = cli_1.CliInternals.createOverwriteableCliOutput(cli_1.CliInternals.quietFlagProvided());
@@ -14,7 +14,7 @@ const quit_1 = require("../../helpers/quit");
14
14
  const log_1 = require("../../log");
15
15
  exports.SITES_CREATE_SUBCOMMAND = 'create';
16
16
  const sitesCreateSubcommand = async (args, remotionRoot) => {
17
- var _a, _b;
17
+ var _a, _b, _c;
18
18
  const { file, reason } = cli_1.CliInternals.findEntryPoint(args, remotionRoot);
19
19
  if (!file) {
20
20
  log_1.Log.error('No entry file passed.');
@@ -54,13 +54,14 @@ const sitesCreateSubcommand = async (args, remotionRoot) => {
54
54
  ].join('\n'));
55
55
  };
56
56
  const bucketStart = Date.now();
57
- const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
57
+ const cliBucketName = (_b = args_1.parsedLambdaCli['force-bucket-name']) !== null && _b !== void 0 ? _b : null;
58
+ const bucketName = cliBucketName !== null && cliBucketName !== void 0 ? cliBucketName : (await (0, get_or_create_bucket_1.getOrCreateBucket)({
58
59
  region: (0, get_aws_region_1.getAwsRegion)(),
59
60
  onBucketEnsured: () => {
60
61
  multiProgress.bucketProgress.bucketCreated = true;
61
62
  updateProgress();
62
63
  },
63
- });
64
+ })).bucketName;
64
65
  multiProgress.bucketProgress.doneIn = Date.now() - bucketStart;
65
66
  updateProgress();
66
67
  const bundleStart = Date.now();
@@ -86,7 +87,7 @@ const sitesCreateSubcommand = async (args, remotionRoot) => {
86
87
  updateProgress();
87
88
  },
88
89
  enableCaching: cli_1.ConfigInternals.getWebpackCaching(),
89
- webpackOverride: (_b = cli_1.ConfigInternals.getWebpackOverrideFn()) !== null && _b !== void 0 ? _b : ((f) => f),
90
+ webpackOverride: (_c = cli_1.ConfigInternals.getWebpackOverrideFn()) !== null && _c !== void 0 ? _c : ((f) => f),
90
91
  },
91
92
  region: (0, get_aws_region_1.getAwsRegion)(),
92
93
  });
@@ -3,14 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sitesRmSubcommand = exports.SITES_RM_COMMAND = void 0;
4
4
  const cli_1 = require("@remotion/cli");
5
5
  const delete_site_1 = require("../../../api/delete-site");
6
- const get_buckets_1 = require("../../../api/get-buckets");
6
+ const get_or_create_bucket_1 = require("../../../api/get-or-create-bucket");
7
7
  const get_sites_1 = require("../../../api/get-sites");
8
+ const args_1 = require("../../args");
8
9
  const get_aws_region_1 = require("../../get-aws-region");
9
10
  const confirm_1 = require("../../helpers/confirm");
10
11
  const quit_1 = require("../../helpers/quit");
11
12
  const log_1 = require("../../log");
12
13
  exports.SITES_RM_COMMAND = 'rm';
13
14
  const sitesRmSubcommand = async (args) => {
15
+ var _a;
14
16
  if (args.length === 0) {
15
17
  log_1.Log.error('No site name was passed. Run the command again and pass another argument <site-name>.');
16
18
  (0, quit_1.quit)(1);
@@ -24,22 +26,10 @@ const sitesRmSubcommand = async (args) => {
24
26
  region,
25
27
  });
26
28
  for (const siteName of args) {
27
- const { remotionBuckets } = await (0, get_buckets_1.getRemotionS3Buckets)(region);
28
- if (remotionBuckets.length > 1) {
29
- log_1.Log.error('You have more than one Remotion Lambda bucket:');
30
- for (const bucket of remotionBuckets) {
31
- log_1.Log.error(`- ${bucket.name}`);
32
- }
33
- log_1.Log.error('You should only have one - delete all but one before continuing.');
34
- (0, quit_1.quit)(1);
35
- }
36
- if (remotionBuckets.length === 0) {
37
- log_1.Log.error(`You don't have a Remotion Lambda bucket in the ${region} region. Therefore nothing was deleted.`);
38
- (0, quit_1.quit)(1);
39
- }
29
+ const bucketName = (_a = args_1.parsedLambdaCli['force-bucket-name']) !== null && _a !== void 0 ? _a : (await (0, get_or_create_bucket_1.getOrCreateBucket)({ region })).bucketName;
40
30
  const site = deployedSites.sites.find((s) => s.id === siteName.trim());
41
31
  if (!site) {
42
- log_1.Log.error(`No site ${siteName.trim()} was found in your bucket ${remotionBuckets[0].name}.`);
32
+ log_1.Log.error(`No site ${siteName.trim()} was found in your bucket ${bucketName}.`);
43
33
  return (0, quit_1.quit)(1);
44
34
  }
45
35
  await (0, confirm_1.confirmCli)({
@@ -47,7 +37,7 @@ const sitesRmSubcommand = async (args) => {
47
37
  allowForceFlag: true,
48
38
  });
49
39
  const { totalSizeInBytes: totalSize } = await (0, delete_site_1.deleteSite)({
50
- bucketName: remotionBuckets[0].name,
40
+ bucketName,
51
41
  siteName,
52
42
  region,
53
43
  onAfterItemDeleted: ({ itemName }) => {
@@ -3,38 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sitesRmallSubcommand = exports.SITES_RMALL_COMMAND = void 0;
4
4
  const cli_1 = require("@remotion/cli");
5
5
  const delete_site_1 = require("../../../api/delete-site");
6
- const get_buckets_1 = require("../../../api/get-buckets");
6
+ const get_or_create_bucket_1 = require("../../../api/get-or-create-bucket");
7
7
  const get_sites_1 = require("../../../api/get-sites");
8
+ const args_1 = require("../../args");
8
9
  const get_aws_region_1 = require("../../get-aws-region");
9
10
  const confirm_1 = require("../../helpers/confirm");
10
- const quit_1 = require("../../helpers/quit");
11
11
  const log_1 = require("../../log");
12
12
  exports.SITES_RMALL_COMMAND = 'rmall';
13
13
  const sitesRmallSubcommand = async () => {
14
+ var _a;
14
15
  const region = (0, get_aws_region_1.getAwsRegion)();
15
16
  const deployedSites = await (0, get_sites_1.getSites)({
16
17
  region,
17
18
  });
18
- const { remotionBuckets } = await (0, get_buckets_1.getRemotionS3Buckets)(region);
19
- if (remotionBuckets.length > 1) {
20
- log_1.Log.error('You have more than one Remotion Lambda bucket:');
21
- for (const bucket of remotionBuckets) {
22
- log_1.Log.error(`- ${bucket.name}`);
23
- }
24
- log_1.Log.error('You should only have one - delete all but one before continuing.');
25
- (0, quit_1.quit)(1);
26
- }
27
- if (remotionBuckets.length === 0) {
28
- log_1.Log.error(`You don't have a Remotion Lambda bucket in the ${region} region. Therefore nothing was deleted.`);
29
- (0, quit_1.quit)(1);
30
- }
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;
31
20
  for (const site of deployedSites.sites) {
32
21
  await (0, confirm_1.confirmCli)({
33
22
  delMessage: `Site ${site.id} in bucket ${site.bucketName} (${cli_1.CliInternals.formatBytes(site.sizeInBytes)}): Delete? (Y/n)`,
34
23
  allowForceFlag: true,
35
24
  });
36
25
  const { totalSizeInBytes: totalSize } = await (0, delete_site_1.deleteSite)({
37
- bucketName: remotionBuckets[0].name,
26
+ bucketName,
38
27
  siteName: site.id,
39
28
  region,
40
29
  onAfterItemDeleted: ({ itemName }) => {
package/dist/client.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import { getCompositionsOnLambda } from './api/get-compositions-on-lambda';
2
2
  import { getFunctions } from './api/get-functions';
3
3
  import { getRenderProgress } from './api/get-render-progress';
4
+ import { getSites } from './api/get-sites';
5
+ import type { PresignUrlInput } from './api/presign-url';
6
+ import { presignUrl } from './api/presign-url';
4
7
  import { renderMediaOnLambda, renderVideoOnLambda } from './api/render-media-on-lambda';
5
8
  import { renderStillOnLambda } from './api/render-still-on-lambda';
6
9
  import { validateWebhookSignature } from './api/validate-webhook-signature';
7
10
  import type { AwsRegion } from './pricing/aws-regions';
8
11
  import type { RenderProgress } from './shared/constants';
9
12
  import type { WebhookPayload } from './shared/invoke-webhook';
10
- export { renderVideoOnLambda, renderMediaOnLambda, renderStillOnLambda, getRenderProgress, getFunctions, validateWebhookSignature, getCompositionsOnLambda, };
11
- export type { AwsRegion, RenderProgress, WebhookPayload };
13
+ export { renderVideoOnLambda, renderMediaOnLambda, renderStillOnLambda, getRenderProgress, getFunctions, validateWebhookSignature, getCompositionsOnLambda, presignUrl, getSites, };
14
+ export type { AwsRegion, RenderProgress, WebhookPayload, PresignUrlInput };
package/dist/client.js CHANGED
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCompositionsOnLambda = exports.validateWebhookSignature = exports.getFunctions = exports.getRenderProgress = exports.renderStillOnLambda = exports.renderMediaOnLambda = exports.renderVideoOnLambda = void 0;
3
+ exports.getSites = exports.presignUrl = exports.getCompositionsOnLambda = exports.validateWebhookSignature = exports.getFunctions = exports.getRenderProgress = exports.renderStillOnLambda = exports.renderMediaOnLambda = exports.renderVideoOnLambda = void 0;
4
4
  const get_compositions_on_lambda_1 = require("./api/get-compositions-on-lambda");
5
5
  Object.defineProperty(exports, "getCompositionsOnLambda", { enumerable: true, get: function () { return get_compositions_on_lambda_1.getCompositionsOnLambda; } });
6
6
  const get_functions_1 = require("./api/get-functions");
7
7
  Object.defineProperty(exports, "getFunctions", { enumerable: true, get: function () { return get_functions_1.getFunctions; } });
8
8
  const get_render_progress_1 = require("./api/get-render-progress");
9
9
  Object.defineProperty(exports, "getRenderProgress", { enumerable: true, get: function () { return get_render_progress_1.getRenderProgress; } });
10
+ const get_sites_1 = require("./api/get-sites");
11
+ Object.defineProperty(exports, "getSites", { enumerable: true, get: function () { return get_sites_1.getSites; } });
12
+ const presign_url_1 = require("./api/presign-url");
13
+ Object.defineProperty(exports, "presignUrl", { enumerable: true, get: function () { return presign_url_1.presignUrl; } });
10
14
  const render_media_on_lambda_1 = require("./api/render-media-on-lambda");
11
15
  Object.defineProperty(exports, "renderMediaOnLambda", { enumerable: true, get: function () { return render_media_on_lambda_1.renderMediaOnLambda; } });
12
16
  Object.defineProperty(exports, "renderVideoOnLambda", { enumerable: true, get: function () { return render_media_on_lambda_1.renderVideoOnLambda; } });
@@ -10,7 +10,7 @@ const deserialize_input_props_1 = require("../shared/deserialize-input-props");
10
10
  const get_browser_instance_1 = require("./helpers/get-browser-instance");
11
11
  const get_current_region_1 = require("./helpers/get-current-region");
12
12
  const compositionsHandler = async (lambdaParams, options) => {
13
- var _a;
13
+ var _a, _b;
14
14
  if (lambdaParams.type !== defaults_1.LambdaRoutines.compositions) {
15
15
  throw new TypeError('Expected info compositions');
16
16
  }
@@ -21,11 +21,11 @@ const compositionsHandler = async (lambdaParams, options) => {
21
21
  throw new Error(`Version mismatch: When calling getCompositionsOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${lambdaParams.version}. Deploy a new function and use it to call getCompositionsOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
22
22
  }
23
23
  const region = (0, get_current_region_1.getCurrentRegionInFunction)();
24
- const [{ bucketName }, browserInstance] = await Promise.all([
25
- (0, get_or_create_bucket_1.getOrCreateBucket)({
24
+ const [bucketName, browserInstance] = await Promise.all([
25
+ (_a = lambdaParams.bucketName) !== null && _a !== void 0 ? _a : (0, get_or_create_bucket_1.getOrCreateBucket)({
26
26
  region,
27
- }),
28
- (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_a = lambdaParams.chromiumOptions) !== null && _a !== void 0 ? _a : {}),
27
+ }).then((b) => b.bucketName),
28
+ (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_b = lambdaParams.chromiumOptions) !== null && _b !== void 0 ? _b : {}),
29
29
  ]);
30
30
  const inputProps = await (0, deserialize_input_props_1.deserializeInputProps)({
31
31
  bucketName,
@@ -1,4 +1,4 @@
1
- import type { FfmpegExecutable } from '@remotion/renderer';
1
+ import type { AudioCodec, FfmpegExecutable } from '@remotion/renderer';
2
2
  import type { AwsRegion } from '../../pricing/aws-regions';
3
3
  import type { LambdaCodec } from '../../shared/validate-lambda-codec';
4
4
  import type { EnhancedErrorInfo } from './write-lambda-error';
@@ -11,7 +11,7 @@ export declare const getAllFilesS3: ({ bucket, expectedFiles, outdir, renderId,
11
11
  expectedBucketOwner: string;
12
12
  onErrors: (errors: EnhancedErrorInfo[]) => Promise<void>;
13
13
  }) => Promise<string[]>;
14
- export declare const concatVideosS3: ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, ffmpegExecutable, remotionRoot, files, outdir, }: {
14
+ export declare const concatVideosS3: ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, ffmpegExecutable, remotionRoot, files, outdir, audioCodec, }: {
15
15
  onProgress: (frames: number) => void;
16
16
  numberOfFrames: number;
17
17
  codec: LambdaCodec;
@@ -21,6 +21,7 @@ export declare const concatVideosS3: ({ onProgress, numberOfFrames, codec, fps,
21
21
  remotionRoot: string;
22
22
  files: string[];
23
23
  outdir: string;
24
+ audioCodec: AudioCodec | null;
24
25
  }) => Promise<{
25
26
  outfile: string;
26
27
  cleanupChunksProm: Promise<void>;
@@ -128,9 +128,9 @@ const getAllFilesS3 = ({ bucket, expectedFiles, outdir, renderId, region, expect
128
128
  });
129
129
  };
130
130
  exports.getAllFilesS3 = getAllFilesS3;
131
- const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, ffmpegExecutable, remotionRoot, files, outdir, }) => {
131
+ const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, ffmpegExecutable, remotionRoot, files, outdir, audioCodec, }) => {
132
132
  var _a;
133
- const outfile = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_CONCATED_TOKEN), 'concat.' + renderer_1.RenderInternals.getFileExtensionFromCodec(codec));
133
+ const outfile = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_CONCATED_TOKEN), 'concat.' + renderer_1.RenderInternals.getFileExtensionFromCodec(codec, audioCodec));
134
134
  const combine = (0, timer_1.timer)('Combine videos');
135
135
  const filelistDir = renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_FILELIST_TOKEN);
136
136
  await renderer_1.RenderInternals.combineVideos({
@@ -144,6 +144,7 @@ const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOf
144
144
  numberOfGifLoops,
145
145
  ffmpegExecutable,
146
146
  remotionRoot,
147
+ audioCodec,
147
148
  });
148
149
  combine.end();
149
150
  const cleanupChunksProm = ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(outdir, {
@@ -25,7 +25,7 @@ const getExpectedOutName = (renderMetadata, bucketName, customCredentials) => {
25
25
  renderMetadata,
26
26
  });
27
27
  if (outNameValue) {
28
- (0, validate_outname_1.validateOutname)(outNameValue);
28
+ (0, validate_outname_1.validateOutname)(outNameValue, renderMetadata.codec, renderMetadata.audioCodec);
29
29
  return (0, defaults_1.customOutName)(renderMetadata.renderId, bucketName, outNameValue);
30
30
  }
31
31
  if (renderMetadata.type === 'still') {
@@ -38,7 +38,7 @@ const getExpectedOutName = (renderMetadata, bucketName, customCredentials) => {
38
38
  if (renderMetadata.type === 'video') {
39
39
  return {
40
40
  renderBucketName: bucketName,
41
- key: (0, defaults_1.outName)(renderMetadata.renderId, renderer_1.RenderInternals.getFileExtensionFromCodec(renderMetadata.codec)),
41
+ key: (0, defaults_1.outName)(renderMetadata.renderId, renderer_1.RenderInternals.getFileExtensionFromCodec(renderMetadata.codec, renderMetadata.audioCodec)),
42
42
  customCredentials: null,
43
43
  };
44
44
  }
@@ -175,7 +175,7 @@ const innerLaunchHandler = async (params, options) => {
175
175
  if (chunkCount > constants_1.MAX_FUNCTIONS_PER_RENDER) {
176
176
  throw new Error(`Too many functions: This render would cause ${chunkCount} functions to spawn. We limit this amount to ${constants_1.MAX_FUNCTIONS_PER_RENDER} functions as more would result in diminishing returns. Values set: frameCount = ${frameCount}, framesPerLambda=${framesPerLambda}. See ${docs_url_1.DOCS_URL}/docs/lambda/concurrency#too-many-functions for help.`);
177
177
  }
178
- (0, validate_outname_1.validateOutname)(params.outName, params.codec);
178
+ (0, validate_outname_1.validateOutname)(params.outName, params.codec, params.audioCodec);
179
179
  (0, validate_privacy_1.validatePrivacy)(params.privacy);
180
180
  renderer_1.RenderInternals.validatePuppeteerTimeout(params.timeoutInMilliseconds);
181
181
  const { chunks } = (0, plan_frame_ranges_1.planFrameRanges)({
@@ -253,6 +253,7 @@ const innerLaunchHandler = async (params, options) => {
253
253
  privacy: params.privacy,
254
254
  everyNthFrame: params.everyNthFrame,
255
255
  frameRange: realFrameRange,
256
+ audioCodec: params.audioCodec,
256
257
  };
257
258
  const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, params.bucketName, typeof params.outName === 'string' || typeof params.outName === 'undefined'
258
259
  ? null
@@ -385,6 +386,7 @@ const innerLaunchHandler = async (params, options) => {
385
386
  remotionRoot: process.cwd(),
386
387
  files,
387
388
  outdir,
389
+ audioCodec: params.audioCodec,
388
390
  });
389
391
  const encodingStop = Date.now();
390
392
  const outputSize = fs_1.default.statSync(outfile);
@@ -50,7 +50,10 @@ const renderHandler = async (params, options, logs) => {
50
50
  const chunkCodec = params.codec === 'gif' || params.codec === 'h264'
51
51
  ? 'h264-mkv'
52
52
  : params.codec;
53
- const outputLocation = path_1.default.join(outdir, `localchunk-${String(params.chunk).padStart(8, '0')}.${renderer_1.RenderInternals.getFileExtensionFromCodec(chunkCodec)}`);
53
+ const outputLocation = path_1.default.join(outdir, `localchunk-${String(params.chunk).padStart(8, '0')}.${renderer_1.RenderInternals.getFileExtensionFromCodec(chunkCodec, renderer_1.RenderInternals.getDefaultAudioCodec({
54
+ codec: params.codec,
55
+ preferLossless: true,
56
+ }))}`);
54
57
  const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
55
58
  const downloads = {};
56
59
  const inputProps = await inputPropsPromise;
@@ -151,6 +154,11 @@ const renderHandler = async (params, options, logs) => {
151
154
  console.log(`Frame ${frame} (${time.toFixed(3)}ms)`);
152
155
  });
153
156
  },
157
+ // Lossless flag takes priority over audio codec
158
+ // https://github.com/remotion-dev/remotion/issues/1647
159
+ // Special flag only in Lambda renderer which improves the audio quality
160
+ audioCodec: null,
161
+ preferLossless: true,
154
162
  })
155
163
  .then(() => resolve())
156
164
  .catch((err) => reject(err));
@@ -11,7 +11,7 @@ const random_hash_1 = require("../shared/random-hash");
11
11
  const get_current_region_1 = require("./helpers/get-current-region");
12
12
  const io_1 = require("./helpers/io");
13
13
  const startHandler = async (params, options) => {
14
- var _a;
14
+ var _a, _b;
15
15
  if (params.type !== constants_1.LambdaRoutines.start) {
16
16
  throw new TypeError('Expected type start');
17
17
  }
@@ -22,9 +22,9 @@ const startHandler = async (params, options) => {
22
22
  throw new Error(`Version mismatch: When calling renderMediaOnLambda(), you passed ${process.env.AWS_LAMBDA_FUNCTION_NAME} as the function, which has the version ${version_1.VERSION}, but the @remotion/lambda package you used to invoke the function has version ${params.version}. Deploy a new function and use it to call renderMediaOnLambda(). See: https://www.remotion.dev/docs/lambda/upgrading`);
23
23
  }
24
24
  const region = (0, get_current_region_1.getCurrentRegionInFunction)();
25
- const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
25
+ const bucketName = (_a = params.bucketName) !== null && _a !== void 0 ? _a : (await (0, get_or_create_bucket_1.getOrCreateBucket)({
26
26
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
27
- });
27
+ })).bucketName;
28
28
  const realServeUrl = (0, convert_to_serve_url_1.convertToServeUrl)({
29
29
  urlOrId: params.serveUrl,
30
30
  region,
@@ -58,7 +58,7 @@ const startHandler = async (params, options) => {
58
58
  quality: params.quality,
59
59
  maxRetries: params.maxRetries,
60
60
  privacy: params.privacy,
61
- logLevel: (_a = params.logLevel) !== null && _a !== void 0 ? _a : 'info',
61
+ logLevel: (_b = params.logLevel) !== null && _b !== void 0 ? _b : 'info',
62
62
  frameRange: params.frameRange,
63
63
  outName: params.outName,
64
64
  timeoutInMilliseconds: params.timeoutInMilliseconds,
@@ -76,6 +76,7 @@ const startHandler = async (params, options) => {
76
76
  forceHeight: params.forceHeight,
77
77
  forceWidth: params.forceWidth,
78
78
  rendererFunctionName: params.rendererFunctionName,
79
+ audioCodec: params.audioCodec,
79
80
  };
80
81
  await (0, aws_clients_1.getLambdaClient)((0, get_current_region_1.getCurrentRegionInFunction)()).send(new client_lambda_1.InvokeCommand({
81
82
  FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
@@ -31,7 +31,7 @@ const io_1 = require("./helpers/io");
31
31
  const validate_composition_1 = require("./helpers/validate-composition");
32
32
  const write_lambda_error_1 = require("./helpers/write-lambda-error");
33
33
  const innerStillHandler = async (lambdaParams, renderId, options) => {
34
- var _a, _b;
34
+ var _a, _b, _c;
35
35
  if (lambdaParams.type !== constants_1.LambdaRoutines.still) {
36
36
  throw new TypeError('Expected still type');
37
37
  }
@@ -43,13 +43,13 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
43
43
  }
44
44
  (0, validate_download_behavior_1.validateDownloadBehavior)(lambdaParams.downloadBehavior);
45
45
  (0, validate_privacy_1.validatePrivacy)(lambdaParams.privacy);
46
- (0, validate_outname_1.validateOutname)(lambdaParams.outName);
46
+ (0, validate_outname_1.validateOutname)(lambdaParams.outName, null, null);
47
47
  const start = Date.now();
48
- const [{ bucketName }, browserInstance] = await Promise.all([
49
- (0, get_or_create_bucket_1.getOrCreateBucket)({
48
+ const [bucketName, browserInstance] = await Promise.all([
49
+ (_a = lambdaParams.bucketName) !== null && _a !== void 0 ? _a : (0, get_or_create_bucket_1.getOrCreateBucket)({
50
50
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
51
- }),
52
- (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_a = lambdaParams.chromiumOptions) !== null && _a !== void 0 ? _a : {}),
51
+ }).then((b) => b.bucketName),
52
+ (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_b = lambdaParams.chromiumOptions) !== null && _b !== void 0 ? _b : {}),
53
53
  ]);
54
54
  const outputDir = renderer_1.RenderInternals.tmpDir('remotion-render-');
55
55
  const outputPath = path_1.default.join(outputDir, 'output');
@@ -98,10 +98,11 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
98
98
  memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
99
99
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
100
100
  renderId,
101
- outName: (_b = lambdaParams.outName) !== null && _b !== void 0 ? _b : undefined,
101
+ outName: (_c = lambdaParams.outName) !== null && _c !== void 0 ? _c : undefined,
102
102
  privacy: lambdaParams.privacy,
103
103
  everyNthFrame: 1,
104
104
  frameRange: [lambdaParams.frame, lambdaParams.frame],
105
+ audioCodec: null,
105
106
  };
106
107
  await (0, io_1.lambdaWriteFile)({
107
108
  bucketName,
@@ -172,6 +173,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
172
173
  };
173
174
  };
174
175
  const stillHandler = async (params, options) => {
176
+ var _a;
175
177
  if (params.type !== constants_1.LambdaRoutines.still) {
176
178
  throw new Error('Params must be renderer');
177
179
  }
@@ -196,9 +198,9 @@ const stillHandler = async (params, options) => {
196
198
  // @ts-expect-error
197
199
  Payload: JSON.stringify(retryPayload),
198
200
  }));
199
- const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
201
+ const bucketName = (_a = params.bucketName) !== null && _a !== void 0 ? _a : (await (0, get_or_create_bucket_1.getOrCreateBucket)({
200
202
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
201
- });
203
+ })).bucketName;
202
204
  // `await` elided on purpose here; using `void` to mark it as intentional
203
205
  // eslint-disable-next-line no-void
204
206
  void (0, write_lambda_error_1.writeLambdaError)({
package/dist/index.d.ts CHANGED
@@ -26,11 +26,9 @@ import { getRegions } from './api/get-regions';
26
26
  import type { GetRenderInput } from './api/get-render-progress';
27
27
  import { getRenderProgress } from './api/get-render-progress';
28
28
  import type { GetSitesInput, GetSitesOutput } from './api/get-sites';
29
- import { getSites } from './api/get-sites';
30
29
  import type { SimulatePermissionsInput, SimulatePermissionsOutput } from './api/iam-validation/simulate';
31
30
  import { simulatePermissions } from './api/iam-validation/simulate';
32
31
  import { getRolePolicy, getUserPolicy } from './api/iam-validation/suggested-policy';
33
- import { presignUrl } from './api/presign-url';
34
32
  import type { RenderMediaOnLambdaInput, RenderMediaOnLambdaOutput } from './api/render-media-on-lambda';
35
33
  import { renderVideoOnLambda } from './api/render-media-on-lambda';
36
34
  import type { RenderStillOnLambdaInput, RenderStillOnLambdaOutput } from './api/render-still-on-lambda';
@@ -46,10 +44,18 @@ import type { LambdaArchitecture } from './shared/validate-architecture';
46
44
  /**
47
45
  * @deprecated Import this from `@remotion/lambda/client` instead
48
46
  */
49
- 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, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
47
+ 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>;
50
48
  /**
51
49
  * @deprecated Import this from `@remotion/lambda/client` instead
52
50
  */
53
- declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
51
+ 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>;
52
+ /**
53
+ * @deprecated Import this from `@remotion/lambda/client` instead
54
+ */
55
+ declare const presignUrl: <CheckIfObjectExists extends boolean = false>({ region, bucketName, objectKey, checkIfObjectExists, expiresInSeconds, }: import("./api/presign-url").PresignUrlInput<CheckIfObjectExists>) => Promise<CheckIfObjectExists extends true ? string | null : string>;
56
+ /**
57
+ * @deprecated Import this from `@remotion/lambda/client` instead
58
+ */
59
+ declare const getSites: ({ region, }: GetSitesInput) => Promise<GetSitesOutput>;
54
60
  export { deleteSite, deployFunction, deploySite, downloadMedia, downloadVideo, getFunctions, getUserPolicy, getRolePolicy, getSites, getOrCreateBucket, getRenderProgress, renderVideoOnLambda, renderMediaOnLambda, simulatePermissions, deleteFunction, getFunctionInfo, estimatePrice, LambdaInternals, renderStillOnLambda, getRegions, getAwsClient, presignUrl, deleteRender, validateWebhookSignature, getCompositionsOnLambda, };
55
61
  export type { AwsRegion, RenderProgress, DeploySiteInput, DeploySiteOutput, LambdaLsReturnType, LambdaLSInput, DeleteSiteInput, DeleteSiteOutput, EstimatePriceInput, DeployFunctionInput, DeployFunctionOutput, DeleteFunctionInput, GetFunctionInfoInput, FunctionInfo, GetFunctionsInput, GetSitesInput, GetSitesOutput, DownloadMediaInput, DownloadMediaOutput, GetOrCreateBucketInput, GetOrCreateBucketOutput, GetRenderInput, RenderMediaOnLambdaInput, RenderMediaOnLambdaOutput, RenderStillOnLambdaInput, RenderStillOnLambdaOutput, SimulatePermissionsInput, SimulatePermissionsOutput, GetAwsClientInput, GetAwsClientOutput, LambdaArchitecture, CustomCredentials, WebhookPayload, LambdaErrorInfo, EnhancedErrorInfo, DeleteRenderInput, GetCompositionsOnLambdaOutput, GetCompositionsOnLambdaInput, };
package/dist/index.js CHANGED
@@ -31,14 +31,12 @@ Object.defineProperty(exports, "getRegions", { enumerable: true, get: function (
31
31
  const get_render_progress_1 = require("./api/get-render-progress");
32
32
  Object.defineProperty(exports, "getRenderProgress", { enumerable: true, get: function () { return get_render_progress_1.getRenderProgress; } });
33
33
  const get_sites_1 = require("./api/get-sites");
34
- Object.defineProperty(exports, "getSites", { enumerable: true, get: function () { return get_sites_1.getSites; } });
35
34
  const simulate_1 = require("./api/iam-validation/simulate");
36
35
  Object.defineProperty(exports, "simulatePermissions", { enumerable: true, get: function () { return simulate_1.simulatePermissions; } });
37
36
  const suggested_policy_1 = require("./api/iam-validation/suggested-policy");
38
37
  Object.defineProperty(exports, "getRolePolicy", { enumerable: true, get: function () { return suggested_policy_1.getRolePolicy; } });
39
38
  Object.defineProperty(exports, "getUserPolicy", { enumerable: true, get: function () { return suggested_policy_1.getUserPolicy; } });
40
39
  const presign_url_1 = require("./api/presign-url");
41
- Object.defineProperty(exports, "presignUrl", { enumerable: true, get: function () { return presign_url_1.presignUrl; } });
42
40
  const render_media_on_lambda_1 = require("./api/render-media-on-lambda");
43
41
  Object.defineProperty(exports, "renderVideoOnLambda", { enumerable: true, get: function () { return render_media_on_lambda_1.renderVideoOnLambda; } });
44
42
  const render_still_on_lambda_1 = require("./api/render-still-on-lambda");
@@ -56,3 +54,13 @@ exports.renderMediaOnLambda = renderMediaOnLambda;
56
54
  */
57
55
  const renderStillOnLambda = render_still_on_lambda_1.renderStillOnLambda;
58
56
  exports.renderStillOnLambda = renderStillOnLambda;
57
+ /**
58
+ * @deprecated Import this from `@remotion/lambda/client` instead
59
+ */
60
+ const presignUrl = presign_url_1.presignUrl;
61
+ exports.presignUrl = presignUrl;
62
+ /**
63
+ * @deprecated Import this from `@remotion/lambda/client` instead
64
+ */
65
+ const getSites = get_sites_1.getSites;
66
+ exports.getSites = getSites;
@@ -1,4 +1,4 @@
1
- import type { ChromiumOptions, Codec, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from '@remotion/renderer';
1
+ import type { AudioCodec, ChromiumOptions, Codec, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } 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';
@@ -117,6 +117,7 @@ export declare type LambdaPayloads = {
117
117
  framesPerLambda: number | null;
118
118
  inputProps: SerializedInputProps;
119
119
  codec: LambdaCodec;
120
+ audioCodec: AudioCodec | null;
120
121
  imageFormat: ImageFormat;
121
122
  crf: number | undefined;
122
123
  envVariables: Record<string, string> | undefined;
@@ -143,6 +144,7 @@ export declare type LambdaPayloads = {
143
144
  webhook: WebhookOption;
144
145
  forceHeight: number | null;
145
146
  forceWidth: number | null;
147
+ bucketName: string | null;
146
148
  };
147
149
  launch: {
148
150
  rendererFunctionName: string | null;
@@ -155,6 +157,7 @@ export declare type LambdaPayloads = {
155
157
  renderId: string;
156
158
  imageFormat: ImageFormat;
157
159
  codec: LambdaCodec;
160
+ audioCodec: AudioCodec | null;
158
161
  crf: number | undefined;
159
162
  envVariables: Record<string, string> | undefined;
160
163
  pixelFormat: PixelFormat | undefined;
@@ -244,6 +247,7 @@ export declare type LambdaPayloads = {
244
247
  version: string;
245
248
  forceHeight: number | null;
246
249
  forceWidth: number | null;
250
+ bucketName: string | null;
247
251
  };
248
252
  compositions: {
249
253
  type: LambdaRoutines.compositions;
@@ -254,6 +258,7 @@ export declare type LambdaPayloads = {
254
258
  envVariables: Record<string, string> | undefined;
255
259
  timeoutInMilliseconds: number;
256
260
  serveUrl: string;
261
+ bucketName: string | null;
257
262
  };
258
263
  };
259
264
  export declare type LambdaPayload = LambdaPayloads[LambdaRoutines];
@@ -269,6 +274,7 @@ export declare type RenderMetadata = {
269
274
  estimatedRenderLambdaInvokations: number;
270
275
  compositionId: string;
271
276
  codec: Codec | null;
277
+ audioCodec: AudioCodec | null;
272
278
  type: 'still' | 'video';
273
279
  imageFormat: ImageFormat;
274
280
  inputProps: SerializedInputProps;
@@ -1,7 +1,8 @@
1
1
  import type { AwsRegion } from '../client';
2
2
  import type { SerializedInputProps } from './constants';
3
- export declare const serializeInputProps: ({ inputProps, region, type, }: {
3
+ export declare const serializeInputProps: ({ inputProps, region, type, userSpecifiedBucketName, }: {
4
4
  inputProps: unknown;
5
5
  region: AwsRegion;
6
6
  type: 'still' | 'video-or-audio';
7
+ userSpecifiedBucketName: string | null;
7
8
  }) => Promise<SerializedInputProps>;
@@ -5,16 +5,16 @@ const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
5
5
  const io_1 = require("../functions/helpers/io");
6
6
  const constants_1 = require("./constants");
7
7
  const random_hash_1 = require("./random-hash");
8
- const serializeInputProps = async ({ inputProps, region, type, }) => {
8
+ const serializeInputProps = async ({ inputProps, region, type, userSpecifiedBucketName, }) => {
9
9
  try {
10
10
  const payload = JSON.stringify(inputProps);
11
11
  const hash = (0, random_hash_1.randomHash)();
12
12
  const MAX_INLINE_PAYLOAD_SIZE = type === 'still' ? 5000000 : 200000;
13
13
  if (payload.length > MAX_INLINE_PAYLOAD_SIZE) {
14
14
  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.`);
15
- const { bucketName } = await (0, get_or_create_bucket_1.getOrCreateBucket)({
15
+ const bucketName = userSpecifiedBucketName !== null && userSpecifiedBucketName !== void 0 ? userSpecifiedBucketName : (await (0, get_or_create_bucket_1.getOrCreateBucket)({
16
16
  region,
17
- });
17
+ })).bucketName;
18
18
  await (0, io_1.lambdaWriteFile)({
19
19
  body: payload,
20
20
  bucketName,
@@ -1,4 +1,4 @@
1
- declare const lambdaCodecs: readonly ["h264", "vp8", "mp3", "aac", "wav", "gif", "prores"];
1
+ declare const lambdaCodecs: readonly ["h264", "vp8", "vp9", "mp3", "aac", "wav", "gif", "prores"];
2
2
  export declare type LambdaCodec = typeof lambdaCodecs[number];
3
3
  export declare const validateLambdaCodec: (codec: unknown) => LambdaCodec;
4
4
  export {};
@@ -4,6 +4,7 @@ exports.validateLambdaCodec = void 0;
4
4
  const lambdaCodecs = [
5
5
  'h264',
6
6
  'vp8',
7
+ 'vp9',
7
8
  'mp3',
8
9
  'aac',
9
10
  'wav',
@@ -1,3 +1,3 @@
1
- import type { Codec } from '@remotion/renderer';
1
+ import type { AudioCodec, Codec } from '@remotion/renderer';
2
2
  import type { OutNameInputWithoutCredentials } from './constants';
3
- export declare const validateOutname: (outName: OutNameInputWithoutCredentials | undefined | null, codec?: Codec) => void;
3
+ export declare const validateOutname: (outName: OutNameInputWithoutCredentials | undefined | null, codec: Codec | null, audioCodec: AudioCodec | null) => void;
@@ -13,13 +13,18 @@ const validateS3Key = (s3Key) => {
13
13
  '. Check for invalid characters.');
14
14
  }
15
15
  };
16
- const validateOutname = (outName, codec) => {
16
+ const validateOutname = (outName, codec, audioCodec) => {
17
17
  if (typeof outName === 'undefined' || outName === null) {
18
18
  return;
19
19
  }
20
20
  if (typeof outName === 'string') {
21
21
  if (codec) {
22
- (0, renderer_1.validateOutputFilename)(codec, renderer_1.RenderInternals.getExtensionOfFilename(outName !== null && outName !== void 0 ? outName : null));
22
+ (0, renderer_1.validateOutputFilename)({
23
+ codec,
24
+ audioCodec,
25
+ extension: renderer_1.RenderInternals.getExtensionOfFilename(outName),
26
+ preferLossless: false,
27
+ });
23
28
  }
24
29
  validateS3Key(outName);
25
30
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "3.3.41",
3
+ "version": "3.3.42",
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.215.0",
34
34
  "@aws-sdk/lib-storage": "3.215.0",
35
35
  "@aws-sdk/s3-request-presigner": "3.215.0",
36
- "@remotion/bundler": "3.3.41",
37
- "@remotion/cli": "3.3.41",
38
- "@remotion/renderer": "3.3.41",
36
+ "@remotion/bundler": "3.3.42",
37
+ "@remotion/cli": "3.3.42",
38
+ "@remotion/renderer": "3.3.42",
39
39
  "aws-policies": "^1.0.1",
40
40
  "mime-types": "2.1.34",
41
- "remotion": "3.3.41"
41
+ "remotion": "3.3.42"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@jonny/eslint-config": "3.0.266",
45
- "@remotion/compositor-linux-arm64-musl": "3.3.41",
46
- "@remotion/compositor-linux-x64-musl": "3.3.41",
45
+ "@remotion/compositor-linux-arm64-musl": "3.3.42",
46
+ "@remotion/compositor-linux-x64-musl": "3.3.42",
47
47
  "@types/mime-types": "2.1.1",
48
48
  "@types/minimist": "1.2.2",
49
49
  "@types/node": "^14.14.14",
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "gitHead": "8e408247d151ac824864acf357782f10c89ed5f5"
62
+ "gitHead": "bfb8098300fb75d4c27220eead954c2dc8e5b4ce"
63
63
  }
Binary file
Binary file