link-onvif-client is a Java toolkit for ONVIF protocol device discovery and management:
- onvif-client-core — Core library. Implements WS-Discovery, SOAP/XML messaging, WS-Security authentication, and all major ONVIF services (Device, Media, PTZ, Imaging, Events, Recording). Packaged as a single JAR with no runtime dependencies beyond SLF4J.
- onvif-dashboard — Web application. Spring Boot backend + SPA frontend, providing a simple dashboard page for device discovery, configuration, PTZ control, and live preview.
- onvif-cli — Command-line interface. Built on picocli, enables direct ONVIF operations from the terminal with support for both interactive and scripted usage.
For questions or issues, feel free to open an issue or submit a pull request.
Features
- Device discovery — WS-Discovery multicast probe for ONVIF devices on the LAN
- Device management — Query and configure device info, hostname, network, users, date/time, NTP, DNS, and system maintenance (reboot, factory reset)
- Media streaming — Enumerate profiles, video/audio sources and encoder configurations; retrieve RTSP stream URIs and snapshot URIs
- PTZ control — Continuous, absolute, and relative moves; preset management; home position
- Imaging — Read and adjust brightness, contrast, sharpness, focus; move/stop focus
- Event subscription — Pull-point and push-mode event monitoring
- Recording — Query recording service capabilities and recording list
- Dashboard visual UI — Real-time device discovery, PTZ panel, stream preview, and event display
- CLI — Discover, interrogate, and control devices from the command line, suitable for automation and headless environments
onvif-client-core
A self-contained ONVIF library — single JAR with only SLF4J as a runtime dependency, feature-complete for device interaction. Add it to your project and start working with ONVIF devices immediately.
Build & Install Locally
git clone https://github.com/openlink2/link-onvif-client.git
cd link-onvif-client
mvn clean install -pl onvif-client-core -DskipTests
Then add the dependency to your pom.xml:
<!-- Maven -->
<dependency>
<groupId>com.openlink2.onvif</groupId>
<artifactId>onvif-client-core</artifactId>
<version>1.0.1</version>
</dependency>
Quick Example
// Connect and query device info
try (var client = new OnvifClient("http://192.168.1.100/onvif/device_service", "admin", "pass")) {
// Device information
DeviceInfo info = client.getDeviceInformation();
System.out.println(info.manufacturer() + " " + info.model());
// Hostname and time
System.out.println("Hostname: " + client.getHostname());
System.out.println("Time: " + client.getSystemDateAndTime());
// Media profiles and stream URIs
List<Profile> profiles = client.getProfiles();
for (Profile p : profiles) {
System.out.println("Profile: " + p.token() + " (" + p.name() + ")");
System.out.println(" RTSP: " + client.getStreamUri(p.token(), "RTSP").uri());
System.out.println(" Snapshot: " + client.getSnapshotUri(p.token()).uri());
}
// PTZ control (if supported)
var status = client.getPtzStatus(profiles.get(0).token());
client.continuousMove(profiles.get(0).token(), 0.5, 0, 0);
Thread.sleep(1000);
client.stopPtz(profiles.get(0).token());
// Imaging settings
var videoSources = client.getVideoSources();
if (!videoSources.isEmpty()) {
var img = client.getImagingSettings(videoSources.get(0).token());
System.out.println("Brightness: " + img.brightness());
}
}
// Blocking — returns all results after timeout
List<DiscoveryProbeResult> devices = WSDiscoveryService.discover(5000);
devices.forEach(d -> System.out.println(d.getDeviceUrl() + " " + d.getHardware()));
// Streaming — Consumer callback per device (real-time as they arrive)
WSDiscoveryService.discover(5000, device -> {
System.out.println("Found: " + device.getDeviceUrl()
+ " (" + device.getHardware() + ")");
});
// Streaming — DiscoveryListener lifecycle callbacks
WSDiscoveryService.discover(5000, new DiscoveryListener() {
@Override
public void onDiscoveryStarted() {
System.out.println("Scanning network...");
}
@Override
public void onDeviceDiscovered(DiscoveryProbeResult device) {
System.out.println(" + " + device.getDeviceName()
+ " @ " + device.getDeviceUrl());
}
@Override
public void onDiscoveryFinished(List<DiscoveryProbeResult> devices) {
System.out.println("Done — found " + devices.size() + " device(s)");
}
});
// Filter by device capabilities
DiscoveryProbeResult first = WSDiscoveryService.discover(3000).stream()
.filter(d -> d.getDeviceTypes().contains(DiscoveryProbeResult.DeviceType.PTZ))
.findFirst()
.orElse(null);
onvif-dashboard
A Spring Boot web application providing a full visual interface for ONVIF device management.
Pre-built Release
# Download and start the dashboard
wget https://github.com/openlink2/link-onvif-client/releases/download/v1.0.1/link-onvif-dashboard.jar
java -jar link-onvif-dashboard.jar
# Or start the lighter version without stream preview
wget https://github.com/openlink2/link-onvif-client/releases/download/v1.0.1/link-onvif-dashboard-no-stream-feature.jar
java -jar link-onvif-dashboard-no-stream-feature.jar
Open http://localhost:19998 in your browser.
Build from source
cd onvif-dashboard
mvn spring-boot:run
Open http://localhost:19998 in your browser.
onvif-cli
A command-line tool for direct ONVIF device operations, built with picocli.
Pre-built Release
Linux
# 1. Download
wget https://github.com/openlink2/link-onvif-client/releases/download/v1.0.1/onvif-cli-linux.tar.gz
# 2. Extract
tar xzf onvif-cli-linux.tar.gz
# 3. Add to PATH (temporary, for current session)
export PATH="$PWD/onvif-cli-linux/bin:$PATH"
# 4. Verify installation
onvif-cli --help
To make it permanent, append to your shell profile:
echo 'export PATH="$PATH:/path/to/onvif-cli-linux/bin"' >> ~/.bashrc
source ~/.bashrc
Windows (PowerShell)
# 1. Download
Invoke-WebRequest -Uri "https://github.com/openlink2/link-onvif-client/releases/download/v1.0.1/onvif-cli-windows.zip" -OutFile "onvif-cli-windows.zip"
# 2. Extract
Expand-Archive -Path "onvif-cli-windows.zip" -DestinationPath "onvif-cli"
# 3. Add to PATH (temporary, for current session)
$env:Path += ";$pwd\onvif-cli\bin"
# 4. Verify installation
onvif-cli --help
To make it permanent, add onvif-cli\bin to your system PATH via:
System Properties → Environment Variables → Path → New.
Usage examples
# Discover devices on the LAN
onvif-cli discover -t 5000
# Probe with auto-authentication (try credentials to identify authenticated devices)
onvif-cli discover -t 5000 --probe -U admin -P pass
# Query device information
onvif-cli device info http://192.168.1.100/onvif/device_service -U admin -P pass
Build from source
# Windows distribution (produces a zip with bundled JRE)
mvn package -Pcli-win
# Linux distribution (requires Docker)
mvn package -Pcli-linux
The output will be in onvif-cli/target/dist/.
Project Build
Requires JDK 17+ and Maven 3.
# Build all modules
mvn clean install -DskipTests
# Include frontend dashboard
mvn clean install -DskipTests -Pfrontend
# Include RTSP streaming support
mvn clean install -DskipTests -Pfrontend,with-stream
Comments