RTSP Stream Latency with TP-Link VIGI C440I & OpenCV - NEED ADVICE !
Hello everyone,
I'm currently working on a computer vision project using OpenCV in C++ and I'm having latency problems with my TP-Link VIGI C440I 1.0 cameras. Here's a brief overview of the situation:
- Configuration: Two VIGI C440I 1.0 cameras connected to a TL-SG1005P PoE+ switch.
- Problem: Interestingly, the web application provides a real-time stream with no lag, but when extracting the stream via OpenCV, there is a noticeable lag of 2 seconds. What magic does the web application use? 🤔
- What I tried: I built a GStreamer pipeline in conjunction with OpenCV. After a few adjustments, I managed to reduce the latency to 200-300 ms. However, it's still not possible to achieve the real-time performance I observed on the web application.
```
std::string pipeline = "rtspsrc location=rtsp://[id]:[pwd]@192.168.1.51/stream1 latency=0 drop-on-latency=true buffer-mode=none ! "
"rtph264depay ! h264parse ! decodebin ! queue max-size-buffers=0 max-size-time=0 max-size-bytes=0 ! "
"videoconvert ! videoscale ! videorate ! video/x-raw,format=BGR,width=640,height=480,framerate=30/1 ! "
"appsink max-buffers=0 drop=true sync=false";
cv::VideoCapture captureRTSP(pipeline, cv::CAP_GSTREAMER);
```
Has anyone else experienced this problem? I'm looking for optimised libraries or perhaps tricks to make the RTSP stream closer to instantaneous. Any ideas or shared experiences are welcome!
thank you in advance!
Stay awesome,
Hans