Breakthrough/PySceneDetect
:movie_camera: Python and OpenCV-based scene cut/transition detection program & library.
PySceneDetect — Video Cut Detection and Analysis Tool
What it is: A tool that automatically finds the boundaries between scenes (cuts) in video files. It can split a video at those boundaries, save still frames from each scene, and more. It works both as a command-line program and as a Python library.
Latest release: v0.7.3
Key capabilities
- Detect scene changes — finds where one shot ends and another begins (fast cuts, fades, etc.)
- Split videos — cuts the input video into separate clips at each detected scene boundary (requires
ffmpegormkvmergeinstalled) - Save images — extracts one or more frames from each detected scene
- Time filtering — skip a portion of the input (e.g., ignore the first 10 seconds)
- Three detection algorithms:
ContentDetector— general-purpose, content-aware detectionAdaptiveDetector— two-pass version that handles fast camera movement betterThresholdDetector— designed for fade-out/fade-in events
Installation
pip install scenedetect --upgrade
- Video splitting requires
ffmpegand/ormkvmergeon your system. - Windows users can get an MSI installer or portable ZIP from the download page.
- A Docker image with everything included (
ffmpeg/mkvmergebundled) is available asghcr.io/breakthrough/pyscenedetect.
Usage examples (from the README)
Command line:
scenedetect -i video.mp4 split-video # split on each fast cut
scenedetect -i video.mp4 save-images # save frames from each cut
scenedetect -i video.mp4 time -s 10s # skip first 10 seconds
Docker (no install needed):
docker run --rm -v "$(pwd):/files" ghcr.io/breakthrough/pyscenedetect -i /files/video.mp4 split-video -o /files
Python API (high-level):
from scenedetect import detect, ContentDetector
scene_list = detect("my_video.mp4", ContentDetector())
This returns a list of start/end times for every scene. You can iterate over it, print timecodes and frame numbers, or split the video directly:
from scenedetect import detect, ContentDetector, split_video_ffmpeg
scene_list = detect("my_video.mp4", ContentDetector())
split_video_ffmpeg("my_video.mp4", scene_list)
For more control, the lower-level API lets you configure detectors (e.g., set a threshold), show progress, and integrate with custom pipelines.
Performance benchmarks
Accuracy and processing-speed results for the different detectors are published at scenedetect.com/benchmarks.
Development
- Clone the repo, create a virtual environment, and install in editable mode with dev dependencies:
pip install -e ".[dev]" - Tests use videos from a separate
resourcesbranch (fetched intotests/resources/) - Run tests with
pytest; the full suite needsffmpegandmkvmerge(ifffmpegis missing, theimageio-ffmpegbundled copy is used;mkvmergetests are skipped if it's not installed)
Project details
- License: BSD 3-Clause (see
LICENSEandTHIRD-PARTY.md) - Author: Brandon Castellano (Copyright 2014)
- Code signing: Free code signing provided by SignPath.io and the SignPath Foundation
- Support channels: GitHub Issue Tracker, official Discord server, and the project website
- Documentation: scenedetect.com/docs
All information above is taken directly from the project README.
Related
- Project
- Project
- Project
- Project
- Project