How to Use FFmpeg afade Filter for Audio Fade In
This article provides a quick and practical guide on how to apply a
smooth audio fade-in effect to your audio tracks using the FFmpeg
command-line tool. You will learn the syntax of the afade
filter, understand its key parameters like start time and duration, and
see real-world command examples that you can copy and run
immediately.
To apply a fade-in effect to an audio file in FFmpeg, you use the
audio filter flag (-af) followed by the afade
filter configuration. The basic syntax requires you to define the
transition type, the start time, and the duration of the fade.
Here is the standard command to fade in an audio track right from the beginning:
ffmpeg -i input.mp3 -af "afade=type=in:start_time=0:duration=5" output.mp3Understanding the Parameters
type=in(ort=in): Specifies that the effect is a fade-in. (Useoutfor a fade-out).start_time=0(orss=0): The time in seconds when the fade-in effect starts. Setting this to0starts the fade immediately. You can also use timecode format like00:01:23.duration=5(ord=5): The length of the fade effect in seconds. In this example, the audio will transition from complete silence to full volume over 5 seconds.
Alternative Shorthand Syntax
FFmpeg allows you to write the same command using shorthand parameter names, which makes the command shorter and quicker to type:
ffmpeg -i input.wav -af "afade=t=in:ss=0:d=3" output.wavIn this shorthand example, the audio will fade in starting at
0 seconds for a duration of 3 seconds.
Fading in at a Specific Timestamp
If you want the audio to play silently first and then fade in later
in the track, change the start_time parameter. For example,
to start a 4-second fade-in after 10 seconds of silence:
ffmpeg -i input.mp3 -af "afade=t=in:ss=10:d=4" output.mp3Changing the Fade Curve (Optional)
By default, FFmpeg applies a linear fade. You can change the
mathematical curve of the fade-in using the curve parameter
to get different acoustic results (such as logarithmic or
exponential).
ffmpeg -i input.mp3 -af "afade=t=in:ss=0:d=5:curve=log" output.mp3Common curve options include: * tri (linear/triangular -
default) * qsin (quarter sine) * log
(logarithmic) * exp (exponential)