Skip to content

detect() returns empty list if video has no cuts #282

Closed

Description

@entron

I used the example code

scene_list = detect(path, ContentDetector())

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.

Activity

  1. Breakthrough commented on Aug 6, 2022

    @Breakthrough
    Owner

    You can use a SceneManager to always get at least one element by setting start_in_scene to True when calling get_scene_list:

    from scenedetect import open_video, ContentDetector, SceneManager
    video = 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 >= 1
    scene_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.

  2. changed the title [-]detect return empty list[/-] [+]detect() returns empty list if video has no cuts[/+] on Aug 6, 2022
  3. added this to the v0.6.1 milestone on Aug 6, 2022
  4. pinned this issue on Aug 6, 2022
  5. Breakthrough commented on Aug 6, 2022

    @Breakthrough
    Owner

    Fixed in v0.6.1 branch, will be included in next release of PySceneDetect. Thanks for the report.

  6. unpinned this issue on Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions