title: Opencv and Gstreamer
body: <p>i'm trying to send opencv video <strong>cv2.VideoCapture()</strong> 
  bash code work excelent, but when I copy it to appsrc it don't want to work</p></p>
  
  <p>bash:</p>
  
  <pre><code>send `gst-launch-1.0 -v v4l2src device='/dev/video0' ! video/x-raw,width=640,height=480,framerate=30/1,encoding-name=JPEG! jpegenc ! rtpjpegpay ! udpsink host=127.0.0.1 port=5000`
  
  recv `gst-launch-1.0 -v udpsrc port=5000 ! "application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)JPEG" ! rtpjpegdepay ! jpegdec ! videorate ! autovideosink sync=false
  </code></pre>
  
  <p>python code:</p>
  
  <pre><code>import cv2
  
  cap = cv2.VideoCapture(0)
  
  four = cv2.VideoWriter_fourcc(*'MJPG')
  out = cv2.VideoWriter()
  out.open("appsrc ! video/x-raw,width=640,height=480,framerate=30/1,encoding-name=JPEG! jpegenc ! rtpjpegpay ! udpsink host=127.0.0.1 port=5000",four,30.0,(640,480))
  
  if(out.isOpened()):
      print('d')
  while True:
      ret, frame = cap.read()
      if ret:
          out.write(frame)
  </code></pre>