@remotion/lambda 3.3.7 → 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/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/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/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-chunk-progress.d.ts +0 -0
- package/dist/functions/helpers/get-chunk-progress.js +1 -0
- 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/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/parse-chunk-key.d.ts +4 -0
- package/dist/shared/parse-chunk-key.js +14 -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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const md5 = (data) => crypto_1.default.createHash('md5').update(data).digest('hex');
|
|
9
|
+
const chunks = [];
|
|
10
|
+
for (let i = 0; i < 2000; i++) {
|
|
11
|
+
const etag = `"${md5(String(i))}"`;
|
|
12
|
+
chunks.push(etag);
|
|
13
|
+
}
|
|
14
|
+
(0, fs_1.writeFileSync)('etags.json', JSON.stringify(chunks));
|
|
@@ -3,6 +3,7 @@ import * as IamSdk from '@aws-sdk/client-iam';
|
|
|
3
3
|
import * as LambdaSDK from '@aws-sdk/client-lambda';
|
|
4
4
|
import * as S3SDK from '@aws-sdk/client-s3';
|
|
5
5
|
import * as ServiceQuotasSDK from '@aws-sdk/client-service-quotas';
|
|
6
|
+
import * as StsSdk from '@aws-sdk/client-sts';
|
|
6
7
|
import type { AwsRegion } from '../client';
|
|
7
8
|
import type { CustomCredentials, ServiceMapping } from '../shared/aws-clients';
|
|
8
9
|
export declare type GetAwsClientInput<T extends keyof ServiceMapping> = {
|
|
@@ -16,6 +17,7 @@ declare type SdkMapping = {
|
|
|
16
17
|
iam: typeof IamSdk;
|
|
17
18
|
lambda: typeof LambdaSDK;
|
|
18
19
|
servicequotas: typeof ServiceQuotasSDK;
|
|
20
|
+
sts: typeof StsSdk;
|
|
19
21
|
};
|
|
20
22
|
export declare type GetAwsClientOutput<T extends keyof ServiceMapping> = {
|
|
21
23
|
client: ServiceMapping[T];
|
|
@@ -29,6 +29,7 @@ const IamSdk = __importStar(require("@aws-sdk/client-iam"));
|
|
|
29
29
|
const LambdaSDK = __importStar(require("@aws-sdk/client-lambda"));
|
|
30
30
|
const S3SDK = __importStar(require("@aws-sdk/client-s3"));
|
|
31
31
|
const ServiceQuotasSDK = __importStar(require("@aws-sdk/client-service-quotas"));
|
|
32
|
+
const StsSdk = __importStar(require("@aws-sdk/client-sts"));
|
|
32
33
|
const aws_clients_1 = require("../shared/aws-clients");
|
|
33
34
|
/**
|
|
34
35
|
* @description Gets the full AWS SDK and an instantiated client for an AWS service
|
|
@@ -51,6 +52,7 @@ const getAwsClient = ({ region, service, customCredentials, }) => {
|
|
|
51
52
|
iam: IamSdk,
|
|
52
53
|
s3: S3SDK,
|
|
53
54
|
servicequotas: ServiceQuotasSDK,
|
|
55
|
+
sts: StsSdk,
|
|
54
56
|
}[service],
|
|
55
57
|
};
|
|
56
58
|
};
|
|
@@ -2,32 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.simulateRule = void 0;
|
|
4
4
|
const client_iam_1 = require("@aws-sdk/client-iam");
|
|
5
|
-
const aws_policies_1 = require("aws-policies");
|
|
6
5
|
const aws_clients_1 = require("../../shared/aws-clients");
|
|
7
6
|
const simulateRule = async (options) => {
|
|
8
7
|
var _a;
|
|
9
8
|
try {
|
|
10
|
-
if (options.actionNames.includes(aws_policies_1.iam.GetUser)) {
|
|
11
|
-
try {
|
|
12
|
-
await (0, aws_clients_1.getIamClient)(options.region).send(new client_iam_1.GetUserCommand({}));
|
|
13
|
-
const result = [
|
|
14
|
-
{
|
|
15
|
-
decision: 'allowed',
|
|
16
|
-
name: aws_policies_1.iam.GetUser,
|
|
17
|
-
},
|
|
18
|
-
];
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
22
|
-
const result = [
|
|
23
|
-
{
|
|
24
|
-
decision: 'explicitDeny',
|
|
25
|
-
name: aws_policies_1.iam.GetUser,
|
|
26
|
-
},
|
|
27
|
-
];
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
9
|
const res = await (0, aws_clients_1.getIamClient)(options.region).send(new client_iam_1.SimulatePrincipalPolicyCommand({
|
|
32
10
|
ActionNames: options.actionNames,
|
|
33
11
|
PolicySourceArn: options.arn,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.simulatePermissions = exports.logPermissionOutput = void 0;
|
|
4
|
-
const
|
|
4
|
+
const client_sts_1 = require("@aws-sdk/client-sts");
|
|
5
5
|
const aws_clients_1 = require("../../shared/aws-clients");
|
|
6
6
|
const simulate_rule_1 = require("./simulate-rule");
|
|
7
7
|
const user_permissions_1 = require("./user-permissions");
|
|
@@ -26,15 +26,27 @@ exports.logPermissionOutput = logPermissionOutput;
|
|
|
26
26
|
*/
|
|
27
27
|
const simulatePermissions = async (options) => {
|
|
28
28
|
var _a;
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
31
|
-
throw new Error('No valid AWS
|
|
29
|
+
const callerIdentity = await (0, aws_clients_1.getStsClient)(options.region).send(new client_sts_1.GetCallerIdentityCommand({}));
|
|
30
|
+
if (!callerIdentity || !callerIdentity.Arn) {
|
|
31
|
+
throw new Error('No valid AWS Caller Identity detected');
|
|
32
|
+
}
|
|
33
|
+
const callerIdentityArnComponents = callerIdentity.Arn.match(/arn:aws:([^:]+)::(\d+):([^/]+)(.*)/);
|
|
34
|
+
if (!callerIdentityArnComponents) {
|
|
35
|
+
throw new Error('Unknown AWS Caller Identity ARN detected');
|
|
36
|
+
}
|
|
37
|
+
const callerIdentityArnType = callerIdentityArnComponents[1];
|
|
38
|
+
let callerArn;
|
|
39
|
+
if (callerIdentityArnType === 'iam' && callerIdentityArnComponents[3] === 'user') {
|
|
40
|
+
callerArn = callerIdentity.Arn;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
throw new Error('Unsupported AWS Caller Identity ARN detected');
|
|
32
44
|
}
|
|
33
45
|
const results = [];
|
|
34
46
|
for (const per of user_permissions_1.requiredPermissions) {
|
|
35
47
|
const result = await (0, simulate_rule_1.simulateRule)({
|
|
36
48
|
actionNames: per.actions,
|
|
37
|
-
arn:
|
|
49
|
+
arn: callerArn,
|
|
38
50
|
region: options.region,
|
|
39
51
|
resource: per.resource,
|
|
40
52
|
retries: 2,
|
|
@@ -15,12 +15,6 @@ exports.requiredPermissions = [
|
|
|
15
15
|
],
|
|
16
16
|
resource: ['*'],
|
|
17
17
|
},
|
|
18
|
-
{
|
|
19
|
-
id: 'Identity',
|
|
20
|
-
actions: [aws_policies_1.iam.GetUser],
|
|
21
|
-
// eslint-disable-next-line no-template-curly-in-string
|
|
22
|
-
resource: ['arn:aws:iam::*:user/${aws:username}'],
|
|
23
|
-
},
|
|
24
18
|
{
|
|
25
19
|
id: 'PermissionValidation',
|
|
26
20
|
actions: [aws_policies_1.iam.SimulatePrincipalPolicy],
|
|
@@ -3,12 +3,13 @@ import type { ChunkRetry } from '../../../functions/helpers/get-retry-stats';
|
|
|
3
3
|
declare type LambdaInvokeProgress = {
|
|
4
4
|
totalLambdas: number | null;
|
|
5
5
|
lambdasInvoked: number;
|
|
6
|
-
doneIn: number | null;
|
|
7
6
|
};
|
|
8
7
|
declare type ChunkProgress = {
|
|
8
|
+
doneIn: number | null;
|
|
9
|
+
framesRendered: number;
|
|
10
|
+
totalFrames: number | null;
|
|
9
11
|
totalChunks: number | null;
|
|
10
12
|
chunksInvoked: number;
|
|
11
|
-
doneIn: number | null;
|
|
12
13
|
};
|
|
13
14
|
declare type MultiRenderProgress = {
|
|
14
15
|
lambdaInvokeProgress: LambdaInvokeProgress;
|
|
@@ -22,11 +23,13 @@ declare type DownloadedInfo = {
|
|
|
22
23
|
downloaded: number;
|
|
23
24
|
doneIn: number | null;
|
|
24
25
|
};
|
|
25
|
-
export declare const makeProgressString: ({ progress, steps, downloadInfo, retriesInfo, verbose, }: {
|
|
26
|
+
export declare const makeProgressString: ({ progress, steps, downloadInfo, retriesInfo, verbose, timeToEncode, totalFrames, }: {
|
|
26
27
|
progress: MultiRenderProgress;
|
|
27
28
|
steps: number;
|
|
28
29
|
downloadInfo: DownloadedInfo | null;
|
|
29
30
|
retriesInfo: ChunkRetry[];
|
|
30
31
|
verbose: boolean;
|
|
32
|
+
timeToEncode: number | null;
|
|
33
|
+
totalFrames: number | null;
|
|
31
34
|
}) => string;
|
|
32
35
|
export {};
|
|
@@ -2,45 +2,54 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.makeProgressString = exports.makeMultiProgressFromStatus = void 0;
|
|
4
4
|
const cli_1 = require("@remotion/cli");
|
|
5
|
+
const renderer_1 = require("@remotion/renderer");
|
|
5
6
|
const remotion_1 = require("remotion");
|
|
7
|
+
const truthy_1 = require("../../../shared/truthy");
|
|
6
8
|
const makeInvokeProgress = (invokeProgress, totalSteps, retriesInfo) => {
|
|
7
|
-
const { lambdasInvoked, totalLambdas
|
|
8
|
-
const progress =
|
|
9
|
-
? 1
|
|
10
|
-
: totalLambdas === null
|
|
11
|
-
? 0
|
|
12
|
-
: lambdasInvoked / totalLambdas;
|
|
9
|
+
const { lambdasInvoked, totalLambdas } = invokeProgress;
|
|
10
|
+
const progress = totalLambdas === null ? 0 : lambdasInvoked / totalLambdas;
|
|
13
11
|
return [
|
|
14
12
|
'⚡️',
|
|
15
13
|
`(1/${totalSteps})`,
|
|
16
14
|
cli_1.CliInternals.makeProgressBar(progress),
|
|
17
|
-
`${
|
|
18
|
-
|
|
19
|
-
?
|
|
20
|
-
:
|
|
15
|
+
`${progress === 0 ? 'Invoked' : 'Invoking'} lambdas`,
|
|
16
|
+
progress === 1
|
|
17
|
+
? cli_1.CliInternals.chalk.gray('100%')
|
|
18
|
+
: `${Math.round(progress * 100)}%`,
|
|
21
19
|
retriesInfo.length > 0 ? `(+${retriesInfo.length} retries)` : [],
|
|
22
20
|
].join(' ');
|
|
23
21
|
};
|
|
24
|
-
const
|
|
25
|
-
const lambdaIsDone = invokeProgress.doneIn !== null;
|
|
22
|
+
const makeRenderProgress = ({ chunkProgress, totalSteps, }) => {
|
|
26
23
|
const { chunksInvoked, totalChunks, doneIn } = chunkProgress;
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
const renderProgress = chunkProgress.totalFrames === null
|
|
25
|
+
? 0
|
|
26
|
+
: chunkProgress.framesRendered / chunkProgress.totalFrames;
|
|
27
|
+
const encodingProgress = totalChunks === null ? 0 : chunksInvoked / totalChunks;
|
|
28
|
+
const frames = chunkProgress.totalFrames === null
|
|
29
|
+
? null
|
|
30
|
+
: `(${chunkProgress.framesRendered}/${chunkProgress.totalFrames})`;
|
|
31
|
+
const first = [
|
|
33
32
|
'🧩',
|
|
34
33
|
`(2/${totalSteps})`,
|
|
35
|
-
cli_1.CliInternals.makeProgressBar(
|
|
36
|
-
|
|
34
|
+
cli_1.CliInternals.makeProgressBar(renderProgress),
|
|
35
|
+
doneIn === null ? 'Rendering frames' : 'Rendered frames',
|
|
36
|
+
doneIn === null ? frames : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
|
|
37
|
+
]
|
|
38
|
+
.filter(truthy_1.truthy)
|
|
39
|
+
.join(' ');
|
|
40
|
+
const second = [
|
|
41
|
+
'🏗️ ',
|
|
42
|
+
`(3/${totalSteps})`,
|
|
43
|
+
cli_1.CliInternals.makeProgressBar(encodingProgress),
|
|
44
|
+
`${doneIn === null ? 'Encoding' : 'Encoded'} chunks`,
|
|
37
45
|
doneIn === null
|
|
38
|
-
? `${Math.round(
|
|
46
|
+
? `${Math.round(encodingProgress * 100)}%`
|
|
39
47
|
: cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
|
|
40
48
|
].join(' ');
|
|
49
|
+
return [first, second];
|
|
41
50
|
};
|
|
42
|
-
const makeEncodingProgress = ({ encodingProgress, chunkProgress, totalSteps, }) => {
|
|
43
|
-
const { framesEncoded
|
|
51
|
+
const makeEncodingProgress = ({ encodingProgress, chunkProgress, totalSteps, totalFrames, timeToEncode, }) => {
|
|
52
|
+
const { framesEncoded } = encodingProgress;
|
|
44
53
|
const progress = totalFrames === null ? 0 : framesEncoded / totalFrames;
|
|
45
54
|
const chunksDone = chunkProgress.doneIn !== null;
|
|
46
55
|
const shouldShow = progress > 0 || chunksDone;
|
|
@@ -49,12 +58,12 @@ const makeEncodingProgress = ({ encodingProgress, chunkProgress, totalSteps, })
|
|
|
49
58
|
}
|
|
50
59
|
return [
|
|
51
60
|
'📽 ',
|
|
52
|
-
`(
|
|
61
|
+
`(4/${totalSteps})`,
|
|
53
62
|
cli_1.CliInternals.makeProgressBar(progress),
|
|
54
|
-
`${
|
|
55
|
-
|
|
63
|
+
`${timeToEncode === null ? 'Combining' : 'Combined'} videos`,
|
|
64
|
+
timeToEncode === null
|
|
56
65
|
? `${Math.round(progress * 100)}%`
|
|
57
|
-
: cli_1.CliInternals.chalk.gray(`${
|
|
66
|
+
: cli_1.CliInternals.chalk.gray(`${timeToEncode}ms`),
|
|
58
67
|
].join(' ');
|
|
59
68
|
};
|
|
60
69
|
const makeCleanupProgress = (cleanupInfo, totalSteps, skipped) => {
|
|
@@ -64,7 +73,7 @@ const makeCleanupProgress = (cleanupInfo, totalSteps, skipped) => {
|
|
|
64
73
|
if (skipped) {
|
|
65
74
|
return [
|
|
66
75
|
'🪣 ',
|
|
67
|
-
`(
|
|
76
|
+
`(5/${totalSteps})`,
|
|
68
77
|
cli_1.CliInternals.chalk.blueBright(`Not cleaning up because --log=verbose was set`),
|
|
69
78
|
].join(' ');
|
|
70
79
|
}
|
|
@@ -72,7 +81,7 @@ const makeCleanupProgress = (cleanupInfo, totalSteps, skipped) => {
|
|
|
72
81
|
const progress = filesDeleted / minFilesToDelete;
|
|
73
82
|
return [
|
|
74
83
|
'🪣 ',
|
|
75
|
-
`(
|
|
84
|
+
`(5/${totalSteps})`,
|
|
76
85
|
cli_1.CliInternals.makeProgressBar(progress),
|
|
77
86
|
`${doneIn === null ? 'Cleaning up' : 'Cleaned up'} artifacts`,
|
|
78
87
|
doneIn === null
|
|
@@ -83,7 +92,7 @@ const makeCleanupProgress = (cleanupInfo, totalSteps, skipped) => {
|
|
|
83
92
|
const makeDownloadProgress = (downloadInfo, totalSteps) => {
|
|
84
93
|
return [
|
|
85
94
|
'💾',
|
|
86
|
-
`(
|
|
95
|
+
`(6/${totalSteps})`,
|
|
87
96
|
downloadInfo.totalSize === null
|
|
88
97
|
? cli_1.CliInternals.getFileSizeDownloadBar(downloadInfo.downloaded)
|
|
89
98
|
: cli_1.CliInternals.makeProgressBar(downloadInfo.downloaded / downloadInfo.totalSize),
|
|
@@ -101,40 +110,41 @@ const makeDownloadProgress = (downloadInfo, totalSteps) => {
|
|
|
101
110
|
].join(' ');
|
|
102
111
|
};
|
|
103
112
|
const makeMultiProgressFromStatus = (status) => {
|
|
104
|
-
var _a, _b, _c, _d, _e, _f
|
|
113
|
+
var _a, _b, _c, _d, _e, _f;
|
|
105
114
|
return {
|
|
106
115
|
chunkProgress: {
|
|
107
116
|
chunksInvoked: status.chunks,
|
|
108
117
|
totalChunks: (_b = (_a = status.renderMetadata) === null || _a === void 0 ? void 0 : _a.totalChunks) !== null && _b !== void 0 ? _b : null,
|
|
109
118
|
doneIn: status.timeToFinishChunks,
|
|
119
|
+
framesRendered: status.framesRendered,
|
|
120
|
+
totalFrames: status.renderMetadata
|
|
121
|
+
? renderer_1.RenderInternals.getFramesToRender(status.renderMetadata.frameRange, status.renderMetadata.everyNthFrame).length
|
|
122
|
+
: null,
|
|
110
123
|
},
|
|
111
124
|
encodingProgress: {
|
|
112
125
|
framesEncoded: (_d = (_c = status.encodingStatus) === null || _c === void 0 ? void 0 : _c.framesEncoded) !== null && _d !== void 0 ? _d : 0,
|
|
113
|
-
totalFrames: (_f = (_e = status.renderMetadata) === null || _e === void 0 ? void 0 : _e.videoConfig.durationInFrames) !== null && _f !== void 0 ? _f : 1,
|
|
114
|
-
doneIn: (_h = (_g = status.encodingStatus) === null || _g === void 0 ? void 0 : _g.doneIn) !== null && _h !== void 0 ? _h : null,
|
|
115
|
-
timeToInvoke: (_k = (_j = status.encodingStatus) === null || _j === void 0 ? void 0 : _j.timeToInvoke) !== null && _k !== void 0 ? _k : null,
|
|
116
126
|
},
|
|
117
127
|
lambdaInvokeProgress: {
|
|
118
|
-
doneIn: status.timeToInvokeLambdas,
|
|
119
128
|
lambdasInvoked: status.lambdasInvoked,
|
|
120
|
-
totalLambdas: (
|
|
129
|
+
totalLambdas: (_f = (_e = status.renderMetadata) === null || _e === void 0 ? void 0 : _e.estimatedRenderLambdaInvokations) !== null && _f !== void 0 ? _f : null,
|
|
121
130
|
},
|
|
122
131
|
cleanupInfo: status.cleanup,
|
|
123
132
|
};
|
|
124
133
|
};
|
|
125
134
|
exports.makeMultiProgressFromStatus = makeMultiProgressFromStatus;
|
|
126
|
-
const makeProgressString = ({ progress, steps, downloadInfo, retriesInfo, verbose, }) => {
|
|
135
|
+
const makeProgressString = ({ progress, steps, downloadInfo, retriesInfo, verbose, timeToEncode, totalFrames, }) => {
|
|
127
136
|
return [
|
|
128
137
|
makeInvokeProgress(progress.lambdaInvokeProgress, steps, retriesInfo),
|
|
129
|
-
|
|
138
|
+
...makeRenderProgress({
|
|
130
139
|
chunkProgress: progress.chunkProgress,
|
|
131
|
-
invokeProgress: progress.lambdaInvokeProgress,
|
|
132
140
|
totalSteps: steps,
|
|
133
141
|
}),
|
|
134
142
|
makeEncodingProgress({
|
|
135
143
|
encodingProgress: progress.encodingProgress,
|
|
136
144
|
chunkProgress: progress.chunkProgress,
|
|
137
145
|
totalSteps: steps,
|
|
146
|
+
timeToEncode,
|
|
147
|
+
totalFrames,
|
|
138
148
|
}),
|
|
139
149
|
makeCleanupProgress(progress.cleanupInfo, steps, verbose),
|
|
140
150
|
downloadInfo ? makeDownloadProgress(downloadInfo, steps) : null,
|
|
@@ -97,7 +97,7 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
97
97
|
}
|
|
98
98
|
: undefined,
|
|
99
99
|
});
|
|
100
|
-
const totalSteps = downloadName ?
|
|
100
|
+
const totalSteps = downloadName ? 6 : 5;
|
|
101
101
|
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput(cli_1.CliInternals.quietFlagProvided());
|
|
102
102
|
log_1.Log.info(cli_1.CliInternals.chalk.gray(`bucket = ${res.bucketName}, function = ${functionName}`));
|
|
103
103
|
log_1.Log.info(cli_1.CliInternals.chalk.gray(`renderId = ${res.renderId}, codec = ${codec} (${reason})`));
|
|
@@ -117,6 +117,8 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
117
117
|
downloadInfo: null,
|
|
118
118
|
retriesInfo: status.retriesInfo,
|
|
119
119
|
verbose,
|
|
120
|
+
totalFrames: getTotalFrames(status),
|
|
121
|
+
timeToEncode: status.timeToEncode,
|
|
120
122
|
}));
|
|
121
123
|
// eslint-disable-next-line no-constant-condition
|
|
122
124
|
while (true) {
|
|
@@ -134,6 +136,8 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
134
136
|
retriesInfo: newStatus.retriesInfo,
|
|
135
137
|
downloadInfo: null,
|
|
136
138
|
verbose,
|
|
139
|
+
timeToEncode: newStatus.timeToEncode,
|
|
140
|
+
totalFrames: getTotalFrames(newStatus),
|
|
137
141
|
}));
|
|
138
142
|
if (newStatus.done) {
|
|
139
143
|
progressBar.update((0, progress_1.makeProgressString)({
|
|
@@ -142,6 +146,8 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
142
146
|
downloadInfo: null,
|
|
143
147
|
retriesInfo: newStatus.retriesInfo,
|
|
144
148
|
verbose,
|
|
149
|
+
timeToEncode: newStatus.timeToEncode,
|
|
150
|
+
totalFrames: getTotalFrames(newStatus),
|
|
145
151
|
}));
|
|
146
152
|
if (downloadName) {
|
|
147
153
|
const downloadStart = Date.now();
|
|
@@ -161,6 +167,8 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
161
167
|
totalSize,
|
|
162
168
|
},
|
|
163
169
|
verbose,
|
|
170
|
+
timeToEncode: newStatus.timeToEncode,
|
|
171
|
+
totalFrames: getTotalFrames(newStatus),
|
|
164
172
|
}));
|
|
165
173
|
},
|
|
166
174
|
});
|
|
@@ -174,6 +182,8 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
174
182
|
totalSize: sizeInBytes,
|
|
175
183
|
},
|
|
176
184
|
verbose,
|
|
185
|
+
timeToEncode: newStatus.timeToEncode,
|
|
186
|
+
totalFrames: getTotalFrames(newStatus),
|
|
177
187
|
}));
|
|
178
188
|
log_1.Log.info();
|
|
179
189
|
log_1.Log.info();
|
|
@@ -226,3 +236,8 @@ const renderCommand = async (args, remotionRoot) => {
|
|
|
226
236
|
}
|
|
227
237
|
};
|
|
228
238
|
exports.renderCommand = renderCommand;
|
|
239
|
+
function getTotalFrames(status) {
|
|
240
|
+
return status.renderMetadata
|
|
241
|
+
? renderer_1.RenderInternals.getFramesToRender(status.renderMetadata.frameRange, status.renderMetadata.everyNthFrame).length
|
|
242
|
+
: null;
|
|
243
|
+
}
|
|
@@ -2,22 +2,26 @@ import type { FfmpegExecutable } from '@remotion/renderer';
|
|
|
2
2
|
import type { AwsRegion } from '../../pricing/aws-regions';
|
|
3
3
|
import type { LambdaCodec } from '../../shared/validate-lambda-codec';
|
|
4
4
|
import type { EnhancedErrorInfo } from './write-lambda-error';
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const getAllFilesS3: ({ bucket, expectedFiles, outdir, renderId, region, expectedBucketOwner, onErrors, }: {
|
|
6
6
|
bucket: string;
|
|
7
7
|
expectedFiles: number;
|
|
8
|
-
|
|
9
|
-
onErrors: (errors: EnhancedErrorInfo[]) => Promise<void>;
|
|
10
|
-
numberOfFrames: number;
|
|
8
|
+
outdir: string;
|
|
11
9
|
renderId: string;
|
|
12
10
|
region: AwsRegion;
|
|
13
|
-
codec: LambdaCodec;
|
|
14
11
|
expectedBucketOwner: string;
|
|
12
|
+
onErrors: (errors: EnhancedErrorInfo[]) => Promise<void>;
|
|
13
|
+
}) => Promise<string[]>;
|
|
14
|
+
export declare const concatVideosS3: ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, ffmpegExecutable, remotionRoot, files, outdir, }: {
|
|
15
|
+
onProgress: (frames: number) => void;
|
|
16
|
+
numberOfFrames: number;
|
|
17
|
+
codec: LambdaCodec;
|
|
15
18
|
fps: number;
|
|
16
19
|
numberOfGifLoops: number | null;
|
|
17
20
|
ffmpegExecutable: FfmpegExecutable;
|
|
18
21
|
remotionRoot: string;
|
|
22
|
+
files: string[];
|
|
23
|
+
outdir: string;
|
|
19
24
|
}) => Promise<{
|
|
20
25
|
outfile: string;
|
|
21
26
|
cleanupChunksProm: Promise<void>;
|
|
22
|
-
encodingStart: number;
|
|
23
27
|
}>;
|
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.concatVideosS3 = void 0;
|
|
26
|
+
exports.concatVideosS3 = exports.getAllFilesS3 = void 0;
|
|
27
27
|
const renderer_1 = require("@remotion/renderer");
|
|
28
28
|
const fs_1 = __importStar(require("fs"));
|
|
29
29
|
const path_1 = __importStar(require("path"));
|
|
@@ -127,34 +127,18 @@ const getAllFilesS3 = ({ bucket, expectedFiles, outdir, renderId, region, expect
|
|
|
127
127
|
loop().catch((err) => reject(err));
|
|
128
128
|
});
|
|
129
129
|
};
|
|
130
|
-
|
|
130
|
+
exports.getAllFilesS3 = getAllFilesS3;
|
|
131
|
+
const concatVideosS3 = async ({ onProgress, numberOfFrames, codec, fps, numberOfGifLoops, ffmpegExecutable, remotionRoot, files, outdir, }) => {
|
|
131
132
|
var _a;
|
|
132
|
-
const outdir = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.CONCAT_FOLDER_TOKEN), 'bucket');
|
|
133
|
-
if ((0, fs_1.existsSync)(outdir)) {
|
|
134
|
-
(fs_1.rmSync !== null && fs_1.rmSync !== void 0 ? fs_1.rmSync : fs_1.rmdirSync)(outdir, {
|
|
135
|
-
recursive: true,
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
(0, fs_1.mkdirSync)(outdir);
|
|
139
|
-
const files = await getAllFilesS3({
|
|
140
|
-
bucket,
|
|
141
|
-
expectedFiles,
|
|
142
|
-
outdir,
|
|
143
|
-
renderId,
|
|
144
|
-
region,
|
|
145
|
-
expectedBucketOwner,
|
|
146
|
-
onErrors,
|
|
147
|
-
});
|
|
148
133
|
const outfile = (0, path_1.join)(renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_CONCATED_TOKEN), 'concat.' + renderer_1.RenderInternals.getFileExtensionFromCodec(codec, 'final'));
|
|
149
134
|
const combine = (0, timer_1.timer)('Combine videos');
|
|
150
135
|
const filelistDir = renderer_1.RenderInternals.tmpDir(constants_1.REMOTION_FILELIST_TOKEN);
|
|
151
|
-
const encodingStart = Date.now();
|
|
152
136
|
const codecForCombining = codec === 'h264-mkv' ? 'h264' : codec;
|
|
153
137
|
await (0, renderer_1.combineVideos)({
|
|
154
138
|
files,
|
|
155
139
|
filelistDir,
|
|
156
140
|
output: outfile,
|
|
157
|
-
onProgress: (p) => onProgress(p
|
|
141
|
+
onProgress: (p) => onProgress(p),
|
|
158
142
|
numberOfFrames,
|
|
159
143
|
codec: codecForCombining,
|
|
160
144
|
fps,
|
|
@@ -166,6 +150,6 @@ const concatVideosS3 = async ({ bucket, expectedFiles, onProgress, numberOfFrame
|
|
|
166
150
|
const cleanupChunksProm = ((_a = fs_1.default.promises.rm) !== null && _a !== void 0 ? _a : fs_1.default.promises.rmdir)(outdir, {
|
|
167
151
|
recursive: true,
|
|
168
152
|
});
|
|
169
|
-
return { outfile, cleanupChunksProm
|
|
153
|
+
return { outfile, cleanupChunksProm };
|
|
170
154
|
};
|
|
171
155
|
exports.concatVideosS3 = concatVideosS3;
|
|
@@ -8,7 +8,6 @@ const parse_lambda_timings_key_1 = require("../../shared/parse-lambda-timings-ke
|
|
|
8
8
|
const calculate_chunk_times_1 = require("./calculate-chunk-times");
|
|
9
9
|
const get_current_architecture_1 = require("./get-current-architecture");
|
|
10
10
|
const get_files_to_delete_1 = require("./get-files-to-delete");
|
|
11
|
-
const get_lambdas_invoked_stats_1 = require("./get-lambdas-invoked-stats");
|
|
12
11
|
const get_retry_stats_1 = require("./get-retry-stats");
|
|
13
12
|
const get_time_to_finish_1 = require("./get-time-to-finish");
|
|
14
13
|
const createPostRenderData = ({ renderId, region, memorySizeInMb, renderMetadata, contents, timeToEncode, errorExplanations, timeToDelete, outputFile, }) => {
|
|
@@ -41,17 +40,7 @@ const createPostRenderData = ({ renderId, region, memorySizeInMb, renderMetadata
|
|
|
41
40
|
const renderSize = contents
|
|
42
41
|
.map((c) => { var _a; return (_a = c.Size) !== null && _a !== void 0 ? _a : 0; })
|
|
43
42
|
.reduce((a, b) => a + b, 0);
|
|
44
|
-
const { timeToInvokeLambdas } = (0, get_lambdas_invoked_stats_1.getLambdasInvokedStats)({
|
|
45
|
-
contents,
|
|
46
|
-
renderId,
|
|
47
|
-
estimatedRenderLambdaInvokations: renderMetadata.estimatedRenderLambdaInvokations,
|
|
48
|
-
startDate: renderMetadata.startedDate,
|
|
49
|
-
checkIfAllLambdasWereInvoked: false,
|
|
50
|
-
});
|
|
51
43
|
const retriesInfo = (0, get_retry_stats_1.getRetryStats)({ contents, renderId });
|
|
52
|
-
if (timeToInvokeLambdas === null) {
|
|
53
|
-
throw new Error('should have timing for all lambdas');
|
|
54
|
-
}
|
|
55
44
|
return {
|
|
56
45
|
cost: {
|
|
57
46
|
currency: 'USD',
|
|
@@ -81,7 +70,6 @@ const createPostRenderData = ({ renderId, region, memorySizeInMb, renderMetadata
|
|
|
81
70
|
renderId,
|
|
82
71
|
type: 'absolute-time',
|
|
83
72
|
}),
|
|
84
|
-
timeToInvokeLambdas,
|
|
85
73
|
retriesInfo,
|
|
86
74
|
mostExpensiveFrameRanges: (0, get_most_expensive_chunks_1.getMostExpensiveChunks)(parsedTimings, renderMetadata.framesPerLambda),
|
|
87
75
|
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
+
import type { _Object } from '@aws-sdk/client-s3';
|
|
1
2
|
import type { EncodingProgress } from '../../defaults';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
bucketName: string;
|
|
6
|
-
renderId: string;
|
|
7
|
-
region: AwsRegion;
|
|
8
|
-
expectedBucketOwner: string;
|
|
9
|
-
}) => Promise<EncodingProgress | null>;
|
|
3
|
+
export declare const getEncodingMetadata: ({ exists, }: {
|
|
4
|
+
exists: _Object | undefined;
|
|
5
|
+
}) => EncodingProgress | null;
|
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEncodingMetadata = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const io_1 = require("./io");
|
|
7
|
-
const getEncodingMetadata = async ({ exists, bucketName, renderId, region, expectedBucketOwner, }) => {
|
|
4
|
+
const chunk_progress_1 = require("../../shared/chunk-progress");
|
|
5
|
+
const getEncodingMetadata = ({ exists, }) => {
|
|
8
6
|
if (!exists) {
|
|
9
7
|
return null;
|
|
10
8
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
bucketName,
|
|
14
|
-
key: (0, defaults_1.encodingProgressKey)(renderId),
|
|
15
|
-
region,
|
|
16
|
-
expectedBucketOwner,
|
|
17
|
-
});
|
|
18
|
-
const encodingProgress = JSON.parse(await (0, stream_to_string_1.streamToString)(Body));
|
|
19
|
-
return encodingProgress;
|
|
20
|
-
}
|
|
21
|
-
catch (err) {
|
|
22
|
-
// The file may not yet have been fully written or already have been cleaned up again
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
9
|
+
const framesEncoded = (0, chunk_progress_1.getProgressOfChunk)(exists.ETag);
|
|
10
|
+
return { framesEncoded };
|
|
25
11
|
};
|
|
26
12
|
exports.getEncodingMetadata = getEncodingMetadata;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { EncodingProgress, RenderMetadata } from '../../shared/constants';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
encodingStatus: EncodingProgress | null;
|
|
2
|
+
export declare const getFinalEncodingStatus: ({ encodingProgress, renderMetadata, outputFileExists, }: {
|
|
3
|
+
encodingProgress: EncodingProgress | null;
|
|
5
4
|
renderMetadata: RenderMetadata | null;
|
|
6
5
|
outputFileExists: boolean;
|
|
7
|
-
lambdaInvokeStatus: LambdaInvokeStats;
|
|
8
6
|
}) => EncodingProgress | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getFinalEncodingStatus = void 0;
|
|
4
|
-
const getFinalEncodingStatus = ({
|
|
4
|
+
const getFinalEncodingStatus = ({ encodingProgress, renderMetadata, outputFileExists, }) => {
|
|
5
5
|
if (!renderMetadata) {
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
@@ -11,9 +11,6 @@ const getFinalEncodingStatus = ({ encodingStatus: encodingProgress, renderMetada
|
|
|
11
11
|
if (outputFileExists) {
|
|
12
12
|
return {
|
|
13
13
|
framesEncoded: renderMetadata.videoConfig.durationInFrames,
|
|
14
|
-
totalFrames: renderMetadata.videoConfig.durationInFrames,
|
|
15
|
-
doneIn: null,
|
|
16
|
-
timeToInvoke: lambdaInvokeStatus.timeToInvokeLambdas,
|
|
17
14
|
};
|
|
18
15
|
}
|
|
19
16
|
return null;
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { _Object } from '@aws-sdk/client-s3';
|
|
2
2
|
export declare type LambdaInvokeStats = {
|
|
3
|
-
timeToInvokeLambdas: number | null;
|
|
4
3
|
lambdasInvoked: number;
|
|
5
4
|
};
|
|
6
|
-
export declare const getLambdasInvokedStats: ({ contents, renderId,
|
|
5
|
+
export declare const getLambdasInvokedStats: ({ contents, renderId, }: {
|
|
7
6
|
contents: _Object[];
|
|
8
7
|
renderId: string;
|
|
9
|
-
estimatedRenderLambdaInvokations: number | null;
|
|
10
|
-
startDate: number | null;
|
|
11
|
-
checkIfAllLambdasWereInvoked: boolean;
|
|
12
8
|
}) => LambdaInvokeStats;
|
|
@@ -3,19 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getLambdasInvokedStats = void 0;
|
|
4
4
|
const constants_1 = require("../../shared/constants");
|
|
5
5
|
const parse_lambda_initialized_key_1 = require("../../shared/parse-lambda-initialized-key");
|
|
6
|
-
const
|
|
7
|
-
const getLambdasInvokedStats = ({ contents, renderId, estimatedRenderLambdaInvokations, startDate, checkIfAllLambdasWereInvoked, }) => {
|
|
8
|
-
var _a;
|
|
6
|
+
const getLambdasInvokedStats = ({ contents, renderId, }) => {
|
|
9
7
|
const lambdasInvoked = contents
|
|
10
8
|
.filter((c) => { var _a; return (_a = c.Key) === null || _a === void 0 ? void 0 : _a.startsWith((0, constants_1.lambdaChunkInitializedPrefix)(renderId)); })
|
|
11
9
|
.filter((c) => (0, parse_lambda_initialized_key_1.parseLambdaInitializedKey)(c.Key).attempt === 1);
|
|
12
|
-
const allLambdasInvoked = !checkIfAllLambdasWereInvoked ||
|
|
13
|
-
lambdasInvoked.length === estimatedRenderLambdaInvokations;
|
|
14
|
-
const timeToInvokeLambdas = !allLambdasInvoked || startDate === null
|
|
15
|
-
? null
|
|
16
|
-
: ((_a = (0, min_max_1.max)(lambdasInvoked.map((l) => { var _a; return (_a = l.LastModified) === null || _a === void 0 ? void 0 : _a.getTime(); }))) !== null && _a !== void 0 ? _a : 0) - startDate;
|
|
17
10
|
return {
|
|
18
|
-
timeToInvokeLambdas,
|
|
19
11
|
lambdasInvoked: lambdasInvoked.length,
|
|
20
12
|
};
|
|
21
13
|
};
|