系统相关
首页 > 系统相关> > ubuntu18.04 cv2.VideoCapture无法读取视频

ubuntu18.04 cv2.VideoCapture无法读取视频

作者:互联网

源代码:

# 读取视频

import cv2
video_file = 'cd ~/home/edit/Projects/test/test.mp4'
cap = cv2.VideoCapture(video_file)


# 读取摄像头,0为摄像头索引,当有多个摄像头时,从0开始编号

cap = cv2.VideoCapture(0)

# 从视频或摄像头中读取一帧(即一张图像),返回是否成功标识ret(True代表成功,False代表失败),img为读取的视频帧


ret,frame = cap.read()

问题:

(python3.6:15946): GStreamer-CRITICAL **: 10:44:40.930: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (711) open OpenCV | GStreamer warning: Error opening bin: no element "cd"
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (933) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-

状态:
未解决

标签:GStreamer,读取,cap,cv2,opencv,VideoCapture,home,ubuntu18.04
来源: https://blog.csdn.net/the_beginner/article/details/119320493