Repository navigation
fix(engine): ffprobe read intervals never carry an exponent - #6909
Conversation
There was a problem hiding this comment.
Approving at 3f75d0aa. I found no blockers.
-
Root cause matches.
tailStartwas interpolated raw. For a 1.000001 s duration,String(9.999999999177334e-7)gives an exponent, which ffprobe's-read_intervalsstart parser rejects. -
The fix holds.
formatFfmpegSecondsmaps values with an exponent throughtoFixed(6):- 9.99e-7 →
0.000001 - 4e-7 →
0 - a tiny negative such as -4e-7 →
0(becauseString(-0)is"0")
Values without an exponent print exactly as before. String end tokens (
+2147483647,+#1) pass through untouched, and numericstreamEndis formatted as it was before. - 9.99e-7 →
-
Coverage is complete. All four call sites that build a
-read_intervalsvalue now usereadIntervalSpec. The two remainingargs.splice/unshiftsites only forward those strings. -
Fails without the fix (checked). With
ffprobe.tsreverted to main, the named test fails withexpected '9.999999999177334e-7' to match /^\d+(\.\d+)?$/, exactly as the PR body says. It passes at this head. -
Suite.
ffprobe.test.tspassed the same way 3 runs in a row. Locally, 4 PNG cICP fixture tests fail at both main and this head, because my clone has no Git LFS fixtures. They are not related to this change.tsc --noEmiton the engine package is clean. The commit skipped local typecheck hooks, but CITypecheckis running.
Edit accuracy: accurate 271 (base branch 271), smooth 132 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
What
A render no longer fails with
ffprobe exit 1: Invalid interval start specwhen a media file's duration is a hair over one second (for example 1.000001 s).Why
The audio duration probe starts reading at
start + duration - 1. For a duration just over one second that is below 1e-6, and JavaScript prints such a number in exponent form (9.999999999177334e-7). ffprobe's-read_intervalsparser does not accept an exponent and rejects it. The video probe had the same problem and was fixed withformatFfmpegSeconds; the audio probe still interpolated the raw number.How
readIntervalSpec(start, end)inutils/ffprobe.tsbuilds every-read_intervalsvalue; it formats the start throughformatFfmpegSeconds. The four places that built the string by hand (video tail, video tail fallback, audio tail, keyframe gap) all use it.Test plan
fails without the fix: packages/engine/src/utils/ffprobe.test.ts › the audio tail probe's read interval › starts at a plain decimal when the duration is a hair over one second
expected '9.999999999177334e-7' to match /^\d+(\.\d+)?$/.ffprobe.test.ts: 125 passed, 3 runs in a row. oxlint 0 errors.Size
Under 100 lines, and it stands alone: it completes the
-read_intervalsfix already shipped for the video probe, and one test covers all four sites through their single builder.