1

I'm trying to get working OpenCV with GStreamer to get IP camera rtsp stream. But it is giving error which is (with opencv-master branch, Gstreamer 1.2.4, Raspbian 3.18.7-v7+:

GStreamer Plugin: Embedded video playback halted; module typefind reported: Could not determine type of stream.
OpenCV Error: Unspecified error (GStreamer: unable to start pipeline) in cvCaptureFromCAM_GStreamer, file in /opt/opencv/modules/videoio/src/cap_gstreamer.cpp, line773
terminate called after throwing an instance of 'cv::Exception'
  what(): /opt/opencv/modules/videoio/src/cap_gstreamer.cpp:773: error: (-2) GStreamer: unable to start pipeline
 in function cvCaptureFromCAM_GStreamer

Aborted

and also it has given the same error with opencv-2.4.10. I'm getting stream with omxplayer and gst-launch-1.0 (frames rotated 180 degrees why I don't know) and also getting stream with OpenCV with FFMPEG but its H264 is not decoding video correctly. Images are distortioning continuously like this. I can open streams with Raspberry Pi 1 with GStreamer but it's too slow approximately 1/30 fps. Code;

const string Address = "rtsp://user:password@xxx.xxx.xxx.xxx:xxx/cam/realmonitor?channel=1&subtype=0";
int main () {
  cv::VideoCapture video;
  cv::Mat im;
  video.open(Address);
  while (video.isOpened()) {
    video >> im;
    if (!im.data) break;
    if (cv::waitKey(30) >= 0) break;
  }
  return 0;
}

Why GStreamer is not working with OpenCV ?

Thanks.

  • 1
    I've compiled gstreamer-1.4.5 and it's working correctly with opencv from raspberry pi but when compiled and installed gstreamer/ we must define the PKG_CONFIG_PATH, LD_LIBRARY_PATH then starts to compile for gst-ocr (if wanted) -> gst-plugins-base (when installed, we need to define GST_PLUGIN_PATH) -> gst-plugins-good -> gst-plugins-ugly -> gst-plugins-bad -> gst-omx (when installed, define GST_OMX_CONFIG_DIR=${install-dir}/etc/xdg). Now playing rtsp without rotation and working with opencv but still slow so I don't know will opencv give gstreamer with omx support or also is giving? – Orkun Kasapoglu Feb 17 '15 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.