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

fade
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.mp4

st 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

  1. 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.mp4
  2. Fade to white

    color sets what the picture fades from and to. These fades last half a second, so the fade out starts half a second before the end, at st=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.mp4
  3. Fade 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

The options in these commands
FlagWhat it doesUsed here
fade=t=inFades the picture in; t=out fades it outFade, white
st=8.767When the fade starts, in seconds from the beginningFade
d=1How long the fade lasts, in secondsFade, audio fade out
afadeThe same for sound, from and to silenceFade, audio fade out
color=whiteThe colour to fade from and to; black is the defaultWhite
areversePlays the audio backwards; twice puts it backAudio fade out
-c:v copyKeeps the picture as it isAudio 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.

terminalTry it
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"]
  }'
faded.mp4 from the API: 1 s fades at both ends.Input: 9.767 s input

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.

Ready to build?

Ship video from your app today

Your first $0.50 is free, and one key covers every endpoint.

Moonlit lake with a lit cabin under the mountains