Skip to content

fix(distributed): apply -r <fps> to single-chunk pass-through path#1053

Merged
jrusso1020 merged 1 commit into
mainfrom
fix/distributed-single-chunk-fps-flag
May 24, 2026
Merged

fix(distributed): apply -r <fps> to single-chunk pass-through path#1053
jrusso1020 merged 1 commit into
mainfrom
fix/distributed-single-chunk-fps-flag

Conversation

@jrusso1020
Copy link
Copy Markdown
Collaborator

What

The v0.6.39 fix (#1040) added -r <fps> to the multi-chunk concat ffmpeg invocation but didn't reach the single-chunk pass-through path. Result: 1-chunk renders ship with fractional r_frame_rate (e.g. 359/12) while multi-chunk renders ship with exact 30/1.

Why

Without this fix, the metadata-exactness guarantee from #1040 doesn't apply uniformly across chunk-count configurations. Downstream pipelines that consume r_frame_rate see inconsistent values depending on how a render plan happens to chunk.

How

Single-chunk path now goes through the same -r <fps> + -c copy ffmpeg invocation as the concat path, ensuring uniform exact r_frame_rate metadata.

Test plan

  • Added regression test exercising the 1-chunk path; asserts r_frame_rate === "<fpsNum>/<fpsDen>" exact.
  • Existing multi-chunk concat tests still pass.
  • Lint + typecheck + format clean.

The v0.6.39 fix added -r <fps> to the multi-chunk concat ffmpeg
invocation but didn't reach the single-chunk pass-through path,
which is taken when totalFrames * fpsDen / fpsNum fits in one
chunk. Result: 1-chunk renders shipped with fractional
r_frame_rate (e.g. 359/12) while multi-chunk renders shipped
with exact 30/1.

Single-chunk path now goes through the same -r <fps> + -c copy
ffmpeg invocation as the concat path, ensuring uniform exact
r_frame_rate metadata across all chunk-count configurations.

Adds a regression test exercising the 1-chunk path and asserting
r_frame_rate === "<fpsNum>/<fpsDen>" exact.
const concatBody = chunkPaths
.map((path) => `file '${path.replace(/'/g, "'\\''")}'`)
.join("\n");
writeFileSync(concatListPath, `${concatBody}\n`, "utf-8");
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen left a comment

Choose a reason for hiding this comment

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

Review: Magi

Clean fix. The single-chunk branch is the correct approach — using -r as an output flag on a direct remux rather than trying to make the concat demuxer honor it for a one-entry list.

Verified:

  • -r <fps> is correctly placed as an output-side flag (after -i) with -c copy — no re-encode
  • Test pins r_frame_rate === "30/1" + 1ms duration tolerance on the 1-chunk path
  • Downstream audio pad/trim, mux, and faststart pipeline is unchanged and shared between both branches
  • Multi-chunk path is byte-identical to the original PR #1040 code, just moved inside else
  • 0-chunk edge case is pre-existing (invalid upstream state), no regression

No issues found. Ship it.

Magi

@jrusso1020 jrusso1020 merged commit 4729254 into main May 24, 2026
41 of 42 checks passed
@jrusso1020 jrusso1020 deleted the fix/distributed-single-chunk-fps-flag branch May 24, 2026 03:50
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.

3 participants