title: How to use Opencv VideoWriter with GStreamer?
body: <p>I am trying to transfer a h264 stream using Opencv VideoWriter to get it on another pc on the network using VideoCapture. However, I am stuck on VideoWriter. Execution of this code returns with an error and out.isOpened () is always false.</p>
  
  <pre><code>    int FOURCC = cv::VideoWriter::fourcc('H', '2', '6', '4');
      cv::VideoWriter out;
      out.open ("appsrc ! videoconvert ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast ! rtph264pay ! udpsink host=127.0.0.1 port=5000",
          cv::CAP_GSTREAMER,
          FOURCC,
          16,
          cv::Size (640, 480),
          true);
  
      if (!out.isOpened ()) {
          qDebug () &lt;&lt; "\ n ***** Failed to open videowriter *****";
          return -1;
      }
  
  [ WARN:0] global D:\Libs\opencv-4.3.0\modules\videoio\src\cap_gstreamer.cpp (1274) cv::CvVideoWriter_GStreamer::close_ OpenCV | GStreamer warning: No source in GStreamer pipeline. Ignore
  [ERROR:0] global D:\Libs\opencv-4.3.0\modules\videoio\src\cap.cpp (527) cv::VideoWriter::open VIDEOIO(GSTREAMER): raised OpenCV exception:
  OpenCV(4.3.0) D:\Libs\opencv-4.3.0\modules\videoio\src\cap_gstreamer.cpp:144: error: (-215:Assertion failed) ptr in function 'cv::`anonymous-namespace'::GSafePtr&lt;struct _GstElement&gt;::get'
  
  ***** Failed open videowriter *****
  </code></pre>
  
  <p>Even a simple example returns me an error and out.isOpened() false.</p>
  
  <pre><code>    out.open("autovideosrc ! videoconvert ! appsink",
               cv::CAP_GSTREAMER,
               FOURCC,
               16,
               cv::Size(640, 480),
               true);
  
  [ WARN:0] global D:\Libs\opencv-4.3.0\modules\videoio\src\cap_gstreamer.cpp (1500) cv::CvVideoWriter_GStreamer::open    OpenCV | GStreamer warning: OpenCV backend does not support this file type (extension): autovideosrc ! videoconvert !   appsink
  [ WARN:0] global D:\Libs\opencv-4.3.0\modules\videoio\src\cap_gstreamer.cpp (1274) cv::CvVideoWriter_GStreamer::close_  OpenCV | GStreamer warning: No source in GStreamer pipeline. Ignore
  
      ***** Failed to open videowriter *****
  </code></pre>
  
  <p>The version of opencv 4.3.0 is compiled from source code with gstreamer support.
  cv::getBuildInformation () says:</p>
  
  <pre><code>    Video I/O:
        DC1394: NO
        FFMPEG: YES (prebuilt binaries)
          avcodec: YES (58.54.100)
          avformat: YES (58.29.100)
          avutil: YES (56.31.100)
          swscale: YES (5.5.100)
          avresample: YES (4.0.0)
        GStreamer: YES (1.16.2)
        DirectShow: YES
        Media Foundation: YES
          DXVA: YES
  </code></pre>
  
  <p>How can I stream the stream? What parameters should be specified by VideoWriter? I tried various tips from google, but none of them helped me. I would be grateful for a simple example of how to send a stream from VideoWriter on one side and receive it from VideoCapture on the other.
  I am using Windows 10 x64 and Qt5.13 MSVC2017</p>