1 | initial version |
an ip stream has no "end". and you can't "seek" anything there. itdoes not know the future and does not remember the past.
but vcap.read()
is actually a combination of grab()
and retrieve()
. so you should:
vcap = cv2.VideoCapture("rtsp://{IPcam}/12")
ct = 0
while(1):
ct += 1
ret = vcap.grab()
if ct % 5 == 0: # skip some frames
ret, frame = vcap.retrieve()
if not ret: break
time.sleep(0.2) # <= Simulate processing time
cv2.imshow('VIDEO', frame)
if cv2.waitKey(1) == 27:
break