A fade is just an opacity (or volume) ramp over a time window. FFmpeg gives you fade for picture and afade for sound. Each takes a type (in or out), a start time, and a duration.
Key takeaways
fade=t=in:st=0:d=2fades the video up from black over 2 seconds.fade=t=outneeds a start time near the end of the clip.afademirrors the same syntax for audio.- Combine video and audio fades in one
filter_complex.
Fade the video in from black
ffmpeg -i in.mp4 -vf "fade=t=in:st=0:d=2" -c:a copy out.mp4
st is the start time and d the duration, both in seconds.
Fade the video out to black
A fade-out starts late, so you need the clip length. If the video is 30s and you want a 3s fade, start at 27:
ffmpeg -i in.mp4 -vf "fade=t=out:st=27:d=3" -c:a copy out.mp4
Fade in and out together
Chain two fade filters with a comma — one in at the head, one out at the tail:
ffmpeg -i in.mp4 -vf \ "fade=t=in:st=0:d=2,fade=t=out:st=27:d=3" \ -c:a copy out.mp4
Fade the audio with afade
ffmpeg -i in.mp4 -af \ "afade=t=in:st=0:d=2,afade=t=out:st=27:d=3" \ -c:v copy out.mp4
Fade picture and sound in one command
Use filter_complex to ramp both streams and map them to the output:
ffmpeg -i in.mp4 -filter_complex " [0:v]fade=t=in:st=0:d=2,fade=t=out:st=27:d=3[v]; [0:a]afade=t=in:st=0:d=2,afade=t=out:st=27:d=3[a] " -map "[v]" -map "[a]" out.mp4
Fade to a color other than black
Add color=white (or any color) to fade to white instead:
ffmpeg -i in.mp4 -vf "fade=t=out:st=27:d=3:color=white" out.mp4
Or fade on a timeline
FFmpegLab adds fades with handles on the clip and writes the matching fade/afade command for you. For blends between two clips rather than to black, use an xfade transition; to balance the fading soundtrack against other tracks, see audio mixing with amix. Everything runs offline in the browser.