Standalone Python shot boundary detection package for splitting videos into shots
Project description
Shot Detection Python
Standalone Python package for shot boundary detection.
It takes a video file, runs TransNetV2-style ONNX inference on low-resolution RGB frames, and returns shot ranges with millisecond timestamps.
Built by Seeknetic. If you want to make video shots searchable and enable more professional video understanding workflows, visit seeknetic.com.
What it does
- Probes the input video with
ffprobe - Extracts low-resolution frames with
ffmpeg - Runs sliding-window ONNX inference
- Finds shot boundaries
- Converts them into
{start_ms, end_ms}shot segments
Installation
pip install shot-detection
Import from shot_detection:
from shot_detection import ShotDetector
You also need:
ffmpegffprobe
On first run, the package downloads the default model automatically:
- URL:
https://download.shotai.io/model/shot-detection/transnetv2_open_fp16.onnx - cache dir:
- Linux/macOS:
~/.cache/shot-detection/models/ - Windows:
%LOCALAPPDATA%\\shot-detection\\models\\
- Linux/macOS:
You can override the cache root with SHOT_DETECTION_CACHE_DIR.
Usage
from shot_detection import ShotDetector
detector = ShotDetector()
shots = detector.detect("/path/to/video.mp4")
for shot in shots:
print(shot.start_ms, shot.end_ms)
Advanced usage
from shot_detection import detect_shots
shots = detect_shots(
video_path="/path/to/video.mp4",
threshold=0.5,
min_shot_duration_ms=500,
)
Custom model path
from shot_detection import ShotDetector
detector = ShotDetector(model_path="/path/to/custom-transnetv2.onnx")
Notes
- The package expects the ONNX model input to accept 100-frame windows at
48x27RGB. ffmpegdecode is adaptive: it prefers system-native hardware decoding when available and falls back to software decoding automatically.- CUDA is intentionally not part of the default decode plan.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shot_detection-0.1.0.tar.gz.
File metadata
- Download URL: shot_detection-0.1.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f322a3a2b5b1e1a9d6c6af0f58801bf022138e88affbf458d93a7b8a251d468
|
|
| MD5 |
e6684e26523091725007767707900eed
|
|
| BLAKE2b-256 |
8a7d4150b508d223c8d4840c57dd694f31d5b5e9cc059acd0f483f933c29f9e7
|
Provenance
The following attestation bundles were made for shot_detection-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on Seeknetic/shot-detection-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shot_detection-0.1.0.tar.gz -
Subject digest:
5f322a3a2b5b1e1a9d6c6af0f58801bf022138e88affbf458d93a7b8a251d468 - Sigstore transparency entry: 1281023766
- Sigstore integration time:
-
Permalink:
Seeknetic/shot-detection-python@64c83de03446fa2374b0627a8de6e2f0c855f2a0 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/Seeknetic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@64c83de03446fa2374b0627a8de6e2f0c855f2a0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file shot_detection-0.1.0-py3-none-any.whl.
File metadata
- Download URL: shot_detection-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc62bfeccb2c8683e63b8a7b3fe51f3378a4df82aa6099c146e970942f9b328f
|
|
| MD5 |
e161cf348ebf850f350642ac0786a4f6
|
|
| BLAKE2b-256 |
8502899319da0b5a170da657950060914c98a3d742adf62b7c1a355d78b68478
|
Provenance
The following attestation bundles were made for shot_detection-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on Seeknetic/shot-detection-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shot_detection-0.1.0-py3-none-any.whl -
Subject digest:
fc62bfeccb2c8683e63b8a7b3fe51f3378a4df82aa6099c146e970942f9b328f - Sigstore transparency entry: 1281023768
- Sigstore integration time:
-
Permalink:
Seeknetic/shot-detection-python@64c83de03446fa2374b0627a8de6e2f0c855f2a0 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/Seeknetic
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@64c83de03446fa2374b0627a8de6e2f0c855f2a0 -
Trigger Event:
release
-
Statement type: