2

I am able to successfully use GStreamer to transmit videotestsrc to RTSP and received it using VLC on windows using gst-rtsp-server test-video.c

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.

Code to stream UDP is:

#include <opencv2\opencv.hpp>
#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>

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>>frame;
        if(frame.empty())
            break;
        out.write(frame);
        imshow("frame",frame);
        cvWaitKey(30);

    }
    return 0;
}

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 this question but it is so confusing

A.k.
  • 192
  • 1
  • 22

0 Answers0