GStreamer + OpenCV using Raspberry Pi + Mac OSX

asked 2017-06-04 14:06:02 -0600

hongyuanlu gravatar image

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:

Mac:

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

RPi:

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=129.31.224.100 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!

edit retag flag offensive close merge delete

Comments

did you build opencv with gstreamer support ? (check cv::getBuildInformation())

berak gravatar imageberak ( 2017-06-05 01:38:14 -0600 )edit

I added it now and it is still not working..

hongyuanlu gravatar imagehongyuanlu ( 2017-06-05 05:12:16 -0600 )edit

@berak One more question, is it possible to get the appsink in use? I want to check the buffer of it..

hongyuanlu gravatar imagehongyuanlu ( 2017-06-05 05:16:41 -0600 )edit