@remotion/lambda 4.0.0-alpha4 → 4.0.0-alpha6

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 (86) hide show
  1. package/dist/admin/bundle-lambda.js +24 -30
  2. package/dist/admin/generate-etag-list.js +4 -4
  3. package/dist/admin/make-layer-public.js +59 -87
  4. package/dist/api/clean-items.js +1 -1
  5. package/dist/api/create-function.d.ts +1 -3
  6. package/dist/api/create-function.js +8 -8
  7. package/dist/api/deploy-function.d.ts +0 -3
  8. package/dist/api/deploy-function.js +1 -7
  9. package/dist/api/deploy-site.js +4 -9
  10. package/dist/api/download-media.d.ts +0 -4
  11. package/dist/api/download-media.js +3 -7
  12. package/dist/api/estimate-price.d.ts +1 -3
  13. package/dist/api/estimate-price.js +3 -9
  14. package/dist/api/get-compositions-on-lambda.d.ts +2 -2
  15. package/dist/api/get-or-create-bucket.d.ts +0 -1
  16. package/dist/api/get-or-create-bucket.js +0 -3
  17. package/dist/api/get-sites.d.ts +0 -1
  18. package/dist/api/iam-validation/simulate.js +4 -2
  19. package/dist/api/make-lambda-payload.d.ts +41 -0
  20. package/dist/api/make-lambda-payload.js +65 -0
  21. package/dist/api/render-media-on-lambda.d.ts +10 -6
  22. package/dist/api/render-media-on-lambda.js +5 -58
  23. package/dist/api/render-still-on-lambda.d.ts +7 -3
  24. package/dist/api/render-still-on-lambda.js +6 -3
  25. package/dist/api/upload-dir.js +7 -7
  26. package/dist/cli/args.d.ts +0 -2
  27. package/dist/cli/commands/functions/deploy.js +7 -9
  28. package/dist/cli/commands/functions/ls.js +4 -1
  29. package/dist/cli/commands/functions/rm.js +8 -2
  30. package/dist/cli/commands/functions/rmall.js +8 -2
  31. package/dist/cli/commands/quotas/increase.js +2 -2
  32. package/dist/cli/commands/render/render.js +22 -12
  33. package/dist/cli/commands/sites/create.js +7 -8
  34. package/dist/cli/commands/still.js +7 -5
  35. package/dist/cli/help.js +4 -0
  36. package/dist/cli/helpers/progress-bar.d.ts +1 -2
  37. package/dist/cli/helpers/progress-bar.js +3 -7
  38. package/dist/cli/index.js +3 -3
  39. package/dist/cli/log.d.ts +12 -0
  40. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
  41. package/dist/functions/compositions.d.ts +1 -1
  42. package/dist/functions/compositions.js +0 -2
  43. package/dist/functions/helpers/calculate-price-from-bucket.d.ts +1 -3
  44. package/dist/functions/helpers/calculate-price-from-bucket.js +1 -2
  45. package/dist/functions/helpers/clean-tmpdir.js +7 -7
  46. package/dist/functions/helpers/concat-videos.d.ts +2 -4
  47. package/dist/functions/helpers/concat-videos.js +8 -11
  48. package/dist/functions/helpers/create-post-render-data.js +0 -2
  49. package/dist/functions/helpers/get-chromium-executable-path.js +6 -1
  50. package/dist/functions/helpers/get-current-region.d.ts +1 -1
  51. package/dist/functions/helpers/get-files-in-folder.js +5 -5
  52. package/dist/functions/helpers/get-progress.js +0 -2
  53. package/dist/functions/helpers/io.d.ts +1 -1
  54. package/dist/functions/helpers/is-enosp-err.js +1 -1
  55. package/dist/functions/helpers/validate-composition.d.ts +3 -5
  56. package/dist/functions/helpers/validate-composition.js +1 -3
  57. package/dist/functions/index.d.ts +15 -4
  58. package/dist/functions/index.js +1 -1
  59. package/dist/functions/launch.js +10 -14
  60. package/dist/functions/renderer.js +15 -15
  61. package/dist/functions/start.js +1 -1
  62. package/dist/functions/still.js +7 -11
  63. package/dist/index.d.ts +5 -6
  64. package/dist/index.js +1 -2
  65. package/dist/internals.d.ts +40 -0
  66. package/dist/internals.js +2 -0
  67. package/dist/shared/aws-clients.js +2 -2
  68. package/dist/shared/call-lambda.js +11 -0
  69. package/dist/shared/constants.d.ts +20 -17
  70. package/dist/shared/constants.js +1 -2
  71. package/dist/shared/function-zip-path.d.ts +0 -1
  72. package/dist/shared/function-zip-path.js +3 -4
  73. package/dist/shared/get-etag.js +4 -4
  74. package/dist/shared/hosted-layers.d.ts +2 -91
  75. package/dist/shared/hosted-layers.js +64 -363
  76. package/dist/shared/invoke-webhook.d.ts +1 -3
  77. package/dist/shared/invoke-webhook.js +4 -4
  78. package/dist/shared/make-s3-key.js +2 -2
  79. package/dist/shared/make-s3-url.js +2 -2
  80. package/dist/shared/read-dir.js +2 -2
  81. package/dist/shared/serialize-input-props.js +1 -1
  82. package/dist/shared/validate-privacy.js +1 -1
  83. package/package.json +9 -10
  84. package/remotionlambda-arm64.zip +0 -0
  85. package/remotionlambda-x64.zip +0 -0
  86. package/remotionlambda.zip +0 -0
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.rendererHandler = void 0;
7
7
  const client_lambda_1 = require("@aws-sdk/client-lambda");
8
8
  const renderer_1 = require("@remotion/renderer");
9
- const fs_1 = __importDefault(require("fs"));
10
- const path_1 = __importDefault(require("path"));
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
11
  const version_1 = require("remotion/version");
12
12
  const aws_clients_1 = require("../shared/aws-clients");
13
13
  const chunk_progress_1 = require("../shared/chunk-progress");
@@ -51,7 +51,7 @@ const renderHandler = async (params, options, logs) => {
51
51
  const chunkCodec = params.codec === 'gif' || params.codec === 'h264'
52
52
  ? 'h264-mkv'
53
53
  : params.codec;
54
- const outputLocation = path_1.default.join(outdir, `localchunk-${String(params.chunk).padStart(8, '0')}.${renderer_1.RenderInternals.getFileExtensionFromCodec(chunkCodec, renderer_1.RenderInternals.getDefaultAudioCodec({
54
+ const outputLocation = node_path_1.default.join(outdir, `localchunk-${String(params.chunk).padStart(8, '0')}.${renderer_1.RenderInternals.getFileExtensionFromCodec(chunkCodec, renderer_1.RenderInternals.getDefaultAudioCodec({
55
55
  codec: params.codec,
56
56
  preferLossless: true,
57
57
  }))}`);
@@ -103,7 +103,7 @@ const renderHandler = async (params, options, logs) => {
103
103
  },
104
104
  puppeteerInstance: browserInstance,
105
105
  serveUrl: params.serveUrl,
106
- quality: params.quality,
106
+ jpegQuality: params.jpegQuality,
107
107
  envVariables: params.envVariables,
108
108
  dumpBrowserLogs: (_a = params.dumpBrowserLogs) !== null && _a !== void 0 ? _a : renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'),
109
109
  verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'),
@@ -150,13 +150,6 @@ const renderHandler = async (params, options, logs) => {
150
150
  enforceAudioTrack: true,
151
151
  audioBitrate: params.audioBitrate,
152
152
  videoBitrate: params.videoBitrate,
153
- onSlowestFrames: (slowestFrames) => {
154
- console.log();
155
- console.log(`Slowest frames:`);
156
- slowestFrames.forEach(({ frame, time }) => {
157
- console.log(`Frame ${frame} (${time.toFixed(3)}ms)`);
158
- });
159
- },
160
153
  // Lossless flag takes priority over audio codec
161
154
  // https://github.com/remotion-dev/remotion/issues/1647
162
155
  // Special flag only in Lambda renderer which improves the audio quality
@@ -164,7 +157,14 @@ const renderHandler = async (params, options, logs) => {
164
157
  preferLossless: true,
165
158
  browserExecutable: (0, get_chromium_executable_path_1.executablePath)(),
166
159
  })
167
- .then(() => resolve())
160
+ .then(({ slowestFrames }) => {
161
+ console.log();
162
+ console.log(`Slowest frames:`);
163
+ slowestFrames.forEach(({ frame, time }) => {
164
+ console.log(`Frame ${frame} (${time.toFixed(3)}ms)`);
165
+ });
166
+ resolve();
167
+ })
168
168
  .catch((err) => reject(err));
169
169
  });
170
170
  const endRendered = Date.now();
@@ -178,7 +178,7 @@ const renderHandler = async (params, options, logs) => {
178
178
  renderId: params.renderId,
179
179
  index: params.chunk,
180
180
  }),
181
- body: fs_1.default.createReadStream(outputLocation),
181
+ body: node_fs_1.default.createReadStream(outputLocation),
182
182
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
183
183
  privacy: params.privacy,
184
184
  expectedBucketOwner: options.expectedBucketOwner,
@@ -186,8 +186,8 @@ const renderHandler = async (params, options, logs) => {
186
186
  customCredentials: null,
187
187
  });
188
188
  await Promise.all([
189
- fs_1.default.promises.rm(outputLocation, { recursive: true }),
190
- fs_1.default.promises.rm(outputPath, { recursive: true }),
189
+ node_fs_1.default.promises.rm(outputLocation, { recursive: true }),
190
+ node_fs_1.default.promises.rm(outputPath, { recursive: true }),
191
191
  (0, io_1.lambdaWriteFile)({
192
192
  bucketName: params.bucketName,
193
193
  body: JSON.stringify(condensedTimingData, null, 2),
@@ -55,7 +55,7 @@ const startHandler = async (params, options) => {
55
55
  envVariables: params.envVariables,
56
56
  pixelFormat: params.pixelFormat,
57
57
  proResProfile: params.proResProfile,
58
- quality: params.quality,
58
+ jpegQuality: params.jpegQuality,
59
59
  maxRetries: params.maxRetries,
60
60
  privacy: params.privacy,
61
61
  logLevel: (_b = params.logLevel) !== null && _b !== void 0 ? _b : 'info',
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.stillHandler = void 0;
7
7
  const client_lambda_1 = require("@aws-sdk/client-lambda");
8
8
  const renderer_1 = require("@remotion/renderer");
9
- const fs_1 = __importDefault(require("fs"));
10
- const path_1 = __importDefault(require("path"));
9
+ const node_fs_1 = __importDefault(require("node:fs"));
10
+ const node_path_1 = __importDefault(require("node:path"));
11
11
  const version_1 = require("remotion/version");
12
12
  const estimate_price_1 = require("../api/estimate-price");
13
13
  const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
@@ -25,7 +25,6 @@ const expected_out_name_1 = require("./helpers/expected-out-name");
25
25
  const format_costs_info_1 = require("./helpers/format-costs-info");
26
26
  const get_browser_instance_1 = require("./helpers/get-browser-instance");
27
27
  const get_chromium_executable_path_1 = require("./helpers/get-chromium-executable-path");
28
- const get_current_architecture_1 = require("./helpers/get-current-architecture");
29
28
  const get_current_region_1 = require("./helpers/get-current-region");
30
29
  const get_output_url_from_metadata_1 = require("./helpers/get-output-url-from-metadata");
31
30
  const io_1 = require("./helpers/io");
@@ -53,7 +52,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
53
52
  (0, get_browser_instance_1.getBrowserInstance)(renderer_1.RenderInternals.isEqualOrBelowLogLevel(lambdaParams.logLevel, 'verbose'), (_b = lambdaParams.chromiumOptions) !== null && _b !== void 0 ? _b : {}),
54
53
  ]);
55
54
  const outputDir = renderer_1.RenderInternals.tmpDir('remotion-render-');
56
- const outputPath = path_1.default.join(outputDir, 'output');
55
+ const outputPath = node_path_1.default.join(outputDir, 'output');
57
56
  const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
58
57
  const region = (0, get_current_region_1.getCurrentRegionInFunction)();
59
58
  const inputProps = await (0, deserialize_input_props_1.deserializeInputProps)({
@@ -73,8 +72,6 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
73
72
  composition: lambdaParams.composition,
74
73
  inputProps,
75
74
  envVariables: lambdaParams.envVariables,
76
- ffmpegExecutable: null,
77
- ffprobeExecutable: null,
78
75
  chromiumOptions: lambdaParams.chromiumOptions,
79
76
  timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
80
77
  port: null,
@@ -129,7 +126,7 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
129
126
  inputProps,
130
127
  overwrite: false,
131
128
  puppeteerInstance: browserInstance,
132
- quality: lambdaParams.quality,
129
+ jpegQuality: lambdaParams.jpegQuality,
133
130
  chromiumOptions: lambdaParams.chromiumOptions,
134
131
  scale: lambdaParams.scale,
135
132
  timeoutInMilliseconds: lambdaParams.timeoutInMilliseconds,
@@ -137,19 +134,19 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
137
134
  browserExecutable: (0, get_chromium_executable_path_1.executablePath)(),
138
135
  });
139
136
  const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, bucketName, (0, expected_out_name_1.getCredentialsFromOutName)(lambdaParams.outName));
140
- const { size } = await fs_1.default.promises.stat(outputPath);
137
+ const { size } = await node_fs_1.default.promises.stat(outputPath);
141
138
  await (0, io_1.lambdaWriteFile)({
142
139
  bucketName: renderBucketName,
143
140
  key,
144
141
  privacy: lambdaParams.privacy,
145
- body: fs_1.default.createReadStream(outputPath),
142
+ body: node_fs_1.default.createReadStream(outputPath),
146
143
  expectedBucketOwner: options.expectedBucketOwner,
147
144
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
148
145
  downloadBehavior: lambdaParams.downloadBehavior,
149
146
  customCredentials,
150
147
  });
151
148
  await Promise.all([
152
- fs_1.default.promises.rm(outputPath, { recursive: true }),
149
+ node_fs_1.default.promises.rm(outputPath, { recursive: true }),
153
150
  (0, cleanup_serialized_input_props_1.cleanupSerializedInputProps)({
154
151
  bucketName,
155
152
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
@@ -161,7 +158,6 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
161
158
  memorySizeInMb: Number(process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE),
162
159
  region: (0, get_current_region_1.getCurrentRegionInFunction)(),
163
160
  lambdasInvoked: 1,
164
- architecture: (0, get_current_architecture_1.getCurrentArchitecture)(),
165
161
  // We cannot determine the ephemeral storage size, so we
166
162
  // overestimate the price, but will only have a miniscule effect (~0.2%)
167
163
  diskSizeInMb: constants_1.MAX_EPHEMERAL_STORAGE_IN_MB,
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { deployFunction } from './api/deploy-function';
9
9
  import type { DeploySiteInput, DeploySiteOutput } from './api/deploy-site';
10
10
  import { deploySite } from './api/deploy-site';
11
11
  import type { DownloadMediaInput, DownloadMediaOutput } from './api/download-media';
12
- import { downloadMedia, downloadVideo } from './api/download-media';
12
+ import { downloadMedia } from './api/download-media';
13
13
  import type { EstimatePriceInput } from './api/estimate-price';
14
14
  import { estimatePrice } from './api/estimate-price';
15
15
  import type { GetAwsClientInput, GetAwsClientOutput } from './api/get-aws-client';
@@ -40,15 +40,14 @@ import type { AwsRegion } from './pricing/aws-regions';
40
40
  import type { CustomCredentials } from './shared/aws-clients';
41
41
  import type { RenderProgress } from './shared/constants';
42
42
  import type { WebhookPayload } from './shared/invoke-webhook';
43
- import type { LambdaArchitecture } from './shared/validate-architecture';
44
43
  /**
45
44
  * @deprecated Import this from `@remotion/lambda/client` instead
46
45
  */
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, dumpBrowserLogs, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
46
+ declare const renderMediaOnLambda: (input: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
48
47
  /**
49
48
  * @deprecated Import this from `@remotion/lambda/client` instead
50
49
  */
51
- declare const renderStillOnLambda: ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, forceHeight, forceWidth, forceBucketName, dumpBrowserLogs, }: 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, }: RenderStillOnLambdaInput) => Promise<RenderStillOnLambdaOutput>;
52
51
  /**
53
52
  * @deprecated Import this from `@remotion/lambda/client` instead
54
53
  */
@@ -57,5 +56,5 @@ declare const presignUrl: <CheckIfObjectExists extends boolean = false>({ region
57
56
  * @deprecated Import this from `@remotion/lambda/client` instead
58
57
  */
59
58
  declare const getSites: ({ region, }: GetSitesInput) => Promise<GetSitesOutput>;
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, };
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, };
59
+ export { deleteSite, deployFunction, deploySite, downloadMedia, getFunctions, getUserPolicy, getRolePolicy, getSites, getOrCreateBucket, getRenderProgress, renderVideoOnLambda, renderMediaOnLambda, simulatePermissions, deleteFunction, getFunctionInfo, estimatePrice, LambdaInternals, renderStillOnLambda, getRegions, getAwsClient, presignUrl, deleteRender, validateWebhookSignature, getCompositionsOnLambda, };
60
+ 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, CustomCredentials, WebhookPayload, LambdaErrorInfo, EnhancedErrorInfo, DeleteRenderInput, GetCompositionsOnLambdaOutput, GetCompositionsOnLambdaInput, };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCompositionsOnLambda = exports.validateWebhookSignature = exports.deleteRender = exports.presignUrl = exports.getAwsClient = exports.getRegions = exports.renderStillOnLambda = exports.LambdaInternals = exports.estimatePrice = exports.getFunctionInfo = exports.deleteFunction = exports.simulatePermissions = exports.renderMediaOnLambda = exports.renderVideoOnLambda = exports.getRenderProgress = exports.getOrCreateBucket = exports.getSites = exports.getRolePolicy = exports.getUserPolicy = exports.getFunctions = exports.downloadVideo = exports.downloadMedia = exports.deploySite = exports.deployFunction = exports.deleteSite = void 0;
3
+ exports.getCompositionsOnLambda = exports.validateWebhookSignature = exports.deleteRender = exports.presignUrl = exports.getAwsClient = exports.getRegions = exports.renderStillOnLambda = exports.LambdaInternals = exports.estimatePrice = exports.getFunctionInfo = exports.deleteFunction = exports.simulatePermissions = exports.renderMediaOnLambda = exports.renderVideoOnLambda = exports.getRenderProgress = exports.getOrCreateBucket = exports.getSites = exports.getRolePolicy = exports.getUserPolicy = exports.getFunctions = exports.downloadMedia = exports.deploySite = exports.deployFunction = exports.deleteSite = void 0;
4
4
  const delete_function_1 = require("./api/delete-function");
5
5
  Object.defineProperty(exports, "deleteFunction", { enumerable: true, get: function () { return delete_function_1.deleteFunction; } });
6
6
  const delete_render_1 = require("./api/delete-render");
@@ -13,7 +13,6 @@ const deploy_site_1 = require("./api/deploy-site");
13
13
  Object.defineProperty(exports, "deploySite", { enumerable: true, get: function () { return deploy_site_1.deploySite; } });
14
14
  const download_media_1 = require("./api/download-media");
15
15
  Object.defineProperty(exports, "downloadMedia", { enumerable: true, get: function () { return download_media_1.downloadMedia; } });
16
- Object.defineProperty(exports, "downloadVideo", { enumerable: true, get: function () { return download_media_1.downloadVideo; } });
17
16
  const estimate_price_1 = require("./api/estimate-price");
18
17
  Object.defineProperty(exports, "estimatePrice", { enumerable: true, get: function () { return estimate_price_1.estimatePrice; } });
19
18
  const get_aws_client_1 = require("./api/get-aws-client");
@@ -1,3 +1,43 @@
1
1
  export declare const LambdaInternals: {
2
2
  executeCommand: (args: string[], remotionRoot: string) => Promise<void>;
3
+ makeLambdaPayload: ({ 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<{
4
+ rendererFunctionName: string | null;
5
+ framesPerLambda: number | null;
6
+ composition: string;
7
+ serveUrl: string;
8
+ inputProps: import("./defaults").SerializedInputProps;
9
+ codec: "h264" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "gif" | "prores";
10
+ imageFormat: "png" | "jpeg" | "none";
11
+ crf: number | undefined;
12
+ envVariables: Record<string, string> | undefined;
13
+ pixelFormat: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le" | undefined;
14
+ proResProfile: "4444-xq" | "4444" | "hq" | "standard" | "light" | "proxy" | undefined;
15
+ jpegQuality: number | undefined;
16
+ maxRetries: number;
17
+ privacy: import("./defaults").Privacy;
18
+ logLevel: "verbose" | "info" | "warn" | "error";
19
+ frameRange: import("@remotion/renderer").FrameRange | null;
20
+ outName: import("./defaults").OutNameInput | null;
21
+ timeoutInMilliseconds: number;
22
+ chromiumOptions: import("@remotion/renderer").ChromiumOptions;
23
+ scale: number;
24
+ everyNthFrame: number;
25
+ numberOfGifLoops: number;
26
+ concurrencyPerLambda: number;
27
+ downloadBehavior: import("./shared/content-disposition-header").DownloadBehavior;
28
+ muted: boolean;
29
+ version: string;
30
+ overwrite: boolean;
31
+ audioBitrate: string | null;
32
+ videoBitrate: string | null;
33
+ webhook: {
34
+ url: string;
35
+ secret: string | null;
36
+ } | null;
37
+ forceHeight: number | null;
38
+ forceWidth: number | null;
39
+ bucketName: string | null;
40
+ audioCodec: "mp3" | "aac" | "pcm-16" | "opus" | null;
41
+ dumpBrowserLogs: boolean;
42
+ }>;
3
43
  };
package/dist/internals.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LambdaInternals = void 0;
4
+ const make_lambda_payload_1 = require("./api/make-lambda-payload");
4
5
  const index_1 = require("./cli/index");
5
6
  exports.LambdaInternals = {
6
7
  executeCommand: index_1.executeCommand,
8
+ makeLambdaPayload: make_lambda_payload_1.makeLambdaPayload,
7
9
  };
@@ -8,7 +8,7 @@ const client_s3_1 = require("@aws-sdk/client-s3");
8
8
  const client_service_quotas_1 = require("@aws-sdk/client-service-quotas");
9
9
  const client_sts_1 = require("@aws-sdk/client-sts");
10
10
  const credential_providers_1 = require("@aws-sdk/credential-providers");
11
- const crypto_1 = require("crypto");
11
+ const node_crypto_1 = require("node:crypto");
12
12
  const check_credentials_1 = require("./check-credentials");
13
13
  const is_in_lambda_1 = require("./is-in-lambda");
14
14
  const _clients = {};
@@ -90,7 +90,7 @@ const getCredentialsHash = ({ customCredentials, region, service, }) => {
90
90
  hashComponents.customCredentials = customCredentials;
91
91
  hashComponents.region = region;
92
92
  hashComponents.service = service;
93
- return (0, crypto_1.createHash)('sha256')
93
+ return (0, node_crypto_1.createHash)('sha256')
94
94
  .update(JSON.stringify(hashComponents))
95
95
  .digest('base64');
96
96
  };
@@ -12,6 +12,17 @@ const callLambda = async ({ functionName, type, payload, region, }) => {
12
12
  }));
13
13
  const string = Buffer.from(res.Payload).toString();
14
14
  const json = JSON.parse(string);
15
+ if (json === null) {
16
+ throw new Error('Lambda function unexpectedly returned null: ' +
17
+ JSON.stringify({
18
+ payload,
19
+ type,
20
+ functionName,
21
+ json,
22
+ error: res.FunctionError,
23
+ version: res.$metadata,
24
+ }));
25
+ }
15
26
  if ('errorMessage' in json) {
16
27
  const err = new Error(json.errorMessage);
17
28
  err.name = json.errorType;
@@ -1,17 +1,15 @@
1
- import type { AudioCodec, ChromiumOptions, Codec, FrameRange, ImageFormat, LogLevel, PixelFormat, ProResProfile } from '@remotion/renderer';
2
- import type { VideoConfig } from 'remotion';
1
+ import type { AudioCodec, ChromiumOptions, Codec, FrameRange, LogLevel, PixelFormat, ProResProfile, StillImageFormat, VideoImageFormat } from '@remotion/renderer';
2
+ import type { AnyCompMetadata } from 'remotion';
3
3
  import type { ChunkRetry } from '../functions/helpers/get-retry-stats';
4
4
  import type { EnhancedErrorInfo } from '../functions/helpers/write-lambda-error';
5
5
  import type { AwsRegion } from '../pricing/aws-regions';
6
6
  import type { CustomCredentials, CustomCredentialsWithoutSensitiveData } from './aws-clients';
7
7
  import type { DownloadBehavior } from './content-disposition-header';
8
8
  import type { ExpensiveChunk } from './get-most-expensive-chunks';
9
- import type { LambdaArchitecture } from './validate-architecture';
10
9
  import type { LambdaCodec } from './validate-lambda-codec';
11
10
  export declare const MIN_MEMORY = 512;
12
11
  export declare const MAX_MEMORY = 10240;
13
12
  export declare const DEFAULT_MEMORY_SIZE = 2048;
14
- export declare const DEFAULT_ARCHITECTURE: LambdaArchitecture;
15
13
  export declare const DEFAULT_TIMEOUT = 120;
16
14
  export declare const MIN_TIMEOUT = 15;
17
15
  export declare const MAX_TIMEOUT = 900;
@@ -78,7 +76,7 @@ export declare type OutNameOutput = {
78
76
  };
79
77
  export declare const getSitesKey: (siteId: string) => string;
80
78
  export declare const outName: (renderId: string, extension: string) => string;
81
- export declare const outStillName: (renderId: string, imageFormat: ImageFormat) => string;
79
+ export declare const outStillName: (renderId: string, imageFormat: StillImageFormat) => string;
82
80
  export declare const customOutName: (renderId: string, bucketName: string, name: OutNameInput) => OutNameOutput;
83
81
  export declare const postRenderDataKey: (renderId: string) => string;
84
82
  export declare const inputPropsKey: (hash: string) => string;
@@ -119,12 +117,12 @@ export declare type LambdaPayloads = {
119
117
  inputProps: SerializedInputProps;
120
118
  codec: LambdaCodec;
121
119
  audioCodec: AudioCodec | null;
122
- imageFormat: ImageFormat;
120
+ imageFormat: VideoImageFormat;
123
121
  crf: number | undefined;
124
122
  envVariables: Record<string, string> | undefined;
125
123
  pixelFormat: PixelFormat | undefined;
126
124
  proResProfile: ProResProfile | undefined;
127
- quality: number | undefined;
125
+ jpegQuality: number | undefined;
128
126
  maxRetries: number;
129
127
  privacy: Privacy;
130
128
  logLevel: LogLevel;
@@ -157,14 +155,14 @@ export declare type LambdaPayloads = {
157
155
  bucketName: string;
158
156
  inputProps: SerializedInputProps;
159
157
  renderId: string;
160
- imageFormat: ImageFormat;
158
+ imageFormat: VideoImageFormat;
161
159
  codec: LambdaCodec;
162
160
  audioCodec: AudioCodec | null;
163
161
  crf: number | undefined;
164
162
  envVariables: Record<string, string> | undefined;
165
163
  pixelFormat: PixelFormat | undefined;
166
164
  proResProfile: ProResProfile | undefined;
167
- quality: number | undefined;
165
+ jpegQuality: number | undefined;
168
166
  maxRetries: number;
169
167
  privacy: Privacy;
170
168
  logLevel: LogLevel;
@@ -208,12 +206,12 @@ export declare type LambdaPayloads = {
208
206
  retriesLeft: number;
209
207
  inputProps: SerializedInputProps;
210
208
  renderId: string;
211
- imageFormat: ImageFormat;
209
+ imageFormat: VideoImageFormat;
212
210
  codec: LambdaCodec;
213
211
  crf: number | undefined;
214
212
  proResProfile: ProResProfile | undefined;
215
213
  pixelFormat: PixelFormat | undefined;
216
- quality: number | undefined;
214
+ jpegQuality: number | undefined;
217
215
  envVariables: Record<string, string> | undefined;
218
216
  privacy: Privacy;
219
217
  attempt: number;
@@ -235,10 +233,10 @@ export declare type LambdaPayloads = {
235
233
  serveUrl: string;
236
234
  composition: string;
237
235
  inputProps: SerializedInputProps;
238
- imageFormat: ImageFormat;
236
+ imageFormat: StillImageFormat;
239
237
  envVariables: Record<string, string> | undefined;
240
238
  attempt: number;
241
- quality: number | undefined;
239
+ jpegQuality: number | undefined;
242
240
  maxRetries: number;
243
241
  frame: number;
244
242
  privacy: Privacy;
@@ -271,9 +269,16 @@ export declare type LambdaPayload = LambdaPayloads[LambdaRoutines];
271
269
  export declare type EncodingProgress = {
272
270
  framesEncoded: number;
273
271
  };
274
- export declare type RenderMetadata = {
272
+ declare type Discriminated = {
273
+ type: 'still';
274
+ imageFormat: StillImageFormat;
275
+ } | {
276
+ type: 'video';
277
+ imageFormat: VideoImageFormat;
278
+ };
279
+ export declare type RenderMetadata = Discriminated & {
275
280
  siteId: string;
276
- videoConfig: VideoConfig;
281
+ videoConfig: AnyCompMetadata;
277
282
  startedDate: number;
278
283
  totalChunks: number;
279
284
  estimatedTotalLambdaInvokations: number;
@@ -281,8 +286,6 @@ export declare type RenderMetadata = {
281
286
  compositionId: string;
282
287
  codec: Codec | null;
283
288
  audioCodec: AudioCodec | null;
284
- type: 'still' | 'video';
285
- imageFormat: ImageFormat;
286
289
  inputProps: SerializedInputProps;
287
290
  framesPerLambda: number;
288
291
  memorySizeInMb: number;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LAMBDA_BURST_LIMIT_QUOTA = exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.inputPropsKey = exports.postRenderDataKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = exports.getErrorFileName = exports.getErrorKeyPrefix = exports.chunkKeyForIndex = exports.chunkKey = exports.lambdaTimingsKey = exports.lambdaLogsPrefix = exports.lambdaTimingsPrefixForChunk = exports.lambdaTimingsPrefix = exports.lambdaChunkInitializedKey = exports.lambdaChunkInitializedPrefix = exports.initalizedMetadataKey = exports.renderMetadataKey = exports.encodingProgressKey = exports.rendersPrefix = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.ENCODING_PROGRESS_STEP_SIZE = exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = exports.DEFAULT_OUTPUT_PRIVACY = exports.MAX_EPHEMERAL_STORAGE_IN_MB = exports.MIN_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = exports.MAX_FUNCTIONS_PER_RENDER = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_REGION = exports.COMMAND_NOT_FOUND = exports.BINARY_NAME = exports.DEFAULT_FRAMES_PER_LAMBDA = exports.MINIMUM_FRAMES_PER_LAMBDA = exports.MAX_TIMEOUT = exports.MIN_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_ARCHITECTURE = exports.DEFAULT_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
3
+ exports.LAMBDA_BURST_LIMIT_QUOTA = exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = exports.LambdaRoutines = exports.REMOTION_FILELIST_TOKEN = exports.REMOTION_CONCATED_TOKEN = exports.CONCAT_FOLDER_TOKEN = exports.RENDERER_PATH_TOKEN = exports.inputPropsKey = exports.postRenderDataKey = exports.customOutName = exports.outStillName = exports.outName = exports.getSitesKey = exports.getErrorFileName = exports.getErrorKeyPrefix = exports.chunkKeyForIndex = exports.chunkKey = exports.lambdaTimingsKey = exports.lambdaLogsPrefix = exports.lambdaTimingsPrefixForChunk = exports.lambdaTimingsPrefix = exports.lambdaChunkInitializedKey = exports.lambdaChunkInitializedPrefix = exports.initalizedMetadataKey = exports.renderMetadataKey = exports.encodingProgressKey = exports.rendersPrefix = exports.LOG_GROUP_PREFIX = exports.RENDER_FN_PREFIX = exports.REMOTION_BUCKET_PREFIX = exports.ENCODING_PROGRESS_STEP_SIZE = exports.DEFAULT_CLOUDWATCH_RETENTION_PERIOD = exports.DEFAULT_OUTPUT_PRIVACY = exports.MAX_EPHEMERAL_STORAGE_IN_MB = exports.MIN_EPHEMERAL_STORAGE_IN_MB = exports.DEFAULT_EPHEMERAL_STORAGE_IN_MB = exports.MAX_FUNCTIONS_PER_RENDER = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_REGION = exports.COMMAND_NOT_FOUND = exports.BINARY_NAME = exports.DEFAULT_FRAMES_PER_LAMBDA = exports.MINIMUM_FRAMES_PER_LAMBDA = exports.MAX_TIMEOUT = exports.MIN_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_MEMORY_SIZE = exports.MAX_MEMORY = exports.MIN_MEMORY = void 0;
4
4
  exports.MIN_MEMORY = 512;
5
5
  exports.MAX_MEMORY = 10240;
6
6
  exports.DEFAULT_MEMORY_SIZE = 2048;
7
- exports.DEFAULT_ARCHITECTURE = 'arm64';
8
7
  exports.DEFAULT_TIMEOUT = 120;
9
8
  exports.MIN_TIMEOUT = 15;
10
9
  exports.MAX_TIMEOUT = 900;
@@ -1,2 +1 @@
1
1
  export declare const FUNCTION_ZIP_ARM64: string;
2
- export declare const FUNCTION_ZIP_X86_64: string;
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FUNCTION_ZIP_X86_64 = exports.FUNCTION_ZIP_ARM64 = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- exports.FUNCTION_ZIP_ARM64 = path_1.default.join(path_1.default.resolve(__dirname, '..', '..'), `remotionlambda-arm64.zip`);
9
- exports.FUNCTION_ZIP_X86_64 = path_1.default.join(path_1.default.resolve(__dirname, '..', '..'), `remotionlambda-x64.zip`);
6
+ exports.FUNCTION_ZIP_ARM64 = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ exports.FUNCTION_ZIP_ARM64 = node_path_1.default.join(node_path_1.default.resolve(__dirname, '..', '..'), `remotionlambda-arm64.zip`);
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getEtagOfFile = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const crypto_1 = __importDefault(require("crypto"));
7
+ const node_crypto_1 = __importDefault(require("node:crypto"));
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
9
  const chunk = 1024 * 1024 * 5; // 5MB
10
- const md5 = (data) => crypto_1.default.createHash('md5').update(data).digest('hex');
10
+ const md5 = (data) => node_crypto_1.default.createHash('md5').update(data).digest('hex');
11
11
  const getEtagOfFile = async (filePath) => {
12
- const stream = await fs_1.default.promises.readFile(filePath);
12
+ const stream = await node_fs_1.default.promises.readFile(filePath);
13
13
  if (stream.length <= chunk) {
14
14
  return `"${md5(stream)}"`;
15
15
  }
@@ -1,98 +1,9 @@
1
1
  import type { AwsRegion } from '../pricing/aws-regions';
2
- import type { LambdaArchitecture } from './validate-architecture';
3
2
  export declare const REMOTION_HOSTED_LAYER_ARN = "arn:aws:lambda:*:678892195805:layer:remotion-binaries-*";
4
3
  export declare type HostedLayers = {
5
- [architecture in LambdaArchitecture]: {
6
- [region in AwsRegion]: {
7
- layerArn: string;
8
- version: number;
9
- }[];
10
- };
11
- };
12
- export declare const hostedLayers: {
13
- 'ap-northeast-1': {
14
- layerArn: string;
15
- version: number;
16
- }[];
17
- 'ap-south-1': {
18
- layerArn: string;
19
- version: number;
20
- }[];
21
- 'ap-southeast-1': {
22
- layerArn: string;
23
- version: number;
24
- }[];
25
- 'ap-southeast-2': {
26
- layerArn: string;
27
- version: number;
28
- }[];
29
- 'eu-central-1': {
30
- layerArn: string;
31
- version: number;
32
- }[];
33
- 'eu-west-1': {
34
- layerArn: string;
35
- version: number;
36
- }[];
37
- 'eu-west-2': {
38
- layerArn: string;
39
- version: number;
40
- }[];
41
- 'us-east-1': {
42
- layerArn: string;
43
- version: number;
44
- }[];
45
- 'us-east-2': {
46
- layerArn: string;
47
- version: number;
48
- }[];
49
- 'us-west-2': {
50
- layerArn: string;
51
- version: number;
52
- }[];
53
- 'af-south-1': {
54
- layerArn: string;
55
- version: number;
56
- }[];
57
- 'ap-east-1': {
58
- layerArn: string;
59
- version: number;
60
- }[];
61
- 'ap-northeast-2': {
62
- layerArn: string;
63
- version: number;
64
- }[];
65
- 'ap-northeast-3': {
66
- layerArn: string;
67
- version: number;
68
- }[];
69
- 'ca-central-1': {
70
- layerArn: string;
71
- version: number;
72
- }[];
73
- 'eu-north-1': {
74
- layerArn: string;
75
- version: number;
76
- }[];
77
- 'eu-south-1': {
78
- layerArn: string;
79
- version: number;
80
- }[];
81
- 'eu-west-3': {
82
- layerArn: string;
83
- version: number;
84
- }[];
85
- 'me-south-1': {
86
- layerArn: string;
87
- version: number;
88
- }[];
89
- 'sa-east-1': {
90
- layerArn: string;
91
- version: number;
92
- }[];
93
- 'us-west-1': {
4
+ [region in AwsRegion]: {
94
5
  layerArn: string;
95
6
  version: number;
96
7
  }[];
97
8
  };
98
- export declare const __internal_doNotUsehostedLayers: HostedLayers;
9
+ export declare const hostedLayers: HostedLayers;