Ask Your Question

Revision history [back]

GStreamer + OpenCV using Raspberry Pi + Mac OSX

The current problem I am working on is to send stream from Raspberry Pi to Mac OSX using Gstreamer and extract frames from Gstreamer using OpenCV. Here is my code:


cv::VideoCapture cap("tcpclientsrc host= port=8888 ! gdpdepay ! rtph264depay ! avdec_h264 ! "
                                 "videoconvert ! appsink");
    if (!cap.isOpened()) {
        printf("=ERR= can't create video capture\n");
        return -1;


gst-launch-1.0 wrappercamerabinsrc ! video/x-raw, 
framerate=30/1, width=1280, height=720, format=RGB ! 
videoconvert ! vtenc_h264 ! h264parse !  
rtph264pay config-interval=1 pt=96 ! gdppay ! 
tcpserversink host= port=8888

The error message is:

VIDEOIO(cvCreateFileCapture_AVFoundation (filename)): raised unknown C++ exception!

=ERR= can't create video capture

The thing I want to achieve is to read frames from gstreamer by using OpenCV.

The above command works in command line, but not working in C++ code.

Thank you in advance!