All Projects → RootSoft → ONVIF-Java

RootSoft / ONVIF-Java

Licence: Apache-2.0 License
A Java client library to discover, control and manage ONVIF-supported devices.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to ONVIF-Java

onvif-nvt
ONVIF library for NVT (Network Video Transmitter) devices.
Stars: ✭ 62 (-34.04%)
Mutual labels:  camera, onvif, ipcamera
Androidffmpeg
android 读取摄像头和麦克风,使用rtmp推流
Stars: ✭ 298 (+217.02%)
Mutual labels:  h264, camera
Haishinkit.swift
Camera and Microphone streaming library via RTMP, HLS for iOS, macOS, tvOS.
Stars: ✭ 2,237 (+2279.79%)
Mutual labels:  h264, camera
Trinity
android video record editor muxer sdk
Stars: ✭ 609 (+547.87%)
Mutual labels:  h264, camera
Nager.VideoStream
Get images from a network camera stream or webcam
Stars: ✭ 27 (-71.28%)
Mutual labels:  h264, camera
Media Stream Library Js
JavaScript library to handle media streams on the command line (Node.js) and in the browser.
Stars: ✭ 192 (+104.26%)
Mutual labels:  h264, camera
Obs Ios Camera Source
Use your iPhone camera as a video source in OBS Studio and stream high quality video from your iPhone's camera over USB
Stars: ✭ 199 (+111.7%)
Mutual labels:  h264, camera
mini
OpenSource Mini IP camera streamer
Stars: ✭ 64 (-31.91%)
Mutual labels:  h264, ipcamera
rrtsp client
Rust high level RTSP client
Stars: ✭ 12 (-87.23%)
Mutual labels:  h264, onvif
CamHell
Ingenic T10 IP camera crawler
Stars: ✭ 53 (-43.62%)
Mutual labels:  camera, ipcamera
dji-ryze-tello
Pythonic DJI Ryze Tello Workbench
Stars: ✭ 17 (-81.91%)
Mutual labels:  h264
onvif-viewer
Onvif Viewer capable of a rudimentary HMI/SCADA interface
Stars: ✭ 27 (-71.28%)
Mutual labels:  onvif
Android-Text-Scanner
Read text and numbers with android camera OCR
Stars: ✭ 27 (-71.28%)
Mutual labels:  camera
Maple-Syrup-Pi-Camera
Low power smart camera (3D printed) based on the Raspberry Pi Zero W and Google Coral EdgeTPU
Stars: ✭ 31 (-67.02%)
Mutual labels:  camera
Album
android 图片视频加载库,单选,多选,预览,自定义UI,相机,裁剪...等等 已适配android10,11
Stars: ✭ 53 (-43.62%)
Mutual labels:  camera
onvif-discovery
C# .NetStandard 2.0 library to discover ONVIF compliant devices
Stars: ✭ 29 (-69.15%)
Mutual labels:  onvif
x264
🎥 A safe x264 wrapper for Rust.
Stars: ✭ 35 (-62.77%)
Mutual labels:  h264
VisionLab
📺 A framework with common source code for demo projects that use Vision Framework
Stars: ✭ 32 (-65.96%)
Mutual labels:  camera
tethr
JavaScript/TypeScript library built on top of WebUSB for controlling digital cameras from browsers.
Stars: ✭ 62 (-34.04%)
Mutual labels:  camera
VehicleInfoOCR
Use your camera to read number plates and obtain vehicle details. Simple, ad-free and faster alternative to existing playstore apps
Stars: ✭ 35 (-62.77%)
Mutual labels:  camera

ONVIF-Java


Download

ONVIF is an open industry forum that provides and promotes standardized interfaces for effective interoperability of IP-based physical security products. ONVIF was created to make a standard way of how IP products within CCTV and other security areas can communicate with each other.

Features

  • ONVIF & UPnP discovery
  • ONVIF device management (Services, device information, media profiles, raw media stream uri)
  • UPnP device information
  • Easily extendable with your own requests
  • Android supported!

Discovery


The OnvifDiscovery class uses the Web Services Dynamic Discovery (WS-Discovery). This is a technical specification that defines a multicast discovery protocol to locate services on a local network. It operates over TCP and UDP port 3702 and uses IP multicast address 239.255.255.250. As the name suggests, the actual communication between nodes is done using web services standards, notably SOAP-over-UDP.

With WS-Discovery, the discovery tool puts SSDP queries on the network from its unicast address to 239.255.255.250 multicast address, sending them to the well-known UDP port 3702. The device receives the query, and answers to the discovery tool's unicast IP address from its unicast IP address. The reply contains information about the Web Services (WS) available on the device.

UPnP works in a very similar way, but on a different UDP port (1900). Compared to the WS-Discovery, the UPnP is intended for a general use (data sharing, communication, entertainment).

DiscoveryManager manager = new DiscoveryManager();
manager.setDiscoveryTimeout(10000);
manager.discover(new DiscoveryListener() {
    @Override
    public void onDiscoveryStarted() {
        System.out.println("Discovery started");
    }

    @Override
    public void onDevicesFound(List<Device> devices) {
        for (Device device : devices)
            System.out.println("Devices found: " + device.getHostName());
    }
});

ONVIF


With the OnvifManager class it is possible to send requests to an ONVIF-supported device. All requests are sent asynchronously and you can use the OnvifResponseListener for errors and custom response handling. It is possible to create your own OnvifDevice or retrieve a list from the discover method in the DiscoveryManager

onvifManager = new OnvifManager();
onvifManager.setOnvifResponseListener(this);
OnvifDevice device = new OnvifDevice("192.168.0.131", "username", "password");

Services

Returns information about services on the device.

onvifManager.getServices(device, new OnvifServicesListener() {
    @Override
    public void onServicesReceived(@Nonnull OnvifDevice onvifDevice, OnvifServices services) {
        
    }
});

Device information

Returns basic device information from the device. This includes the manufacturer, serial number, hardwareId, ...

onvifManager.getDeviceInformation(device, new OnvifDeviceInformationListener() {
    @Override
    public void onDeviceInformationReceived(@Nonnull OnvifDevice device, 
                                            @Nonnull OnvifDeviceInformation deviceInformation) {
        
    }
});

Media Profiles

Returns pre-configured or dynamically configured profiles. This command lists all configured profiles in a device. The client does not need to know the media profile in order to use the command.

onvifManager.getMediaProfiles(device, new OnvifMediaProfilesListener() {
    @Override
    public void onMediaProfilesReceived(@Nonnull OnvifDevice device, 
                                        @Nonnull List<OnvifMediaProfile> mediaProfiles) {
        
    }
});

Media Stream URI

Returns a raw media stream URI that remains valid indefinitely even if the profile is changed.

onvifManager.getMediaStreamURI(device, mediaProfiles.get(0), new OnvifMediaStreamURIListener() {
    @Override
    public void onMediaStreamURIReceived(@Nonnull OnvifDevice device, 
                                        @Nonnull OnvifMediaProfile profile, @Nonnull String uri) {
        
    }
});

UPnP


With the UPnPManager it is possible to retrieve device information from a locally connected UPnP device. A UPnPDevice can be created manually or discovered from the DiscoveryManager using discovery.discover(DiscoveryMode.UPNP)

UPnPDevice device = new UPnPDevice("192.168.0.160");
device.setLocation("http://192.168.0.160:49152/rootdesc1.xml");
UPnPManager uPnPManager = new UPnPManager();
uPnPManager.getDeviceInformation(device, new UPnPDeviceInformationListener() {
    @Override
    public void onDeviceInformationReceived(@Nonnull UPnPDevice device, 
                                            @Nonnull UPnPDeviceInformation information) {
        Log.i(TAG, device.getHostName() + ": " + information.getFriendlyName());
    }
    @Override
    public void onError(@Nonnull UPnPDevice onvifDevice, int errorCode, String errorMessage) {
        Log.e(TAG, "Error: " + errorMessage);
    }
});

Custom requests


It is possible to implement your custom ONVIF request by creating a new class and implementing the OnvifRequest interface and overriding the getXml() and getType() methods.

public class PTZRequest implements OnvifRequest {
    @Override
    public String getXml() {
        return "<GetServices xmlns=\"http://www.onvif.org/ver10/device/wsdl\">" +
                "<IncludeCapability>false</IncludeCapability>" +
                "</GetServices>";
    }
    @Override
    public OnvifType getType() {
        return OnvifType.CUSTOM;
    }
}

and send it to the appropriate OnvifDevice:

onvifManager.sendOnvifRequest(device, new PTZRequest());

Use the OnvifResponseListener to receive responses from your custom requests.

Android


In order to receive multicasts packets on your Android device, you'll have to acquire a lock on your WifiManager before making a discovery. Make sure to release the lock once the discovery is completed. More information can be found here: https://developer.android.com/reference/android/net/wifi/WifiManager.MulticastLock

private void lockMulticast() {
    WifiManager wifi = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
    if (wifi == null)
        return;

    WifiManager.MulticastLock lock = wifi.createMulticastLock("ONVIF");
    lock.acquire();
}

Download

Download the latest JAR or grab via Maven:

<dependency>
  <groupId>be.teletask.onvif</groupId>
  <artifactId>onvif</artifactId>
  <version>1.0.0</version>
</dependency>

or Gradle:

compile 'be.teletask.onvif:onvif:1.0.0'

Todos

  • Implementation ONVIF version management
  • Implementation PTZ

Pull Requests


Feel free to send pull requests.

License

Copyright 2018 TELETASK BVBA.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].