Toybrick

标题: 求助,c++中opencv读取本地视频出错! [打印本页]

作者: Sean    时间: 2019-10-16 10:51
标题: 求助,c++中opencv读取本地视频出错!
这是代码:

VideoCapture camera;
camera.open("/home/toybrick/workspace/deploy/local_rtsp/tmp/1.mp4");

while (true) {
  Mat img;
  camera >> img;
  if (img.empty()) {
     cerr << "Fail to read image from camera!" << endl;
     break;
  }
}

这是报错信息:
Failed to query video capabilities: Inappropriate ioctl for device
libv4l2: error getting capabilities: Inappropriate ioctl for device
VIDEOIO ERROR: V4L: device /home/toybrick/workspace/deploy/local_rtsp/tmp/1.mp4: Unable to query number of channels
OpenCV(3.4.1) Error: Unspecified error (GStreamer: unable to start pipeline
) in cvCaptureFromCAM_GStreamer, file /builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp, line 890
VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised OpenCV exception:
OpenCV(3.4.1) /builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:890: error: (-2) GStreamer: unable to start pipeline
in function cvCaptureFromCAM_GStreamer



作者: Sean    时间: 2019-10-16 16:21
    sudo dnf install https://download1.rpmfusion.org/ ... usion-free-release-$(rpm -E %fedora).noarch.rpm
    sudo dnf install gstreamer1-libav
请问这两句怎么在板子上安装不起了

作者: appleUncle    时间: 2019-12-27 10:27
我遇到了和你们一样的问题,花了2天时间,解决了,分享一下:
1,安装gstreamer
sudo dnf install https://download1.rpmfusion.org/ ... usion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install gstreamer1-libav
试一下,不行再重装opencv
2,重装opencv,不要用dnf install opencv,源码安装解决一切bug
https://blog.csdn.net/sac761/article/details/103726065




欢迎光临 Toybrick (https://t.rock-chips.com/) Powered by Discuz! X3.3