title: Using gstreamer with Python OpenCV to capture live stream?
body: <p>First of all I have Python 3 with the Gstreamer library in it.</p>
  <pre><code>print(cv2.getBuildInformation())
  </code></pre>
  <p>It shows Gstreamer with YES next to it.</p>
  <p>Here is the transmitter code using gstreamer in RaspberryPi 3:</p>
  <pre><code>gst-launch-1.0 v4l2src device=&quot;/dev/video0&quot; ! video/x-raw,width=320,height=240 ! videoconvert ! x264enc tune=zerolatency ! rtph264pay ! udpsink host='my ip address' port=10000
  </code></pre>
  <p>and I will be using Python code to determine shapes, recognize objects, etc..</p>
  <p>Here is my Python code:</p>
  <pre><code>import numpy as np
  import cv2
  
  
  
  
  def receive():
  cap = cv2.VideoCapture(&quot;udpsrc port=10000 ! application/x-rtp,encoding-name=H264 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! videoconvert ! ximagesin &quot;, cv2.CAP_GSTREAMER)
  
  while True:
  
      ret,frame = cap.read()
  
      if not ret:
          print('empty frame')
          continue 
  
  
      cv2.imshow('receive', frame)
      if cv2.waitKey(1)&amp;0xFF == ord('q'):
          break
  
  
  cap.release()
  
  
  
  receive();
  </code></pre>
  <p>but it always shows empty frame.</p>
  <p>When I tried this command in the terminal:</p>
  <pre><code>gst-launch-1.0 udpsrc port=10000 ! application/x-rtp,encoding-name=H264 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! videoconvert ! ximagesink
  </code></pre>
  <p>it works just fine, so the problem is on my Python end.</p>
  <p>What do you recommend?</p>