title: Use Gst-RTSP-Server with OpenCV c++ Windows
body: <p>I am able to successfully use GStreamer to transmit <code>videotestsrc</code> to RTSP and received it using VLC on windows using <a href="https://github.com/GStreamer/gst-rtsp-server/blob/master/examples/test-video.c" rel="nofollow noreferrer">gst-rtsp-server test-video.c</a> </p>
  
  <p>Now I have built OpenCV with GStreamer and successfully transmitted UDP stream and received it via GStreamer command. I am reading a video and sending it to localhost.</p>
  
  <p>Code to stream UDP is:</p>
  
  <pre><code>#include &lt;opencv2\opencv.hpp&gt;
  #include &lt;opencv2\core\core.hpp&gt;
  #include &lt;opencv2\highgui\highgui.hpp&gt;
  
  using namespace cv;
  
  VideoCapture cap;
  int _tmain(int argc, _TCHAR* argv[])
  {
  
      Mat image1,frame;
      /*Read Image*/
  
  
      /*Read Video*/
      cap.open("Wildlife.mp4");
      VideoWriter out = VideoWriter("appsrc ! queue ! videoconvert ! video/x-raw, format=I420, width=640, height=360, framerate=30/1 ! rtpvrawpay ! udpsink host=127.0.0.1 port=5004",CAP_GSTREAMER,0,30,Size(640,360));
      while(1)
      {
          cap&gt;&gt;frame;
          if(frame.empty())
              break;
          out.write(frame);
          imshow("frame",frame);
          cvWaitKey(30);
  
      }
      return 0;
  }
  </code></pre>
  
  <p>Now I want to send a stream of my cv::Mat frames via RTSP so that it can be played via VLC or any other video player. I am also following <a href="https://stackoverflow.com/questions/55410507/how-can-i-write-open-cv-frames-to-an-rtsp-stream-with-gstreamer-and-c">this</a> question but it is so confusing</p>