title: GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
body: <p>I am using the OpenCV package with the face_recognition package to detect faces on my laptop webcam.</p>
  <p>Whenever I run it, the code runs fine but I run into the same GStreamer error.</p>
  <pre><code>from imutils.video import VideoStream
  import face_recognition
  import pickle
  import argparse
  import time
  import cv2
  import imutils
  
  ap = argparse.ArgumentParser()
  ap.add_argument(&quot;-o&quot;, &quot;--output&quot;, type=str, help=&quot;path to output video&quot;)
  ap.add_argument(&quot;-y&quot;, &quot;--display&quot;, type=int, default=1,
                  help=&quot;0 to prevent display of frames to screen&quot;)
  ap.add_argument(&quot;-d&quot;, &quot;--detection&quot;, default=&quot;hog&quot;,
                  type=str, help=&quot;Detection method (hog/cnn&quot;)
  args = vars(ap.parse_args())
  
  
  print(&quot;[INFO] loading encodings...&quot;)
  
  data = pickle.load(open(&quot;encodings.p&quot;, &quot;rb&quot;))
  
  print(&quot;[INFO] starting video stream...&quot;)
  vs = VideoStream().start()
  writer = None
  time.sleep(3)
  
  while True:
  
      frame = vs.read()
  
      rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
      rgb = imutils.resize(frame, width=750)
      r = frame.shape[1] / float(rgb.shape[1])
  
      boxes = face_recognition.face_locations(rgb, model=args[&quot;detection&quot;])
      encodings = face_recognition.face_encodings(rgb, boxes)
  
      for encoding, locations in zip(encodings, boxes):
          matches = face_recognition.compare_faces(data[&quot;encodings&quot;], encoding)
          name = &quot;Unknown&quot;
          names = {}
  
          if True in matches:
              ids = [i for (i, b) in enumerate(matches) if b]
              for i in ids:
                  name = data[&quot;names&quot;][i]
                  names[name] = names.get(name, 0) + 1
  
              name = max(names, key=names.get)
  
          for (top, right, bottom, left) in boxes:
  
              top = int(top * r)
              right = int(right * r)
              bottom = int(bottom * r)
              left = int(left * r)
  
              cv2.rectangle(frame, (left, top), (right, bottom), (255, 0, 0), 3)
              y = top - 15 if top - 15 &gt; 15 else top + 15
              cv2.putText(frame, name, (left, y),
                          cv2.FONT_HERSHEY_SIMPLEX, 0.75, (255, 0, 0), 2)
  
      if writer is None and args[&quot;output&quot;] is not None:
          fourcc = cv2.VideoWriter_fourcc(*&quot;MJPG&quot;)
          writer = cv2.VideoWriter(
              args[&quot;output&quot;], fourcc, 20, (frame.shape[1], frame.shape[2]), True)
  
      if writer is not None:
          writer.write(frame)
  
      if args[&quot;display&quot;] == 1:
          cv2.imshow(&quot;frame&quot;, frame)
          key = cv2.waitKey(1)
  
          if key == ord(&quot;q&quot;):
              break
  
  cv2.destroyAllWindows()
  vs.stop()
  
  if writer is not None:
      writer.release()
  </code></pre>
  <p>I can't find any problems, yet I always get this error:</p>
  <p><code>[ WARN:0] global /home/azazel/opencv/modules/videoio/src/cap_gstreamer.cpp (935) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1</code></p>
  <p>The camera still displays and the facial recog works but what does the error signify and how can I fix it?</p>