Skip to content

Fix extract_significant_frames to use class-level threshold in video_describer.py #3

Description

@chigwell

User Story
As a software developer,
I want the extract_significant_frames method to consistently use the class-level threshold value
so that video analysis respects the configured quality standard and avoids unexpected behavior.

Background
The extract_significant_frames method in frame_story/video_describer.py currently declares a threshold parameter that shadows the class-level self.threshold initialized in VideoDescriber.__init__(). This causes the method to ignore the instance's configured threshold, leading to inconsistent frame extraction results. For example, users setting threshold=25000 during VideoDescriber initialization expect this value to govern frame extraction, but the method instead uses its default parameter value of 50000 unless explicitly overridden in calls. This violates the principle of least surprise and creates maintenance challenges.

Acceptance Criteria

  • Modify extract_significant_frames in video_describer.py to remove the threshold parameter and use self.threshold for frame difference calculations
  • Update the method's docstring to clarify that class-level threshold governs extraction
  • Adjust the get_video_descriptions method call to extract_significant_frames to remove threshold argument passing
  • Add test case in tests/test_video_describer.py verifying that class-initialized threshold values correctly influence frame extraction:
    • Create VideoDescriber instance with threshold=30000
    • Mock video processing to validate extraction logic uses 30000 instead of default 50000
  • Confirm through manual testing that omitting threshold during VideoDescriber initialization still uses default 50000 via self.threshold
  • Verify README.md examples (e.g., VideoDescriber(threshold=25000)) produce expected behavior post-fix

Activity

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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions