Skip to content

Implement final frame duration fallback in video_describer.py #8

@chigwell

Description

@chigwell

User Story
As a developer using FrameStory,
I want the final frame's duration to have a fallback value
so that video descriptions contain complete timing metadata for all frames.

Background
The describe_frames method in frame_story/video_describer.py currently leaves the last frame's duration undefined when i+1 exceeds the times array length. This creates inconsistent output formats and risks downstream processing errors for applications relying on complete duration data. The loop in describe_frames calculates durations using times[i+1] - time without handling the terminal case.

Acceptance Criteria

  • Modify describe_frames in video_describer.py to implement duration fallback for final frame
  • Set fallback duration using either:
    • A default value (e.g., 1 second)
    • Configurable parameter via VideoDescriber initialization
  • Add test case verifying last frame's duration matches fallback strategy
  • Ensure existing frame extraction logic remains unchanged
  • Update method docstring to document fallback behavior
  • Validate through:
    • Video with only 1 significant frame
    • Video where all frames are significant
    • Existing test suite passing

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions