SceneDetector

PySceneDetect scenedetect.scene_detector Module

This module implements the base SceneDetector class, from which all scene detectors in the scenedetect.dectectors module are derived from.

The SceneDetector class represents the interface which detection algorithms are expected to provide in order to be compatible with PySceneDetect.

class scenedetect.scene_detector.SceneDetector

Base class to inheret from when implementing a scene detection algorithm.

Also see the implemented scene detectors in the scenedetect.detectors module to get an idea of how a particular detector can be created.

_metric_keys = []

List of frame metric keys to be registered with the stats_manager, if available.

cli_name = 'detect-none'

Name of detector to use in command-line interface description.

get_metrics()

Get Metrics: Get a list of all metric names/keys used by the detector.

Returns:A list of strings of frame metric key names that will be used by the detector when a StatsManager is passed to process_frame.
Return type:List[str]
is_processing_required(frame_num)

Is Processing Required: Test if all calculations for a given frame are already done.

Returns:False if the SceneDetector has assigned _metric_keys, and the stats_manager property is set to a valid StatsManager object containing the required frame metrics/calculations for the given frame - thus, not needing the frame to perform scene detection.

True otherwise (i.e. the frame_img passed to process_frame is required to be passed to process_frame for the given frame_num).

Return type:bool
post_process(frame_num)

Post Process: Performs any processing after the last frame has been read.

Prototype method, no actual detection.

Returns:List of frame numbers of cuts to be added to the cutting list.
Return type:List[int]
process_frame(frame_num, frame_img)

Process Frame: Computes/stores metrics and detects any scene changes.

Prototype method, no actual detection.

Returns:List of frame numbers of cuts to be added to the cutting list.
Return type:List[int]
stats_manager = None

Optional StatsManager to use for caching frame metrics to and from.