How to Add Fade In and Fade Out to Video with FFmpeg

Fading video in and out sounds like it should be simple. And it is, once you know the syntax. But FFmpeg's fade and afade filters have enough parameters that it's easy to get the timing wrong, forget the audio track entirely, or end up with a hard cut where you expected a smooth transition.
This guide covers video fades, audio fades, combining them, and how to run fade operations through an API without installing FFmpeg locally.
The quick version. To fade in the first second and fade out the last second of a 10-second video:
ffmpeg -i input.mp4 -vf "fade=t=in:st=0:d=1,fade=t=out:st=9:d=1" -af "afade=t=in:st=0:d=1,afade=t=out:st=9:d=1" output.mp4
Video Fade with the fade Filter
FFmpeg's fade video filter controls the visual fade. It takes three main parameters:
t- the type:inoroutst- start time in secondsd- duration of the fade in seconds
To fade in from black over the first second:
ffmpeg -i input.mp4 -vf "fade=t=in:st=0:d=1" -c:a copy output.mp4
The -c:a copy flag tells FFmpeg to copy the audio stream without re-encoding. This keeps things fast when you're only changing the video.
To fade out to black over the last second of a 10-second video:
ffmpeg -i input.mp4 -vf "fade=t=out:st=9:d=1" -c:a copy output.mp4
The st=9 value means the fade starts at the 9-second mark. Since the video is 10 seconds long and the fade lasts 1 second (d=1), the math works out: 9 + 1 = 10.
You can chain both fades in a single -vf argument by separating them with a comma:
ffmpeg -i input.mp4 -vf "fade=t=in:st=0:d=1,fade=t=out:st=9:d=1" -c:a copy output.mp4
This applies a fade-in at the start and a fade-out at the end in one pass.
Audio Fade with afade
Video fading alone leaves the audio untouched. A video that fades to black while the audio keeps playing at full volume feels jarring. The afade filter handles the audio side.
The parameters mirror the video fade filter:
ffmpeg -i input.mp4 -af "afade=t=in:st=0:d=1,afade=t=out:st=9:d=1" -c:v copy output.mp4
Here, -c:v copy copies the video stream untouched since we're only modifying audio. The afade filter uses the same t, st, and d parameters, so there's no new syntax to learn.
Combining Video and Audio Fades
Most of the time, you want both fades applied together. Use -vf for video and -af for audio in the same command:
ffmpeg -i input.mp4 \
-vf "fade=t=in:st=0:d=1,fade=t=out:st=9:d=1" \
-af "afade=t=in:st=0:d=1,afade=t=out:st=9:d=1" \
output.mp4
Note that when you're applying both video and audio filters, you can't use -c:a copy or -c:v copy because both streams need to be re-encoded. FFmpeg will use its default encoders unless you specify others explicitly.
You don't have to match the video and audio fade durations. A 0.5-second audio fade paired with a 2-second video fade is perfectly valid. Adjust each to whatever feels right for your content.
Fade to and from Black vs White
By default, FFmpeg's fade filter fades to and from black. You can change that with the color parameter.
To fade in from white:
ffmpeg -i input.mp4 -vf "fade=t=in:st=0:d=1:color=white" -c:a copy output.mp4
To fade out to white:
ffmpeg -i input.mp4 -vf "fade=t=out:st=9:d=1:color=white" -c:a copy output.mp4
The color parameter accepts named colors (black, white, red) and hex values (0xFFFFFF). Black is the standard for cinematic fades, while white fades work well for transitions in presentations, tutorials, or dreamy montage effects.
One thing to note: the color parameter only affects the video fade filter. The afade filter doesn't have a color equivalent since audio just fades to silence.
Adding Fades with the FFmpeg Micro API
If you're building a video pipeline and don't want to manage FFmpeg installations on your servers, you can run the same fade operations through the FFmpeg Micro API. Send a POST request with your fade filters in the options array:
curl -X POST https://api.ffmpeg-micro.com/v1/transcodes \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": [{"url": "https://example.com/input.mp4"}],
"outputFormat": "mp4",
"options": [
{"option": "-vf", "argument": "fade=t=in:st=0:d=1,fade=t=out:st=9:d=1"},
{"option": "-af", "argument": "afade=t=in:st=0:d=1,afade=t=out:st=9:d=1"}
]
}'
The options array maps directly to FFmpeg CLI flags. Each object takes an option (the flag) and an argument (its value). The -vf and -af options are both supported.
One limitation: the FFmpeg Micro API doesn't allow -filter_complex for security reasons. This means crossfade transitions between two separate clips aren't possible through the API. For single-input fades like the ones in this post, -vf and -af cover everything you need.
Common Pitfalls
Calculating the fade-out start time wrong. The st parameter for a fade-out should equal the total video duration minus the fade duration. If your video is 30 seconds and you want a 2-second fade-out, set st=28. If you don't know the exact duration, you can probe it first with ffprobe -v error -show_entries format=duration -of csv=p=0 input.mp4.
Forgetting the audio fade. This is the most common mistake. You add a video fade, the picture goes to black, but the audio keeps playing at full volume. Always pair -vf fade with -af afade unless you specifically want the audio to persist.
Overlapping fades on short videos. If your video is 3 seconds long and you set a 2-second fade-in and a 2-second fade-out, the fades overlap from second 1 to second 2. FFmpeg won't error out, but the overlapping region will be darker than expected. Keep your total fade duration shorter than the video length.
Using -c:a copy with -af. You can't copy the audio stream and apply an audio filter at the same time. FFmpeg will either ignore the filter or throw an error. If you're using -af, drop the -c:a copy flag. Same logic applies to -c:v copy and -vf together.
FAQ
How do I fade in video with FFmpeg?
Use the fade video filter: ffmpeg -i input.mp4 -vf "fade=t=in:st=0:d=1" -c:a copy output.mp4. This fades in from black over the first 1 second. Adjust d for a longer or shorter fade.
Can I fade audio and video at the same time in FFmpeg?
Yes. Use -vf for the video fade and -af for the audio fade in the same command: ffmpeg -i input.mp4 -vf "fade=t=in:st=0:d=1" -af "afade=t=in:st=0:d=1" output.mp4. Both filters accept the same t, st, and d parameters.
What is the difference between fade and afade in FFmpeg?
The fade filter applies to the video stream and transitions the picture to or from a solid color (black by default). The afade filter applies to the audio stream and transitions the sound to or from silence. They're independent filters that you typically use together.
How do I fade to white instead of black in FFmpeg?
Add the color=white parameter to the fade filter: ffmpeg -i input.mp4 -vf "fade=t=out:st=9:d=1:color=white" -c:a copy output.mp4. You can use any named color or hex value.
Can I create a crossfade between two videos with FFmpeg?
Crossfades between two clips require the xfade video filter and -filter_complex, which works in local FFmpeg installations. Note that -filter_complex isn't available in all hosted FFmpeg APIs, including FFmpeg Micro, due to security constraints.
Related Guides
If you're working on a broader video processing workflow, these guides cover adjacent operations:
- How to Trim and Cut Video with FFmpeg covers extracting specific segments before applying fades.
- How to Extract Audio from Video with FFmpeg is useful when you need to process audio fades separately.
- How to Concatenate and Merge Videos with FFmpeg explains joining clips, which pairs well with adding fades between them.
If you need to add fades as part of an automated pipeline and don't want to deal with FFmpeg binaries, the FFmpeg Micro API handles it with a single HTTP request.
About Javid Jamae
Founder & CEO at FFmpeg Micro
Javid is a software engineer, author, and entrepreneur with over 25 years of professional software development experience across enterprise, startup, and consulting environments. He founded FFmpeg Micro to make video processing accessible to developers through a simple, automation-first REST API.
You might also like

How to Trim Video with FFmpeg: 3 Fast Methods (No Re-encoding)
Learn how to trim and cut videos with FFmpeg using 3 proven methods. Extract specific sections, trim by timestamp or duration, and avoid quality loss. Step-by-step guide with examples.

How to Extract Audio from Video with FFmpeg (MP3, WAV, and API Guide)
Learn how to extract audio from video using FFmpeg CLI commands for MP3, WAV, and FLAC output. Plus how to extract audio via API without installing FFmpeg.

Merge Videos with FFmpeg: Concat Demuxer, Filter & Protocol
Concatenate, merge, join, and combine videos with FFmpeg via the concat demuxer, filter, and protocol. Fix codec mismatches, audio sync, and stream errors.
Ready to process videos at scale?
Start using FFmpeg Micro's simple API today. No infrastructure required.
Get Started Free