Object detection with IP camera : video is freezing

Hello,
I’m working on object detection with an IP camera but I met a problem with this project. I can read the camera with an RSTP protocol where I put the IP address in the function cv2.VideoCapture(“IP address”) and I’m displaying the video in real-time. At the beginning, everything is ok, I’m able to see the output of the camera but when I’m detecting something, the image is freezing and then, if we detect nothing, it comes back as before. I’m sure that the problem comes from the IP camera because I tested with an USB camera and everything was working, the video was really good while detecting objects. Even if I don’t display the video in real-time, and instead I record it in a video file, some frames are missing in the video file because of that.
My camera is a PTZ camera DH-PTZ1A225-HNR-XA from Dahua technologies and is connected to my computer by Ethernet.
Thanks you in advance for your help !

When you detect something, do you do more processing? If so you are most likely dropping packets due to this increased delay. This is a common problem, if you can’t reduce the processing overhead the only solution is to have a seperate capture thread which doesn’t get interrupted when a detection is made which you query when you are ready for a frame. In this case you will drop frames rather than packets.

1 Like