如何使用GStreamer在RTMP媒体服务器上编写/推送OpenCV处理的帧

时间:2017-11-03 09:48:10

标签: c++ opencv nginx video-streaming gstreamer

我正在使用OpenCV,我可以使用GStreamer成功读取IP摄像机视频流。

VideoCapture cap = new VideoCapture();
cap.open("rtspsrc location=rtsp://admin:admin12345@192.168.1.64:554/h264/ch33/main/av_stream" latency=0 ! decodebin ! videoconvert ! appsink");
Mat frame = new Mat();
while(cap.read(frame)) {
        // do something with mat
        .....
        // and now write the mat to RTMP stream (network)
}

我打开了如下作者:

VideoWiter writer = new VideoWriter();
boolen open = writer.open("gst-launch-1.0 -v appsrc ! ffenc_flv ! flvmux ! rtmpsink location=rtmp://192.168.1.65/mylive/stream live=1");
if(!open) {
    System.out.println("error open writer");
    return;
} 

rtmp://192.168.1.65/mylive/stream是NGINX媒体服务器地址。 所以我想将图像发送到此服务器或直接发送到HTML页面。

0 个答案:

没有答案