GithubHelp home page GithubHelp logo

thjjava / onvif-simple Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chengtengfei/onvif-simple

0.0 1.0 0.0 78 KB

基于Onvif Profile-S规范完成部分对接IPC(网络摄像机)的功能。

License: Apache License 2.0

Java 100.00%

onvif-simple's Introduction

English

onvif-simple

实现了部分Onvif Profile S 标准。

Getting Started

这是一个用Java写的maven jar包,你可以方便的在使用maven构建的项目中使用它。

<dependency>
    <groupId>com.github.chengtengfei</groupId>
    <artifactId>onvif-sample</artifactId>
    <version>0.0.4</version>
</dependency>

How to use it

需要引入的包

import com.github.chengtengfei.onvif.discovery.IPCDiscovery;
import com.github.chengtengfei.onvif.discovery.SingleIPCDiscovery;
import com.github.chengtengfei.onvif.model.OnvifDeviceInfo;
import com.github.chengtengfei.onvif.model.ProfileInfo;
import com.github.chengtengfei.onvif.service.OnvifService;

使用你计算机的默认IP自动发现设备(会发现和你计算机IP所在同一局域网的设备)。

try {
    List<OnvifDeviceInfo> onvifDeviceInfoList = IPCDiscovery.discovery();
    System.out.println(onvifDeviceInfoList.toString());
} catch (Exception e) {
    e.printStackTrace();
}

使用指定的IP自动发现设备(适合多网卡计算机,指定其中一个网卡IP来发现同一局域网下的设备)。

try {
    List<OnvifDeviceInfo> onvifDeviceInfoList = IPCDiscovery.discovery("192.168.101.1");
    System.out.println(onvifDeviceInfoList.toString());
} catch (Exception e) {
    e.printStackTrace();
}

获取Onvif服务地址.

try {
    OnvifDeviceInfo onvifDeviceInfo = new OnvifDeviceInfo();
    onvifDeviceInfo.setIp("192.168.101.234");
    onvifDeviceInfo.setUsername("admin");
    onvifDeviceInfo.setPassword("admin");
    SingleIPCDiscovery.fillOnvifAddress(onvifDeviceInfo);
    System.out.println(onvifDeviceInfo);
} catch (Exception e) {
    e.printStackTrace();
}

// Output : OnvifDeviceInfo{ip='192.168.101.234', onvifAddress='http://192.168.101.234:2000/onvif/device_service', username='admin', password='admin'}

获取设备媒体信息。

try {
    OnvifDeviceInfo onvifDeviceInfo = new OnvifDeviceInfo();
    onvifDeviceInfo.setIp("192.168.101.234");
    onvifDeviceInfo.setUsername("admin");
    onvifDeviceInfo.setPassword("admin");
    SingleIPCDiscovery.fillOnvifAddress(onvifDeviceInfo);
    List<ProfileInfo> profileInfoList = OnvifService.getVideoInfo(onvifDeviceInfo);
    System.out.println(profileInfoList);
} catch (Exception e) {
    e.printStackTrace();
}

// Output : [ProfileInfo{name='profile0', token='profile0', videoInfo=VideoInfo{videoEncoding='H264', videoWidth=1920, videoHeight=1080, frameRateLimit=25, bitrateLimit=4096, streamUri='rtsp://admin:[email protected]:554/av0_0'}}, ProfileInfo{name='profile1', token='profile1', videoInfo=VideoInfo{videoEncoding='H264', videoWidth=704, videoHeight=576, frameRateLimit=25, bitrateLimit=1024, streamUri='rtsp://admin:[email protected]:554/av0_1'}}]

Authors

License

This project is licensed under the Apache 2.0 License.

Acknowledgments

onvif-simple's People

Contributors

chengtengfei avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.