You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
detect() returns empty list if video has no cuts #282
for some videos like this one, however I got an empty list. Obversly there is one scence in the video and I expect to get at least one element. I don't know whether it is a bug or due to misuse.
You can use a SceneManager to always get at least one element by setting start_in_scene to True when calling get_scene_list:
fromscenedetectimportopen_video, ContentDetector, SceneManagervideo=open_video(path)
scene_manager=SceneManager()
scene_manager.add_detector(ContentDetector())
scene_manager.detect_scenes(video)
# If `start_in_scene` is True, len(scene_list) will always be >= 1scene_list=scene_manager.get_scene_list(start_in_scene=True)
For consistency with ThresholdDetector, the default behaviour of the API is to not return any scenes if there were no cuts detected. It would be useful to add this argument to detect() as well, so for the next release I'll add start_in_scene to detect(). In the meantime, you can use the above code snippet to achieve the desired functionality.
Reacted by Cheng Guo, Mingqi Gao, LymanY, Matěj Štágl, Xin J. and smoothdvd
Activity
Breakthrough commentedon Aug 6, 2022
You can use a
SceneManagerto always get at least one element by settingstart_in_scenetoTruewhen callingget_scene_list:For consistency with
ThresholdDetector, the default behaviour of the API is to not return any scenes if there were no cuts detected. It would be useful to add this argument todetect()as well, so for the next release I'll addstart_in_scenetodetect(). In the meantime, you can use the above code snippet to achieve the desired functionality.[-]detect return empty list[/-][+]detect() returns empty list if video has no cuts[/+][api] Add `start_in_scene` flag to `scenedetect.detect()` (#282)
Breakthrough commentedon Aug 6, 2022
Fixed in v0.6.1 branch, will be included in next release of PySceneDetect. Thanks for the report.