title: How to open a GStreamer pipeline from OpenCV with VideoWriter
body: <p>I am capturing video frames with OpenCV VideoCapture. The capturing works fine as I am able to use the frames like this:</p>
  
  <pre><code>cv::VideoCapture cap("v4l2src device=/dev/video1 ! videoscale ! videorate ! video/x-raw, width=640, height=360, framerate=30/1 ! videoconvert ! appsink");
  cv::imshow("feed", frame);
  </code></pre>
  
  <p>I would also like to send the stream  over the network and here is where I am stuck. Somehow I am failing in the appsrc pipeline part. I want to encode the stream to jpeg and send it vie udp. This is what I got:</p>
  
  <pre><code>cv::VideoWriter writer
  writer.open("appsrc ! videoconvert ! jpegenc ! jpegparse ! rtpjpegpay pt=96 ! udpsink host=192.168.1.25 port=5000", 0, (double)30, cv::Size(640, 360), true);
  </code></pre>
  
  <p>Looks like the above line does not do anything. The <code>writer &lt;&lt; frame</code>does not do anything. Also this gstreamer command does not display anything:</p>
  
  <pre><code>gst-launch-1.0 udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, payload=(int)96" ! rtpjpegdepay ! jpegdec ! decodebin ! videoconvert ! autovideosink
  </code></pre>
  
  <p>I dont know where am I failing  in the <code>writer.open</code> part. If I run the gstreamer commands like this bellow they work:</p>
  
  <pre><code>gst-launch-1.0 v4l2src device=/dev/video1 ! videoscale ! videorate ! video/x-raw, width=640, height=360, framerate=30/1 ! jpegenc ! jpegparse ! rtpjpegpay pt=96 ! udpsink host=192.168.1.25 port=5000
  gst-launch-1.0 udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)JPEG, payload=(int)96" ! rtpjpegdepay ! jpegdec ! decodebin ! videoconvert ! autovideosink
  </code></pre>