@remotion/lambda 3.3.7 → 3.3.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/admin/generate-etag-list.d.ts +1 -0
  2. package/dist/admin/generate-etag-list.js +14 -0
  3. package/dist/api/deploy-site.js +0 -5
  4. package/dist/api/get-aws-client.d.ts +2 -0
  5. package/dist/api/get-aws-client.js +2 -0
  6. package/dist/api/get-or-create-bucket.js +0 -5
  7. package/dist/api/iam-validation/simulate-rule.js +0 -22
  8. package/dist/api/iam-validation/simulate.js +24 -5
  9. package/dist/api/iam-validation/user-permissions.js +0 -8
  10. package/dist/cli/commands/render/progress.d.ts +6 -3
  11. package/dist/cli/commands/render/progress.js +49 -39
  12. package/dist/cli/commands/render/render.js +16 -1
  13. package/dist/cli/commands/sites/create.js +0 -2
  14. package/dist/cli/helpers/progress-bar.d.ts +1 -2
  15. package/dist/cli/helpers/progress-bar.js +2 -2
  16. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
  17. package/dist/functions/helpers/concat-videos.d.ts +10 -6
  18. package/dist/functions/helpers/concat-videos.js +5 -21
  19. package/dist/functions/helpers/create-post-render-data.js +0 -12
  20. package/dist/functions/helpers/get-encoding-metadata.d.ts +4 -8
  21. package/dist/functions/helpers/get-encoding-metadata.js +4 -18
  22. package/dist/functions/helpers/get-final-encoding-status.d.ts +2 -4
  23. package/dist/functions/helpers/get-final-encoding-status.js +1 -4
  24. package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +1 -5
  25. package/dist/functions/helpers/get-lambdas-invoked-stats.js +1 -9
  26. package/dist/functions/helpers/get-overall-progress.d.ts +2 -1
  27. package/dist/functions/helpers/get-overall-progress.js +7 -5
  28. package/dist/functions/helpers/get-progress.js +40 -26
  29. package/dist/functions/helpers/get-rendered-frames-progress.d.ts +8 -0
  30. package/dist/functions/helpers/get-rendered-frames-progress.js +37 -0
  31. package/dist/functions/launch.js +48 -37
  32. package/dist/functions/renderer.js +15 -22
  33. package/dist/functions/still.js +2 -0
  34. package/dist/shared/aws-clients.d.ts +3 -0
  35. package/dist/shared/aws-clients.js +55 -13
  36. package/dist/shared/check-credentials.js +3 -0
  37. package/dist/shared/chunk-progress.d.ts +9 -0
  38. package/dist/shared/chunk-progress.js +2034 -0
  39. package/dist/shared/constants.d.ts +5 -5
  40. package/dist/shared/get-account-id.js +4 -6
  41. package/dist/shared/invoke-webhook.d.ts +0 -2
  42. package/dist/shared/parse-chunk-key.d.ts +4 -0
  43. package/dist/shared/parse-chunk-key.js +14 -0
  44. package/package.json +8 -6
  45. package/remotionlambda.zip +0 -0
@@ -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));
@@ -12,7 +12,6 @@ const validate_aws_region_1 = require("../shared/validate-aws-region");
12
12
  const validate_bucketname_1 = require("../shared/validate-bucketname");
13
13
  const validate_site_name_1 = require("../shared/validate-site-name");
14
14
  const bucket_exists_1 = require("./bucket-exists");
15
- const enable_s3_website_1 = require("./enable-s3-website");
16
15
  const upload_dir_1 = require("./upload-dir");
17
16
  /**
18
17
  * @description Deploys a Remotion project to an S3 bucket to prepare it for rendering on AWS Lambda.
@@ -77,10 +76,6 @@ const deploySite = async ({ bucketName, entryPoint, siteName, options, region, }
77
76
  region,
78
77
  });
79
78
  })),
80
- (0, enable_s3_website_1.enableS3Website)({
81
- region,
82
- bucketName,
83
- }),
84
79
  ]);
85
80
  return {
86
81
  serveUrl: (0, make_s3_url_1.makeS3ServeUrl)({ bucketName, subFolder, region }),
@@ -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
  };
@@ -4,7 +4,6 @@ exports.getOrCreateBucket = void 0;
4
4
  const constants_1 = require("../shared/constants");
5
5
  const random_hash_1 = require("../shared/random-hash");
6
6
  const create_bucket_1 = require("./create-bucket");
7
- const enable_s3_website_1 = require("./enable-s3-website");
8
7
  const get_buckets_1 = require("./get-buckets");
9
8
  /**
10
9
  * @description Creates a bucket for Remotion Lambda in your S3 account. If one already exists, it will get returned instead.
@@ -28,10 +27,6 @@ const getOrCreateBucket = async (options) => {
28
27
  region: options.region,
29
28
  });
30
29
  (_b = options.onBucketEnsured) === null || _b === void 0 ? void 0 : _b.call(options);
31
- await (0, enable_s3_website_1.enableS3Website)({
32
- region: options.region,
33
- bucketName,
34
- });
35
30
  return { bucketName };
36
31
  };
37
32
  exports.getOrCreateBucket = getOrCreateBucket;
@@ -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 client_iam_1 = require("@aws-sdk/client-iam");
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,34 @@ exports.logPermissionOutput = logPermissionOutput;
26
26
  */
27
27
  const simulatePermissions = async (options) => {
28
28
  var _a;
29
- const user = await (0, aws_clients_1.getIamClient)(options.region).send(new client_iam_1.GetUserCommand({}));
30
- if (!user || !user.User) {
31
- throw new Error('No valid AWS user detected');
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 if (callerIdentityArnType === 'sts' && callerIdentityArnComponents[3] === 'assumed-role') {
43
+ const assumedRoleComponents = callerIdentityArnComponents[4].match(/\/([^/]+)\/(.*)/);
44
+ if (!assumedRoleComponents) {
45
+ throw new Error('Unsupported AWS Caller Identity as Assumed-Role ARN detected');
46
+ }
47
+ callerArn = `arn:aws:iam::${callerIdentityArnComponents[2]}:role/${assumedRoleComponents[1]}`;
48
+ }
49
+ else {
50
+ throw new Error('Unsupported AWS Caller Identity ARN detected');
32
51
  }
33
52
  const results = [];
34
53
  for (const per of user_permissions_1.requiredPermissions) {
35
54
  const result = await (0, simulate_rule_1.simulateRule)({
36
55
  actionNames: per.actions,
37
- arn: user.User.Arn,
56
+ arn: callerArn,
38
57
  region: options.region,
39
58
  resource: per.resource,
40
59
  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],
@@ -43,8 +37,6 @@ exports.requiredPermissions = [
43
37
  aws_policies_1.s3.GetBucketLocation,
44
38
  aws_policies_1.s3.PutBucketAcl,
45
39
  aws_policies_1.s3.DeleteBucket,
46
- aws_policies_1.s3.PutBucketWebsite,
47
- aws_policies_1.s3.DeleteBucketWebsite,
48
40
  ],
49
41
  resource: [`arn:aws:s3:::${constants_1.REMOTION_BUCKET_PREFIX}*`],
50
42
  },
@@ -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, doneIn } = invokeProgress;
8
- const progress = doneIn
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
- `${doneIn === null ? 'Invoking' : 'Invoked'} lambdas`,
18
- doneIn === null
19
- ? `${Math.round(progress * 100)}%`
20
- : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
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 makeChunkProgress = ({ chunkProgress, invokeProgress, totalSteps, }) => {
25
- const lambdaIsDone = invokeProgress.doneIn !== null;
22
+ const makeRenderProgress = ({ chunkProgress, totalSteps, }) => {
26
23
  const { chunksInvoked, totalChunks, doneIn } = chunkProgress;
27
- const progress = totalChunks === null ? 0 : chunksInvoked / totalChunks;
28
- const shouldShow = lambdaIsDone || progress > 0;
29
- if (!shouldShow) {
30
- return '';
31
- }
32
- return [
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(progress),
36
- `${doneIn === null ? 'Rendering' : 'Rendered'} chunks`,
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(progress * 100)}%`
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, totalFrames, doneIn } = encodingProgress;
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
- `(3/${totalSteps})`,
61
+ `(4/${totalSteps})`,
53
62
  cli_1.CliInternals.makeProgressBar(progress),
54
- `${doneIn === null ? 'Combining' : 'Combined'} videos`,
55
- doneIn === null
63
+ `${timeToEncode === null ? 'Combining' : 'Combined'} videos`,
64
+ timeToEncode === null
56
65
  ? `${Math.round(progress * 100)}%`
57
- : cli_1.CliInternals.chalk.gray(`${doneIn}ms`),
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
- `(4/${totalSteps})`,
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
- `(4/${totalSteps})`,
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
- `(5/${totalSteps})`,
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, _g, _h, _j, _k, _l, _m;
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: (_m = (_l = status.renderMetadata) === null || _l === void 0 ? void 0 : _l.estimatedRenderLambdaInvokations) !== null && _m !== void 0 ? _m : null,
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
- makeChunkProgress({
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 ? 5 : 4;
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
+ }
@@ -52,7 +52,6 @@ const sitesCreateSubcommand = async (args, remotionRoot) => {
52
52
  bucketProgress: {
53
53
  bucketCreated: false,
54
54
  doneIn: null,
55
- websiteEnabled: false,
56
55
  },
57
56
  deployProgress: {
58
57
  doneIn: null,
@@ -76,7 +75,6 @@ const sitesCreateSubcommand = async (args, remotionRoot) => {
76
75
  updateProgress();
77
76
  },
78
77
  });
79
- multiProgress.bucketProgress.websiteEnabled = true;
80
78
  multiProgress.bucketProgress.doneIn = Date.now() - bucketStart;
81
79
  updateProgress();
82
80
  const bundleStart = Date.now();
@@ -5,10 +5,9 @@ export declare type BundleProgress = {
5
5
  export declare const makeBundleProgress: ({ progress, doneIn }: BundleProgress) => string;
6
6
  export declare type BucketCreationProgress = {
7
7
  bucketCreated: boolean;
8
- websiteEnabled: boolean;
9
8
  doneIn: number | null;
10
9
  };
11
- export declare const makeBucketProgress: ({ bucketCreated, websiteEnabled, doneIn, }: BucketCreationProgress) => string;
10
+ export declare const makeBucketProgress: ({ bucketCreated, doneIn, }: BucketCreationProgress) => string;
12
11
  declare type UploadStats = {
13
12
  addedFiles: number;
14
13
  removedFiles: number;
@@ -15,8 +15,8 @@ const makeBundleProgress = ({ progress, doneIn }) => {
15
15
  ].join(' ');
16
16
  };
17
17
  exports.makeBundleProgress = makeBundleProgress;
18
- const makeBucketProgress = ({ bucketCreated, websiteEnabled, doneIn, }) => {
19
- const states = [bucketCreated, websiteEnabled];
18
+ const makeBucketProgress = ({ bucketCreated, doneIn, }) => {
19
+ const states = [bucketCreated];
20
20
  const statesFinished = states.filter(Boolean).map((p) => p).length;
21
21
  const progress = statesFinished / states.length;
22
22
  return [
@@ -3,5 +3,8 @@ export declare const planFrameRanges: ({ framesPerLambda, frameRange, everyNthFr
3
3
  frameRange: [number, number];
4
4
  everyNthFrame: number;
5
5
  }) => {
6
- chunks: [number, number][];
6
+ chunks: [
7
+ number,
8
+ number
9
+ ][];
7
10
  };
@@ -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 concatVideosS3: ({ bucket, expectedFiles, onProgress, numberOfFrames, renderId, region, codec, expectedBucketOwner, fps, numberOfGifLoops, ffmpegExecutable, remotionRoot, onErrors, }: {
5
+ export declare const getAllFilesS3: ({ bucket, expectedFiles, outdir, renderId, region, expectedBucketOwner, onErrors, }: {
6
6
  bucket: string;
7
7
  expectedFiles: number;
8
- onProgress: (frames: number, encodingStart: number) => void;
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
- const concatVideosS3 = async ({ bucket, expectedFiles, onProgress, numberOfFrames, renderId, region, codec, expectedBucketOwner, fps, numberOfGifLoops, ffmpegExecutable, remotionRoot, onErrors, }) => {
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, encodingStart),
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, encodingStart };
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
  };
@@ -1,9 +1,5 @@
1
+ import type { _Object } from '@aws-sdk/client-s3';
1
2
  import type { EncodingProgress } from '../../defaults';
2
- import type { AwsRegion } from '../../pricing/aws-regions';
3
- export declare const getEncodingMetadata: ({ exists, bucketName, renderId, region, expectedBucketOwner, }: {
4
- exists: boolean;
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;