mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-07 01:56:04 +00:00
The render-complete summary printed `<fileSize> · <time> · completed` where `<time>` was the wall-clock render duration. Presented as a bare middle value, users read it as the video length and compared it to ffprobe, repeatedly reporting a "wrong duration". Show the actual output video length (from the perf summary's compositionDurationSeconds, which equals the rendered frame span) as the primary figure and label the render time explicitly: `<fileSize> · <videoLength> video · rendered in <renderTime>`. png-sequence (directory) output has no single muxed video, so it shows a frame count instead; when neither is known the summary falls back to render time only. Docker renders run the producer in a child process with no perf summary threaded back, so they show render time only rather than a misleading number.
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { formatRenderSummaryDetail } from "./format.js";
|
|
|
|
describe("formatRenderSummaryDetail", () => {
|
|
it("shows the output video length as the primary figure and labels render time", () => {
|
|
// Output is 71.7s of video but only took 34.2s of wall-clock to render:
|
|
// the two must be distinguishable so users stop comparing render time to ffprobe.
|
|
const detail = formatRenderSummaryDetail({
|
|
elapsedMs: 34_200,
|
|
outputDurationSeconds: 71.7,
|
|
isDirectory: false,
|
|
});
|
|
expect(detail).toBe("1m 11.7s video · rendered in 34.2s");
|
|
expect(detail).toContain("video");
|
|
expect(detail).toContain("rendered in");
|
|
});
|
|
|
|
it("omits the video figure gracefully when the duration is unknown", () => {
|
|
expect(formatRenderSummaryDetail({ elapsedMs: 5_000, isDirectory: false })).toBe(
|
|
"rendered in 5.0s",
|
|
);
|
|
});
|
|
|
|
it("shows a frame count for png-sequence directory output instead of a video length", () => {
|
|
const detail = formatRenderSummaryDetail({
|
|
elapsedMs: 12_000,
|
|
isDirectory: true,
|
|
frameCount: 120,
|
|
// a stray duration must not leak into directory output
|
|
outputDurationSeconds: 4,
|
|
});
|
|
expect(detail).toBe("120 frames · rendered in 12.0s");
|
|
expect(detail).not.toContain("video");
|
|
});
|
|
|
|
it("does not crash and shows only render time for a directory with no frame count", () => {
|
|
expect(formatRenderSummaryDetail({ elapsedMs: 1_000, isDirectory: true })).toBe(
|
|
"rendered in 1.0s",
|
|
);
|
|
});
|
|
});
|