当前位置:   article > 正文

海康、大华IpCamera RTSP地址和格式_"ip_camera = camera.camera(\"rtsp://admin:guoxun12

"ip_camera = camera.camera(\"rtsp://admin:guoxun123456@192.168.1.64/streaming/"

海康:
rtsp://[username]:[password]@[ip]:[port]/[codec]/[channel]/[subtype]/av_stream
说明:
username: 用户名。例如admin。
password: 密码。例如12345。
ip: 为设备IP。例如 192.0.0.64。
port: 端口号默认为554,若为默认可不填写。
codec:有h264、MPEG-4、mpeg4这几种。
channel: 通道号,起始为1。例如通道1,则为ch1。
subtype: 码流类型,主码流为main,辅码流为sub。

例如,请求海康摄像机通道1的主码流,Url如下
主码流:
rtsp://admin:12345@192.0.0.64:554/h264/ch1/main/av_stream
rtsp://admin:12345@192.0.0.64:554/MPEG-4/ch1/main/av_stream

子码流:
rtsp://admin:12345@192.0.0.64/mpeg4/ch1/sub/av_stream
rtsp://admin:12345@192.0.0.64/h264/ch1/sub/av_stream

大华:
rtsp://username:password@ip:port/cam/realmonitor?channel=1&subtype=0
说明:
username: 用户名。例如admin。
password: 密码。例如admin。
ip: 为设备IP。例如 192.168.0.254。
port: 端口号默认为377,若为默认可不填写。
channel: 通道号,起始为1。例如通道1,则为channel=1。
subtype: 码流类型,主码流为0(即subtype=0),辅码流为1(即subtype=1)。

例如,请求某设备的通道2的辅码流,Url如下
rtsp://admin:admin@192.168.0.254:377/cam/realmonitor?channel=1&subtype=1

代码如下(前提是已经配好OPENCV)

#include<iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
 
int main()
{
   String rtsp_addr = "rtsp://admin:123456@192.168.0.254/Streaming/Channels/1";
    VideoCapture cap(rtsp_addr);
    if(!cap.isOpened())
    {
        cout<<"create camera capture error"<<endl;
        system("pause");
        exit(-1);
    }
     while(1)
    {
        Mat frame;
        cap>>frame;
        imshow("视频读入",frame);
        waitKey(30);
    }
    return 0;
}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/383164
推荐阅读
相关标签
  

闽ICP备14008679号