Hello, i am using OpenCV 2.4.1 C++ to render the RTSP Stream from IP camera. When i connect to the stream in local home network everything works perfect, but if i try to connect to the RTSP Stream from outside (make a port forwarding in my router) it doesn’t work and capture is empty, while the VLC media player render the RTSP Stream from outside (port forwarded) with no problem.
Format of RTSP connection string: rtsp://admin:8888@xxx.xxx.x.xxx:1987/rtsp_live1
Code example:
try {
videoCapture.open("rtsp://admin:8888@xxx.xxx.x.xxx:1987/rtsp_live1");
}
catch (cv::Exception& e) {
AfxMessageBox(e.msg.c_str());// Here is ok, there is no errors
}
while (true)
{
try
{
cv::Mat processfrm;
//Get frame from webcam
videoCapture >> processfrm;// Here is empty frame in remote mode
}
}
Help me please to find a solution how to render the RTSP stream from outside of home network. Let me know please if you need any additional information.
reproduce this with those first, standalone. when that works, it’s an OpenCV problem. if that doesn’t work, it’s not an opencv problem but an ffmpeg/gstreamer problem.
that will receive no support at all in any case. why? if there was an issue, and it was fixed since then, you’re causing everyone pointless detective work.
VLC and ffmpeg are different programs. they use different libraries. they very likely do their networking differently.
differing behavior is to be expected.
now you’ll have to investigate what is going on. you might need WireShark. and hope the traffic isn’t encrypted, so you can look at what’s going on.
or you could go and ask the ffmpeg community for support. in any case, it’s no longer an OpenCV problem. OpenCV can do nothing about this. it’s all ffmpeg. you confirmed that using ffplay fails on that URL.
Is there a way to delay the captures or drop the captures if they are empty or maybe i should use any buffering technics? It seems like it need long time to read a capture…
Hi dear community! Any help would be really appreciated, i still can’t find solution. I try to use standalone gstreamer with the following command: gst-launch-1.0 -v playbin uri=rtsp://admin:8888@xxx.xx.xx.xxx:1987/rtsp_live1 uridecodebin0::source::latency=300
and it works good with port forwarded video stream, but if i try the same command in opencv it doesn’t work: cv::VideoCapture source("rtsp://admin:8888@xxx.xx.xx.xxx:1987/rtsp_live1 uridecodebin0::source::latency=300", cv::CAP_GSTREAMER);
do not pay attention on the previous screenshot with opencv configuration, i rebuild the opencv using cmake with gstreamer support and my current version of openCV support gstreamer.