Skip to content

fix(engine): ffprobe read intervals never carry an exponent - #6909

Merged
miguel-heygen merged 1 commit into
mainfrom
fix/ffprobe-interval-spec
Nov 1, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
fix/ffprobe-interval-spec

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What

A render no longer fails with ffprobe exit 1: Invalid interval start spec when 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_intervals parser does not accept an exponent and rejects it. The video probe had the same problem and was fixed with formatFfmpegSeconds; the audio probe still interpolated the raw number.

How

  • One readIntervalSpec(start, end) in utils/ffprobe.ts builds every -read_intervals value; it formats the start through formatFfmpegSeconds. The four places that built the string by hand (video tail, video tail fallback, audio tail, keyframe gap) all use it.
  • Ordinary values print exactly as before.

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

  • On main's code that test fails with expected '9.999999999177334e-7' to match /^\d+(\.\d+)?$/.
  • ffprobe.test.ts: 125 passed, 3 runs in a row. oxlint 0 errors.
  • Committed with lint/format/typecheck hooks skipped locally (no node_modules on the Mac); oxlint and the tests were run on a remote box.

Size

Under 100 lines, and it stands alone: it completes the -read_intervals fix already shipped for the video probe, and one test covers all four sites through their single builder.

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 3f75d0aa. I found no blockers.

  • Root cause matches. tailStart was interpolated raw. For a 1.000001 s duration, String(9.999999999177334e-7) gives an exponent, which ffprobe's -read_intervals start parser rejects.

  • The fix holds. formatFfmpegSeconds maps values with an exponent through toFixed(6):

    • 9.99e-7 → 0.000001
    • 4e-7 → 0
    • a tiny negative such as -4e-7 → 0 (because String(-0) is "0")

    Values without an exponent print exactly as before. String end tokens (+2147483647, +#1) pass through untouched, and numeric streamEnd is formatted as it was before.

  • Coverage is complete. All four call sites that build a -read_intervals value now use readIntervalSpec. The two remaining args.splice/unshift sites only forward those strings.

  • Fails without the fix (checked). With ffprobe.ts reverted to main, the named test fails with expected '9.999999999177334e-7' to match /^\d+(\.\d+)?$/, exactly as the PR body says. It passes at this head.

  • Suite. ffprobe.test.ts passed 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 --noEmit on the engine package is clean. The commit skipped local typecheck hooks, but CI Typecheck is running.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 132 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

Unstable (1)

  • seqplainkeys-none-center-r0-root-z100: tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true / tracking 0.06, pressJump 0, drop 0, reload 0, render 0.03, renderKey -, undo true, teleport true

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit f486ad6 Nov 1, 2026
90 checks passed
@miguel-heygen
miguel-heygen deleted the fix/ffprobe-interval-spec branch November 1, 2026 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant