Skip to content

Add error handling to describe_frames method in video_describer.py to prevent video processing crashes #4

@chigwell

Description

@chigwell

User Story
As a developer using FrameStory,
I want robust error handling in the describe_frames method
so that caption generation failures don't crash the entire video processing pipeline.

Background
The current implementation of describe_frames in frame_story/video_describer.py lacks error handling around the image captioning model calls. If the model fails (e.g., due to invalid inputs, API issues, or hardware constraints), uncaught exceptions propagate upward, halting all processing. This is particularly risky given the dependency on external ML models and video input variability. The describe_frames method's loop (lines 45-60) needs structured exception handling to maintain pipeline resilience.

Acceptance Criteria

  • Modify frame_story/video_describer.py with error handling in describe_frames:
    • Wrap model interactions (processor() and model.generate()) in try/except blocks
    • Log errors with context (frame index, timestamp) using Python's logging module
    • Continue processing subsequent frames after failures
  • Ensure error messages include:
    • Timestamp of failed frame
    • Exception type
    • Brief diagnostic info (without exposing model internals)
  • Add validation that:
    • Simulated model failures during testing don't crash the process
    • Error details appear in application logs
    • At least 90% of valid frames get processed despite individual failures
  • Update tests in tests/test_video_describer.py to verify error containment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions