A Python script that automatically adds a static intro image to all videos in a folder using moviepy.
- 🎬 Process multiple videos in batch
- 🖼️ Add custom intro image to each video
- 📁 Supports multiple video formats (MKV, MP4, AVI, MOV, WMV, FLV, WebM)
- ⚙️ Preserves original video format and quality
- ⏱️ Configurable intro duration
- 🔄 Automatically resizes intro to match video dimensions
- Python 3.x
- FFmpeg:
moviepydepends on FFmpeg to read and write videos. It must be installed on your system and accessible from PATH.- Download: https://ffmpeg.org/download.html
- Python libraries (see
requirements.txt)
-
Clone or download this project:
git clone https://github.com/yourusername/batch-video-intro-adder.git cd batch-video-intro-adder -
Install Python dependencies:
pip install -r requirements.txt
The script runs from the command line. You must provide three required arguments and one optional.
Syntax:
python main.py <VIDEO_FOLDER> <IMAGE_PATH> <OUTPUT_FOLDER> [-d DURATION]Arguments:
VIDEO_FOLDER: Path to the folder containing the videos to processIMAGE_PATH: Path to the intro image (.jpg or .png)OUTPUT_FOLDER: Path to the folder where processed videos will be saved-d,--duration: (Optional) Duration of the intro in seconds. Default: 5.0
Example:
python main.py input_videos intro.jpg output_videosWith custom duration (3 seconds):
python main.py input_videos intro.jpg output_videos -d 3- The script scans the specified folder for video files
- For each video:
- Loads the video
- Creates an intro clip from the image with the specified duration
- Resizes the intro to match the video dimensions
- Sets the intro FPS to match the video
- Concatenates intro + video
- Saves the result with the same format as the original
- Skips videos that already exist in the output folder
.mkv- Matroska.mp4- MPEG-4.avi- Audio Video Interleave.mov- QuickTime.wmv- Windows Media Video.flv- Flash Video.webm- WebM
Process started. Found 4 videos.
------------------------------
Processing: video1.mkv...
Saving to: output_videos/video1.mkv
Completed: video1.mkv
Processing: video2.mp4...
Saving to: output_videos/video2.mp4
Completed: video2.mp4
------------------------------
Process finished.
- The intro image will be stretched to match the video dimensions if aspect ratios differ
- Videos already present in the output folder will be skipped
- MoviePy requires FFmpeg to be installed and accessible from your system's PATH
- Processing time depends on video size and system performance
Error: "MoviePy requires FFmpeg"
- Install FFmpeg from https://ffmpeg.org/download.html
- Make sure FFmpeg is in your system PATH
Error: "No video files found"
- Check that the video folder path is correct
- Verify that videos have supported extensions
MIT License - feel free to use and modify as needed.
Contributions are welcome! Feel free to open issues or submit pull requests.