Repository navigation
fix(engine): hundreds of effects in one audio group mix in time, and a mix timeout is named - #6101
Merged
Merged
Conversation
…a mix timeout is named
somanshreddy
approved these changes
Oct 23, 2026
somanshreddy
left a comment
Contributor
There was a problem hiding this comment.
Reviewed at 9f17a3b7. No blockers.
What I checked:
- The sum is unchanged. With
normalize=0,amixis a plain sum, anddropout_transition=0means a member that ends early adds nothing either way. So padding each[aN]to the film length and trimming it there was pure cost. The new graph pads and trims the sum once, which is the sameapad,asetpts=N/SR/TB,atrim=0:Ttail the main mix already uses (audioMixer.ts:834).- A member that runs past
totalDuration(latestart, or an FX tail) used to be cut per member; it is now cut by the finalatrim. The output is the same. - The old-ffmpeg branch without
normalizestill pads per member (padMembers = !useNormalize). That is correct, because its divide-by-N compensation needs all N inputs active for the whole span.
- A member that runs past
- The default is safe for other callers.
buildTrackInputFilter's newpadToDuration = truedefault leaves every other caller unchanged. - The timeout message reaches every mixer call site.
ffmpegFailurenow usesdescribeFfmpegFailure(result, timeoutMs), and each call site passes the timeout it actually ran with: extract, silence, the main mix, the group sub-mix andmixThroughFloatSum. Thereasonclassification still readsstderras before. - The tests pin both fixes. One asserts exactly one
apad, placed after the sum. The other asserts that a deadline kill on the group sub-mix reportsffmpeg_timeoutwith "timed out after 300000 ms" and names the env var.
Non-blocking:
- The
Commentsratchet is red.audioMixer.tswent from 235/1703 to 237/1712 comment lines because the two new lines on thenormalize=0branch push its comment share up. It's not a ruleset-required check, but cutting one line (or folding it into the existing comment on theelsebranch) would turn it green. - Per the body, the 107 s that remain are mostly per-member preparation, which is one ffmpeg spawn per effect. That's fine for now. If groups of 1k+ effects become normal, batching member preparation is the next lever.
— Somu
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 190 of thoseThe gate passes. Quarantined, measured but not gated (0) |
somanshreddy
approved these changes
Oct 23, 2026
somanshreddy
left a comment
Contributor
There was a problem hiding this comment.
Re-reviewed the delta 9f17a3b7..2cc247a2: one commit, audioMixer.ts +2/-3. No blockers.
The two-line comment became the named value padUnitySumOnceToFilm. The resulting amix ... normalize=0[mixed];[mixed]apad,asetpts=N/SR/TB,atrim=0:T[out] string is byte-identical to the approved head, and the per-member branch is untouched. This also addresses my earlier Comments-ratchet nit. Everything in my review at 9f17a3b7 still holds.
— Somu
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Oct 23, 2026
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
A group (
data-audio-group) of hundreds of short effects now mixes well inside the ffmpeg deadline, and when that deadline does kill a mix the error says it timed out.Why
An export of a 10-minute film with ~680 effects in one audio group failed with
audio_processing_failed ... FFmpeg exited with code 255after about 5.5 minutes. Two defects:ffmpegProcessTimeoutwas reported as a bare exit code with the stream-mapping lines of stderr. The failure reason was alreadyffmpeg_timeout, but the detail text never said so, because the audio mixer formatted the error itself instead of usingdescribeFfmpegFailureas the other ffmpeg callers do.Related work
Follows the group sub-mix gain work that introduced
normalize=0there. No overlapping PR.How
mixGroupMembers: whenamixsupportsnormalize=0, members are no longer padded one by one; the sum is padded and trimmed once to the film length, as the main mix does. Members that end early add silence either way, so the output is the same. Old ffmpeg builds withoutnormalizekeep the per-member padding, because their input-count compensation needs it.ffmpegFailurenow builds its detail withdescribeFfmpegFailure, so a deadline kill reads "FFmpeg timed out after N ms (ffmpegProcessTimeout; ... FFMPEG_PROCESS_TIMEOUT_MS)" ahead of the stderr tail. Its callers pass the timeout they already hold.Measured end to end through
processCompositionAudioon the same machine, 680 members of 0.4 s spread over a 600 s film, one group: 482 s before, 107 s after (the deadline is 300 s by default). That time still includes preparing each member file; the group graph itself no longer scales with film length per member.Test plan
audioMixer.test.ts: the group graph has oneapad, after the sum (fails on main:adelay=...,apadon every member); a group sub-mix killed at the deadline reports "FFmpeg timed out after 300000 ms" with the env var named (fails on main: "FFmpeg exited with code 255").src/services/audioMixer*6 files, 109 tests pass, including the real-ffmpeg grouped-versus-flat level checks that guard the unity sum. Typecheck, lint and format hooks pass.Unit tests added/updated
Manual testing performed
Documentation updated (if applicable)
Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug