could not open RTSP link through openCV

asked 2015-04-28 14:23:07 -0500

jakr13 gravatar image

updated 2015-04-29 02:01:00 -0500

Hello Everyone,

I have a RTSP link which I am trying to open through openCV and I have the following code snippet

#include <iostream>
#include <opencv2/opencv.hpp>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
       cv::VideoCapture cap;
       cv::Mat image;

       const std::string videocap = "rtsp://ipaddress:portaddress/user=admin&password=1234&channel=4&stream=test.sdp";

      if(!cap.open(videocap)){
                 std::cout<<"Error opening video stream or file"<<std::endl;
                 return -1;
      }

     for(;;){
         if(!cap.read(image)){
                  std::cout<<"No frame"<<std::endl;
                  cv::waitKey();
          }
     cv::imshow("output",image);
     if(cv::waitKey(33)==27)break;
     }
   }

Error: Error opening video stream or file.

Where I am going wrong? is the way I written my rtsp link correct?

Thanks in advance!!! jakr13

edit retag flag offensive close merge delete