Unable to open gstreamer pipeline using opencv Vid

2019-06-08 08:05发布

I wrote a program that reads frames from a gstreamer pipeline, processes them with opencv libraries and then writes back to the gstreamer pipeline.

Code snippet:

cv::VideoCapture cap("v4l2src ! video/x-raw, framerate=30/1, width=640, height=480, format=RGB ! videoconvert ! appsink");
if (!cap.isOpened()) {
    printf("=ERR= can't create video capture\n");
    return -1;
}

cv::VideoWriter writer;
writer.open("appsrc ! videoconvert ! x264enc noise-reduction=10000 tune=zerolatency byte-stream=true threads=4 key-int-max=15 ! mpegtsmux ! udpsink host=localhost port=9999"
            , 0, (double)15, cv::Size(640, 480), true);
if (!writer.isOpened()) {
    printf("=ERR= can't create video writer\n");
    return -1;
}

/* Read/write frames as usual */
// Mat frame
// while true
//     cap >> frame
//     process the frame
//     writer << frame

The program works great on my ubuntu 14.04 64bit VM. When I trying to run it on Jetson TK1, however, VideoCapture and VideoWriter always return false on isOpened().

I was using Opencv4Tegra, then I built opencv from source and installed it. Both were having the same problem. Does anyone know why VideoCapture can't open gstreamer pipeline on Jetson TK1? Is it because it doesn't work on 32bit machines?

Note that I'm using Opencv 2.4.13 and Gstreamer 1.2 and camera Logitech C310.

0条回答
登录 后发表回答