Grab raw data in VideoCapture

I’m using python opencv version 4.4.0, I tried codes blow but got an error which says im is NoneType.

import cv2

def process(types=cv2.CAP_ANY):
    video_url = "test.mp4"
    video = cv2.VideoCapture(video_url)
    print(video.set(cv2.CAP_PROP_FORMAT, -1))
    success, frame = video.read()
    print(frame.shape, frame.dtype)
    im = cv2.imdecode(frame, cv2.IMREAD_COLOR)
    print(im.shape)
    cv2.imwrite("a.jpg", im)

if __name__ == "__main__":
    process()