@remotion/lambda 4.0.50 → 4.0.52
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/create-function.js +20 -1
- package/dist/api/download-media.d.ts +2 -0
- package/dist/api/download-media.js +2 -1
- package/dist/api/iam-validation/user-permissions.js +1 -0
- package/dist/cli/commands/render/render.js +2 -0
- package/dist/cli/commands/sites/create.js +1 -0
- package/dist/cli/commands/still.js +1 -0
- package/dist/functions/helpers/read-with-progress.d.ts +3 -1
- package/dist/functions/helpers/read-with-progress.js +3 -1
- package/dist/functions/renderer.js +1 -0
- package/package.json +8 -8
- package/remotionlambda-arm64.zip +0 -0
- package/dist/cli/helpers/validate.d.ts +0 -4
- package/dist/cli/helpers/validate.js +0 -8
- package/dist/functions/streaming/streaming.d.ts +0 -12
- package/dist/functions/streaming/streaming.js +0 -100
|
@@ -4,6 +4,7 @@ exports.createFunction = void 0;
|
|
|
4
4
|
const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
|
|
5
5
|
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
6
6
|
const node_fs_1 = require("node:fs");
|
|
7
|
+
const version_1 = require("remotion/version");
|
|
7
8
|
const defaults_1 = require("../defaults");
|
|
8
9
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
9
10
|
const hosted_layers_1 = require("../shared/hosted-layers");
|
|
@@ -31,7 +32,7 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
|
|
|
31
32
|
return { FunctionName: functionName };
|
|
32
33
|
}
|
|
33
34
|
const defaultRoleName = `arn:aws:iam::${accountId}:role/${suggested_policy_1.ROLE_NAME}`;
|
|
34
|
-
const { FunctionName } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.CreateFunctionCommand({
|
|
35
|
+
const { FunctionName, FunctionArn } = await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.CreateFunctionCommand({
|
|
35
36
|
Code: {
|
|
36
37
|
ZipFile: (0, node_fs_1.readFileSync)(zipFile),
|
|
37
38
|
},
|
|
@@ -48,6 +49,24 @@ const createFunction = async ({ createCloudWatchLogGroup, region, zipFile, funct
|
|
|
48
49
|
Size: ephemerealStorageInMb,
|
|
49
50
|
},
|
|
50
51
|
}));
|
|
52
|
+
try {
|
|
53
|
+
await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.TagResourceCommand({
|
|
54
|
+
Resource: FunctionArn,
|
|
55
|
+
Tags: {
|
|
56
|
+
'remotion-lambda': 'true',
|
|
57
|
+
'remotion-version': version_1.VERSION,
|
|
58
|
+
'remotion-memory-in-mb': String(memorySizeInMb),
|
|
59
|
+
'remotion-timeout-in-seconds': String(timeoutInSeconds),
|
|
60
|
+
'remotion-ephemereal-storage-in-mb': String(ephemerealStorageInMb),
|
|
61
|
+
},
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
// Previous Lambda versions had no permission to tag the function
|
|
66
|
+
if (!err.name.includes('AccessDenied')) {
|
|
67
|
+
throw err;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
51
70
|
await (0, aws_clients_1.getLambdaClient)(region).send(new client_lambda_1.PutFunctionEventInvokeConfigCommand({
|
|
52
71
|
MaximumRetryAttempts: 0,
|
|
53
72
|
FunctionName,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LogLevel } from '@remotion/renderer';
|
|
1
2
|
import type { LambdaReadFileProgress } from '../functions/helpers/read-with-progress';
|
|
2
3
|
import type { AwsRegion } from '../pricing/aws-regions';
|
|
3
4
|
import type { CustomCredentials } from '../shared/aws-clients';
|
|
@@ -8,6 +9,7 @@ export type DownloadMediaInput = {
|
|
|
8
9
|
outPath: string;
|
|
9
10
|
onProgress?: LambdaReadFileProgress;
|
|
10
11
|
customCredentials?: CustomCredentials;
|
|
12
|
+
logLevel?: LogLevel;
|
|
11
13
|
};
|
|
12
14
|
export type DownloadMediaOutput = {
|
|
13
15
|
outputPath: string;
|
|
@@ -22,7 +22,7 @@ const get_account_id_1 = require("../shared/get-account-id");
|
|
|
22
22
|
* @returns {Promise<RenderMediaOnLambdaOutput>} See documentation for detailed structure
|
|
23
23
|
*/
|
|
24
24
|
const downloadMedia = async (input) => {
|
|
25
|
-
var _a, _b;
|
|
25
|
+
var _a, _b, _c;
|
|
26
26
|
const expectedBucketOwner = await (0, get_account_id_1.getAccountId)({
|
|
27
27
|
region: input.region,
|
|
28
28
|
});
|
|
@@ -43,6 +43,7 @@ const downloadMedia = async (input) => {
|
|
|
43
43
|
onProgress: (_b = input.onProgress) !== null && _b !== void 0 ? _b : (() => undefined),
|
|
44
44
|
outputPath,
|
|
45
45
|
customCredentials,
|
|
46
|
+
logLevel: (_c = input.logLevel) !== null && _c !== void 0 ? _c : 'info',
|
|
46
47
|
});
|
|
47
48
|
return {
|
|
48
49
|
outputPath,
|
|
@@ -62,6 +62,7 @@ exports.requiredPermissions = [
|
|
|
62
62
|
aws_policies_1.lambda.DeleteFunction,
|
|
63
63
|
aws_policies_1.lambda.PutFunctionEventInvokeConfig,
|
|
64
64
|
'lambda:PutRuntimeManagementConfig',
|
|
65
|
+
aws_policies_1.lambda.TagResource,
|
|
65
66
|
],
|
|
66
67
|
resource: [`arn:aws:lambda:*:*:function:${constants_1.RENDER_FN_PREFIX}*`],
|
|
67
68
|
},
|
|
@@ -91,6 +91,7 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
91
91
|
outName: outName !== null && outName !== void 0 ? outName : null,
|
|
92
92
|
configFile: (_b = config_1.ConfigInternals.getOutputCodecOrUndefined()) !== null && _b !== void 0 ? _b : null,
|
|
93
93
|
uiCodec: null,
|
|
94
|
+
compositionCodec: null,
|
|
94
95
|
});
|
|
95
96
|
const imageFormat = cli_1.CliInternals.getVideoImageFormat({
|
|
96
97
|
codec,
|
|
@@ -216,6 +217,7 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
216
217
|
outPath: downloadName,
|
|
217
218
|
region: (0, get_aws_region_1.getAwsRegion)(),
|
|
218
219
|
renderId: res.renderId,
|
|
220
|
+
logLevel,
|
|
219
221
|
onProgress: ({ downloaded, totalSize }) => {
|
|
220
222
|
progressBar.update((0, progress_1.makeProgressString)({
|
|
221
223
|
progress: newProgress,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LogLevel } from '@remotion/renderer';
|
|
1
2
|
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
2
3
|
import type { CustomCredentials } from '../../shared/aws-clients';
|
|
3
4
|
export type LambdaReadFileProgress = (progress: {
|
|
@@ -5,7 +6,7 @@ export type LambdaReadFileProgress = (progress: {
|
|
|
5
6
|
downloaded: number;
|
|
6
7
|
percent: number;
|
|
7
8
|
}) => unknown;
|
|
8
|
-
export declare const lambdaDownloadFileWithProgress: ({ bucketName, key, region, expectedBucketOwner, outputPath, onProgress, customCredentials, }: {
|
|
9
|
+
export declare const lambdaDownloadFileWithProgress: ({ bucketName, key, region, expectedBucketOwner, outputPath, onProgress, customCredentials, logLevel, }: {
|
|
9
10
|
bucketName: string;
|
|
10
11
|
key: string;
|
|
11
12
|
region: AwsRegion;
|
|
@@ -13,6 +14,7 @@ export declare const lambdaDownloadFileWithProgress: ({ bucketName, key, region,
|
|
|
13
14
|
outputPath: string;
|
|
14
15
|
onProgress: LambdaReadFileProgress;
|
|
15
16
|
customCredentials: CustomCredentials | null;
|
|
17
|
+
logLevel: LogLevel;
|
|
16
18
|
}) => Promise<{
|
|
17
19
|
sizeInBytes: number;
|
|
18
20
|
to: string;
|
|
@@ -5,7 +5,7 @@ const client_s3_1 = require("@aws-sdk/client-s3");
|
|
|
5
5
|
const s3_request_presigner_1 = require("@aws-sdk/s3-request-presigner");
|
|
6
6
|
const renderer_1 = require("@remotion/renderer");
|
|
7
7
|
const aws_clients_1 = require("../../shared/aws-clients");
|
|
8
|
-
const lambdaDownloadFileWithProgress = async ({ bucketName, key, region, expectedBucketOwner, outputPath, onProgress, customCredentials, }) => {
|
|
8
|
+
const lambdaDownloadFileWithProgress = async ({ bucketName, key, region, expectedBucketOwner, outputPath, onProgress, customCredentials, logLevel, }) => {
|
|
9
9
|
const client = (0, aws_clients_1.getS3Client)(region, customCredentials);
|
|
10
10
|
const command = new client_s3_1.GetObjectCommand({
|
|
11
11
|
Bucket: bucketName,
|
|
@@ -24,6 +24,8 @@ const lambdaDownloadFileWithProgress = async ({ bucketName, key, region, expecte
|
|
|
24
24
|
});
|
|
25
25
|
},
|
|
26
26
|
to: () => outputPath,
|
|
27
|
+
indent: false,
|
|
28
|
+
logLevel,
|
|
27
29
|
});
|
|
28
30
|
return { sizeInBytes, to };
|
|
29
31
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/lambda",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.52",
|
|
4
4
|
"description": "Distributed renderer for Remotion based on AWS Lambda",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"aws-policies": "^1.0.1",
|
|
27
27
|
"mime-types": "2.1.34",
|
|
28
28
|
"zod": "3.22.3",
|
|
29
|
-
"@remotion/bundler": "4.0.
|
|
30
|
-
"remotion": "4.0.
|
|
31
|
-
"
|
|
32
|
-
"@remotion/renderer": "4.0.
|
|
29
|
+
"@remotion/bundler": "4.0.52",
|
|
30
|
+
"@remotion/cli": "4.0.52",
|
|
31
|
+
"remotion": "4.0.52",
|
|
32
|
+
"@remotion/renderer": "4.0.52"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jonny/eslint-config": "3.0.276",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"ts-node": "^10.8.0",
|
|
44
44
|
"vitest": "0.31.1",
|
|
45
45
|
"zip-lib": "^0.7.2",
|
|
46
|
-
"@remotion/bundler": "4.0.
|
|
47
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.
|
|
46
|
+
"@remotion/bundler": "4.0.52",
|
|
47
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.52"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@remotion/bundler": "4.0.
|
|
50
|
+
"@remotion/bundler": "4.0.52"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
package/remotionlambda-arm64.zip
CHANGED
|
Binary file
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateDurationInFrames = exports.validateDimension = exports.validateFps = void 0;
|
|
4
|
-
/* eslint-disable prefer-destructuring */
|
|
5
|
-
const remotion_1 = require("remotion");
|
|
6
|
-
exports.validateFps = remotion_1.Internals.validateFps;
|
|
7
|
-
exports.validateDimension = remotion_1.Internals.validateDimension;
|
|
8
|
-
exports.validateDurationInFrames = remotion_1.Internals.validateDurationInFrames;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
type OnMessage = (type: 'error' | 'success', nonce: string, data: Buffer) => void;
|
|
3
|
-
export declare const makeStreaming: (onMessage: OnMessage) => {
|
|
4
|
-
addData: (data: Buffer) => void;
|
|
5
|
-
};
|
|
6
|
-
export declare const makePayloadMessage: (nonce: number, data: Buffer, status: 0 | 1) => Buffer;
|
|
7
|
-
export type StreamingPayload = {
|
|
8
|
-
type: 'frames-rendered';
|
|
9
|
-
frames: number;
|
|
10
|
-
};
|
|
11
|
-
export type OnStream = (payload: StreamingPayload) => void;
|
|
12
|
-
export {};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makePayloadMessage = exports.makeStreaming = void 0;
|
|
4
|
-
const makeStreaming = (onMessage) => {
|
|
5
|
-
let outputBuffer = Buffer.from('');
|
|
6
|
-
const separator = Buffer.from('remotion_buffer:');
|
|
7
|
-
let unprocessedBuffers = [];
|
|
8
|
-
let missingData = null;
|
|
9
|
-
const processInput = () => {
|
|
10
|
-
let separatorIndex = outputBuffer.indexOf(separator);
|
|
11
|
-
if (separatorIndex === -1) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
separatorIndex += separator.length;
|
|
15
|
-
let nonceString = '';
|
|
16
|
-
let lengthString = '';
|
|
17
|
-
let statusString = '';
|
|
18
|
-
// Each message from Rust is prefixed with `remotion_buffer;{[nonce]}:{[length]}`
|
|
19
|
-
// Let's read the buffer to extract the nonce, and if the full length is available,
|
|
20
|
-
// we'll extract the data and pass it to the callback.
|
|
21
|
-
// eslint-disable-next-line no-constant-condition
|
|
22
|
-
while (true) {
|
|
23
|
-
const nextDigit = outputBuffer[separatorIndex];
|
|
24
|
-
// 0x3a is the character ":"
|
|
25
|
-
if (nextDigit === 0x3a) {
|
|
26
|
-
separatorIndex++;
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
separatorIndex++;
|
|
30
|
-
nonceString += String.fromCharCode(nextDigit);
|
|
31
|
-
}
|
|
32
|
-
// eslint-disable-next-line no-constant-condition
|
|
33
|
-
while (true) {
|
|
34
|
-
const nextDigit = outputBuffer[separatorIndex];
|
|
35
|
-
if (nextDigit === 0x3a) {
|
|
36
|
-
separatorIndex++;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
separatorIndex++;
|
|
40
|
-
lengthString += String.fromCharCode(nextDigit);
|
|
41
|
-
}
|
|
42
|
-
// eslint-disable-next-line no-constant-condition
|
|
43
|
-
while (true) {
|
|
44
|
-
const nextDigit = outputBuffer[separatorIndex];
|
|
45
|
-
if (nextDigit === 0x3a) {
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
separatorIndex++;
|
|
49
|
-
statusString += String.fromCharCode(nextDigit);
|
|
50
|
-
}
|
|
51
|
-
const length = Number(lengthString);
|
|
52
|
-
const status = Number(statusString);
|
|
53
|
-
const dataLength = outputBuffer.length - separatorIndex - 1;
|
|
54
|
-
if (dataLength < length) {
|
|
55
|
-
missingData = {
|
|
56
|
-
dataMissing: length - dataLength,
|
|
57
|
-
};
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const data = outputBuffer.subarray(separatorIndex + 1, separatorIndex + 1 + Number(lengthString));
|
|
61
|
-
onMessage(status === 1 ? 'error' : 'success', nonceString, data);
|
|
62
|
-
missingData = null;
|
|
63
|
-
outputBuffer = outputBuffer.subarray(separatorIndex + Number(lengthString) + 1);
|
|
64
|
-
processInput();
|
|
65
|
-
};
|
|
66
|
-
return {
|
|
67
|
-
addData: (data) => {
|
|
68
|
-
unprocessedBuffers.push(data);
|
|
69
|
-
const separatorIndex = data.indexOf(separator);
|
|
70
|
-
if (separatorIndex === -1) {
|
|
71
|
-
if (missingData) {
|
|
72
|
-
missingData.dataMissing -= data.length;
|
|
73
|
-
}
|
|
74
|
-
if (!missingData || missingData.dataMissing > 0) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
unprocessedBuffers.unshift(outputBuffer);
|
|
79
|
-
outputBuffer = Buffer.concat(unprocessedBuffers);
|
|
80
|
-
unprocessedBuffers = [];
|
|
81
|
-
console.log('the unprocessed input is now', new TextDecoder('utf-8').decode(outputBuffer));
|
|
82
|
-
processInput();
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
exports.makeStreaming = makeStreaming;
|
|
87
|
-
const makePayloadMessage = (nonce, data, status) => {
|
|
88
|
-
const concat = Buffer.concat([
|
|
89
|
-
Buffer.from('remotion_buffer:'),
|
|
90
|
-
Buffer.from(nonce.toString()),
|
|
91
|
-
Buffer.from(':'),
|
|
92
|
-
Buffer.from(data.length.toString()),
|
|
93
|
-
Buffer.from(':'),
|
|
94
|
-
Buffer.from(String(status)),
|
|
95
|
-
Buffer.from(':'),
|
|
96
|
-
data,
|
|
97
|
-
]);
|
|
98
|
-
return concat;
|
|
99
|
-
};
|
|
100
|
-
exports.makePayloadMessage = makePayloadMessage;
|