Commit Graph
1 Commits
Author SHA1 Message Date
Haoran Wang f6e51f5950 Add empty-frames guard to cv2 video loader
Summary:
## Context
When cv2.VideoCapture opens a video but cannot decode any frames (e.g., due to an unsupported codec), the frames list is empty and np.stack crashes with "need at least one array to stack" — an unhelpful error message that obscures the real problem.

## This Diff
- Add explicit check for empty frames list after cap.release() and before np.stack
- Raise RuntimeError with descriptive message about possible causes (corrupted file, empty video, or unsupported codec)

Differential Revision: D94142839

fbshipit-source-id: 89a973d067d83439039734712d18727b06d0706d
2026-02-24 10:28:32 -08:00