How to Create a Lead-Out in FFmpeg
While FFmpeg does not have a standalone filter explicitly named
leadout, creating a lead-out—whether as a gradual fade to
black, an audio fade to silence, or trailing padding at the end of a
stream—is directly achieved using the fade,
afade, tpad, and apad filters.
This guide covers how to implement these filters to construct seamless
lead-outs for both video and audio files.
Video Fade-Out Using
fade
To create a visual lead-out that fades a video to black, use the
fade video filter with the type=out parameter.
You must specify the starting point and the duration of the fade.
ffmpeg -i input.mp4 -vf "fade=type=out:start_time=55:duration=5" -c:a copy output.mp4type=out: Designates the filter as a fade-out (lead-out).start_time=55: The timestamp in seconds where the fade begins.duration=5: The length of the fade in seconds.-c:a copy: Copies the audio stream without re-encoding.
Alternatively, you can define the lead-out by frame count using
start_frame and nb_frames:
ffmpeg -i input.mp4 -vf "fade=t=out:s=1650:n=150" -c:a copy output.mp4Audio Fade-Out Using
afade
To fade audio to silence at the end of a track or video, use the
afade filter.
ffmpeg -i input.mp3 -af "afade=type=out:start_time=55:duration=5" output.mp3type=out: Applies an audio fade-out.start_time=55: The timestamp in seconds when the audio volume begins to drop.duration=5: The duration in seconds over which the audio reaches total silence.
Adding Black Screen
Padding Using tpad
If you need a lead-out that extends the end of a video with extra
black frames or holds the last frame, use the tpad (time
pad) filter.
To append 3 seconds of black frames:
ffmpeg -i input.mp4 -vf "tpad=stop_mode=add:stop_duration=3:color=black" -c:a copy output.mp4To hold the final frame for 3 seconds as a lead-out:
ffmpeg -i input.mp4 -vf "tpad=stop_mode=clone:stop_duration=3" -c:a copy output.mp4stop_mode=add: Adds solid color frames to the end.stop_mode=clone: Freezes and repeats the last video frame.stop_duration=3: The length of the lead-out in seconds.
Adding Trailing Silence
Using apad
To extend an audio stream with silent lead-out time, use the
apad filter combined with -t to define the
total duration:
ffmpeg -i input.wav -af "apad=pad_dur=4" output.wavpad_dur=4: Appends 4 seconds of silence to the end of the audio track.
Complete Combined Lead-Out Example
To apply both a video fade to black and an audio fade to silence simultaneously, combine the filters:
ffmpeg -i input.mp4 -vf "fade=type=out:start_time=55:duration=5" -af "afade=type=out:start_time=55:duration=5" -c:v libx264 -c:a aac output.mp4This ensures both the picture and sound smoothly conclude over the final 5 seconds of a 60-second clip.