Linux video capture 10 seconds delay

asked 2019-03-04 00:36:42 -0500

foreign222 gravatar image

updated 2019-03-04 06:39:12 -0500

I have an ip camera and streaming using rtsp protocol. I set camera fps to 5. In windows, it works properly. But in linux, first cap.read() call waits 10 seconds and after that reads 5 frame per second. So i have 10 seconds delay. I think it reads buffer with 5 fps and buffer is never clear. How i can solve this?

import cv2
source = "rtsp://user:pass@ip:port"
print("[INFO] starting video stream...")
cap=cv2.VideoCapture(source)
while True:
    print("Next Frame")
    ret, frame = cap.read()
edit retag flag offensive close merge delete