Skip to content

Add video_contact_sheet: Generate contact sheets from videos using keyframes #426

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

libran11
Copy link

@libran11 libran11 commented May 13, 2025

🚀 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

Related issue links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants