MCPcopy Create free account
hub / github.com/Breakthrough/PySceneDetect / get_scene_list

Method get_scene_list

scenedetect/scene_manager.py:348–373  ·  view source on GitHub ↗

Return a list of tuples of start/end FrameTimecodes for each detected scene. Arguments: start_in_scene: Assume the video begins in a scene. This means that when detecting fast cuts with `ContentDetector`, if no cuts are found, the resulting scene list

(self, start_in_scene: bool = False)

Source from the content-addressed store, hash-verified

346 self._detector_list.clear()
347
348 def get_scene_list(self, start_in_scene: bool = False) -> SceneList:
349 """Return a list of tuples of start/end FrameTimecodes for each detected scene.
350
351 Arguments:
352 start_in_scene: Assume the video begins in a scene. This means that when detecting
353 fast cuts with `ContentDetector`, if no cuts are found, the resulting scene list
354 will contain a single scene spanning the entire video (instead of no scenes).
355 When detecting fades with `ThresholdDetector`, the beginning portion of the video
356 will always be included until the first fade-out event is detected.
357
358 Returns:
359 List of tuples in the form (start_time, end_time), where both start_time and
360 end_time are FrameTimecode objects representing the exact time/frame where each
361 detected scene in the video begins and ends.
362 """
363 if self._base_timecode is None or self._start_pos is None or self._last_pos is None:
364 return []
365 cut_list = self._get_cutting_list()
366 scene_list = get_scenes_from_cuts(
367 cut_list=cut_list, start_pos=self._start_pos, end_pos=self._last_pos + 1
368 )
369 # If we didn't actually detect any cuts, make sure the resulting scene_list is empty
370 # unless start_in_scene is True.
371 if not cut_list and not start_in_scene:
372 scene_list = []
373 return sorted(scene_list)
374
375 def _get_cutting_list(self) -> list[FrameTimecode]:
376 """Return a sorted list of unique frame numbers of any detected scene cuts."""

Calls 2

_get_cutting_listMethod · 0.95
get_scenes_from_cutsFunction · 0.85