(process:10728): GStreamer-CRITICAL **: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed

放肆的年华 提交于 2019-12-11 12:06:33

问题


I am using cap = cv.VideoCapture(0) When opening the camera to record video, the program will work but he prompts me ((process:10728): GStreamer-CRITICAL **: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed ) I don't know what the reason is, is it because of a problem with your cmake or a problem with the installation?


回答1:


I had similar issue in version 3.4.4, compiled with gstreamer support. Syntax "cv2.VideoCapture(0)" just stopped working. I had all gst-* libraries installed, so most of answers wasn't helpful. But finally changing VideoCapture argument to full device path ("/dev/video0") helped.




回答2:


Try:

cap = cv2.VideoCapture(0, cv2.CAP_V4L)

From this SO Answer

it works in my project



来源:https://stackoverflow.com/questions/50868893/process10728-gstreamer-critical-gst-element-get-state-assertion-gst-is

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