moviepy.video.tools.cuts.detect_scenes#

moviepy.video.tools.cuts.detect_scenes(clip=None, luminosities=None, luminosity_threshold=10, logger='bar', fps=None)[source]#

Detects scenes of a clip based on luminosity changes.

Note that for large clip this may take some time.

Returns:

tuple -- cuts is a series of cuts [(0,t1), (t1,t2),...(...,tf)] luminosities are the luminosities computed for each frame of the clip.

Return type:

cuts, luminosities

Parameters:
  • clip (video.VideoClip.VideoClip, optional) -- A video clip. Can be None if a list of luminosities is provided instead. If provided, the luminosity of each frame of the clip will be computed. If the clip has no 'fps' attribute, you must provide it.

  • luminosities (list, optional) -- A list of luminosities, e.g. returned by detect_scenes in a previous run.

  • luminosity_threshold (float, optional) -- Determines a threshold above which the 'luminosity jumps' will be considered as scene changes. A scene change is defined as a change between 2 consecutive frames that is larger than (avg * thr) where avg is the average of the absolute changes between consecutive frames.

  • logger (str, optional) -- Either "bar" for progress bar or None or any Proglog logger.

  • fps (int, optional) -- Frames per second value. Must be provided if you provide no clip or a clip without fps attribute.