@remotion/lambda 3.1.11 → 3.2.2
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/api/presign-url.js +5 -0
- package/dist/api/render-media-on-lambda.d.ts +3 -2
- package/dist/api/render-media-on-lambda.js +45 -35
- package/dist/api/render-still-on-lambda.js +39 -30
- package/dist/cli/commands/render/render.js +2 -1
- package/dist/functions/helpers/find-output-file-in-bucket.js +6 -0
- package/dist/functions/launch.js +23 -6
- package/dist/functions/renderer.js +80 -74
- package/dist/functions/start.js +1 -0
- package/dist/shared/constants.d.ts +4 -1
- package/dist/shared/constants.js +1 -1
- package/package.json +6 -6
- package/remotionlambda.zip +0 -0
- package/dist/cli/helpers/format-bytes.d.ts +0 -6
- package/dist/cli/helpers/format-bytes.js +0 -103
- package/dist/shared/chunk.d.ts +0 -1
- package/dist/shared/chunk.js +0 -11
package/dist/api/presign-url.js
CHANGED
|
@@ -31,6 +31,11 @@ const presignUrl = async ({ region, bucketName, objectKey, checkIfObjectExists =
|
|
|
31
31
|
if (err.name === 'NotFound') {
|
|
32
32
|
return null;
|
|
33
33
|
}
|
|
34
|
+
if (err.message === 'UnknownError' ||
|
|
35
|
+
err.$metadata
|
|
36
|
+
.httpStatusCode === 403) {
|
|
37
|
+
throw new Error(`Unable to access item "${objectKey}" from bucket "${bucketName}". You must have permission for both "s3:GetObject" and "s3:ListBucket" actions.`);
|
|
38
|
+
}
|
|
34
39
|
throw err;
|
|
35
40
|
}
|
|
36
41
|
}
|
|
@@ -29,6 +29,7 @@ export declare type RenderMediaOnLambdaInput = {
|
|
|
29
29
|
numberOfGifLoops?: number | null;
|
|
30
30
|
concurrencyPerLambda?: number;
|
|
31
31
|
downloadBehavior?: DownloadBehavior | null;
|
|
32
|
+
muted?: boolean;
|
|
32
33
|
};
|
|
33
34
|
export declare type RenderMediaOnLambdaOutput = {
|
|
34
35
|
renderId: string;
|
|
@@ -52,8 +53,8 @@ export declare type RenderMediaOnLambdaOutput = {
|
|
|
52
53
|
* @param params.logLevel Level of logging that Lambda function should perform. Default "info".
|
|
53
54
|
* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
|
|
54
55
|
*/
|
|
55
|
-
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, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
56
|
+
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, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
56
57
|
/**
|
|
57
58
|
* @deprecated Renamed to renderMediaOnLambda()
|
|
58
59
|
*/
|
|
59
|
-
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, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
60
|
+
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, }: RenderMediaOnLambdaInput) => Promise<RenderMediaOnLambdaOutput>;
|
|
@@ -26,46 +26,56 @@ const validate_serveurl_1 = require("../shared/validate-serveurl");
|
|
|
26
26
|
* @param params.logLevel Level of logging that Lambda function should perform. Default "info".
|
|
27
27
|
* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
|
|
28
28
|
*/
|
|
29
|
-
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, }) => {
|
|
29
|
+
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, }) => {
|
|
30
|
+
var _a;
|
|
30
31
|
const actualCodec = (0, validate_lambda_codec_1.validateLambdaCodec)(codec);
|
|
31
32
|
(0, validate_serveurl_1.validateServeUrl)(serveUrl);
|
|
32
33
|
(0, validate_frames_per_lambda_1.validateFramesPerLambda)(framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null);
|
|
33
34
|
(0, validate_download_behavior_1.validateDownloadBehavior)(downloadBehavior);
|
|
34
35
|
const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
36
|
+
try {
|
|
37
|
+
const res = await (0, call_lambda_1.callLambda)({
|
|
38
|
+
functionName,
|
|
39
|
+
type: constants_1.LambdaRoutines.start,
|
|
40
|
+
payload: {
|
|
41
|
+
framesPerLambda: framesPerLambda !== null && framesPerLambda !== void 0 ? framesPerLambda : null,
|
|
42
|
+
composition,
|
|
43
|
+
serveUrl: realServeUrl,
|
|
44
|
+
inputProps,
|
|
45
|
+
codec: actualCodec,
|
|
46
|
+
imageFormat,
|
|
47
|
+
crf,
|
|
48
|
+
envVariables,
|
|
49
|
+
pixelFormat,
|
|
50
|
+
proResProfile,
|
|
51
|
+
quality,
|
|
52
|
+
maxRetries,
|
|
53
|
+
privacy,
|
|
54
|
+
logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
|
|
55
|
+
frameRange: frameRange !== null && frameRange !== void 0 ? frameRange : null,
|
|
56
|
+
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
57
|
+
timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
|
|
58
|
+
chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
|
|
59
|
+
scale: scale !== null && scale !== void 0 ? scale : 1,
|
|
60
|
+
everyNthFrame: everyNthFrame !== null && everyNthFrame !== void 0 ? everyNthFrame : 1,
|
|
61
|
+
numberOfGifLoops: numberOfGifLoops !== null && numberOfGifLoops !== void 0 ? numberOfGifLoops : 0,
|
|
62
|
+
concurrencyPerLambda: concurrencyPerLambda !== null && concurrencyPerLambda !== void 0 ? concurrencyPerLambda : 1,
|
|
63
|
+
downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : { type: 'play-in-browser' },
|
|
64
|
+
muted: muted !== null && muted !== void 0 ? muted : false,
|
|
65
|
+
},
|
|
66
|
+
region,
|
|
67
|
+
});
|
|
68
|
+
return {
|
|
69
|
+
renderId: res.renderId,
|
|
70
|
+
bucketName: res.bucketName,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('UnrecognizedClientException')) {
|
|
75
|
+
throw new Error('UnrecognizedClientException: The AWS credentials provided were probably mixed up. Learn how to fix this issue here: https://remotion.dev/docs/lambda/troubleshooting/unrecognizedclientexception');
|
|
76
|
+
}
|
|
77
|
+
throw err;
|
|
78
|
+
}
|
|
69
79
|
};
|
|
70
80
|
exports.renderMediaOnLambda = renderMediaOnLambda;
|
|
71
81
|
/**
|
|
@@ -21,36 +21,45 @@ const convert_to_serve_url_1 = require("../shared/convert-to-serve-url");
|
|
|
21
21
|
* @returns {Promise<RenderStillOnLambdaOutput>} See documentation for exact response structure.
|
|
22
22
|
*/
|
|
23
23
|
const renderStillOnLambda = async ({ functionName, serveUrl, inputProps, imageFormat, envVariables, quality, region, maxRetries, composition, privacy, frame, logLevel, outName, timeoutInMilliseconds, chromiumOptions, scale, downloadBehavior, }) => {
|
|
24
|
+
var _a;
|
|
24
25
|
const realServeUrl = await (0, convert_to_serve_url_1.convertToServeUrl)(serveUrl, region);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
26
|
+
try {
|
|
27
|
+
const res = await (0, call_lambda_1.callLambda)({
|
|
28
|
+
functionName,
|
|
29
|
+
type: constants_1.LambdaRoutines.still,
|
|
30
|
+
payload: {
|
|
31
|
+
composition,
|
|
32
|
+
serveUrl: realServeUrl,
|
|
33
|
+
inputProps,
|
|
34
|
+
imageFormat,
|
|
35
|
+
envVariables,
|
|
36
|
+
quality,
|
|
37
|
+
maxRetries: maxRetries !== null && maxRetries !== void 0 ? maxRetries : constants_1.DEFAULT_MAX_RETRIES,
|
|
38
|
+
frame: frame !== null && frame !== void 0 ? frame : 0,
|
|
39
|
+
privacy,
|
|
40
|
+
attempt: 1,
|
|
41
|
+
logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
|
|
42
|
+
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
43
|
+
timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : 30000,
|
|
44
|
+
chromiumOptions: chromiumOptions !== null && chromiumOptions !== void 0 ? chromiumOptions : {},
|
|
45
|
+
scale: scale !== null && scale !== void 0 ? scale : 1,
|
|
46
|
+
downloadBehavior: downloadBehavior !== null && downloadBehavior !== void 0 ? downloadBehavior : { type: 'play-in-browser' },
|
|
47
|
+
},
|
|
48
|
+
region,
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
estimatedPrice: res.estimatedPrice,
|
|
52
|
+
url: res.output,
|
|
53
|
+
sizeInBytes: res.size,
|
|
54
|
+
bucketName: res.bucketName,
|
|
55
|
+
renderId: res.renderId,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
if ((_a = err.stack) === null || _a === void 0 ? void 0 : _a.includes('UnrecognizedClientException')) {
|
|
60
|
+
throw new Error('UnrecognizedClientException: The AWS credentials provided were probably mixed up. Learn how to fix this issue here: https://remotion.dev/docs/lambda/troubleshooting/unrecognizedclientexception');
|
|
61
|
+
}
|
|
62
|
+
throw err;
|
|
63
|
+
}
|
|
55
64
|
};
|
|
56
65
|
exports.renderStillOnLambda = renderStillOnLambda;
|
|
@@ -38,7 +38,7 @@ const renderCommand = async (args) => {
|
|
|
38
38
|
(0, quit_1.quit)(1);
|
|
39
39
|
}
|
|
40
40
|
const outName = (_a = args[2]) !== null && _a !== void 0 ? _a : null;
|
|
41
|
-
const { chromiumOptions, codec, crf, envVariables, frameRange, imageFormat, inputProps, logLevel, pixelFormat, proResProfile, puppeteerTimeout, quality, scale, everyNthFrame, numberOfGifLoops, } = await cli_1.CliInternals.getCliOptions({
|
|
41
|
+
const { chromiumOptions, codec, crf, envVariables, frameRange, imageFormat, inputProps, logLevel, pixelFormat, proResProfile, puppeteerTimeout, quality, scale, everyNthFrame, numberOfGifLoops, muted, } = await cli_1.CliInternals.getCliOptions({
|
|
42
42
|
type: 'series',
|
|
43
43
|
isLambda: true,
|
|
44
44
|
});
|
|
@@ -75,6 +75,7 @@ const renderCommand = async (args) => {
|
|
|
75
75
|
numberOfGifLoops,
|
|
76
76
|
everyNthFrame,
|
|
77
77
|
concurrencyPerLambda: args_1.parsedLambdaCli['concurrency-per-lambda'],
|
|
78
|
+
muted,
|
|
78
79
|
});
|
|
79
80
|
const totalSteps = outName ? 5 : 4;
|
|
80
81
|
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput(cli_1.CliInternals.quietFlagProvided());
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.findOutputFileInBucket = void 0;
|
|
4
4
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
|
+
const suggested_policy_1 = require("../../api/iam-validation/suggested-policy");
|
|
5
6
|
const aws_clients_1 = require("../../shared/aws-clients");
|
|
6
7
|
const expected_out_name_1 = require("./expected-out-name");
|
|
7
8
|
const get_output_url_from_metadata_1 = require("./get-output-url-from-metadata");
|
|
@@ -26,6 +27,11 @@ const findOutputFileInBucket = async ({ region, renderMetadata, bucketName, }) =
|
|
|
26
27
|
if (err.name === 'NotFound') {
|
|
27
28
|
return null;
|
|
28
29
|
}
|
|
30
|
+
if (err.message === 'UnknownError' ||
|
|
31
|
+
err.$metadata
|
|
32
|
+
.httpStatusCode === 403) {
|
|
33
|
+
throw new Error(`Unable to access item "${expectedOutData.key}" from bucket "${expectedOutData.renderBucketName}". The "${suggested_policy_1.ROLE_NAME}" role must have permission for both "s3:GetObject" and "s3:ListBucket" actions.`);
|
|
34
|
+
}
|
|
29
35
|
throw err;
|
|
30
36
|
}
|
|
31
37
|
};
|
package/dist/functions/launch.js
CHANGED
|
@@ -39,6 +39,27 @@ const timer_1 = require("./helpers/timer");
|
|
|
39
39
|
const validate_composition_1 = require("./helpers/validate-composition");
|
|
40
40
|
const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
41
41
|
const write_post_render_data_1 = require("./helpers/write-post-render-data");
|
|
42
|
+
const callFunctionWithRetry = async (payload, retries = 0) => {
|
|
43
|
+
try {
|
|
44
|
+
await (0, aws_clients_1.getLambdaClient)((0, get_current_region_1.getCurrentRegionInFunction)()).send(new client_lambda_1.InvokeCommand({
|
|
45
|
+
FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
46
|
+
// @ts-expect-error
|
|
47
|
+
Payload: JSON.stringify(payload),
|
|
48
|
+
InvocationType: 'Event',
|
|
49
|
+
}), {});
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
if (err.name === 'ResourceConflictException') {
|
|
53
|
+
if (retries > 10) {
|
|
54
|
+
throw err;
|
|
55
|
+
}
|
|
56
|
+
await new Promise((resolve) => {
|
|
57
|
+
setTimeout(resolve, 1000);
|
|
58
|
+
});
|
|
59
|
+
return callFunctionWithRetry(payload, retries + 1);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
42
63
|
const innerLaunchHandler = async (params, options) => {
|
|
43
64
|
var _a, _b;
|
|
44
65
|
if (params.type !== constants_1.LambdaRoutines.launch) {
|
|
@@ -127,6 +148,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
127
148
|
scale: params.scale,
|
|
128
149
|
everyNthFrame: params.everyNthFrame,
|
|
129
150
|
concurrencyPerLambda: params.concurrencyPerLambda,
|
|
151
|
+
muted: params.muted,
|
|
130
152
|
};
|
|
131
153
|
return payload;
|
|
132
154
|
});
|
|
@@ -167,12 +189,7 @@ const innerLaunchHandler = async (params, options) => {
|
|
|
167
189
|
});
|
|
168
190
|
await Promise.all(lambdaPayloads.map(async (payload, index) => {
|
|
169
191
|
const callingLambdaTimer = (0, timer_1.timer)('Calling chunk ' + index);
|
|
170
|
-
await (
|
|
171
|
-
FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
172
|
-
// @ts-expect-error
|
|
173
|
-
Payload: JSON.stringify(payload),
|
|
174
|
-
InvocationType: 'Event',
|
|
175
|
-
}), {});
|
|
192
|
+
await callFunctionWithRetry(payload);
|
|
176
193
|
callingLambdaTimer.end();
|
|
177
194
|
}));
|
|
178
195
|
reqSend.end();
|
|
@@ -18,7 +18,7 @@ const get_folder_size_1 = require("./helpers/get-folder-size");
|
|
|
18
18
|
const io_1 = require("./helpers/io");
|
|
19
19
|
const write_lambda_error_1 = require("./helpers/write-lambda-error");
|
|
20
20
|
const renderHandler = async (params, options, logs) => {
|
|
21
|
-
var _a
|
|
21
|
+
var _a;
|
|
22
22
|
if (params.type !== constants_1.LambdaRoutines.renderer) {
|
|
23
23
|
throw new Error('Params must be renderer');
|
|
24
24
|
}
|
|
@@ -41,81 +41,87 @@ const renderHandler = async (params, options, logs) => {
|
|
|
41
41
|
const outputLocation = path_1.default.join(outdir, `localchunk-${String(params.chunk).padStart(8, '0')}.${renderer_1.RenderInternals.getFileExtensionFromCodec(params.codec, 'chunk')}`);
|
|
42
42
|
const chunkCodec = params.codec === 'gif' ? 'h264-mkv' : params.codec;
|
|
43
43
|
const downloadMap = renderer_1.RenderInternals.makeDownloadMap();
|
|
44
|
-
await (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
44
|
+
await new Promise((resolve, reject) => {
|
|
45
|
+
var _a;
|
|
46
|
+
(0, renderer_1.renderMedia)({
|
|
47
|
+
composition: {
|
|
48
|
+
id: params.composition,
|
|
49
|
+
durationInFrames: params.durationInFrames,
|
|
50
|
+
fps: params.fps,
|
|
51
|
+
height: params.height,
|
|
52
|
+
width: params.width,
|
|
53
|
+
},
|
|
54
|
+
imageFormat: params.imageFormat,
|
|
55
|
+
inputProps: params.inputProps,
|
|
56
|
+
frameRange: params.frameRange,
|
|
57
|
+
onProgress: ({ renderedFrames, encodedFrames, stitchStage }) => {
|
|
58
|
+
if (renderedFrames % 10 === 0 &&
|
|
59
|
+
renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose')) {
|
|
60
|
+
console.log(`Rendered ${renderedFrames} frames, encoded ${encodedFrames} frames, stage = ${stitchStage}`);
|
|
61
|
+
}
|
|
62
|
+
const allFrames = renderer_1.RenderInternals.getFramesToRender(params.frameRange, params.everyNthFrame);
|
|
63
|
+
if (renderedFrames === allFrames.length) {
|
|
64
|
+
console.log('Rendered all frames!');
|
|
65
|
+
}
|
|
66
|
+
chunkTimingData.timings[renderedFrames] = Date.now() - start;
|
|
67
|
+
},
|
|
68
|
+
parallelism: params.concurrencyPerLambda,
|
|
69
|
+
onStart: () => {
|
|
70
|
+
(0, io_1.lambdaWriteFile)({
|
|
71
|
+
privacy: 'private',
|
|
72
|
+
bucketName: params.bucketName,
|
|
73
|
+
body: JSON.stringify({
|
|
74
|
+
filesCleaned: clean_tmpdir_1.deletedFilesSize,
|
|
75
|
+
filesInTmp: fs_1.default.readdirSync('/tmp'),
|
|
76
|
+
isWarm: options.isWarm,
|
|
77
|
+
deletedFiles: clean_tmpdir_1.deletedFiles,
|
|
78
|
+
tmpSize: (0, get_folder_size_1.getFolderSizeRecursively)('/tmp'),
|
|
79
|
+
tmpDirFiles: (0, get_files_in_folder_1.getFolderFiles)('/tmp'),
|
|
80
|
+
}),
|
|
81
|
+
key: (0, constants_1.lambdaInitializedKey)({
|
|
82
|
+
renderId: params.renderId,
|
|
83
|
+
chunk: params.chunk,
|
|
84
|
+
attempt: params.attempt,
|
|
85
|
+
}),
|
|
86
|
+
region: (0, get_current_region_1.getCurrentRegionInFunction)(),
|
|
87
|
+
expectedBucketOwner: options.expectedBucketOwner,
|
|
88
|
+
downloadBehavior: null,
|
|
89
|
+
}).catch((err) => reject(err));
|
|
90
|
+
},
|
|
91
|
+
puppeteerInstance: browserInstance,
|
|
92
|
+
serveUrl: params.serveUrl,
|
|
93
|
+
quality: params.quality,
|
|
94
|
+
envVariables: params.envVariables,
|
|
95
|
+
dumpBrowserLogs: renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'),
|
|
96
|
+
verbose: renderer_1.RenderInternals.isEqualOrBelowLogLevel(params.logLevel, 'verbose'),
|
|
97
|
+
onBrowserLog: (log) => {
|
|
98
|
+
logs.push(log);
|
|
99
|
+
},
|
|
100
|
+
outputLocation,
|
|
101
|
+
codec: chunkCodec,
|
|
102
|
+
crf: (_a = params.crf) !== null && _a !== void 0 ? _a : undefined,
|
|
103
|
+
ffmpegExecutable: process.env.NODE_ENV === 'test' ? null : '/opt/bin/ffmpeg',
|
|
104
|
+
pixelFormat: params.pixelFormat,
|
|
105
|
+
proResProfile: params.proResProfile,
|
|
106
|
+
onDownload: (src) => {
|
|
107
|
+
console.log('Downloading', src);
|
|
108
|
+
return () => undefined;
|
|
109
|
+
},
|
|
110
|
+
overwrite: false,
|
|
111
|
+
chromiumOptions: params.chromiumOptions,
|
|
112
|
+
scale: params.scale,
|
|
113
|
+
timeoutInMilliseconds: params.timeoutInMilliseconds,
|
|
114
|
+
port: null,
|
|
115
|
+
everyNthFrame: params.everyNthFrame,
|
|
116
|
+
numberOfGifLoops: null,
|
|
117
|
+
downloadMap,
|
|
118
|
+
muted: params.muted,
|
|
119
|
+
enforceAudioTrack: true,
|
|
120
|
+
})
|
|
121
|
+
.then(() => resolve())
|
|
122
|
+
.catch((err) => reject(err));
|
|
116
123
|
});
|
|
117
124
|
const endRendered = Date.now();
|
|
118
|
-
console.log('Adding silent audio, chunk', params.chunk);
|
|
119
125
|
const condensedTimingData = {
|
|
120
126
|
...chunkTimingData,
|
|
121
127
|
timings: Object.values(chunkTimingData.timings),
|
package/dist/functions/start.js
CHANGED
|
@@ -43,6 +43,7 @@ const startHandler = async (params) => {
|
|
|
43
43
|
everyNthFrame: params.everyNthFrame,
|
|
44
44
|
concurrencyPerLambda: params.concurrencyPerLambda,
|
|
45
45
|
downloadBehavior: params.downloadBehavior,
|
|
46
|
+
muted: params.muted,
|
|
46
47
|
};
|
|
47
48
|
await (0, aws_clients_1.getLambdaClient)((0, get_current_region_1.getCurrentRegionInFunction)()).send(new client_lambda_1.InvokeCommand({
|
|
48
49
|
FunctionName: process.env.AWS_LAMBDA_FUNCTION_NAME,
|
|
@@ -113,6 +113,7 @@ export declare type LambdaPayloads = {
|
|
|
113
113
|
numberOfGifLoops: number | null;
|
|
114
114
|
concurrencyPerLambda: number;
|
|
115
115
|
downloadBehavior: DownloadBehavior;
|
|
116
|
+
muted: boolean;
|
|
116
117
|
};
|
|
117
118
|
launch: {
|
|
118
119
|
type: LambdaRoutines.launch;
|
|
@@ -141,6 +142,7 @@ export declare type LambdaPayloads = {
|
|
|
141
142
|
numberOfGifLoops: number | null;
|
|
142
143
|
concurrencyPerLambda: number;
|
|
143
144
|
downloadBehavior: DownloadBehavior;
|
|
145
|
+
muted: boolean;
|
|
144
146
|
};
|
|
145
147
|
status: {
|
|
146
148
|
type: LambdaRoutines.status;
|
|
@@ -176,6 +178,7 @@ export declare type LambdaPayloads = {
|
|
|
176
178
|
chromiumOptions: ChromiumOptions;
|
|
177
179
|
scale: number;
|
|
178
180
|
everyNthFrame: number;
|
|
181
|
+
muted: boolean;
|
|
179
182
|
};
|
|
180
183
|
still: {
|
|
181
184
|
type: LambdaRoutines.still;
|
|
@@ -224,7 +227,7 @@ export declare type RenderMetadata = {
|
|
|
224
227
|
renderId: string;
|
|
225
228
|
outName: OutNameInput | undefined;
|
|
226
229
|
};
|
|
227
|
-
export declare type LambdaVersions = '2022-08-04' | '2022-08-02' | '2022-08-01' | '2022-07-28' | '2022-07-27' | '2022-07-25' | '2022-07-23' | '2022-07-20' | '2022-07-18' | '2022-07-15' | '2022-07-14' | '2022-07-12' | '2022-07-10' | '2022-07-09' | '2022-07-08' | '2022-07-04' | '2022-06-30' | '2022-06-29' | '2022-06-25' | '2022-06-22' | '2022-06-21' | '2022-06-14' | '2022-06-08' | '2022-06-07' | '2022-06-02' | '2022-05-31' | '2022-05-28' | '2022-05-27' | '2022-05-19' | '2022-05-16' | '2022-05-11' | '2022-05-07' | '2022-05-06' | '2022-05-03' | '2022-04-20' | '2022-04-19' | '2022-04-18' | '2022-04-09' | '2022-04-08' | '2022-04-05' | '2022-04-02' | '2022-03-29' | '2022-03-17' | '2022-03-02' | '2022-03-01' | '2022-02-27' | '2022-02-14' | '2022-02-12' | '2022-02-09' | '2022-02-08' | '2022-02-07' | '2022-02-06' | '2022-02-05' | '2022-02-04' | '2022-02-03' | '2022-01-23' | '2022-01-19' | '2022-01-11' | '2022-01-10' | '2022-01-09' | '2022-01-06' | '2022-01-05' | '2021-12-22' | '2021-12-17' | '2021-12-16' | '2021-12-15' | '2021-12-14' | '2021-12-13' | '2021-12-11' | '2021-12-10' | '2021-12-04' | '2021-11-29' | '2021-11-27' | '2021-11-24' | '2021-11-22' | '2021-11-19' | '2021-11-18' | '2021-11-15' | '2021-11-12' | '2021-11-10' | '2021-11-01' | '2021-10-29' | '2021-10-27' | '2021-10-21' | '2021-10-19' | '2021-10-07' | '2021-10-03' | '2021-10-01' | '2021-09-15' | '2021-09-06' | '2021-08-06' | '2021-07-14' | '2021-07-05' | '2021-07-02' | '2021-06-23' | 'n/a';
|
|
230
|
+
export declare type LambdaVersions = '2022-08-11' | '2022-08-10' | '2022-08-04' | '2022-08-02' | '2022-08-01' | '2022-07-28' | '2022-07-27' | '2022-07-25' | '2022-07-23' | '2022-07-20' | '2022-07-18' | '2022-07-15' | '2022-07-14' | '2022-07-12' | '2022-07-10' | '2022-07-09' | '2022-07-08' | '2022-07-04' | '2022-06-30' | '2022-06-29' | '2022-06-25' | '2022-06-22' | '2022-06-21' | '2022-06-14' | '2022-06-08' | '2022-06-07' | '2022-06-02' | '2022-05-31' | '2022-05-28' | '2022-05-27' | '2022-05-19' | '2022-05-16' | '2022-05-11' | '2022-05-07' | '2022-05-06' | '2022-05-03' | '2022-04-20' | '2022-04-19' | '2022-04-18' | '2022-04-09' | '2022-04-08' | '2022-04-05' | '2022-04-02' | '2022-03-29' | '2022-03-17' | '2022-03-02' | '2022-03-01' | '2022-02-27' | '2022-02-14' | '2022-02-12' | '2022-02-09' | '2022-02-08' | '2022-02-07' | '2022-02-06' | '2022-02-05' | '2022-02-04' | '2022-02-03' | '2022-01-23' | '2022-01-19' | '2022-01-11' | '2022-01-10' | '2022-01-09' | '2022-01-06' | '2022-01-05' | '2021-12-22' | '2021-12-17' | '2021-12-16' | '2021-12-15' | '2021-12-14' | '2021-12-13' | '2021-12-11' | '2021-12-10' | '2021-12-04' | '2021-11-29' | '2021-11-27' | '2021-11-24' | '2021-11-22' | '2021-11-19' | '2021-11-18' | '2021-11-15' | '2021-11-12' | '2021-11-10' | '2021-11-01' | '2021-10-29' | '2021-10-27' | '2021-10-21' | '2021-10-19' | '2021-10-07' | '2021-10-03' | '2021-10-01' | '2021-09-15' | '2021-09-06' | '2021-08-06' | '2021-07-14' | '2021-07-05' | '2021-07-02' | '2021-06-23' | 'n/a';
|
|
228
231
|
export declare const CURRENT_VERSION: LambdaVersions;
|
|
229
232
|
export declare type PostRenderData = {
|
|
230
233
|
cost: {
|
package/dist/shared/constants.js
CHANGED
|
@@ -84,6 +84,6 @@ var LambdaRoutines;
|
|
|
84
84
|
LambdaRoutines["renderer"] = "renderer";
|
|
85
85
|
LambdaRoutines["still"] = "still";
|
|
86
86
|
})(LambdaRoutines = exports.LambdaRoutines || (exports.LambdaRoutines = {}));
|
|
87
|
-
exports.CURRENT_VERSION = '2022-08-
|
|
87
|
+
exports.CURRENT_VERSION = '2022-08-11';
|
|
88
88
|
exports.LAMBDA_CONCURRENCY_LIMIT_QUOTA = 'L-B99A9384';
|
|
89
89
|
exports.LAMBDA_BURST_LIMIT_QUOTA = 'L-548AE339';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"@aws-sdk/client-service-quotas": "3.58.0",
|
|
33
33
|
"@aws-sdk/lib-storage": "3.58.0",
|
|
34
34
|
"@aws-sdk/s3-request-presigner": "3.58.0",
|
|
35
|
-
"@remotion/bundler": "3.
|
|
36
|
-
"@remotion/cli": "3.
|
|
37
|
-
"@remotion/renderer": "3.
|
|
35
|
+
"@remotion/bundler": "3.2.2",
|
|
36
|
+
"@remotion/cli": "3.2.2",
|
|
37
|
+
"@remotion/renderer": "3.2.2",
|
|
38
38
|
"aws-policies": "^1.0.1",
|
|
39
39
|
"mime-types": "2.1.34",
|
|
40
|
-
"remotion": "3.
|
|
40
|
+
"remotion": "3.2.2"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"react": ">=16.8.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "8e5f2d05adf7ddd3824ea734fa888b4b4761f364"
|
|
66
66
|
}
|
package/remotionlambda.zip
CHANGED
|
Binary file
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.formatBytes = void 0;
|
|
4
|
-
const BYTE_UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
5
|
-
const BIBYTE_UNITS = [
|
|
6
|
-
'B',
|
|
7
|
-
'kiB',
|
|
8
|
-
'MiB',
|
|
9
|
-
'GiB',
|
|
10
|
-
'TiB',
|
|
11
|
-
'PiB',
|
|
12
|
-
'EiB',
|
|
13
|
-
'ZiB',
|
|
14
|
-
'YiB',
|
|
15
|
-
];
|
|
16
|
-
const BIT_UNITS = [
|
|
17
|
-
'b',
|
|
18
|
-
'kbit',
|
|
19
|
-
'Mbit',
|
|
20
|
-
'Gbit',
|
|
21
|
-
'Tbit',
|
|
22
|
-
'Pbit',
|
|
23
|
-
'Ebit',
|
|
24
|
-
'Zbit',
|
|
25
|
-
'Ybit',
|
|
26
|
-
];
|
|
27
|
-
const BIBIT_UNITS = [
|
|
28
|
-
'b',
|
|
29
|
-
'kibit',
|
|
30
|
-
'Mibit',
|
|
31
|
-
'Gibit',
|
|
32
|
-
'Tibit',
|
|
33
|
-
'Pibit',
|
|
34
|
-
'Eibit',
|
|
35
|
-
'Zibit',
|
|
36
|
-
'Yibit',
|
|
37
|
-
];
|
|
38
|
-
/*
|
|
39
|
-
Formats the given number using `Number#toLocaleString`.
|
|
40
|
-
- If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
41
|
-
- If locale is true, the system default locale is used for translation.
|
|
42
|
-
- If no value for locale is specified, the number is returned unmodified.
|
|
43
|
-
*/
|
|
44
|
-
const toLocaleString = (number, locale, options) => {
|
|
45
|
-
if (typeof locale === 'string' || Array.isArray(locale)) {
|
|
46
|
-
return number.toLocaleString(locale, options);
|
|
47
|
-
}
|
|
48
|
-
if (locale === true || options !== undefined) {
|
|
49
|
-
return number.toLocaleString(undefined, options);
|
|
50
|
-
}
|
|
51
|
-
return String(number);
|
|
52
|
-
};
|
|
53
|
-
const formatBytes = (number, options = {
|
|
54
|
-
locale: 'en-US',
|
|
55
|
-
signed: false,
|
|
56
|
-
maximumFractionDigits: 1,
|
|
57
|
-
}) => {
|
|
58
|
-
if (!Number.isFinite(number)) {
|
|
59
|
-
throw new TypeError(`Expected a finite number, got ${typeof number}: ${number}`);
|
|
60
|
-
}
|
|
61
|
-
options = { bits: false, binary: false, ...options };
|
|
62
|
-
const UNITS = options.bits
|
|
63
|
-
? options.binary
|
|
64
|
-
? BIBIT_UNITS
|
|
65
|
-
: BIT_UNITS
|
|
66
|
-
: options.binary
|
|
67
|
-
? BIBYTE_UNITS
|
|
68
|
-
: BYTE_UNITS;
|
|
69
|
-
if (options.signed && number === 0) {
|
|
70
|
-
return `0 $ {
|
|
71
|
-
UNITS[0]
|
|
72
|
-
}`;
|
|
73
|
-
}
|
|
74
|
-
const isNegative = number < 0;
|
|
75
|
-
const prefix = isNegative ? '-' : options.signed ? '+' : '';
|
|
76
|
-
if (isNegative) {
|
|
77
|
-
number = -number;
|
|
78
|
-
}
|
|
79
|
-
let localeOptions;
|
|
80
|
-
if (options.minimumFractionDigits !== undefined) {
|
|
81
|
-
localeOptions = {
|
|
82
|
-
minimumFractionDigits: options.minimumFractionDigits,
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
if (options.maximumFractionDigits !== undefined) {
|
|
86
|
-
localeOptions = {
|
|
87
|
-
maximumFractionDigits: options.maximumFractionDigits,
|
|
88
|
-
...localeOptions,
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
if (number < 1) {
|
|
92
|
-
const numString = toLocaleString(number, options.locale, localeOptions);
|
|
93
|
-
return prefix + numString + ' ' + UNITS[0];
|
|
94
|
-
}
|
|
95
|
-
const exponent = Math.min(Math.floor(options.binary
|
|
96
|
-
? Math.log(number) / Math.log(1024)
|
|
97
|
-
: Math.log10(number) / 3), UNITS.length - 1);
|
|
98
|
-
number /= (options.binary ? 1024 : 1000) ** exponent;
|
|
99
|
-
const numberString = toLocaleString(Number(number), options.locale, localeOptions);
|
|
100
|
-
const unit = UNITS[exponent];
|
|
101
|
-
return prefix + numberString + ' ' + unit;
|
|
102
|
-
};
|
|
103
|
-
exports.formatBytes = formatBytes;
|
package/dist/shared/chunk.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const chunk: <T>(input: T[], size: number) => T[][];
|
package/dist/shared/chunk.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.chunk = void 0;
|
|
4
|
-
const chunk = (input, size) => {
|
|
5
|
-
return input.reduce((arr, item, idx) => {
|
|
6
|
-
return idx % size === 0
|
|
7
|
-
? [...arr, [item]]
|
|
8
|
-
: [...arr.slice(0, -1), [...arr.slice(-1)[0], item]];
|
|
9
|
-
}, []);
|
|
10
|
-
};
|
|
11
|
-
exports.chunk = chunk;
|