Video Scene Cut Detection and Analysis Tool.

Quick Install: To install PySceneDetect via pip with all dependencies:

pip install scenedetect[opencv]

For servers, you can use the headless (non-GUI) version of OpenCV by installing scenedetect[opencv-headless]. To enable video splitting support, you will also need to have mkvmerge or ffmpeg installed - see the documentation on Video Splitting Support for details.

Requires Python modules click, numpy, OpenCV cv2, and (optional) tqdm for displaying progress. For details, see the dependencies on the downloads page.

Quick Start (Command Line):

Split the input video wherever a new scene is detected:

scenedetect -i video.mp4 detect-content split-video

Skip the first 10 seconds of the input video, and output a list of scenes to the terminal:

scenedetect -i video.mp4 time -s 10s detect-content list-scenes

To show a summary of all other options and commands:

scenedetect help

You can find more examples on the website or in the manual.

Quick Start (Python API):

In the code example below, we create a function find_scenes() which will
load a video, detect the scenes, and return a list of tuples containing the
(start, end) timecodes of each detected scene. Note that you can modify
the threshold argument to modify the sensitivity of the scene detection.

# Standard PySceneDetect imports:
from scenedetect import VideoManager
from scenedetect import SceneManager

# For content-aware scene detection:
from scenedetect.detectors import ContentDetector

def find_scenes(video_path, threshold=30.0):
    # Create our video & scene managers, then add the detector.
    video_manager = VideoManager([video_path])
    scene_manager = SceneManager()

    # Improve processing speed by downscaling before processing.

    # Start the video manager and perform the scene detection.

    # Each returned scene is a tuple of the (start, end) timecode.
    return scene_manager.get_scene_list()

To get started, try printing the result from calling find_scenes on a small video clip:

    scenes = find_scenes('video.mp4')

See the manual for the full PySceneDetect API documentation.