Python-Scripts
Python-Scripts copied to clipboard
Add video_contact_sheet: Generate contact sheets from videos using keyframes
🚀 Add video_contact_sheet: Generate contact sheets from videos using keyframes
Summary
This PR introduces a new advanced utility script video_contact_sheet which generates visual contact sheets from video files using scene-change keyframes.
Description
This tool extracts keyframes based on histogram difference, composes them into a grid with metadata (duration, resolution, codec), and exports them as JPEG images. It is particularly useful for dataset QA, content review, or automated preview generation.
The script supports both single-file and batch directory input, and includes multi-threaded processing for high efficiency. Full CLI interface and pytest-based test cases are included.
The changes are as follows:
- Added video_contact_sheet/ submodule with the following files:
- cli.py: CLI entry using click
- core.py: Core logic for keyframe extraction and contact sheet composition
- utils.py: FFmpeg metadata fetching and thread pool management
- tool_test/test_contact_sheet.py: Unit test using a generated sample video
- requirements.txt: Light dependencies list
- README.md: Project documentation
- Provided random sample video and automated testing
- Compatible with Pillow ≥10 (textbbox used)
Checks
in the repository
• Made no changes that degrades the functioning of the repository
• Gave each commit a better title (unlike updated README.md)
in the PR
• Followed the format of the pull_request_template
• Made the Pull Request in a small level (for the creator’s wellfare)
• Tested the changes you made