MCPcopy Index your code
hub / github.com/Breakthrough/PySceneDetect / test_api_scene_manager_start_end_time

Function test_api_scene_manager_start_end_time

tests/test_api.py:57–72  ·  view source on GitHub ↗

Demonstrate how to use a SceneManager to process a subset of the input video.

(test_video_file: str)

Source from the content-addressed store, hash-verified

55
56
57def test_api_scene_manager_start_end_time(test_video_file: str):
58 """Demonstrate how to use a SceneManager to process a subset of the input video."""
59 from scenedetect import ContentDetector, SceneManager, open_video
60
61 video = open_video(test_video_file)
62 scene_manager = SceneManager()
63 scene_manager.add_detector(ContentDetector())
64 # Times can be seconds (float), frames (int), or timecode 'HH:MM:SSS.nnn' (str).
65 # See test_api_timecode_types() for examples of each format.
66 start_time = 200 # Start at frame (int) 200
67 end_time = 15.0 # End at 15 seconds (float)
68 video.seek(start_time)
69 scene_manager.detect_scenes(video=video, end_time=end_time)
70 scene_list = scene_manager.get_scene_list()
71 for i, scene in enumerate(scene_list):
72 print(f"Scene {i + 1}: {scene[0].get_timecode()} - {scene[1].get_timecode()}")
73
74
75def test_api_open_video_framerate_legacy_alias(test_video_file: str):

Callers

nothing calls this directly

Calls 8

add_detectorMethod · 0.95
detect_scenesMethod · 0.95
get_scene_listMethod · 0.95
open_videoFunction · 0.90
SceneManagerClass · 0.90
ContentDetectorClass · 0.90
get_timecodeMethod · 0.80
seekMethod · 0.45

Tested by

no test coverage detected