title: GStreamer-CRITICAL **: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed error in Opencv
body: <p>Am trying to open the web camera through GSTREAMER API using Opencv on windows, but am getting 
  this error at runtime</p>
  
  <blockquote>
    <p>GStreamer-CRITICAL **: gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed
    OpenCV | GStreamer warning: GStreamer: unable to query pipeline state</p>
  </blockquote>
  
  <p>Below is code am running</p>
  
  <pre><code>VideoCapture capture(0,CAP_GSTREAMER);
  
  if (capture.isOpened()) {
      std::cout &lt;&lt; "Camera 0 via " &lt;&lt; capture.getBackendName() &lt;&lt; " backend" &lt;&lt; std::endl;
      std::cout &lt;&lt; "Frame width: " &lt;&lt; capture.get(CAP_PROP_FRAME_WIDTH) &lt;&lt; std::endl;
      std::cout &lt;&lt; "     height: " &lt;&lt; capture.get(CAP_PROP_FRAME_HEIGHT) &lt;&lt; std::endl;
      std::cout &lt;&lt; "Capturing FPS: " &lt;&lt; capture.get(CAP_PROP_FPS) &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>However camera is working fine with Gstreamer command </p>
  
  <blockquote>
    <p>gst-launch-1.0.exe -v ksvideosrc device-index=0 ! autovideosink</p>
  </blockquote>
  
  <p>I have built OpenCV4.0 with GStreamer enabled, what exactly missing element here and is there a fix for this? </p>