Skip to content

Commit e87f5bb

Browse files
committed
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.
1 parent a54953b commit e87f5bb

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

packages/engine/src/services/videoFrameExtractor.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,10 @@ describe.skipIf(!HAS_FFMPEG)("extractAllVideoFrames on a VFR source", () => {
395395
expect(result.extracted).toHaveLength(1);
396396
const frames = readdirSync(join(outputDir, "v1")).filter((f) => f.endsWith(".jpg"));
397397
// Pre-fix behavior produced ~90 frames (a 25% shortfall).
398-
expect(frames.length).toBeGreaterThanOrEqual(119);
399-
expect(frames.length).toBeLessThanOrEqual(121);
398+
// ±3 tolerance: FFmpeg's VFR→CFR normalization yields slightly different
399+
// frame counts across versions (timestamp rounding in the fps filter).
400+
expect(frames.length).toBeGreaterThanOrEqual(117);
401+
expect(frames.length).toBeLessThanOrEqual(123);
400402

401403
expect(result.phaseBreakdown).toBeDefined();
402404
expect(result.phaseBreakdown.extractMs).toBeGreaterThan(0);
@@ -656,8 +658,9 @@ describe.skipIf(!HAS_FFMPEG)("extractAllVideoFrames on a VFR source", () => {
656658
const frames = readdirSync(frameDir)
657659
.filter((f) => f.endsWith(".jpg"))
658660
.sort();
659-
expect(frames.length).toBeGreaterThanOrEqual(299);
660-
expect(frames.length).toBeLessThanOrEqual(301);
661+
// ±3 tolerance: same FFmpeg VFR→CFR rounding variance as the mid-segment test.
662+
expect(frames.length).toBeGreaterThanOrEqual(297);
663+
expect(frames.length).toBeLessThanOrEqual(303);
661664

662665
let prevHash: string | null = null;
663666
let duplicates = 0;

0 commit comments

Comments
 (0)