opencv 获取rtsp流媒体视频

      在opencv3.2.0+vs2015的环境下,是可以使用opencv读取rtsp流的. 

      cv::VideoCapture vcap; const std::string videoStreamAddress = "rtsp://admin:[email protected]:55/MPEG-4/ch1/main/av_stream";

      rtsp://192.168.1.19/vod/mp4://BigBuckBunny_175k.mov

if (!vcap.open(videoStreamAddress)) 
{
    std::cout << "Error opening video stream or file" << std::endl;
    return -1;
}

代码如下:

#include "stdafx.h"
#include 
#include 
 
using namespace std;
using namespace cv;
 
 
int main()
{
        VideoCapture cap;
        cap.open("rtsp://192.168.1.19/stream1");
 
        Mat Camera_CImg;
        Mat Camera_GImg;
 
        cap.set(CV_CAP_PROP_FRAME_HEIGHT,768);
        cap.set(CV_CAP_PROP_FRAME_WIDTH,1024);
 
        if (!cap.isOpened())
            return 1024;
 
        while (1)
        {

你可能感兴趣的:(FFmpeg开发实战指南)