0
votes

My Opencv is version 4.5.4 and compiled with gstreamer lib.

In my situation, I'm getting frames of streaming videos. There is the gap between streaming video time and getting video time(cv2.VideoCapture). And if though streaming next video, cv2.VideoCapture don't get frames of next streaming video because opencv didn't reach last frame.

How do i solve it? (When I use opencv version 3.4.0, i didn't face with this issue.)

My Code(not use mulitprocess/thread)

def connect_streaming(rtsp_url):
    while True:
        video_cap = cv2.VideoCapture(rtsp_url, cv2.CAP_GSTREAMER)

        while video_cap.isOpened():
            ret, frame = video_cap.read()
            if not ret:
                video_cap.release()
                break
             ...
You show no code, so it is hard to see what would be wrong. Perhaps you need to multithread or multiprocess?RufusVS