Rock5 , video capture HDMI input, timeout

Hello,
I am using the Rock 5, model b, by radxa, for video capturing through the integrated HDMI in that it has. There is this problem, that when i boot the linux 11,debian, and launch the python file it works. Then i close the application and disconnect the hdmi source. I connect it back again , but it get this error : [ WARN:0@11.561] global cap_v4l.cpp:1134 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
when i restart Linux, it works again.

UPDATE: I have installed obs to check if there is the video feed working, which doesnt happen too, so there must be something to do with the v4l2 drivers ?
Any ideas about why this is happening ? Thanks a lot.

These are the main parts of the code:


video_capture = cv2.VideoCapture(0)
video_capture.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc('M', 'J', 'P', 'G'))



def capture_video():
    global global_img
    global image

    cv2.namedWindow("Endoscope", cv2.WINDOW_NORMAL | cv2.WINDOW_GUI_NORMAL)
    cv2.setWindowProperty("Endoscope", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)
    cv2.setWindowProperty("Endoscope", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_NORMAL)
    cv2.resizeWindow("Endoscope", window_width, window_height)
    cv2.setMouseCallback('Endoscope', mouse_callback, image)

    t_start = time.time()  # Record the start time
    last_label_update = t_start
    time_label_counter = 0

    while not ThreadFlag.exit_event.is_set():
        ret, frame = video_capture.read()
        if not ret:
            break

        image = cv2.cvtColor(frame, cv2.COLOR_BGR2BGRA)
        image = cv2.resize(image, (window_width, window_height))
#video edit stuff here

cv2.destroyAllWindows()
video_capture.release()