I’m trying to capture live feed through an h264 camera on RTSP protocol. On a terminal, the following gst-launch-1.0 command gives almost real-time feed:
gst-launch-1.0 playbin uri=rtsp://IP:PORT/live uridecodebin0::source::latency=0
When I put in the converted URL into OpenCV VideoCapture, it works but is always exactly two seconds behind. The following two URLs seem to give the same result:
cv2.VideoCapture("uridecodebin uri=rtsp://IP:PORT/live latency=0 ! videoconvert ! appsink") cv2.VideoCapture("rtsp://IP:PORT/live", cv2.CAP_GSTREAMER)
Is there something like, OpenCV is maintaining a buffer of the video? Or is the converted URL missing something? If the first case is true, can the buffer be removed?
I have also built the latest FFmpeg but the same problem exists. This problem is seen on h264 but the problem reduces on a mjpeg stream, a lot.
My configuration is:
GPU: GTX-1060 6GB