PySceneDetect Cuts Videos Into Shots With 91 F1 and No GPU
PySceneDetect ships five swappable shot-boundary detectors, TRECVID-style benchmarks, and a Python API that plugs cleanly into video pipelines.
Takeaways
- PySceneDetect is a BSD-licensed Python and OpenCV library for detecting shot boundaries and splitting videos into clips.
- Five swappable detectors cover fast cuts, perceptual hash matching, histogram comparison, and fade-to-black transitions.
- AdaptiveDetector scores 91.59 F1 on BBC Planet Earth hard cuts at default settings, the top score across detectors.
- HistogramDetector dominates on gradual fades with 75.33 F1 on ClipShots, where content-based methods drop below 42.
- Ships CLI, Python API, Docker image, and exports to EDL, OTIO, HTML, and x264 QP files.
- Install with
pip install scenedetect; see benchmarks for detector selection.
Cutting a long video into individual shots sounds like a solved problem until you try to do it inside a training or preprocessing pipeline. PySceneDetect has quietly been that solution for years, and its latest release pairs a mature OpenCV-based library with a benchmark suite that tells you which detector to reach for and when.
The project is a Python and OpenCV tool for detecting shot changes in videos, which can then automatically split the source into separate clips. It ships as both a command-line binary and an embeddable library, under a BSD-3-Clause license.
Install once, cut anything
Getting started takes a single pip command, with optional ffmpeg or mkvmerge if you want the tool to also slice the source file into per-scene clips. A Docker image bundles the dependencies for anyone who does not want to touch their system Python.
pip install scenedetect --upgrade
scenedetect -i video.mp4 split-video
The Python API mirrors the CLI. A three-line call returns start and end timecodes for every detected shot, which you can feed into your own pipeline:
from scenedetect import detect, AdaptiveDetector, split_video_ffmpeg
scene_list = detect("my_video.mp4", AdaptiveDetector())
split_video_ffmpeg("my_video.mp4", scene_list)
Five detectors, not one
Rather than committing to a single algorithm, PySceneDetect exposes a family of detectors you can pick between depending on the source material: