@remotion/lambda 3.3.6 → 3.3.8
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.
- package/dist/admin/generate-etag-list.d.ts +1 -0
- package/dist/admin/generate-etag-list.js +14 -0
- package/dist/admin/make-layer-public.js +23 -1
- package/dist/api/deploy-site.d.ts +5 -0
- package/dist/api/deploy-site.js +39 -16
- package/dist/api/get-aws-client.d.ts +2 -0
- package/dist/api/get-aws-client.js +2 -0
- package/dist/api/iam-validation/simulate-rule.js +0 -22
- package/dist/api/iam-validation/simulate.js +17 -5
- package/dist/api/iam-validation/user-permissions.js +0 -6
- package/dist/api/upload-dir.d.ts +4 -3
- package/dist/api/upload-dir.js +33 -19
- package/dist/cli/commands/render/progress.d.ts +6 -3
- package/dist/cli/commands/render/progress.js +49 -39
- package/dist/cli/commands/render/render.js +16 -1
- package/dist/cli/commands/sites/create.js +12 -2
- package/dist/cli/helpers/progress-bar.d.ts +8 -1
- package/dist/cli/helpers/progress-bar.js +17 -1
- package/dist/cli/index.js +6 -1
- package/dist/functions/helpers/concat-videos.d.ts +10 -6
- package/dist/functions/helpers/concat-videos.js +5 -21
- package/dist/functions/helpers/create-post-render-data.js +0 -12
- package/dist/functions/helpers/get-chromium-executable-path.js +2 -1
- package/dist/functions/helpers/get-chunk-progress.d.ts +0 -0
- package/dist/functions/helpers/get-chunk-progress.js +1 -0
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/get-encoding-metadata.d.ts +4 -8
- package/dist/functions/helpers/get-encoding-metadata.js +4 -18
- package/dist/functions/helpers/get-final-encoding-status.d.ts +2 -4
- package/dist/functions/helpers/get-final-encoding-status.js +1 -4
- package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +1 -5
- package/dist/functions/helpers/get-lambdas-invoked-stats.js +1 -9
- package/dist/functions/helpers/get-overall-progress.d.ts +2 -1
- package/dist/functions/helpers/get-overall-progress.js +7 -5
- package/dist/functions/helpers/get-progress.js +37 -25
- package/dist/functions/helpers/get-rendered-frames-progress.d.ts +8 -0
- package/dist/functions/helpers/get-rendered-frames-progress.js +37 -0
- package/dist/functions/launch.js +48 -37
- package/dist/functions/renderer.js +15 -22
- package/dist/functions/still.js +2 -0
- package/dist/pricing/aws-regions.d.ts +1 -1
- package/dist/pricing/aws-regions.js +11 -0
- package/dist/pricing/price-per-1-s.js +413 -39
- package/dist/shared/aws-clients.d.ts +3 -0
- package/dist/shared/aws-clients.js +9 -1
- package/dist/shared/chunk-progress.d.ts +9 -0
- package/dist/shared/chunk-progress.js +2034 -0
- package/dist/shared/constants.d.ts +4 -5
- package/dist/shared/get-account-id.js +4 -6
- package/dist/shared/get-chunk-progress.d.ts +0 -0
- package/dist/shared/get-chunk-progress.js +1 -0
- package/dist/shared/get-etag.d.ts +1 -0
- package/dist/shared/get-etag.js +24 -0
- package/dist/shared/get-s3-operations.d.ts +10 -0
- package/dist/shared/get-s3-operations.js +36 -0
- package/dist/shared/hosted-layers.js +368 -60
- package/dist/shared/parse-chunk-key.d.ts +4 -0
- package/dist/shared/parse-chunk-key.js +14 -0
- package/dist/shared/read-dir.d.ts +9 -0
- package/dist/shared/read-dir.js +57 -0
- package/package.json +7 -6
- package/remotionlambda.zip +0 -0
- package/dist/shared/get-cloudwatch-stream-url.d.ts +0 -8
- package/dist/shared/get-cloudwatch-stream-url.js +0 -7
package/dist/functions/launch.js
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.launchHandler = void 0;
|
|
7
27
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
8
28
|
const renderer_1 = require("@remotion/renderer");
|
|
9
|
-
const fs_1 =
|
|
29
|
+
const fs_1 = __importStar(require("fs"));
|
|
30
|
+
const path_1 = require("path");
|
|
10
31
|
const remotion_1 = require("remotion");
|
|
11
32
|
const version_1 = require("remotion/version");
|
|
12
33
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
@@ -29,7 +50,6 @@ const find_output_file_in_bucket_1 = require("./helpers/find-output-file-in-buck
|
|
|
29
50
|
const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
30
51
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
31
52
|
const get_files_to_delete_1 = require("./helpers/get-files-to-delete");
|
|
32
|
-
const get_lambdas_invoked_stats_1 = require("./helpers/get-lambdas-invoked-stats");
|
|
33
53
|
const get_output_url_from_metadata_1 = require("./helpers/get-output-url-from-metadata");
|
|
34
54
|
const inspect_errors_1 = require("./helpers/inspect-errors");
|
|
35
55
|
const io_1 = require("./helpers/io");
|
|
@@ -223,6 +243,8 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
223
243
|
renderId: params.renderId,
|
|
224
244
|
outName: (_b = params.outName) !== null && _b !== void 0 ? _b : undefined,
|
|
225
245
|
privacy: params.privacy,
|
|
246
|
+
everyNthFrame: params.everyNthFrame,
|
|
247
|
+
frameRange: realFrameRange,
|
|
226
248
|
};
|
|
227
249
|
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, params.bucketName, typeof params.outName === 'string' || typeof params.outName === 'undefined'
|
|
228
250
|
? null
|
|
@@ -264,27 +286,17 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
264
286
|
}));
|
|
265
287
|
reqSend.end();
|
|
266
288
|
let lastProgressUploaded = 0;
|
|
267
|
-
|
|
268
|
-
const onProgress = (framesEncoded, start) => {
|
|
289
|
+
const onProgress = (framesEncoded) => {
|
|
269
290
|
const relativeProgress = framesEncoded / frameCount.length;
|
|
270
291
|
const deltaSinceLastProgressUploaded = relativeProgress - lastProgressUploaded;
|
|
271
|
-
if (relativeProgress === 1) {
|
|
272
|
-
encodingStop = Date.now();
|
|
273
|
-
}
|
|
274
292
|
if (deltaSinceLastProgressUploaded < 0.1) {
|
|
275
293
|
return;
|
|
276
294
|
}
|
|
277
295
|
lastProgressUploaded = relativeProgress;
|
|
278
|
-
const encodingProgress = {
|
|
279
|
-
framesEncoded,
|
|
280
|
-
totalFrames: frameCount.length,
|
|
281
|
-
doneIn: encodingStop ? encodingStop - start : null,
|
|
282
|
-
timeToInvoke: null,
|
|
283
|
-
};
|
|
284
296
|
(0, io_1.lambdaWriteFile)({
|
|
285
297
|
bucketName: params.bucketName,
|
|
286
298
|
key: (0, constants_1.encodingProgressKey)(params.renderId),
|
|
287
|
-
body:
|
|
299
|
+
body: String(framesEncoded),
|
|
288
300
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
289
301
|
privacy: 'private',
|
|
290
302
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -338,24 +350,35 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
338
350
|
throw new Error('Stopping Lambda function because error occurred: ' + errors[0].stack);
|
|
339
351
|
};
|
|
340
352
|
const fps = comp.fps / params.everyNthFrame;
|
|
341
|
-
const
|
|
353
|
+
const outdir = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.CONCAT_FOLDER_TOKEN), 'bucket');
|
|
354
|
+
if ((0, fs_1.existsSync)(outdir)) {
|
|
355
|
+
(fs_1.rmSync !== null && fs_1.rmSync !== void 0 ? fs_1.rmSync : fs_1.rmdirSync)(outdir, {
|
|
356
|
+
recursive: true,
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
(0, fs_1.mkdirSync)(outdir);
|
|
360
|
+
const files = await (0, concat_videos_1.getAllFilesS3)({
|
|
342
361
|
bucket: params.bucketName,
|
|
343
362
|
expectedFiles: chunkCount,
|
|
344
|
-
|
|
345
|
-
numberOfFrames: frameCount.length,
|
|
363
|
+
outdir,
|
|
346
364
|
renderId: params.renderId,
|
|
347
365
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
348
|
-
codec: params.codec,
|
|
349
366
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
367
|
+
onErrors,
|
|
368
|
+
});
|
|
369
|
+
const encodingStart = Date.now();
|
|
370
|
+
const { outfile, cleanupChunksProm } = await (0, concat_videos_1.concatVideosS3)({
|
|
371
|
+
onProgress,
|
|
372
|
+
numberOfFrames: frameCount.length,
|
|
373
|
+
codec: params.codec,
|
|
350
374
|
fps,
|
|
351
375
|
numberOfGifLoops: params.numberOfGifLoops,
|
|
352
376
|
ffmpegExecutable: null,
|
|
353
377
|
remotionRoot: process.cwd(),
|
|
354
|
-
|
|
378
|
+
files,
|
|
379
|
+
outdir,
|
|
355
380
|
});
|
|
356
|
-
|
|
357
|
-
encodingStop = Date.now();
|
|
358
|
-
}
|
|
381
|
+
const encodingStop = Date.now();
|
|
359
382
|
const outputSize = fs_1.default.statSync(outfile);
|
|
360
383
|
await (0, io_1.lambdaWriteFile)({
|
|
361
384
|
bucketName: renderBucketName,
|
|
@@ -373,22 +396,10 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
373
396
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
374
397
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
375
398
|
});
|
|
376
|
-
const finalEncodingProgress = {
|
|
377
|
-
framesEncoded: frameCount.length,
|
|
378
|
-
totalFrames: frameCount.length,
|
|
379
|
-
doneIn: encodingStop ? encodingStop - encodingStart : null,
|
|
380
|
-
timeToInvoke: (0, get_lambdas_invoked_stats_1.getLambdasInvokedStats)({
|
|
381
|
-
contents,
|
|
382
|
-
renderId: params.renderId,
|
|
383
|
-
estimatedRenderLambdaInvokations: renderMetadata.estimatedRenderLambdaInvokations,
|
|
384
|
-
checkIfAllLambdasWereInvoked: false,
|
|
385
|
-
startDate: renderMetadata.startedDate,
|
|
386
|
-
}).timeToInvokeLambdas,
|
|
387
|
-
};
|
|
388
399
|
const finalEncodingProgressProm = (0, io_1.lambdaWriteFile)({
|
|
389
400
|
bucketName: params.bucketName,
|
|
390
401
|
key: (0, constants_1.encodingProgressKey)(params.renderId),
|
|
391
|
-
body:
|
|
402
|
+
body: String(frameCount.length),
|
|
392
403
|
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
393
404
|
privacy: 'private',
|
|
394
405
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
@@ -9,13 +9,11 @@ const renderer_1 = require("@remotion/renderer");
|
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
12
|
+
const chunk_progress_1 = require("../shared/chunk-progress");
|
|
12
13
|
const constants_1 = require("../shared/constants");
|
|
13
14
|
const deserialize_input_props_1 = require("../shared/deserialize-input-props");
|
|
14
|
-
const clean_tmpdir_1 = require("./helpers/clean-tmpdir");
|
|
15
15
|
const get_browser_instance_1 = require("./helpers/get-browser-instance");
|
|
16
16
|
const get_current_region_1 = require("./helpers/get-current-region");
|
|
17
|
-
const get_files_in_folder_1 = require("./helpers/get-files-in-folder");
|
|
18
|
-
const get_folder_size_1 = require("./helpers/get-folder-size");
|
|
19
17
|
const io_1 = require("./helpers/io");
|
|
20
18
|
const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
21
19
|
const renderHandler = async (params, options, logs) => {
|
|
@@ -64,9 +62,17 @@ const renderHandler = async (params, options, logs) => {
|
|
|
64
62
|
inputProps,
|
|
65
63
|
frameRange: params.frameRange,
|
|
66
64
|
onProgress: ({ renderedFrames, encodedFrames, stitchStage }) => {
|
|
67
|
-
if (renderedFrames %
|
|
65
|
+
if (renderedFrames % 5 === 0 &&
|
|
68
66
|
renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose')) {
|
|
69
67
|
console.log(`Rendered ${renderedFrames} frames, encoded ${encodedFrames} frames, stage = ${stitchStage}`);
|
|
68
|
+
(0, chunk_progress_1.writeLambdaInitializedFile)({
|
|
69
|
+
attempt: params.attempt,
|
|
70
|
+
bucketName: params.bucketName,
|
|
71
|
+
chunk: params.chunk,
|
|
72
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
73
|
+
framesRendered: renderedFrames,
|
|
74
|
+
renderId: params.renderId,
|
|
75
|
+
}).catch((err) => reject(err));
|
|
70
76
|
}
|
|
71
77
|
const allFrames = renderer_1.RenderInternals.getFramesToRender(params.frameRange, params.everyNthFrame);
|
|
72
78
|
if (renderedFrames === allFrames.length) {
|
|
@@ -76,26 +82,13 @@ const renderHandler = async (params, options, logs) => {
|
|
|
76
82
|
},
|
|
77
83
|
concurrency: params.concurrencyPerLambda,
|
|
78
84
|
onStart: () => {
|
|
79
|
-
(0,
|
|
80
|
-
|
|
85
|
+
(0, chunk_progress_1.writeLambdaInitializedFile)({
|
|
86
|
+
attempt: params.attempt,
|
|
81
87
|
bucketName: params.bucketName,
|
|
82
|
-
|
|
83
|
-
filesCleaned: clean_tmpdir_1.deletedFilesSize,
|
|
84
|
-
filesInTmp: fs_1.default.readdirSync('/tmp'),
|
|
85
|
-
isWarm: options.isWarm,
|
|
86
|
-
deletedFiles: clean_tmpdir_1.deletedFiles,
|
|
87
|
-
tmpSize: (0, get_folder_size_1.getFolderSizeRecursively)('/tmp'),
|
|
88
|
-
tmpDirFiles: (0, get_files_in_folder_1.getFolderFiles)('/tmp'),
|
|
89
|
-
}),
|
|
90
|
-
key: (0, constants_1.lambdaChunkInitializedKey)({
|
|
91
|
-
renderId: params.renderId,
|
|
92
|
-
chunk: params.chunk,
|
|
93
|
-
attempt: params.attempt,
|
|
94
|
-
}),
|
|
95
|
-
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
88
|
+
chunk: params.chunk,
|
|
96
89
|
expectedBucketOwner: options.expectedBucketOwner,
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
framesRendered: 0,
|
|
91
|
+
renderId: params.renderId,
|
|
99
92
|
}).catch((err) => reject(err));
|
|
100
93
|
},
|
|
101
94
|
puppeteerInstance: browserInstance,
|
package/dist/functions/still.js
CHANGED
|
@@ -93,6 +93,8 @@ const innerStillHandler = async (lambdaParams, renderId, options) => {
|
|
|
93
93
|
renderId,
|
|
94
94
|
outName: (_b = lambdaParams.outName) !== null && _b !== void 0 ? _b : undefined,
|
|
95
95
|
privacy: lambdaParams.privacy,
|
|
96
|
+
everyNthFrame: 1,
|
|
97
|
+
frameRange: [lambdaParams.frame, lambdaParams.frame],
|
|
96
98
|
};
|
|
97
99
|
await (0, io_1.lambdaWriteFile)({
|
|
98
100
|
bucketName,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const AWS_REGIONS: readonly ["eu-central-1", "eu-west-1", "eu-west-2", "us-east-1", "us-east-2", "us-west-2", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1"];
|
|
1
|
+
export declare const AWS_REGIONS: readonly ["eu-central-1", "eu-west-1", "eu-west-2", "eu-west-3", "eu-south-1", "eu-north-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2", "af-south-1", "ap-south-1", "ap-east-1", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ca-central-1", "me-south-1", "sa-east-1"];
|
|
2
2
|
export declare type AwsRegion = typeof AWS_REGIONS[number];
|
|
@@ -5,11 +5,22 @@ exports.AWS_REGIONS = [
|
|
|
5
5
|
'eu-central-1',
|
|
6
6
|
'eu-west-1',
|
|
7
7
|
'eu-west-2',
|
|
8
|
+
'eu-west-3',
|
|
9
|
+
'eu-south-1',
|
|
10
|
+
'eu-north-1',
|
|
8
11
|
'us-east-1',
|
|
9
12
|
'us-east-2',
|
|
13
|
+
'us-west-1',
|
|
10
14
|
'us-west-2',
|
|
15
|
+
'af-south-1',
|
|
11
16
|
'ap-south-1',
|
|
17
|
+
'ap-east-1',
|
|
12
18
|
'ap-southeast-1',
|
|
13
19
|
'ap-southeast-2',
|
|
14
20
|
'ap-northeast-1',
|
|
21
|
+
'ap-northeast-2',
|
|
22
|
+
'ap-northeast-3',
|
|
23
|
+
'ca-central-1',
|
|
24
|
+
'me-south-1',
|
|
25
|
+
'sa-east-1',
|
|
15
26
|
];
|