Skip to content

Incorrect end timecode when last scene is 1 frame long #307

@Breakthrough

Description

@Breakthrough

When the last scene contains a single frame, the resulting scene list reports the same timecode for both the start/end frames. This is technically incorrect as it results in a duration of zero. This only affects the final scene in the scene list when the scene only consists of a single frame.

The changes described in #242 and #265 led to some significant changes to internal timekeeping, so this may have been introduced then. This was reported by voidwalker on discord.

The following test case demonstrates the desired behaviour:

def test_scene_list_one_frame(test_video_file):
    """Test SceneManager get_scene_list method with VideoStreamCv2/ContentDetector."""
    video = VideoStreamCv2(test_video_file)
    sm = SceneManager()
    sm.add_detector(ContentDetector())
    sm.auto_downscale = True
    sm.detect_scenes(video=video, end_time=0)
    start, end = sm.get_scene_list(start_in_scene=True)[0]
    assert (start + 1) == scene_list[0][1]

The assertion currently fails because start == end currently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions