fix(distributed): apply -r <fps> to single-chunk pass-through path#1053
Merged
Conversation
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"); |
miguel-heygen
approved these changes
May 24, 2026
Collaborator
miguel-heygen
left a comment
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 fractionalr_frame_rate(e.g.359/12) while multi-chunk renders ship with exact30/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_ratesee inconsistent values depending on how a render plan happens to chunk.How
Single-chunk path now goes through the same
-r <fps>+-c copyffmpeg invocation as the concat path, ensuring uniform exactr_frame_ratemetadata.Test plan
r_frame_rate === "<fpsNum>/<fpsDen>"exact.