fade=t=in:st=0:d=1 fades the picture in and afade does the sound; for the fade out, subtract the fade length from the duration ffprobe reports. The same command on ReelSDK cost a fraction of a cent for a 10-second clip, at $0.02 per compute minute.
Fade in and fade out with ffmpeg
Both filters count from the start, so a 1-second fade out on a 10-second clip starts about 9 seconds in. On ReelSDK both fades, picture and sound, finished in about 14 seconds. No length to go on? Reverse the audio, fade it in, and reverse it back.
GuidesUpdated
ffmpeg -i in.mp4 -vf fade=t=in:st=0:d=1,fade=t=out:st=8.767:d=1 \
-af afade=t=in:st=0:d=1,afade=t=out:st=8.767:d=1 \
-c:v libx264 -crf 20 -preset veryfast -c:a aac -movflags +faststart faded.mp4st is when the fade starts, in seconds from the beginning, and d how long it lasts. Video fades to black by default; afade fades to silence.
Variations
The other commands you will need
Find the fade-out start
ffprobe prints the length in seconds. Subtract the fade length and use what is left as the start; for a 1-second fade on our clip that is
st=8.767.length ffprobe -v error -show_entries format=duration -of csv=p=0 in.mp4Fade to white
colorsets what the picture fades from and to. These fades last half a second, so the fade out starts half a second before the end, atst=9.267.white ffmpeg -i in.mp4 -vf fade=t=in:st=0:d=0.5:color=white,fade=t=out:st=9.267:d=0.5:color=white \ -c:v libx264 -crf 20 -preset veryfast -c:a copy -movflags +faststart white.mp4Fade out the sound without the length
Reverse the audio, fade in its start (the real end), reverse it back. Sound is small, so buffering it is cheap, and the video is copied as it is.
audio fade out ffmpeg -i in.mp4 -af areverse,afade=t=in:d=1,areverse -c:v copy -c:a aac -movflags +faststart audio-out.mp4
The flags
The options in these commands
| Flag | What it does | Used here |
|---|---|---|
fade=t=in | Fades the picture in; t=out fades it out | Fade, white |
st=8.767 | When the fade starts, in seconds from the beginning | Fade |
d=1 | How long the fade lasts, in seconds | Fade, audio fade out |
afade | The same for sound, from and to silence | Fade, audio fade out |
color=white | The colour to fade from and to; black is the default | White |
areverse | Plays the audio backwards; twice puts it back | Audio fade out |
-c:v copy | Keeps the picture as it is | Audio fade out |
Sources: ffmpeg filters: fade, ffmpeg filters: afade, checked November 2026.
Why the fade out needs the length
fade and afade take a start time and a duration, both counted from the beginning of the stream. Neither has an option that counts from the end, so a fade out over the last second has to start 1 second before the length that ffprobe reports.
Get the length with ffprobe first, and in a script compute the start from it. Use the same start for the picture and the sound, or one fades before the other.
The blind fade out
When you can't run ffprobe first, the areverse trick fades the sound without knowing its length: reverse it, fade in what is now the start, reverse it again. It ran in well under a second and used little memory, because only the audio is touched and the video is copied.
The same trick on the picture would mean reverse, which holds every decoded frame in memory. For video, work out the start instead.
On the API
fade, afade and areverse are all allowed on POST /v1/ffmpeg, and the job above finished in about 14 seconds. Billing is per compute second; see pricing.
Without installing ffmpeg
The same command as one API call
Send the first command's args to POST /v1/ffmpeg. Each job runs ffmpeg 8.1 on a fresh machine at $0.02 per compute minute, billed per second; this one finished in about 14 seconds and cost a fraction of a cent.
curl "https://api.reelsdk.com/v1/ffmpeg?wait=60" \
-H "Authorization: Bearer $REELSDK_KEY" \
--json '{
"inputs": {
"in.mp4": "https://api.reelsdk.com/f/lib/demo/landscape.mp4"
},
"args": [
"-i", "in.mp4", "-vf", "fade=t=in:st=0:d=1,fade=t=out:st=8.767:d=1",
"-af", "afade=t=in:st=0:d=1,afade=t=out:st=8.767:d=1", "-c:v",
"libx264", "-crf", "20", "-preset", "veryfast", "-c:a", "aac",
"-movflags", "+faststart", "faded.mp4"
],
"outputs": ["faded.mp4"]
}'FAQ
Questions, answered
How do I fade in and fade out a video with ffmpeg?
Use -vf fade=t=in:st=0:d=1,fade=t=out:st=8.767:d=1 with the start of the fade out 1 s before the end, and the same afade pair for the audio.
How do I find where the fade out should start?
Run ffprobe -v error -show_entries format=duration -of csv=p=0 in.mp4 and subtract the fade length from it. What is left is the st of the fade out, for both fade and afade.
Can I fade out audio without knowing the video length?
Yes: -af areverse,afade=t=in:d=1,areverse. It fades the last second and copies the video as it is.
How do I fade to white instead of black?
Add color=white to both fade filters, for example fade=t=in:st=0:d=0.5:color=white.
- ffmpeg xfade transitions, all 59 renderedEvery xfade transition in ffmpeg 8.1 as a clip you can play, with the offset math and the fix for the do-not-match error.
- Trim a video with ffmpegCut a clip with -ss and -to: frame-exact with a re-encode, fast with -c copy, and why the copy starts before your time.
- Concatenate videos with ffmpegJoin clips with the concat demuxer and -c copy when they match, or with the concat filter when their size, frame rate or codec differ.
- Reverse a video with ffmpegPlay a clip backwards with reverse and areverse, keep memory down on long clips, and make a boomerang loop.
- Mix two audio tracks with ffmpegLay music under a voice or combine any two tracks with amix, set their levels with weights, and avoid the three defaults that bite.
- Images to video with ffmpegTurn photos into an MP4 slideshow with music: frame rate per photo, a concat list for custom durations, and one still with audio.
- FFmpeg onlineRun your own ffmpeg command on your files in the browser, free and without installing or uploading anything.
- ffmpeg exited with code 1: Conversion failed!fluent-ffmpeg reports only ffmpeg's exit code and last line. The real cause is in stderr: print it, or use -v error to see it alone.
- ReelSDK vs self-hosted FFmpegTranscoding a minute of 1080p to 720p takes about 24 seconds of compute: about 0.8 cents on ReelSDK, about a tenth of a cent on a busy 4 vCPU box. Below about 11,000 minutes a month, the API costs less than an always-on box.
Sources, checked November 2026
Ready to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
