def video_frame_bytes(video: VideoFile, frame: int, format: str = "jpg") -> bytes:
    """
    Reads video frame from a file and returns as image bytes.

    Args:
        video (VideoFile): Video file object.
        frame (int): Frame index.
        format (str): Image format (default: 'jpg').

    Returns:
        bytes: Video frame image as bytes.
    """
    img = video_frame_np(video, frame)
    return iio.imwrite("<bytes>", img, extension=f".{format}")

    Reads video frame from a file and returns as image bytes.

    Args:
        video (VideoFile): Video file object.
        frame (int): Frame index.
        format (str): Image format (default: 'jpg').

    Returns:
        bytes: Video frame image as bytes.
    
src/datachain/lib/video.py