ExpertOnVif 1.0.1

dotnet add package ExpertOnVif --version 1.0.1
                    
NuGet\Install-Package ExpertOnVif -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ExpertOnVif" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ExpertOnVif" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="ExpertOnVif" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ExpertOnVif --version 1.0.1
                    
#r "nuget: ExpertOnVif, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ExpertOnVif@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ExpertOnVif&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=ExpertOnVif&version=1.0.1
                    
Install as a Cake Tool

ExpertOnVif SDK

ExpertOnVif is an ONVIF-compliant client library for .NET, designed for building Network Video Recorder (NVR) applications. It provides seamless integration with IP cameras supporting ONVIF standards, enabling device discovery, RTSP streaming, H.264 video recording, and basic camera management. Built on top of RtspClientSharp and Onvif.Core, it simplifies video capture, processing, and storage for surveillance and security systems.

Note: This library targets .NET Framework 4.8 (net48) and is compatible with C# 7.3. It does not include OpenCV integration in the core library but can be extended for computer vision tasks.

Features

  • ONVIF Device Discovery: Automatically detect ONVIF-compliant cameras on the local network using WS-Discovery.
  • RTSP Streaming: Connect to camera RTSP streams and receive raw H.264 frames.
  • Video Recording: Write H.264 frames directly to files with automatic file breaking (e.g., every 5 minutes) for efficient storage management.
  • Camera Configuration: Set video encoding parameters like resolution, bitrate, FPS, and more via CameraSettings.
  • PTZ Control: Basic support for Pan-Tilt-Zoom operations (via OnvifCameraClient).
  • Snapshot Capture: Retrieve JPEG snapshots from the camera.
  • Network Utilities: IP range scanning, MAC address lookup, pinging, and OUI (Organizationally Unique Identifier) queries.
  • Logging: Simple debug logging.
  • File Handling: Binary file readers/writers for chunked data, optimized for video frames.
  • Error Handling: Events for connection, disconnection, and errors.

Installation

Install via NuGet Package Manager:

Install-Package ExpertOnVif -Version 1.0.1

Or via .NET CLI:

dotnet add package ExpertOnVif --version 1.0.1

Dependencies

  • RtspClientSharp (1.3.3)
  • Onvif.Core (3.0.0)
  • System.Text.Json (10.0.0)
  • System.ServiceModel.Primitives (10.0.652802)

These are automatically resolved when installing the package.

Usage

1. Discovering Cameras

Use CameraDiscovery to find ONVIF devices on the network.

var discovery = new CameraDiscovery();
discovery.OnCameraDetected += (sender, ipAddress) => Console.WriteLine($"Camera found at {ipAddress}");
discovery.DiscoverCameras();

2. Initializing and Configuring a Camera

Create a CameraSettings object and initialize the camera using OnvifCameraClient.

var settings = new CameraSettings
{
    IPAddress = "192.168.1.10",
    Username = "admin",
    Password = "admin",
    FPS = 10,
    Width = 704,
    Height = 576,
    Bitrate = 1500
};

var onvifClient = new OnvifCameraClient();
await onvifClient.InitializeCamera(settings);

// Set camera name (OSD)
await onvifClient.SetCameraName("Front Door Camera");

3. Streaming and Recording Video

Use RTSPCamera to connect to the RTSP stream and record H.264 files.

// Define filename provider and file breaker functions
string GetFilename() => $@"C:\NVR\{DateTimeOffset.Now:yyyyMMdd}\{DateTimeOffset.Now:HHmmss}";
bool FileBreaker(DateTimeOffset creationTime) =>
    DateTimeOffset.Now.Minute % 5 == 0 && (DateTimeOffset.Now - creationTime) > TimeSpan.FromMinutes(1);

var rtspCamera = new RTSPCamera(settings.Name, GetFilename, FileBreaker, CancellationToken.None);
rtspCamera.OnVifControl = onvifClient; // Link to Onvif client
rtspCamera.OnConnect += (sender, e) => Console.WriteLine($"Connected to {rtspCamera.Name}");
rtspCamera.OnDisconnect += (sender, e) => Console.WriteLine($"Disconnected from {rtspCamera.Name}");
rtspCamera.OnError += (sender, ex) => Console.WriteLine($"Error: {ex.Message}");

rtspCamera.Start(CancellationToken.None);

4. Capturing Snapshots

byte[] snapshot = await onvifClient.GetSnapshotAsync();
File.WriteAllBytes("snapshot.jpg", snapshot);

5. Network Utilities

  • Ping a camera until responsive:

    var pingHelper = new PingHelper();
    pingHelper.PingUntilSuccessful("192.168.1.10", CancellationToken.None);
    
  • Get IP ranges:

    var ranges = NetworkHelper.GetAllIPAddressRanges();
    
  • Lookup OUI for a MAC address:

    string vendor = await NetworkHelper.GetOUIInfoAsync("00:1A:2B:3C:4D:5E");
    

6. File Handling

  • Writing H.264 frames (handled internally by H264FileWriter).
  • Reading/Writing binary files:
    using (var writer = new FileWriter("output.bin", storeChunkSize: true))
    {
        writer.Write(new byte[] { 0x01, 0x02 });
    }
    
    using (var reader = new FileReader("output.bin"))
    {
        byte[] data = reader.Read();
    }
    

Configuration

All camera settings are configurable via the CameraSettings class properties, such as FPS, Bitrate, Width, Height, etc. Use attributes like [FriendlyName] for UI-friendly display if building a configuration interface.

Events

  • OnConnect, OnDisconnect, OnError in RTSPCamera and OnvifCameraClient.
  • OnCameraDetected in CameraDiscovery.

License

This software is provided under a commercial license. See LICENSE.txt for details.

Copyright � 2025 Experts in Software Engineering, LLC. All rights reserved.

For licensing inquiries: vincent@expertsoftwareengineering.com

Contributing

This is a proprietary library. Contributions are not accepted at this time.

Contact

Product Compatible and additional computed target framework versions.
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 68 3/8/2026
1.0.0 117 12/27/2025