@remotion/lambda 4.0.164 → 4.0.166
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/delete-render.js +7 -3
- package/dist/api/deploy-function.d.ts +0 -1
- package/dist/api/deploy-function.js +3 -3
- package/dist/api/download-media.js +6 -3
- package/dist/api/get-compositions-on-lambda.js +0 -2
- package/dist/api/get-render-progress.js +0 -2
- package/dist/api/make-lambda-payload.js +2 -1
- package/dist/api/render-media-on-lambda.js +0 -2
- package/dist/api/render-still-on-lambda.js +37 -25
- package/dist/cli/commands/render/progress.d.ts +3 -28
- package/dist/cli/commands/render/progress.js +89 -90
- package/dist/cli/commands/render/render.js +7 -40
- package/dist/cli/commands/sites/create.js +2 -2
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
- package/dist/functions/chunk-optimization/types.d.ts +0 -3
- package/dist/functions/helpers/calculate-chunk-times.d.ts +3 -4
- package/dist/functions/helpers/calculate-chunk-times.js +4 -8
- package/dist/functions/helpers/calculate-price-from-bucket.d.ts +3 -5
- package/dist/functions/helpers/calculate-price-from-bucket.js +5 -18
- package/dist/functions/helpers/check-if-render-exists.js +1 -1
- package/dist/functions/helpers/clean-tmpdir.d.ts +0 -2
- package/dist/functions/helpers/clean-tmpdir.js +1 -7
- package/dist/functions/helpers/concat-videos.d.ts +1 -13
- package/dist/functions/helpers/concat-videos.js +7 -131
- package/dist/functions/helpers/create-post-render-data.d.ts +6 -6
- package/dist/functions/helpers/create-post-render-data.js +17 -37
- package/dist/functions/helpers/find-output-file-in-bucket.d.ts +1 -3
- package/dist/functions/helpers/find-output-file-in-bucket.js +1 -4
- package/dist/functions/helpers/get-cleanup-progress.d.ts +1 -3
- package/dist/functions/helpers/get-cleanup-progress.js +1 -3
- package/dist/functions/helpers/get-custom-out-name.js +1 -0
- package/dist/functions/helpers/get-files-to-delete.d.ts +1 -3
- package/dist/functions/helpers/get-files-to-delete.js +1 -35
- package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +0 -5
- package/dist/functions/helpers/get-lambdas-invoked-stats.js +0 -12
- package/dist/functions/helpers/get-overall-progress-s3.d.ts +4 -2
- package/dist/functions/helpers/get-overall-progress-s3.js +8 -6
- package/dist/functions/helpers/get-overall-progress.d.ts +1 -2
- package/dist/functions/helpers/get-overall-progress.js +2 -4
- package/dist/functions/helpers/get-progress.js +78 -154
- package/dist/functions/helpers/get-retry-stats.d.ts +0 -5
- package/dist/functions/helpers/get-retry-stats.js +0 -18
- package/dist/functions/helpers/inspect-errors.d.ts +4 -10
- package/dist/functions/helpers/inspect-errors.js +5 -27
- package/dist/functions/helpers/io.d.ts +0 -1
- package/dist/functions/helpers/io.js +2 -3
- package/dist/functions/helpers/lifecycle.d.ts +0 -4
- package/dist/functions/helpers/lifecycle.js +2 -3
- package/dist/functions/helpers/make-timeout-error.d.ts +0 -2
- package/dist/functions/helpers/merge-chunks.d.ts +5 -0
- package/dist/functions/helpers/merge-chunks.js +16 -143
- package/dist/functions/helpers/min-max.d.ts +1 -1
- package/dist/functions/helpers/min-max.js +1 -1
- package/dist/functions/helpers/overall-render-progress.d.ts +26 -4
- package/dist/functions/helpers/overall-render-progress.js +116 -27
- package/dist/functions/helpers/stream-renderer.js +15 -9
- package/dist/functions/helpers/streamify-response.d.ts +0 -3
- package/dist/functions/helpers/streamify-response.js +2 -14
- package/dist/functions/helpers/write-lambda-error.d.ts +3 -6
- package/dist/functions/helpers/write-lambda-error.js +1 -21
- package/dist/functions/index.d.ts +5 -0
- package/dist/functions/index.js +70 -38
- package/dist/functions/launch.js +103 -133
- package/dist/functions/renderer.d.ts +2 -2
- package/dist/functions/renderer.js +70 -123
- package/dist/functions/start.d.ts +1 -0
- package/dist/functions/start.js +3 -2
- package/dist/functions/still.d.ts +7 -2
- package/dist/functions/still.js +17 -34
- package/dist/functions/streaming/streaming.d.ts +15 -2
- package/dist/functions/streaming/streaming.js +8 -6
- package/dist/internals.d.ts +2 -1
- package/dist/shared/aws-clients.js +14 -1
- package/dist/shared/call-lambda.d.ts +5 -4
- package/dist/shared/call-lambda.js +53 -44
- package/dist/shared/chunk-progress.d.ts +1 -2
- package/dist/shared/chunk-progress.js +2 -2
- package/dist/shared/constants.d.ts +14 -35
- package/dist/shared/constants.js +3 -31
- package/dist/shared/content-disposition-header.d.ts +0 -3
- package/dist/shared/get-function-version.js +0 -2
- package/dist/shared/is-flaky-error.js +4 -0
- package/dist/shared/parse-lambda-timings-key.d.ts +0 -2
- package/dist/shared/parse-lambda-timings-key.js +0 -14
- package/dist/shared/return-values.d.ts +0 -5
- package/package.json +18 -18
- package/remotionlambda-arm64.zip +0 -0
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deleteRender = void 0;
|
|
4
4
|
const defaults_1 = require("../defaults");
|
|
5
5
|
const expected_out_name_1 = require("../functions/helpers/expected-out-name");
|
|
6
|
-
const
|
|
6
|
+
const get_overall_progress_s3_1 = require("../functions/helpers/get-overall-progress-s3");
|
|
7
7
|
const io_1 = require("../functions/helpers/io");
|
|
8
8
|
const get_account_id_1 = require("../shared/get-account-id");
|
|
9
9
|
const clean_items_1 = require("./clean-items");
|
|
@@ -20,13 +20,17 @@ const deleteRender = async (input) => {
|
|
|
20
20
|
const expectedBucketOwner = await (0, get_account_id_1.getAccountId)({
|
|
21
21
|
region: input.region,
|
|
22
22
|
});
|
|
23
|
-
const
|
|
23
|
+
const progress = await (0, get_overall_progress_s3_1.getOverallProgressS3)({
|
|
24
24
|
bucketName: input.bucketName,
|
|
25
25
|
expectedBucketOwner,
|
|
26
26
|
region: input.region,
|
|
27
27
|
renderId: input.renderId,
|
|
28
28
|
});
|
|
29
|
-
|
|
29
|
+
// Render did not start yet
|
|
30
|
+
if (progress.renderMetadata === null) {
|
|
31
|
+
return { freedBytes: 0 };
|
|
32
|
+
}
|
|
33
|
+
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(progress.renderMetadata, input.bucketName, (_a = input.customCredentials) !== null && _a !== void 0 ? _a : null);
|
|
30
34
|
await (0, io_1.lambdaDeleteFile)({
|
|
31
35
|
bucketName: renderBucketName,
|
|
32
36
|
customCredentials,
|
|
@@ -23,7 +23,6 @@ export type DeployFunctionOutput = {
|
|
|
23
23
|
alreadyExisted: boolean;
|
|
24
24
|
};
|
|
25
25
|
export declare const internalDeployFunction: (params: MandatoryParameters & OptionalParameters) => Promise<DeployFunctionOutput>;
|
|
26
|
-
export declare const errorHandled: (params: MandatoryParameters & OptionalParameters) => Promise<DeployFunctionOutput>;
|
|
27
26
|
/**
|
|
28
27
|
* @description Creates an AWS Lambda function in your account that will be able to render a video in the cloud.
|
|
29
28
|
* @see [Documentation](https://www.remotion.dev/docs/lambda/deployfunction)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deployFunction = exports.
|
|
3
|
+
exports.deployFunction = exports.internalDeployFunction = void 0;
|
|
4
4
|
const pure_1 = require("@remotion/renderer/pure");
|
|
5
5
|
const no_react_1 = require("remotion/no-react");
|
|
6
6
|
const version_1 = require("remotion/version");
|
|
@@ -66,7 +66,7 @@ const internalDeployFunction = async (params) => {
|
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
exports.internalDeployFunction = internalDeployFunction;
|
|
69
|
-
|
|
69
|
+
const errorHandled = pure_1.NoReactAPIs.wrapWithErrorHandling(exports.internalDeployFunction);
|
|
70
70
|
/**
|
|
71
71
|
* @description Creates an AWS Lambda function in your account that will be able to render a video in the cloud.
|
|
72
72
|
* @see [Documentation](https://www.remotion.dev/docs/lambda/deployfunction)
|
|
@@ -82,7 +82,7 @@ exports.errorHandled = pure_1.NoReactAPIs.wrapWithErrorHandling(exports.internal
|
|
|
82
82
|
const deployFunction = ({ createCloudWatchLogGroup, memorySizeInMb, region, timeoutInSeconds, cloudWatchLogRetentionPeriodInDays, customRoleArn, enableLambdaInsights, indent, logLevel, enableV5Runtime, vpcSubnetIds, vpcSecurityGroupIds, ...options }) => {
|
|
83
83
|
var _a;
|
|
84
84
|
const diskSizeInMb = (_a = options.diskSizeInMb) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_EPHEMERAL_STORAGE_IN_MB;
|
|
85
|
-
return
|
|
85
|
+
return errorHandled({
|
|
86
86
|
indent: indent !== null && indent !== void 0 ? indent : false,
|
|
87
87
|
logLevel: logLevel !== null && logLevel !== void 0 ? logLevel : 'info',
|
|
88
88
|
createCloudWatchLogGroup,
|
|
@@ -7,7 +7,7 @@ exports.downloadMedia = void 0;
|
|
|
7
7
|
const renderer_1 = require("@remotion/renderer");
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const expected_out_name_1 = require("../functions/helpers/expected-out-name");
|
|
10
|
-
const
|
|
10
|
+
const get_overall_progress_s3_1 = require("../functions/helpers/get-overall-progress-s3");
|
|
11
11
|
const read_with_progress_1 = require("../functions/helpers/read-with-progress");
|
|
12
12
|
const get_account_id_1 = require("../shared/get-account-id");
|
|
13
13
|
/**
|
|
@@ -26,15 +26,18 @@ const downloadMedia = async (input) => {
|
|
|
26
26
|
const expectedBucketOwner = await (0, get_account_id_1.getAccountId)({
|
|
27
27
|
region: input.region,
|
|
28
28
|
});
|
|
29
|
-
const
|
|
29
|
+
const overallProgress = await (0, get_overall_progress_s3_1.getOverallProgressS3)({
|
|
30
30
|
bucketName: input.bucketName,
|
|
31
31
|
expectedBucketOwner,
|
|
32
32
|
region: input.region,
|
|
33
33
|
renderId: input.renderId,
|
|
34
34
|
});
|
|
35
|
+
if (!overallProgress.renderMetadata) {
|
|
36
|
+
throw new Error('Render did not finish yet');
|
|
37
|
+
}
|
|
35
38
|
const outputPath = node_path_1.default.resolve(process.cwd(), input.outPath);
|
|
36
39
|
renderer_1.RenderInternals.ensureOutputDirectory(outputPath);
|
|
37
|
-
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(renderMetadata, input.bucketName, (_a = input.customCredentials) !== null && _a !== void 0 ? _a : null);
|
|
40
|
+
const { key, renderBucketName, customCredentials } = (0, expected_out_name_1.getExpectedOutName)(overallProgress.renderMetadata, input.bucketName, (_a = input.customCredentials) !== null && _a !== void 0 ? _a : null);
|
|
38
41
|
const { sizeInBytes } = await (0, read_with_progress_1.lambdaDownloadFileWithProgress)({
|
|
39
42
|
bucketName: renderBucketName,
|
|
40
43
|
expectedBucketOwner,
|
|
@@ -46,9 +46,7 @@ const getCompositionsOnLambda = async ({ chromiumOptions, serveUrl, region, inpu
|
|
|
46
46
|
offthreadVideoCacheSizeInBytes: offthreadVideoCacheSizeInBytes !== null && offthreadVideoCacheSizeInBytes !== void 0 ? offthreadVideoCacheSizeInBytes : null,
|
|
47
47
|
},
|
|
48
48
|
region,
|
|
49
|
-
receivedStreamingPayload: () => undefined,
|
|
50
49
|
timeoutInTest: 120000,
|
|
51
|
-
retriesRemaining: 0,
|
|
52
50
|
});
|
|
53
51
|
return res.compositions;
|
|
54
52
|
}
|
|
@@ -20,9 +20,7 @@ const getRenderProgress = async (input) => {
|
|
|
20
20
|
type: constants_1.LambdaRoutines.status,
|
|
21
21
|
payload: (0, make_lambda_payload_1.getRenderProgressPayload)(input),
|
|
22
22
|
region: input.region,
|
|
23
|
-
receivedStreamingPayload: () => undefined,
|
|
24
23
|
timeoutInTest: 120000,
|
|
25
|
-
retriesRemaining: 2,
|
|
26
24
|
});
|
|
27
25
|
return result;
|
|
28
26
|
};
|
|
@@ -54,7 +54,7 @@ const makeLambdaRenderMediaPayload = async ({ rendererFunctionName, frameRange,
|
|
|
54
54
|
numberOfGifLoops,
|
|
55
55
|
concurrencyPerLambda,
|
|
56
56
|
downloadBehavior,
|
|
57
|
-
muted
|
|
57
|
+
muted,
|
|
58
58
|
version: version_1.VERSION,
|
|
59
59
|
overwrite: overwrite !== null && overwrite !== void 0 ? overwrite : false,
|
|
60
60
|
audioBitrate: audioBitrate !== null && audioBitrate !== void 0 ? audioBitrate : null,
|
|
@@ -121,6 +121,7 @@ const makeLambdaRenderStillPayload = async ({ serveUrl, inputProps, imageFormat,
|
|
|
121
121
|
offthreadVideoCacheSizeInBytes,
|
|
122
122
|
deleteAfter,
|
|
123
123
|
type: defaults_1.LambdaRoutines.still,
|
|
124
|
+
streamed: true,
|
|
124
125
|
};
|
|
125
126
|
};
|
|
126
127
|
exports.makeLambdaRenderStillPayload = makeLambdaRenderStillPayload;
|
|
@@ -15,9 +15,7 @@ const internalRenderMediaOnLambdaRaw = async (input) => {
|
|
|
15
15
|
type: constants_1.LambdaRoutines.start,
|
|
16
16
|
payload: await (0, make_lambda_payload_1.makeLambdaRenderMediaPayload)(input),
|
|
17
17
|
region,
|
|
18
|
-
receivedStreamingPayload: () => undefined,
|
|
19
18
|
timeoutInTest: 120000,
|
|
20
|
-
retriesRemaining: 0,
|
|
21
19
|
});
|
|
22
20
|
return {
|
|
23
21
|
renderId: res.renderId,
|
|
@@ -10,31 +10,43 @@ const internalRenderStillOnLambda = async (input) => {
|
|
|
10
10
|
var _a;
|
|
11
11
|
const { functionName, region, onInit } = input;
|
|
12
12
|
try {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
13
|
+
const payload = await (0, make_lambda_payload_1.makeLambdaRenderStillPayload)(input);
|
|
14
|
+
const res = await new Promise((resolve, reject) => {
|
|
15
|
+
(0, call_lambda_1.callLambdaWithStreaming)({
|
|
16
|
+
functionName,
|
|
17
|
+
type: constants_1.LambdaRoutines.still,
|
|
18
|
+
payload,
|
|
19
|
+
region,
|
|
20
|
+
receivedStreamingPayload: ({ message }) => {
|
|
21
|
+
if (message.type === 'render-id-determined') {
|
|
22
|
+
onInit === null || onInit === void 0 ? void 0 : onInit({
|
|
23
|
+
renderId: message.payload.renderId,
|
|
24
|
+
cloudWatchLogs: (0, get_aws_urls_1.getCloudwatchMethodUrl)({
|
|
25
|
+
functionName,
|
|
26
|
+
method: constants_1.LambdaRoutines.still,
|
|
27
|
+
region,
|
|
28
|
+
rendererFunctionName: null,
|
|
29
|
+
renderId: message.payload.renderId,
|
|
30
|
+
}),
|
|
31
|
+
lambdaInsightsUrl: (0, get_aws_urls_1.getLambdaInsightsUrl)({
|
|
32
|
+
functionName,
|
|
33
|
+
region,
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (message.type === 'still-rendered') {
|
|
38
|
+
resolve(message.payload);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
timeoutInTest: 120000,
|
|
42
|
+
retriesRemaining: 0,
|
|
43
|
+
})
|
|
44
|
+
.then(() => {
|
|
45
|
+
reject(new Error('Expected response to be streamed'));
|
|
46
|
+
})
|
|
47
|
+
.catch((err) => {
|
|
48
|
+
reject(err);
|
|
49
|
+
});
|
|
38
50
|
});
|
|
39
51
|
return {
|
|
40
52
|
estimatedPrice: res.estimatedPrice,
|
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CleanupInfo, EncodingProgress, RenderProgress } from '../../../defaults';
|
|
3
|
-
import type { ChunkRetry } from '../../../functions/helpers/get-retry-stats';
|
|
4
|
-
type LambdaInvokeProgress = {
|
|
5
|
-
totalLambdas: number | null;
|
|
6
|
-
lambdasInvoked: number;
|
|
7
|
-
};
|
|
8
|
-
type ChunkProgress = {
|
|
9
|
-
doneIn: number | null;
|
|
10
|
-
framesRendered: number;
|
|
11
|
-
totalFrames: number | null;
|
|
12
|
-
totalChunks: number | null;
|
|
13
|
-
chunksEncoded: number;
|
|
14
|
-
};
|
|
15
|
-
type MultiRenderProgress = {
|
|
16
|
-
lambdaInvokeProgress: LambdaInvokeProgress;
|
|
17
|
-
chunkProgress: ChunkProgress;
|
|
18
|
-
encodingProgress: EncodingProgress;
|
|
19
|
-
cleanupInfo: CleanupInfo | null;
|
|
20
|
-
};
|
|
21
|
-
export declare const makeMultiProgressFromStatus: (status: RenderProgress) => MultiRenderProgress;
|
|
1
|
+
import type { RenderProgress } from '../../../defaults';
|
|
22
2
|
type DownloadedInfo = {
|
|
23
3
|
totalSize: number | null;
|
|
24
4
|
downloaded: number;
|
|
25
5
|
doneIn: number | null;
|
|
26
6
|
};
|
|
27
|
-
export declare const makeProgressString: ({
|
|
28
|
-
|
|
29
|
-
steps: number;
|
|
7
|
+
export declare const makeProgressString: ({ downloadInfo, overall, }: {
|
|
8
|
+
overall: RenderProgress;
|
|
30
9
|
downloadInfo: DownloadedInfo | null;
|
|
31
|
-
retriesInfo: ChunkRetry[];
|
|
32
|
-
logLevel: LogLevel;
|
|
33
|
-
timeToEncode: number | null;
|
|
34
|
-
totalFrames: number | null;
|
|
35
10
|
}) => string;
|
|
36
11
|
export {};
|
|
@@ -1,89 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeProgressString =
|
|
3
|
+
exports.makeProgressString = void 0;
|
|
4
4
|
const cli_1 = require("@remotion/cli");
|
|
5
5
|
const renderer_1 = require("@remotion/renderer");
|
|
6
6
|
const no_react_1 = require("remotion/no-react");
|
|
7
7
|
const truthy_1 = require("../../../shared/truthy");
|
|
8
|
-
const makeInvokeProgress = (
|
|
8
|
+
const makeInvokeProgress = (overall) => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
const invokeProgress = {
|
|
11
|
+
lambdasInvoked: overall.lambdasInvoked,
|
|
12
|
+
totalLambdas: (_b = (_a = overall.renderMetadata) === null || _a === void 0 ? void 0 : _a.estimatedRenderLambdaInvokations) !== null && _b !== void 0 ? _b : null,
|
|
13
|
+
};
|
|
9
14
|
const { lambdasInvoked, totalLambdas } = invokeProgress;
|
|
10
15
|
const progress = totalLambdas === null ? 0 : lambdasInvoked / totalLambdas;
|
|
11
|
-
|
|
16
|
+
const topLine = [
|
|
12
17
|
`${progress === 0 ? 'Invoked' : 'Invoking'} lambdas`.padEnd(cli_1.CliInternals.LABEL_WIDTH),
|
|
13
18
|
cli_1.CliInternals.makeProgressBar(progress),
|
|
14
19
|
progress === 1
|
|
15
|
-
? cli_1.CliInternals.chalk.gray(
|
|
16
|
-
:
|
|
17
|
-
|
|
20
|
+
? cli_1.CliInternals.chalk.gray(`${lambdasInvoked}/${totalLambdas}`)
|
|
21
|
+
: totalLambdas === null
|
|
22
|
+
? null
|
|
23
|
+
: `${lambdasInvoked}/${totalLambdas}`,
|
|
18
24
|
].join(' ');
|
|
25
|
+
return [
|
|
26
|
+
topLine,
|
|
27
|
+
overall.retriesInfo.length > 0
|
|
28
|
+
? `! Retrying chunk${overall.retriesInfo.length === 1 ? '' : 's'} ${overall.retriesInfo.map((r) => r.chunk).join(', ')}`
|
|
29
|
+
: null,
|
|
30
|
+
].filter(no_react_1.NoReactInternals.truthy);
|
|
19
31
|
};
|
|
20
|
-
const makeRenderProgress = (
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
const makeRenderProgress = (progress) => {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const framesEncoded = (_b = (_a = progress.encodingStatus) === null || _a === void 0 ? void 0 : _a.framesEncoded) !== null && _b !== void 0 ? _b : 0;
|
|
35
|
+
const totalFrames = progress.renderMetadata && progress.renderMetadata.type === 'video'
|
|
36
|
+
? renderer_1.RenderInternals.getFramesToRender(progress.renderMetadata.frameRange, progress.renderMetadata.everyNthFrame).length
|
|
37
|
+
: null;
|
|
38
|
+
const renderProgress = totalFrames === null ? 0 : progress.framesRendered / totalFrames;
|
|
39
|
+
const encodingProgress = totalFrames === null ? 0 : framesEncoded / totalFrames;
|
|
40
|
+
const frames = totalFrames === null ? null : `${progress.framesRendered}/${totalFrames}`;
|
|
29
41
|
const first = [
|
|
30
|
-
(
|
|
42
|
+
(progress.timeToRenderFrames === null
|
|
43
|
+
? 'Rendering frames'
|
|
44
|
+
: 'Rendered frames').padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
|
|
31
45
|
cli_1.CliInternals.makeProgressBar(renderProgress),
|
|
32
|
-
|
|
46
|
+
progress.timeToRenderFrames === null
|
|
47
|
+
? frames
|
|
48
|
+
: cli_1.CliInternals.chalk.gray(`${progress.timeToRenderFrames}ms`),
|
|
33
49
|
]
|
|
34
50
|
.filter(truthy_1.truthy)
|
|
35
51
|
.join(' ');
|
|
36
52
|
const second = [
|
|
37
|
-
`${
|
|
53
|
+
`${progress.timeToEncode === null ? 'Encoding' : 'Encoded'} frames`.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
|
|
38
54
|
cli_1.CliInternals.makeProgressBar(encodingProgress),
|
|
39
|
-
|
|
40
|
-
?
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
progress.timeToEncode === null
|
|
56
|
+
? totalFrames === null
|
|
57
|
+
? null
|
|
58
|
+
: `${framesEncoded}/${totalFrames}`
|
|
59
|
+
: cli_1.CliInternals.chalk.gray(`${progress.timeToEncode}ms`),
|
|
60
|
+
]
|
|
61
|
+
.filter(truthy_1.truthy)
|
|
62
|
+
.join(' ');
|
|
43
63
|
return [first, second];
|
|
44
64
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
const makeCleanupProgress = (cleanupInfo, skipped) => {
|
|
62
|
-
if (!cleanupInfo) {
|
|
63
|
-
return '';
|
|
64
|
-
}
|
|
65
|
-
if (skipped) {
|
|
66
|
-
return [
|
|
67
|
-
cli_1.CliInternals.chalk.blueBright(`Not cleaning up because --log=verbose was set`),
|
|
68
|
-
].join(' ');
|
|
69
|
-
}
|
|
70
|
-
const { doneIn, filesDeleted, minFilesToDelete } = cleanupInfo;
|
|
71
|
-
const progress = filesDeleted / minFilesToDelete;
|
|
65
|
+
function getTotalFrames(status) {
|
|
66
|
+
return status.renderMetadata && status.renderMetadata.type === 'video'
|
|
67
|
+
? renderer_1.RenderInternals.getFramesToRender(status.renderMetadata.frameRange, status.renderMetadata.everyNthFrame).length
|
|
68
|
+
: null;
|
|
69
|
+
}
|
|
70
|
+
const makeCombinationProgress = (prog) => {
|
|
71
|
+
var _a, _b;
|
|
72
|
+
const encodingProgress = {
|
|
73
|
+
framesEncoded: (_b = (_a = prog.encodingStatus) === null || _a === void 0 ? void 0 : _a.framesEncoded) !== null && _b !== void 0 ? _b : 0,
|
|
74
|
+
combinedFrames: prog.combinedFrames,
|
|
75
|
+
timeToCombine: prog.timeToCombine,
|
|
76
|
+
};
|
|
77
|
+
const totalFrames = getTotalFrames(prog);
|
|
78
|
+
const { combinedFrames, timeToCombine } = encodingProgress;
|
|
79
|
+
const progress = totalFrames === null ? 0 : combinedFrames / totalFrames;
|
|
72
80
|
return [
|
|
81
|
+
`${timeToCombine === null ? 'Combining' : 'Combined'} chunks`.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
|
|
73
82
|
cli_1.CliInternals.makeProgressBar(progress),
|
|
74
|
-
|
|
75
|
-
doneIn === null
|
|
83
|
+
timeToCombine === null
|
|
76
84
|
? `${Math.round(progress * 100)}%`
|
|
77
|
-
: cli_1.CliInternals.chalk.gray(`${
|
|
85
|
+
: cli_1.CliInternals.chalk.gray(`${timeToCombine}ms`),
|
|
78
86
|
].join(' ');
|
|
79
87
|
};
|
|
80
|
-
const makeDownloadProgress = (downloadInfo
|
|
88
|
+
const makeDownloadProgress = (downloadInfo) => {
|
|
81
89
|
return [
|
|
82
|
-
|
|
90
|
+
`${downloadInfo.doneIn === null ? 'Downloading' : 'Downloaded'} video`.padEnd(cli_1.CliInternals.LABEL_WIDTH, ' '),
|
|
83
91
|
downloadInfo.totalSize === null
|
|
84
92
|
? cli_1.CliInternals.getFileSizeDownloadBar(downloadInfo.downloaded)
|
|
85
93
|
: cli_1.CliInternals.makeProgressBar(downloadInfo.downloaded / downloadInfo.totalSize),
|
|
86
|
-
`${downloadInfo.doneIn === null ? 'Downloading' : 'Downloaded'} video`,
|
|
87
94
|
downloadInfo.doneIn === null
|
|
88
95
|
? [
|
|
89
96
|
`${cli_1.CliInternals.formatBytes(downloadInfo.downloaded)}`,
|
|
@@ -96,43 +103,35 @@ const makeDownloadProgress = (downloadInfo, totalSteps) => {
|
|
|
96
103
|
: cli_1.CliInternals.chalk.gray(`${downloadInfo.doneIn}ms`),
|
|
97
104
|
].join(' ');
|
|
98
105
|
};
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
106
|
+
const makeTopRow = (overall) => {
|
|
107
|
+
const timeoutInSeconds = Math.round((overall.timeoutTimestamp - Date.now()) / 1000);
|
|
108
|
+
if (!overall.renderMetadata) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
if (overall.done) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const str = [
|
|
115
|
+
`${Math.round(overall.overallProgress * 100)}%`,
|
|
116
|
+
overall.renderMetadata
|
|
117
|
+
? `${overall.renderMetadata.estimatedTotalLambdaInvokations} λ`
|
|
118
|
+
: null,
|
|
119
|
+
`${overall.costs.displayCost}`,
|
|
120
|
+
timeoutInSeconds < 0
|
|
121
|
+
? 'Timeout reached - Expecting crash shortly'
|
|
122
|
+
: `Timeout ${timeoutInSeconds}s`,
|
|
123
|
+
]
|
|
124
|
+
.filter(no_react_1.NoReactInternals.truthy)
|
|
125
|
+
.join(' • ');
|
|
126
|
+
return cli_1.CliInternals.chalk.gray(str);
|
|
120
127
|
};
|
|
121
|
-
|
|
122
|
-
const makeProgressString = ({ progress, steps, downloadInfo, retriesInfo, logLevel, timeToEncode, totalFrames, }) => {
|
|
128
|
+
const makeProgressString = ({ downloadInfo, overall, }) => {
|
|
123
129
|
return [
|
|
124
|
-
|
|
125
|
-
...
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
encodingProgress: progress.encodingProgress,
|
|
130
|
-
chunkProgress: progress.chunkProgress,
|
|
131
|
-
timeToEncode,
|
|
132
|
-
totalFrames,
|
|
133
|
-
}),
|
|
134
|
-
makeCleanupProgress(progress.cleanupInfo, logLevel === 'verbose'),
|
|
135
|
-
downloadInfo ? makeDownloadProgress(downloadInfo, steps) : null,
|
|
130
|
+
makeTopRow(overall),
|
|
131
|
+
...makeInvokeProgress(overall),
|
|
132
|
+
...makeRenderProgress(overall),
|
|
133
|
+
makeCombinationProgress(overall),
|
|
134
|
+
downloadInfo ? makeDownloadProgress(downloadInfo) : null,
|
|
136
135
|
]
|
|
137
136
|
.filter(no_react_1.NoReactInternals.truthy)
|
|
138
137
|
.join('\n');
|
|
@@ -23,11 +23,6 @@ const quit_1 = require("../../helpers/quit");
|
|
|
23
23
|
const log_1 = require("../../log");
|
|
24
24
|
const progress_1 = require("./progress");
|
|
25
25
|
exports.RENDER_COMMAND = 'render';
|
|
26
|
-
function getTotalFrames(status) {
|
|
27
|
-
return status.renderMetadata && status.renderMetadata.type === 'video'
|
|
28
|
-
? renderer_1.RenderInternals.getFramesToRender(status.renderMetadata.frameRange, status.renderMetadata.everyNthFrame).length
|
|
29
|
-
: null;
|
|
30
|
-
}
|
|
31
26
|
const { x264Option, audioBitrateOption, offthreadVideoCacheSizeInBytesOption, scaleOption, crfOption, jpegQualityOption, videoBitrateOption, mutedOption, colorSpaceOption, deleteAfterOption, enableMultiprocessOnLinuxOption, glOption, headlessOption, numberOfGifLoopsOption, encodingMaxRateOption, encodingBufferSizeOption, delayRenderTimeoutInMillisecondsOption, overwriteOption, binariesDirectoryOption, preferLosslessOption, } = client_1.BrowserSafeApis.options;
|
|
32
27
|
const renderCommand = async (args, remotionRoot, logLevel) => {
|
|
33
28
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
@@ -236,7 +231,6 @@ const renderCommand = async (args, remotionRoot, logLevel) => {
|
|
|
236
231
|
preferLossless,
|
|
237
232
|
indent: false,
|
|
238
233
|
});
|
|
239
|
-
const totalSteps = downloadName ? 6 : 5;
|
|
240
234
|
const progressBar = cli_1.CliInternals.createOverwriteableCliOutput({
|
|
241
235
|
quiet: cli_1.CliInternals.quietFlagProvided(),
|
|
242
236
|
cancelSignal: null,
|
|
@@ -256,19 +250,13 @@ const renderCommand = async (args, remotionRoot, logLevel) => {
|
|
|
256
250
|
region: (0, get_aws_region_1.getAwsRegion)(),
|
|
257
251
|
logLevel,
|
|
258
252
|
});
|
|
259
|
-
const multiProgress = (0, progress_1.makeMultiProgressFromStatus)(status);
|
|
260
253
|
progressBar.update((0, progress_1.makeProgressString)({
|
|
261
|
-
progress: multiProgress,
|
|
262
|
-
steps: totalSteps,
|
|
263
254
|
downloadInfo: null,
|
|
264
|
-
|
|
265
|
-
logLevel,
|
|
266
|
-
totalFrames: getTotalFrames(status),
|
|
267
|
-
timeToEncode: status.timeToEncode,
|
|
255
|
+
overall: status,
|
|
268
256
|
}), false);
|
|
269
257
|
// eslint-disable-next-line no-constant-condition
|
|
270
258
|
while (true) {
|
|
271
|
-
await (0, sleep_1.sleep)(
|
|
259
|
+
await (0, sleep_1.sleep)(500);
|
|
272
260
|
const newStatus = await (0, get_render_progress_1.getRenderProgress)({
|
|
273
261
|
functionName,
|
|
274
262
|
bucketName: res.bucketName,
|
|
@@ -276,25 +264,14 @@ const renderCommand = async (args, remotionRoot, logLevel) => {
|
|
|
276
264
|
region: (0, get_aws_region_1.getAwsRegion)(),
|
|
277
265
|
logLevel,
|
|
278
266
|
});
|
|
279
|
-
const newProgress = (0, progress_1.makeMultiProgressFromStatus)(newStatus);
|
|
280
267
|
progressBar.update((0, progress_1.makeProgressString)({
|
|
281
|
-
progress: newProgress,
|
|
282
|
-
steps: totalSteps,
|
|
283
|
-
retriesInfo: newStatus.retriesInfo,
|
|
284
268
|
downloadInfo: null,
|
|
285
|
-
|
|
286
|
-
timeToEncode: newStatus.timeToEncode,
|
|
287
|
-
totalFrames: getTotalFrames(newStatus),
|
|
269
|
+
overall: newStatus,
|
|
288
270
|
}), false);
|
|
289
271
|
if (newStatus.done) {
|
|
290
272
|
progressBar.update((0, progress_1.makeProgressString)({
|
|
291
|
-
progress: newProgress,
|
|
292
|
-
steps: totalSteps,
|
|
293
273
|
downloadInfo: null,
|
|
294
|
-
|
|
295
|
-
logLevel,
|
|
296
|
-
timeToEncode: newStatus.timeToEncode,
|
|
297
|
-
totalFrames: getTotalFrames(newStatus),
|
|
274
|
+
overall: newStatus,
|
|
298
275
|
}), false);
|
|
299
276
|
if (downloadName) {
|
|
300
277
|
const downloadStart = Date.now();
|
|
@@ -306,32 +283,22 @@ const renderCommand = async (args, remotionRoot, logLevel) => {
|
|
|
306
283
|
logLevel,
|
|
307
284
|
onProgress: ({ downloaded, totalSize }) => {
|
|
308
285
|
progressBar.update((0, progress_1.makeProgressString)({
|
|
309
|
-
progress: newProgress,
|
|
310
|
-
steps: totalSteps,
|
|
311
|
-
retriesInfo: newStatus.retriesInfo,
|
|
312
286
|
downloadInfo: {
|
|
313
287
|
doneIn: null,
|
|
314
288
|
downloaded,
|
|
315
289
|
totalSize,
|
|
316
290
|
},
|
|
317
|
-
|
|
318
|
-
timeToEncode: newStatus.timeToEncode,
|
|
319
|
-
totalFrames: getTotalFrames(newStatus),
|
|
291
|
+
overall: newStatus,
|
|
320
292
|
}), false);
|
|
321
293
|
},
|
|
322
294
|
});
|
|
323
295
|
progressBar.update((0, progress_1.makeProgressString)({
|
|
324
|
-
progress: newProgress,
|
|
325
|
-
steps: totalSteps,
|
|
326
|
-
retriesInfo: newStatus.retriesInfo,
|
|
327
296
|
downloadInfo: {
|
|
328
297
|
doneIn: Date.now() - downloadStart,
|
|
329
298
|
downloaded: sizeInBytes,
|
|
330
299
|
totalSize: sizeInBytes,
|
|
331
300
|
},
|
|
332
|
-
|
|
333
|
-
timeToEncode: newStatus.timeToEncode,
|
|
334
|
-
totalFrames: getTotalFrames(newStatus),
|
|
301
|
+
overall: newStatus,
|
|
335
302
|
}), false);
|
|
336
303
|
log_1.Log.info({ indent: false, logLevel });
|
|
337
304
|
log_1.Log.info({ indent: false, logLevel });
|
|
@@ -349,7 +316,7 @@ const renderCommand = async (args, remotionRoot, logLevel) => {
|
|
|
349
316
|
newStatus.timeToFinish
|
|
350
317
|
? `${(newStatus.timeToFinish / 1000).toFixed(2)}sec`
|
|
351
318
|
: null,
|
|
352
|
-
`Estimated cost
|
|
319
|
+
`Estimated cost ${newStatus.costs.displayCost}`,
|
|
353
320
|
]
|
|
354
321
|
.filter(Boolean)
|
|
355
322
|
.join(', '));
|
|
@@ -141,14 +141,14 @@ const sitesCreateSubcommand = async (args, remotionRoot, logLevel) => {
|
|
|
141
141
|
left: 'Serve URL',
|
|
142
142
|
logLevel,
|
|
143
143
|
right: serveUrl,
|
|
144
|
-
color: '
|
|
144
|
+
color: 'blueBright',
|
|
145
145
|
});
|
|
146
146
|
cli_1.CliInternals.printFact('info')({
|
|
147
147
|
indent: false,
|
|
148
148
|
left: 'Site name',
|
|
149
149
|
logLevel,
|
|
150
150
|
right: siteName,
|
|
151
|
-
color: '
|
|
151
|
+
color: 'blueBright',
|
|
152
152
|
});
|
|
153
153
|
log_1.Log.info({ indent: false, logLevel });
|
|
154
154
|
log_1.Log.info({ indent: false, logLevel }, cli_1.CliInternals.chalk.blueBright('ℹ️ Redeploy your site everytime you make changes to it. You can overwrite the existing site by running:'));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const calculateChunkTimes: ({
|
|
3
|
-
contents: _Object[];
|
|
4
|
-
renderId: string;
|
|
1
|
+
import type { ParsedTiming } from '../../shared/parse-lambda-timings-key';
|
|
2
|
+
export declare const calculateChunkTimes: ({ type, timings, }: {
|
|
5
3
|
type: 'combined-time-for-cost-calculation' | 'absolute-time';
|
|
4
|
+
timings: ParsedTiming[];
|
|
6
5
|
}) => number;
|