Configure FFmpeg amix Dropout Transition Time
This article explains how to configure the
dropout_transition parameter within the FFmpeg
amix audio filter. You will learn how this setting controls
the volume adjustment period when an input stream ends during a mix,
along with practical command-line examples to customize this transition
duration to suit your audio processing needs.
Understanding the dropout_transition Parameter
When using the FFmpeg amix filter to merge multiple
audio streams, you may encounter situations where one audio input is
shorter than the others. When this shorter stream ends, FFmpeg
automatically renormalizes the volume of the remaining active streams so
that the output volume remains consistent.
The dropout_transition parameter specifies the time, in
seconds, over which this volume renormalization occurs.
- Default Value: 2 seconds.
- Function: It prevents abrupt, jarring volume jumps by gradually fading the remaining audio up to its new volume level.
How to Set the Dropout Transition Time
To configure this setting, append the dropout_transition
option to your amix filter chain, followed by the desired
duration in seconds.
Basic Syntax
amix=inputs=X:dropout_transition=Y- X: The number of input streams.
- Y: The transition duration in seconds (can be an integer or a decimal).
Command Example
In the following example, two audio files are mixed together. If one file ends early, the remaining audio will transition to its new volume level over a period of 5 seconds instead of the default 2 seconds:
ffmpeg -i input1.mp3 -i input2.mp3 -filter_complex "amix=inputs=2:dropout_transition=5" output.mp3Disabling the Transition Time
If you want the volume to adjust instantly the moment an audio stream
dropouts, set the dropout_transition value to
0:
ffmpeg -i input1.mp3 -i input2.mp3 -filter_complex "amix=inputs=2:dropout_transition=0" output.mp3