A Python utility that automatically extracts the first frame from video files in a specified directory. This tool is useful for creating thumbnails or previews from a collection of videos.
- 🎥 Supports multiple video formats (MP4, AVI, MOV, MKV, WMV, FLV)
- 📦 Automatic dependency installation
- 🚀 Progress bar visualization
- 📝 Comprehensive logging
- ⚡ Batch processing capabilities
- 🔒 Input validation and error handling
- 📊 Processing summary statistics
- Python 3.6 or higher
- Pip (Python package installer)
The script will automatically install the required dependencies if they're not present:
- OpenCV (cv2)
- tqdm (for progress bars)
- Clone the repository:
git clone https://github.com/yourusername/get1stVideoFrame.git
cd get1stVideoFrame- (Optional) Create and activate a virtual environment:
python -m venv venv
# On Windows
venv\Scripts\activate
# On macOS/Linux
source venv/bin/activate- Install dependencies:
pip install -r requirements.txtRun the script by providing the directory path as an argument:
python get1stVideoFrame.py /path/to/video/directoryRun the script without arguments to enter interactive mode:
python get1stVideoFrame.pyYou'll be prompted to enter the directory path.
The script will:
- Scan the specified directory for video files
- Extract the first frame from each video
- Save frames as PNG files with "_first_frame" suffix
- Display progress and provide a summary of the operation
Example output structure:
video_directory/
├── video1.mp4
├── video1_first_frame.png
├── video2.avi
├── video2_first_frame.png
└── ...
The script includes comprehensive error handling for common issues:
- Invalid directory paths
- Inaccessible directories
- Corrupted video files
- Missing dependencies
- Insufficient permissions
All errors are logged with appropriate messages to help troubleshoot issues.
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
If you encounter any issues or have questions, please:
- Check the existing issues in the GitHub repository
- Create a new issue with a detailed description of your problem
- Include any relevant error messages and your environment details
This project is actively maintained. Feel free to create issues for bugs or feature requests.
Create a requirements.txt file in your project directory with the following content:
opencv-python>=4.5.0
tqdm>=4.65.0
- Initial release
- Basic frame extraction functionality
- Automatic dependency installation
- Progress bar implementation
- Error handling and logging