Commit bff2da5
committed
fix(engine): cap volume-automation keyframes so dense fades keep their audio
GSAP/JS volume automation is folded into an FFmpeg `volume` expression that
nests one `if(lt(t,...))` per keyframe. The 60 Hz timeline probe emits 100-300
keyframes for a multi-second fade, nesting the expression deep enough to
overflow FFmpeg's expression evaluator (build-dependent, ~95 levels; lower on
some Linux ffmpeg builds). When that happens filter-graph init fails, the whole
audio mix fails, and the muxer drops the audio track entirely — so a
`data-volume="0"` fade-in rendered with no audio at all (follow-up to #1066,
where #1064's own scenario regressed once the fade was dense enough).
Simplify the keyframes to a bounded piecewise-linear envelope before building
the expression: Ramer-Douglas-Peucker at ~1% tolerance, with a uniform-
downsample backstop to 32 segments. A linear fade collapses to its two
endpoints, an eased fade to a handful, and pathological audio-rate input is
capped well under the evaluator's limit. Endpoints are preserved so the
envelope still spans the clip.
Verified end-to-end: a 297-keyframe fade that previously rendered with no audio
stream now renders a full track with the correct envelope. Adds a regression
test asserting the nesting depth stays bounded for dense automation (the prior
tests mocked ffmpeg, so they could not catch the evaluator overflow).1 parent b1f9587 commit bff2da5
2 files changed
Lines changed: 139 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
111 | 166 | | |
112 | 167 | | |
113 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
33 | 106 | | |
34 | 107 | | |
35 | 108 | | |
| |||
57 | 130 | | |
58 | 131 | | |
59 | 132 | | |
60 | | - | |
61 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
62 | 140 | | |
63 | 141 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
68 | 146 | | |
69 | 147 | | |
70 | 148 | | |
| |||
0 commit comments