Hi
I capture and process an IP camera RTSP stream in a OpenCV 3.4.2 on Raspberry Pi. Unfortunately the processing takes quite a lot of time, roughly 0.2s per frame, and the stream quickly gets delayed.
I don't mind if I skip some frames so I'm looking for a way to seek to the end of the stream before capturing and processing the next frame.
vcap = cv2.VideoCapture("rtsp://{IPcam}/12")
while(1):
ret, frame = vcap.read()
time.sleep(0.2) # <= Simulate processing time
cv2.imshow('VIDEO', frame)
if cv2.waitKey(1) == 27:
break
vcap.seek_to_end() # <== How to do this?
How can I do that vcap.seek_to_end()
to catch up with the stream, discard the missed frames, and start processing the most current one?
Thanks!