title: Access an IP camera with Raspberry Pi2, OpenCV and GStreamer: Gstremaer unable to start pipeline
body: <p>I'm trying to get frames from an IP camera. I can get frames with FFMPEG or GStreamer from my Ubuntu 14.04 PC and <code>omxplayer</code> or <code>gst-launch-1.0</code> from Raspberry Pi. But when I want to access camera with c++ OpenCV from Raspberry Pi, it is giving me an error about GStreamer pipeline;</p>
  
  <pre><code>(ocvip:2870): GStreamer-WARNING **: Failed to load plugin '/usr/local/lib/gstreamer-1.0/libgstrtsp.so': /usr/local/lib/gstreamer-1.0/libgstrtsp.so: undefined symbol: gst_rtsp_connection_set_tls_validation_flags
  GStreamer Plugin: Embedded video playback halted; module u-uridecodebin, reported: URI was not accepted by any element
  OpenCV Error: Unspecified error (GStreamer: unable to start pipeline) in icvStartPipeline, file /opt/opencv-2.4.10/modules/highgui/src/cap_gstreamer.cpp, line 383
  what(): /opt/opencv-2.4.10/modules/highgui/src/cap_gstreamer.cpp:383: error: (-2) GStreamer unable to start pipeline in function icvStartPipeline
  
  Aborted
  </code></pre>
  
  <p>code:</p>
  
  <pre><code>const string videoAddress = "rtsp://user:password@xxx.xxx.x.xxx:xxx/cam/realmonitor?channel=1&amp;subtype=1";
  int main() {
    cv::VideoCapture video;
    cv::Mat im;
    cv::namedWindow("IP", 1);
    video.open(videoAddress);
    if (video.isOpened()) {
      video &gt;&gt; im;
      if (!im.data) break;
      cv::imshow("IP", im);
      if (cv::waitKey(20) &gt;= 0) break;
    }
  }
  </code></pre>
  
  <p>I can access camera with same rtsp address, omxplayer is showing normal gst-launch is showing frames rotated by 180 degrees. I've built GStreamer-1.0 using <a href="http://www.onepitwopi.com/raspberry-pi/gstreamer-1-2-on-the-raspberry-pi/" rel="nofollow">this page</a> because prebuilt libraries hasn't found by cmake. I found <a href="http://code.opencv.org/issues/3953" rel="nofollow">this issue</a>. There are two fixes int this bug but I'm not sure are these the correct solutions and solve my problem because I'm not accessing camera with <code>video.open(0)</code> so I couldn't do like <code>video.open(IPAddress + CV_CAP_PVAPI)</code>?</p>
  
  <p>Thanks.</p>