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

Verified: FFmpeg 8.1 on Windows — all 7 commands in this article were executed by the verification script and passed (2026-09-06). 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
Parameter Value Description
t=in Fade in
st=0 0 s Fade start time
d=3 3 s Fade 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
Parameter Value Description
t=out Fade out
st=50 50 s Fade start time
d=10 10 s Fade 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
Curve Description
tri Linear (triangular). The default
qsin Quarter sine wave. Natural-sounding
hsin Half sine wave. Smoother S-shape
exp Exponential. Changes sharply
log Logarithmic. 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: time and size

The command that was measured:

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
Measured
Wall time 1.03 s (116.62x realtime)
Output size 353.15 MB

Rig: Core i9-14900KF (32 threads), FFmpeg 8.1 (gyan.dev), source 1920x1080 / 30 fps / 120 s / 351.4 MB (Big Buck Bunny, looped, CC BY 3.0). Run sequentially on 2026-09-05; the raw numbers are in the dataset.

Why it lands at one second

-c:v copy is doing all the work here. afade only ever touches the audio track, so the 1080p video stream is never decoded and never encoded — it is remuxed straight into the output container. The only real job in this command is rebuilding a 128 kbps AAC track.

Put next to the rest of the same run, the split is stark. Anything that re-encodes video cost seconds to minutes: 14.0 s to deinterlace, 27.97 s for a plain re-encode with no filter at all, 53.26 s for colour correction, 729.16 s to transcode to VP9. Anything that copies streams finished before you could switch windows: 0.41 s to remap streams, 0.49 s to move the moov atom, 1.03 s for this audio fade. That is two to three orders of magnitude, and it is decided by one flag.

The size behaves the same way. At 353.15 MB the output sits right alongside the 351.4 MB source, because the video stream — nearly all of the file — is carried through untouched and only the audio is rewritten. A fade that produces a file the same size as the original is working correctly, not failing.

An earlier version of this page guessed “a few to a dozen seconds” for this command. The measurement came in at 1.03 s, so that estimate was an order of magnitude too pessimistic.

If you fade the video too

Adding a video fade rules out -c:v copy, and the cost changes character entirely. The 1.03 s figure is audio-only, and a video fade was not part of this benchmark run. The numbers to budget against are the re-encoding ones from the same source and machine: 27.97 s with no filter, 53.26 s with colour correction. Treat it as a different job, not a variation on this one.

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.49 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.



Verified: FFmpeg 8.1 on Windows — all 7 commands in this article were executed by the verification script and passed (2026-09-06). Primary sources: ffmpeg.org/ffmpeg-filters.html#afade / trac.ffmpeg.org/wiki/AudioVolume