Toybrick

求助,c++中opencv读取本地视频出错!

Sean

中级会员

积分
249
楼主
发表于 2019-10-16 10:51:10    查看: 7095|回复: 2 | [复制链接]    打印 | 只看该作者
这是代码:

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

中级会员

积分
249
沙发
 楼主| 发表于 2019-10-16 16:21:46 | 只看该作者
    sudo dnf install https://download1.rpmfusion.org/ ... usion-free-release-$(rpm -E %fedora).noarch.rpm
    sudo dnf install gstreamer1-libav
请问这两句怎么在板子上安装不起了
回复

使用道具 举报

appleUncle

中级会员

积分
440
板凳
发表于 2019-12-27 10:27:13 | 只看该作者
我遇到了和你们一样的问题,花了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
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表