Need Help With OpenCV & RTSP - Python

If you can only process 2-3 frames a second from a h264 source where each frame is not an I-frame and you are not using a buffer you need your source to produce frames at that rate.

As I said above:

  1. Check if the glitches persist if you remove the object detection code. If they are gone the cause is the delay introduced by the object detecion code.
  2. See if you can reduce the frame rate of the source (use the web gui) to the same rate that you are reading the frames. i.e. 2fps.

You can also try the suggestions below but first confirm what the cause of your issue is by removing the object detection code and seeing if you have glitches when reading from a single camera.

  1. Use MJPEG if the camera supports it.
  2. Only use I-frames by seting the GOP size to 1.
  3. Manually read/decode all the frames into a fixed size circular buffer. Then using whatever heuristic you like (most recent, oldest frame etc.) process frames from that buffer.