Unable to open gstreamer pipeline using opencv VideoCapture on Jetson TK1

蹲街弑〆低调 提交于 2019-12-08 07:16:46

问题


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.

来源:https://stackoverflow.com/questions/37904755/unable-to-open-gstreamer-pipeline-using-opencv-videocapture-on-jetson-tk1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!