Toybrick

标题: rk3399pro使用opencv调用gstreamer出错 [打印本页]

作者: gungnir    时间: 2021-9-9 17:05
标题: rk3399pro使用opencv调用gstreamer出错
首先我按步骤编译安装了Mpp和gstreamer-rockchip,然后用以下shell命令成功硬解视频
  1. gst-launch-1.0 filesrc location=/home/toybrick/yolov5/test_data/20210728105542_1km.mp4 ! decodebin ! rkximagesink
复制代码
但是我使用opencv调用gstreamer时
  1. gst='filesrc location=/home/toybrick/yolov5/test_data/20210728105542_1km.mp4 ! decodebin ! rkximagesink'
  2. cap = cv.VideoCapture(gst,cv.CAP_GSTREAMER)

  3. if not cap.isOpened():
  4.     print("Cannot capture from camera. Exiting.")
  5.     #os._exit()

  6. while(True):

  7.     ret, frame = cap.read()
  8.     if ret:
  9.         cv.imshow('frame', frame)

  10.     if cv.waitKey(1) & 0xFF == ord('q'):
  11.         break

  12. cap.release()
  13. cv.destroyAllWindows()
复制代码
出现了以下错误:
  1. root@debian10:/home/toybrick/yolov5# python gstreamer.py
  2. [ WARN:0] OpenCV | GStreamer warning: cannot find appsink in manual pipeline
  3. [ WARN:0] OpenCV | GStreamer warning: GStreamer: pipeline have not been created
  4. Cannot capture from camera. Exiting.
复制代码
按理说opencv调用gstreamer的方法和直接在shell中调用的方法应该是差不多的,为啥会出现这种错误





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