Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV | GStreamer warning: GStreamer: unable to query pipeline state

Am trying to open the web camera through GSTREAMER API using Opencv on windows, but am getting this error at runtime

GStreamer-CRITICAL **: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed OpenCV | GStreamer warning: GStreamer: unable to query pipeline state

Below is code am running

VideoCapture capture(0,CAP_GSTREAMER);

if (capture.isOpened()) {
    std::cout << "Camera 0 via " << capture.getBackendName() << " backend" << std::endl;
    std::cout << "Frame width: " << capture.get(CAP_PROP_FRAME_WIDTH) << std::endl;
    std::cout << "     height: " << capture.get(CAP_PROP_FRAME_HEIGHT) << std::endl;
    std::cout << "Capturing FPS: " << capture.get(CAP_PROP_FPS) << std::endl;
}

However camera is working fine with Gstreamer command

gst-launch-1.0.exe -v ksvideosrc device-index=0 ! autovideosink

I have built OpenCV4.0 with GStreamer enabled on Windows, what exactly missing element here and is there a fix for this?

OpenCV | GStreamer warning: GStreamer: unable to query pipeline state

Am trying to open the web camera through GSTREAMER API using Opencv on windows, but am getting this error at runtime

GStreamer-CRITICAL **: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed OpenCV | GStreamer warning: GStreamer: unable to query pipeline state

Below is code am running

VideoCapture capture(0,CAP_GSTREAMER);

if (capture.isOpened()) {
    std::cout << "Camera 0 via " << capture.getBackendName() << " backend" << std::endl;
    std::cout << "Frame width: " << capture.get(CAP_PROP_FRAME_WIDTH) << std::endl;
    std::cout << "     height: " << capture.get(CAP_PROP_FRAME_HEIGHT) << std::endl;
    std::cout << "Capturing FPS: " << capture.get(CAP_PROP_FPS) << std::endl;
}

However camera is working fine with Gstreamer command

gst-launch-1.0.exe -v ksvideosrc device-index=0 ! autovideosink

I have built OpenCV4.0 with GStreamer enabled on Windows, what exactly missing element here and is there a fix for this?