Repolode
Breakthrough

Breakthrough/PySceneDetect

Python and OpenCV tool and library that detects scene cuts and transitions in video, with optional splitting into clips.

Stars
5,396
Forks
560
Open issues
64
Last commit
6 days ago

What is it?

PySceneDetect analyzes video files to find where one shot ends and the next begins. It offers a command-line program and a Python API. Detection methods include content-aware detection for fast cuts, adaptive detection for fast camera movement, and threshold detection for fades to and from black.

The CLI can split a video at each detected scene using ffmpeg or mkvmerge, save representative frames from each scene, and list scene start and end timecodes. Commands can be chained, and settings can be stored in a config file. The library exposes functions such as detect() and split_video_ffmpeg() for use in other pipelines.

The project is published on PyPI and ships a Docker image with ffmpeg and mkvmerge included. Windows MSI and portable builds are also provided.

Key features

  • 01Detects hard cuts with content-aware and adaptive detectors.
  • 02Detects fades to and from black with a threshold detector.
  • 03Splits videos into scene clips using ffmpeg or mkvmerge.
  • 04Saves frames from each detected scene as images.
  • 05Provides both a command-line interface and a Python API.
  • 06Distributed via PyPI, Docker, and Windows installers.

Use cases

  • Splitting long footage or films into individual shots for editing or review.
  • Building a dataset of shots or keyframes for video machine learning.
  • Automatically generating thumbnails or previews from each scene.
  • Adding scene detection as a step in a video processing pipeline.

Quick start

  1. 1

    Install the package from PyPI

    pip install scenedetect --upgrade
  2. 2

    Detect scenes and split the video on each cut using ffmpeg

    scenedetect -i video.mp4 split-video

Things to know

  • Video splitting requires ffmpeg or mkvmerge to be installed separately, unless you use the Docker image.

In collections

Topics

#video-processing#scene-detection#opencv#computer-vision#python#video-editing#analysis#image-processing#python-opencv#scene-recognition

FAQ

What is PySceneDetect?
Python and OpenCV tool and library that detects scene cuts and transitions in video, with optional splitting into clips. PySceneDetect analyzes video files to find where one shot ends and the next begins. It offers a command-line program and a Python API. Detection methods include content-aware detection for fast cuts, adaptive detection for fast camera movement, and threshold detection for fades to and from black.
Is PySceneDetect free to use? What license does it have?
PySceneDetect is open source under the BSD-3-Clause license. Check the license terms before using it in commercial products.
Is PySceneDetect still maintained?
Actively maintained. The last commit to PySceneDetect was on Nov 2, 2026.
What can I use PySceneDetect for?
Splitting long footage or films into individual shots for editing or review. Building a dataset of shots or keyframes for video machine learning. Automatically generating thumbnails or previews from each scene. Adding scene detection as a step in a video processing pipeline.
How do I install PySceneDetect?
Install the package from PyPI: pip install scenedetect --upgrade Detect scenes and split the video on each cut using ffmpeg: scenedetect -i video.mp4 split-video
Where can I get PySceneDetect?
The source code and installation instructions are on GitHub: https://github.com/Breakthrough/PySceneDetect

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects