Back to Resources
Technical Guide

ONVIF Profile Implementation: Complete Developer Guide

Step-by-step technical guide for implementing ONVIF Profile S, G, and T in IP camera firmware, including code examples and conformance testing.

SECUTRONIC Engineering
November 28, 2024
35 min read
ONVIFProtocolIntegrationFirmware

Understanding ONVIF Standards

ONVIF (Open Network Video Interface Forum) defines standardized interfaces for IP-based physical security products. This guide covers implementation of the three most important profiles for video surveillance systems.

ONVIF Profile Overview

ProfilePurposeKey Features
Profile SVideo StreamingRTSP streaming, PTZ control, video configuration
Profile GRecordingEdge storage, recording search, playback
Profile TAdvanced StreamingH.265, imaging settings, motion detection

Profile S Implementation

Profile S is the foundation for video streaming interoperability. Implementation requires the following core services:

Device Service

The Device Service provides device discovery and management capabilities:

xml
<!-- GetDeviceInformation Response -->
<tds:GetDeviceInformationResponse>
  <tds:Manufacturer>SECUTRONIC</tds:Manufacturer>
  <tds:Model>SEC-AI-4K Pro</tds:Model>
  <tds:FirmwareVersion>2.4.1</tds:FirmwareVersion>
  <tds:SerialNumber>SEC2024001234</tds:SerialNumber>
  <tds:HardwareId>HW-REV-3.0</tds:HardwareId>
</tds:GetDeviceInformationResponse>

Media Service

The Media Service configures video profiles and streaming. Each profile combines video source, encoder, and optional PTZ configuration:

  • VideoSourceConfiguration: Defines the video input (sensor)
  • VideoEncoderConfiguration: Specifies codec parameters (H.264/H.265)
  • PTZConfiguration: Links to PTZ control if available
  • AudioSourceConfiguration: Optional audio input settings
  • AudioEncoderConfiguration: Audio codec parameters

ONVIF requires at least one media profile to be pre-configured. Most implementations provide a "Main Stream" and "Sub Stream" profile by default.

Streaming Service

The Streaming Service provides RTSP URIs for video access. Implementation must support both unicast and multicast delivery:

text
RTSP URI Format:
rtsp://<device-ip>:<port>/onvif/profile<N>/media.smp

Example:
rtsp://192.168.1.100:554/onvif/profile1/media.smp

Profile G Implementation

Profile G adds edge recording and playback capabilities. Key components include:

Recording Service

Manages recording jobs and configurations:

  • CreateRecording: Initialize storage allocation
  • CreateRecordingJob: Define recording parameters
  • GetRecordings: List available recordings
  • DeleteRecording: Remove stored content

Search Service

Enables searching recorded content by time range or events:

xml
<!-- FindRecordings Request -->
<tse:FindRecordings>
  <tse:Scope>
    <tt:IncludedRecordings>
      <tt:RecordingToken>Recording001</tt:RecordingToken>
    </tt:IncludedRecordings>
  </tse:Scope>
  <tse:SearchFilter>
    <tt:Start>2024-01-15T00:00:00Z</tt:Start>
    <tt:End>2024-01-15T23:59:59Z</tt:End>
  </tse:SearchFilter>
</tse:FindRecordings>

Profile T Implementation

Profile T extends Profile S with advanced features for modern surveillance:

H.265 Support

Profile T mandates H.265 (HEVC) encoder support with the following requirements:

ParameterRequirement
ResolutionUp to 4K (3840x2160)
Frame RateMinimum 25 fps at max resolution
ProfileMain Profile required
GOP StructureConfigurable I-frame interval

Imaging Service

Advanced image settings control:

  • Exposure: Auto/Manual with gain and iris control
  • Focus: Auto-focus with one-push and continuous modes
  • White Balance: Multiple preset and custom modes
  • Wide Dynamic Range: Configurable WDR/HDR settings
  • Image Enhancement: Noise reduction, defog, BLC

Conformance Testing

Before claiming ONVIF conformance, devices must pass the official ONVIF Test Tool. Key testing areas:

  • Device Discovery: WS-Discovery and GetServices
  • Authentication: WS-Security UsernameToken
  • Media Configuration: Profile creation and modification
  • Streaming: RTSP setup and teardown
  • Events: Basic event service operation

ONVIF conformance requires passing 100% of mandatory tests. Optional features should only be declared if fully implemented and tested.

Common Implementation Issues

Based on our experience, these are the most frequent ONVIF implementation challenges:

  • Incorrect namespace handling in SOAP messages
  • Missing or incorrect WS-Security implementation
  • RTSP URI format incompatibility
  • Profile configuration persistence issues
  • Event subscription memory leaks

Conclusion

ONVIF implementation enables interoperability with thousands of VMS platforms and third-party devices. While the specification is complex, following this guide and utilizing the official test tools will ensure successful certification and market acceptance.

Published by

SECUTRONIC Engineering

Contact Our Team