DetectVideoShotLength
DetectVideoShotLength is a Python package for detecting scene cuts in videos using advanced histogram and structural similarity (SSIM) analysis. This tool identifies frames where abrupt scene changes (or "cuts") occur, saves cut frames, and provides insights into shot durations, distribution, and visual frequency.
It is ideal for projects requiring video analysis, such as filmmaking, video editing, or computer vision research.
Key Features
- Cut Detection: Detects scene cuts based on RGB histogram changes and verifies cuts using SSIM thresholds.
- Scene Duration Analysis: Calculates the duration of each scene and provides insights into average shot lengths.
- Scene Length Visualization: Plots scene lengths over time, showing the pacing and rhythm of a video.
- Scene Frequency Distribution: Visualizes the distribution of scene lengths in a logarithmic frequency chart.
- Sorted Scene Listing: Lists scenes sorted by duration, with start and end timestamps for detailed scene timing.
Implementation
Change threshold_hist from 0 to 1, the default threshold would be 0.15
and threshold_ssim from 0.75 to 0.95, default would be 0.85
Usually, the parameters give different results with day scenes and night scenes.
If the video is large, a segment could be analyzed.
import DetectVideoShotLength
video_path = r"D:\___Research\average shot\test_video.mp4"
output_dir = r"D:\___Research\average shot\video"
results = DetectVideoShotLength.detect_cuts(video_path, output_dir, threshold_hist=0.20, threshold_ssim=0.80, min_minutes=5, max_minutes=7)
DetectVideoShotLength.plot_scene_lengths(results)
DetectVideoShotLength.list_scenes_sorted_by_length(results)
DetectVideoShotLength.plot_scene_length_frequencies(results)
Metadata
Release files for DetectVideoShotLength 0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| detectvideoshotlength-0.12.tar.gz | 6.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| DetectVideoShotLength-0.12-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.6 kB
Release files / detectvideoshotlength-0.12.tar.gz
| Download URL | detectvideoshotlength-0.12.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
087a000256369e85848d2bac7052211ff2c1c0583f7f5b3ecae0097755273b94
|
|
BLAKE2b-256 checksum How to use checksums |
5b2c3583fc340e0708804a348cb17677b271f71bfc38bb83de30d40e68da673d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|
Release files / DetectVideoShotLength-0.12-py3-none-any.whl
| Download URL | DetectVideoShotLength-0.12-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
35b80be6a80b31e3a3749e37b84014dfe821171a96da03d36bf4b80519b4a63e
|
|
BLAKE2b-256 checksum How to use checksums |
219fa7bdb13fcc35e6df0cf9d0eba95ff94c84c1e63f53ab717978efdc46c6af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|
Security for DetectVideoShotLength 0.12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.