mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 14:50:02 +00:00
fix(engine): widen VFR test frame count tolerance for cross-platform FFmpeg
FFmpeg's VFR-to-CFR normalization produces slightly different frame counts across versions due to timestamp rounding in the fps filter. The ±1 tolerance was too tight for Linux FFmpeg builds. Widen to ±3 frames — still catches the 25% shortfall regression these tests guard against.
This commit is contained in:
@@ -395,8 +395,10 @@ describe.skipIf(!HAS_FFMPEG)("extractAllVideoFrames on a VFR source", () => {
|
|||||||
expect(result.extracted).toHaveLength(1);
|
expect(result.extracted).toHaveLength(1);
|
||||||
const frames = readdirSync(join(outputDir, "v1")).filter((f) => f.endsWith(".jpg"));
|
const frames = readdirSync(join(outputDir, "v1")).filter((f) => f.endsWith(".jpg"));
|
||||||
// Pre-fix behavior produced ~90 frames (a 25% shortfall).
|
// Pre-fix behavior produced ~90 frames (a 25% shortfall).
|
||||||
expect(frames.length).toBeGreaterThanOrEqual(119);
|
// ±3 tolerance: FFmpeg's VFR→CFR normalization yields slightly different
|
||||||
expect(frames.length).toBeLessThanOrEqual(121);
|
// frame counts across versions (timestamp rounding in the fps filter).
|
||||||
|
expect(frames.length).toBeGreaterThanOrEqual(117);
|
||||||
|
expect(frames.length).toBeLessThanOrEqual(123);
|
||||||
|
|
||||||
expect(result.phaseBreakdown).toBeDefined();
|
expect(result.phaseBreakdown).toBeDefined();
|
||||||
expect(result.phaseBreakdown.extractMs).toBeGreaterThan(0);
|
expect(result.phaseBreakdown.extractMs).toBeGreaterThan(0);
|
||||||
@@ -656,8 +658,9 @@ describe.skipIf(!HAS_FFMPEG)("extractAllVideoFrames on a VFR source", () => {
|
|||||||
const frames = readdirSync(frameDir)
|
const frames = readdirSync(frameDir)
|
||||||
.filter((f) => f.endsWith(".jpg"))
|
.filter((f) => f.endsWith(".jpg"))
|
||||||
.sort();
|
.sort();
|
||||||
expect(frames.length).toBeGreaterThanOrEqual(299);
|
// ±3 tolerance: same FFmpeg VFR→CFR rounding variance as the mid-segment test.
|
||||||
expect(frames.length).toBeLessThanOrEqual(301);
|
expect(frames.length).toBeGreaterThanOrEqual(297);
|
||||||
|
expect(frames.length).toBeLessThanOrEqual(303);
|
||||||
|
|
||||||
let prevHash: string | null = null;
|
let prevHash: string | null = null;
|
||||||
let duplicates = 0;
|
let duplicates = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user