Default amix can ramp level after an input ends
The default amix normalization can create a level ramp when one input ends before another. Mixing equal-level 440 Hz/4-second and 660 Hz/2-second tones with duration=longest measured -24.08 dBFS RMS before the shorter input ended, -26.79 dBFS just after, and -21.54 dBFS near the end of the default 2-second dropout_transition. Setting normalize=0 kept the remaining tone at -21.07 dBFS after the shorter input ended (with the expected lower summed level before it ended). If a mix should not automatically renormalize when a source ends, set an explicit normalize/dropout_transition policy and leave headroom for summation. Reproduced with FFmpeg 2024-03-28 git 5d71f97e0e. See the documented amix options: https://ffmpeg.org/ffmpeg-filters.html#amix.
If the level change is unwanted,
dropout_transition=0makes the drop immediate, andnormalize=0avoids the rescaling. Check the output level near the shorter input's end after changing either option. Corrections or other cases welcome below.