Skip to content

🎥 Make videos programmatically with React

better progress reporting

Jonny Burger9980baae5b69
diff --git a/packages/lambda/src/cli/commands/render/progress.ts b/packages/lambda/src/cli/commands/render/progress.ts
index 6de035a1e8..a4f4087108 100644
--- a/packages/lambda/src/cli/commands/render/progress.ts
+++ b/packages/lambda/src/cli/commands/render/progress.ts
@@ -179,10 +179,6 @@ const makeTopRow = (overall: RenderProgress) => {
(overall.timeoutTimestamp - Date.now()) / 1000,
);
- if (!overall.renderMetadata) {
- return null;
- }
-
if (overall.done) {
return null;
}
diff --git a/packages/lambda/src/functions/helpers/get-overall-progress.ts b/packages/lambda/src/functions/helpers/get-overall-progress.ts
index 0c1ca15304..90a41cddb9 100644
--- a/packages/lambda/src/functions/helpers/get-overall-progress.ts
+++ b/packages/lambda/src/functions/helpers/get-overall-progress.ts
@@ -1,10 +1,18 @@
-type Factors = 'invoking' | 'rendering' | 'frames' | 'encoding';
+type Factors =
+ | 'invoking'
+ | 'rendering'
+ | 'frames'
+ | 'encoding'
+ | 'evaluating'
+ | 'combining';
const weights: {[key in Factors]: number} = {
- encoding: 0.225,
- rendering: 0.225,
- frames: 0.225,
- invoking: 0.225,
+ evaluating: 0.1,
+ encoding: 0.1,
+ rendering: 0.4,
+ frames: 0.2,
+ invoking: 0.1,
+ combining: 0.1,
};
export const getOverallProgress = ({
@@ -12,16 +20,33 @@ export const getOverallProgress = ({
rendering,
invoking,
frames,
+ invokedLambda,
+ visitedServeUrl,
+ gotComposition,
+ combining,
}: {
+ invokedLambda: number;
+ visitedServeUrl: number | null;
+ gotComposition: number | null;
encoding: number;
rendering: number;
invoking: number;
frames: number;
+ combining: number;
}) => {
+ const evaluationProgress =
+ [
+ Boolean(invokedLambda),
+ Boolean(visitedServeUrl),
+ Boolean(gotComposition),
+ ].reduce((a, b) => Number(a) + Number(b), 0) / 3;
+
return (
+ evaluationProgress * weights.evaluating +
encoding * weights.encoding +
rendering * weights.rendering +
invoking * weights.invoking +
- frames * weights.frames
+ frames * weights.frames +
+ combining * weights.combining
);
};
diff --git a/packages/lambda/src/functions/helpers/get-progress.ts b/packages/lambda/src/functions/helpers/get-progress.ts
index b466e4af6f..8b31ec82a1 100644
--- a/packages/lambda/src/functions/helpers/get-progress.ts
+++ b/packages/lambda/src/functions/helpers/get-progress.ts
@@ -237,6 +237,10 @@ export const getProgress = async ({
: 0,
rendering: renderMetadata ? chunkCount / renderMetadata.totalChunks : 0,
frames: (overallProgress.framesRendered ?? 0) / (frameCount ?? 1),
+ gotComposition: overallProgress.compositionValidated,
+ visitedServeUrl: overallProgress.serveUrlOpened,
+ invokedLambda: overallProgress.lambdasInvoked,
+ combining: overallProgress.combinedFrames / (frameCount ?? 1),
}),
retriesInfo: overallProgress.retries ?? [],
outKey: null,