What You’ll Learn

  • How to apply fade-in and fade-out with the afade filter
  • The meaning of t (type), st (start time), and d (duration)
  • Differences between curve types (tri, sin, exp, etc.)
  • How to apply fades to the audio track of a video file
  • How to combine fade-in and fade-out in a single command

Tested with: FFmpeg 6.1 (verified against real FFmpeg) Platform: Windows / macOS / Linux


Basic Commands

Fade-in (gradually ramp up at the start)

ffmpeg -i input.mp3 -af "afade=t=in:st=0:d=3" output.mp3
ParameterValueDescription
t=inFade in
st=00 sFade start time
d=33 sFade duration

Fade-out (gradually ramp down at the end)

First check the length of the audio:

ffmpeg -i input.mp3 -f null /dev/null 2>&1 | grep Duration

Fade out over the last 10 seconds of a 60-second file:

ffmpeg -i input.mp3 -af "afade=t=out:st=50:d=10" output.mp3
ParameterValueDescription
t=outFade out
st=5050 sFade start time
d=1010 sFade duration

Applying Fade-In and Fade-Out Together

Chain multiple filters with a comma inside -af:

ffmpeg -i input.mp3 -af "afade=t=in:st=0:d=3,afade=t=out:st=50:d=10" output.mp3

Curve Types

Use the curve option to change the shape of the fade:

ffmpeg -i input.mp3 -af "afade=t=in:st=0:d=3:curve=qsin" output.mp3
CurveDescription
triLinear (triangular). The default
qsinQuarter sine wave. Natural-sounding
hsinHalf sine wave. Smoother S-shape
expExponential. Changes sharply
logLogarithmic. Starts sharply, ends gently

Apply Fades to the Audio Track of a Video File

ffmpeg -i input.mp4 -af "afade=t=in:st=0:d=2" -c:v copy output.mp4

-c:v copy keeps the video untouched and only re-encodes the audio.


Combine with Video Fades

Apply a matching video fade (fade) alongside the audio fade (afade):

ffmpeg -i input.mp4 -vf "fade=t=in:st=0:d=2" -af "afade=t=in:st=0:d=2" -c:a aac output.mp4

Common Pitfalls

Match st to the actual audio length for fade-out

If st + d goes past the end of the track FFmpeg will not error out, but the fade will be truncated. Check the duration first if the fade sounds cut short.

Combine with -c:v copy to re-encode only the audio

When the video doesn’t need any changes, -c:v copy preserves its quality and only the audio is re-encoded.


Measured Example

For a 1080p/30fps, 2-minute MP4 with H.264 video and AAC audio, this command adds a 2-second fade-in and a 5-second fade-out to the audio only:

ffmpeg -i input.mp4 \
  -af "afade=t=in:st=0:d=2,afade=t=out:st=115:d=5" \
  -c:v copy -c:a aac -b:a 128k \
  output.mp4

On a typical 8-core desktop, this often finishes in a few to a dozen seconds because the video stream is copied. The output size stays very close to the input; only the re-encoded audio track changes. If the original audio bitrate is similar, the size difference is often around 1–3%.

If you also apply a video fade, -c:v copy is no longer possible and the video must be re-encoded. For a 2-minute 1080p source, that can take several minutes depending on the preset and CPU. Results vary by environment.

Use the audio stream duration, not just the container duration, when calculating fade-out start times. After trimming or working with variable-frame-rate sources, audio and video duration can differ by a few hundred milliseconds. Checking the audio duration with ffprobe -show_streams helps avoid a fade that starts too late or leaves a hard cut at the end.


Frequently Asked Questions

What is the difference between afade and acrossfade?

afade fades a single track in or out, while acrossfade blends two tracks over a transition window. For BGM swaps, use acrossfade; for opener/closer fades, use afade.

How long should the fade be?

Speech: 0.3–0.5 s in, 1–2 s out. Music: 1–2 s in, 2–4 s out. Anything shorter than 100 ms can pop on cheaper speakers.

Can I fade only specific frequencies?

afade affects the whole signal. For frequency-selective fading you would chain a band filter (e.g. lowpass) before the fade.

Why does my fade start too early?

Check the st= (start time) parameter — fades default to 0. To fade out at the end of the file, compute start = duration − fade_length and pass it explicitly.

Does afade re-encode the file?

Yes — any audio filter forces re-encoding of the audio track. Video can stay copy-only by using -c:v copy alongside.



Tested with ffmpeg 6.1 / Ubuntu 24.04 (検証スクリプトで実行確認) Primary sources: ffmpeg.org/ffmpeg-filters.html#afade / trac.ffmpeg.org/wiki/AudioVolume