def video_frame_np(video: VideoFile, frame: int) -> ndarray:
    """
    Reads video frame from a file and returns as numpy array.

    Args:
        video (VideoFile): Video file object.
        frame (int): Frame index.

    Returns:
        ndarray: Video frame.
    """
    if frame < 0:
        raise ValueError("frame must be a non-negative integer")

    with video.open() as f:
        return iio.imread(f, index=frame, plugin="pyav")  # type: ignore[arg-type]

    Reads video frame from a file and returns as numpy array.

    Args:
        video (VideoFile): Video file object.
        frame (int): Frame index.

    Returns:
        ndarray: Video frame.
    
src/datachain/lib/video.py