Skip to content

vllm.multimodal.video_decoders.opencv

Classes:

OpenCVVideoBackendMixin

Methods:

_can_use_for_recovery(idx, failed_frames, next_target_map, total_frames) classmethod

Check if current frame can recover the oldest failed frame.

_read_frames_with_recovery(cap, frame_indices, total_frames) classmethod

Read frames with dynamic window forward-scan recovery.

When a target frame fails to load, the next successfully grabbed frame (before the next target frame) will be used to recover it.

Parameters:

  • cap

    (VideoCapture) –

    OpenCV VideoCapture object

  • frame_indices

    (list[int]) –

    Sorted list of target frame indices to load

  • total_frames

    (int) –

    Total number of frames in the video

Returns:

  • NDArray –

    Tuple of (frames_array, valid_frame_indices, recovered_map)

  • list[int] –
    • frames_array: Array of loaded frames
  • dict[int, int] –
    • valid_frame_indices: List of frame indices that were loaded
  • tuple[NDArray, list[int], dict[int, int]] –
    • recovered_map: Dict mapping recovered_idx -> source_idx

demux_count_frames(data) classmethod

Count frames with OpenCV's demuxer-only mode.