Repository navigation
fix(media-execution): preserve AAC tail for non-integer frame rates - #317
Conversation
259fcbb to
3a17155
Compare
|
Thanks for picking this up — and for the Windows / 9.0.1 number, which matches what I measured on macOS exactly (1,461,248 presented samples, −1013). I checked the branch on ffmpeg 6.1.6, 7.1.5 and 9.0.1 (macOS arm64):
So the regression test is red without the fix on the ffmpeg generations CI installs, which was the objection to the test offered in #283. The one failure on 7.1.5 is the StillVideo test, unrelated to this change (#316). Two things worth knowing before merging, both written up in #315: the media-pipeline mux producer currently refuses these lengths one step earlier (exact-equality check), so this path is only reachable when the capability is called directly; and |
Closes #315
What this fixes
executeMuxProgramMediapassed-frames:v <frameCount>while stream-copying the already-validatedvisual and encoding the TimelineAudio to AAC. FFmpeg treats that frame limit as a mux sync limit,
so non-integer frame rates such as
30000/1001can drop the final AAC packet even though the audioand visual inputs are valid.
On Windows with FFmpeg 9.0.1, a 913-frame
30000/1001visual and its exact 1,462,261-sampleTimelineAudio produced only 1,461,248 presented samples (missing 1,013 samples). FFmpeg 6.x/7.x
can exceed the assertion tolerance and fail the final Build instead.
The visual frame count is already asserted before muxing. Removing the redundant mux frame limit
lets the AAC stream preserve the complete TimelineAudio while retaining the existing video-domain
validation and AAC-delay tolerance.
Test evidence
node --import tsx --test packages/provider-media-local/test/provider.test.ts # tests 15, pass 15, fail 0The regression test uses a real FFmpeg-generated 913-frame
30000/1001visual, an exact 48 kHzTimelineAudio artifact, and the local Provider's actual
mux-program-mediahandler. It assertsthat AAC coding frames cover all 1,462,261 samples and that the presentation span remains within
64 samples of the authoritative TimelineAudio, allowing the normal cross-version AAC edit-list
rounding while catching the 1,013-sample truncation.
Verification
pnpm check— passnode --import tsx --test packages/provider-media-local/test/provider.test.ts— 15 pass, 0 failgit diff --check— passpnpm testwas attempted after a frozen offline install; the suite reached unrelatedlong-running HyperFrames process/capture tests on this Windows host and was interrupted, so no
full-suite pass claim is made here.