A fast and efficient Python tool for extracting frames from videos at specified time intervals. This tool is perfect for creating thumbnails, analyzing video content, or generating training data for machine learning models.
- Extract frames at precise time intervals
- Efficient frame processing without sleep delays
- Progress tracking with frame counts
- Organized output structure
- Support for any video format compatible with OpenCV
- Python 3.6+
- OpenCV (
cv2
) - NumPy
- Clone this repository:
git clone https://github.com/yourusername/video-snapshot-extractor.git
cd video-snapshot-extractor
- Install the required packages:
pip install -r requirements.txt
Basic usage with default settings (1-second intervals):
python snapshot_extractor.py --video_path path/to/your/video.mp4
Extract frames every 0.5 seconds:
python snapshot_extractor.py --video_path path/to/your/video.mp4 --seconds_interval 0.5
--video_path
: Path to the input video file (required)--seconds_interval
: Time interval between snapshots in seconds (default: 1.0)
The script creates a snapshots
directory containing subdirectories for each processed video. Frames are saved as JPEG files with names formatted as frame_XXXXX.jpg
.
Example output structure:
snapshots/
└── video_name/
├── frame_00000.jpg
├── frame_00001.jpg
├── frame_00002.jpg
└── ...
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenCV community for their excellent video processing library
- All contributors who help improve this tool