In this comprehensive tutorial, you'll learn how to master FFmpeg to create a professional video from scratch, combining multiple media: two still images (for introduction and ending), a main video, and a soundtrack with an elegant fade-out effect at the end.
We use FFmpeg's powerful concatenation function to join the three video parts and the fade filter for the audio, all in a single command line.
Full Command Used in the Video:
ffmpeg -i Video.mp4 -loop 1 -t 3 -i Intro.png -loop 1 -t 2 -i Fim.png -i Musica.mp3 -filter_complex "[0:v]setsar=1[video];[1:v]setsar=1[intro];[2:v]setsar=1[fim];[intro][video][fim]concat=n=3:v=1:a=0 [v];[3:a]afade=t=out:st=13:d=1[a]" -map "[v]" -map "[a]" -shortest final.mkv -y && ffplay final.mkv
🛠 What the command does:
Inputs: Sets the main video (Video.mp4), the intro image (Intro.png for 3s), the final image (End.png for 2s) and background audio (Music.mp3).
Video: The filter concat=n=3:v=1:a=0 joins the 3 visual parts (Intro, Video.mp4 and End) into a single video stream [v].
Audio: The filter afade=t=out:st=13:d=1 applies a 1-second fade-out (d=1) starting at second 13 (st=13) to the audio stream [a].
Output: Creates the final file (final.mkv) with the concatenated video and the faded audio.