
FFmpeg: How to Add an Intro to Multiple Videos
Updated
Learn how to automatically add an intro clip to multiple videos at once using FFmpeg.
Before getting started, make sure you have FFmpeg installed on your system, your main video files saved in MP4 format, and your intro clip named intro.mp4 inside the exact same folder.
Open your terminal or command line and navigate to the folder where your videos are located.
Method 1: Same Resolution / Frame Rate
If your intro video and target videos already share the exact same resolution and frame rate, you can merge them instantly without re-encoding. Run this command:
for f in *.mp4; do [ "$f" != "intro.mp4" ] && echo -e "file 'intro.mp4'\nfile '$f'" > list.txt && ffmpeg -y -f concat -safe 0 -i list.txt -c copy "intro_$f" && rm list.txt; done
This loops through every MP4 file in your folder, creates a temporary file list, attaches intro.mp4 to the beginning, and saves a new file with intro_ prefixed to the original name.
Method 2: Different Resolution / Frame Rate
If your intro video and main videos have different resolutions, re-encoding is necessary to prevent playback issues. You can scale both to 1920x1080 by running this command instead:
for f in *.mp4; do [ "$f" = "intro.mp4" ] && continue; ffmpeg -i intro.mp4 -i "$f" -filter_complex "[0:v]scale=1920:1080,setsar=1[v0]; [1:v]scale=1920:1080,setsar=1[v1]; [v0][0:a][v1][1:a] concat=n=2:v=1:a=1 [v][a]" -map "[v]" -map "[a]" "processed_$f"; done
Depending on how many videos you have and whether you are re-encoding, this process might take a few moments to finish processing, so let the command run until your terminal prompt returns.
Once it completes, open one of your newly generated files in a video player to confirm that the intro plays seamlessly before your main video begins.
As a quick tip: If your videos use a resolution other than 1080p, you can easily adjust the 1920:1080 numbers in the second command to match your target dimensions.
Thanks for watching :)
