Skip to content

Commit d09f4f8

Browse files
committed
chore: project init
0 parents  commit d09f4f8

41 files changed

Lines changed: 4525 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# ONVIF Camera / NVR Configuration
2+
# Copy this file to .env.local and fill in your device details
3+
4+
# Primary camera / NVR
5+
ONVIF_HOST=192.168.1.100
6+
ONVIF_PORT=80
7+
ONVIF_USERNAME=admin
8+
ONVIF_PASSWORD=password
9+
10+
# For multi-camera examples (09-real-world)
11+
CAMERA_1_HOST=192.168.1.100
12+
CAMERA_1_PORT=80
13+
CAMERA_1_USERNAME=admin
14+
CAMERA_1_PASSWORD=password
15+
16+
CAMERA_2_HOST=192.168.1.101
17+
CAMERA_2_PORT=80
18+
CAMERA_2_USERNAME=admin
19+
CAMERA_2_PASSWORD=password
20+
21+
CAMERA_3_HOST=192.168.1.102
22+
CAMERA_3_PORT=80
23+
CAMERA_3_USERNAME=admin
24+
CAMERA_3_PASSWORD=password

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Binaries
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
bin/
8+
dist/
9+
10+
# Go build cache
11+
*.test
12+
*.out
13+
vendor/
14+
15+
# Environment variables (contains camera credentials)
16+
.env
17+
*.env.local
18+
19+
# macOS
20+
.DS_Store
21+
22+
# IDE
23+
.idea/
24+
.vscode/
25+
*.swp
26+
*.swo

00-concepts/01-what-is-onvif.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# What is ONVIF?
2+
3+
## Overview
4+
5+
**ONVIF** (Open Network Video Interface Forum) is a global, open industry standard that defines a common protocol for IP-based physical security products. Founded in 2008 by Axis Communications, Bosch Security Systems, and Sony, ONVIF provides a standardized interface for how IP cameras, video management software (VMS), and other security devices communicate with each other.
6+
7+
At its core, ONVIF is a set of SOAP-based web service specifications that allow any ONVIF-conformant device to work with any ONVIF-conformant client -- regardless of manufacturer.
8+
9+
## The Problem: Vendor Lock-In
10+
11+
Before ONVIF, the IP surveillance industry suffered from severe fragmentation:
12+
13+
- **Every camera manufacturer** had their own proprietary SDK and API
14+
- **VMS developers** had to write separate integration code for each camera brand
15+
- **End users** were locked into a single vendor's ecosystem
16+
- **Adding a new camera brand** to a VMS could take months of development
17+
- **Firmware updates** could break existing integrations
18+
19+
This created a situation where:
20+
- A VMS supporting 50 camera brands needed 50 separate integration modules
21+
- Each integration had to be maintained independently
22+
- Small VMS companies could not compete because they lacked resources to integrate with enough brands
23+
- Camera manufacturers had to provide SDKs and support for every VMS vendor
24+
25+
## How ONVIF Solves This
26+
27+
ONVIF provides a single, standardized interface that all conformant devices implement:
28+
29+
```
30+
Before ONVIF:
31+
Camera Brand A ──[SDK A]──► VMS
32+
Camera Brand B ──[SDK B]──► VMS (each needs custom integration)
33+
Camera Brand C ──[SDK C]──► VMS
34+
35+
After ONVIF:
36+
Camera Brand A ──┐
37+
Camera Brand B ──┤──[ONVIF]──► VMS (one integration works for all)
38+
Camera Brand C ──┘
39+
```
40+
41+
### Key Benefits
42+
43+
1. **Interoperability**: Any ONVIF-conformant camera works with any ONVIF-conformant VMS
44+
2. **Reduced Development Cost**: Write one ONVIF client instead of dozens of proprietary integrations
45+
3. **Future-Proof**: New cameras automatically work if they support ONVIF
46+
4. **Vendor Independence**: End users can mix and match cameras from different manufacturers
47+
5. **Standardized Discovery**: Cameras can be auto-discovered on the network using WS-Discovery
48+
49+
## ONVIF vs Proprietary SDKs
50+
51+
| Aspect | ONVIF | Proprietary SDK |
52+
|--------|-------|-----------------|
53+
| **Protocol** | SOAP/XML over HTTP(S) | Varies (binary, REST, custom TCP) |
54+
| **Discovery** | WS-Discovery (standardized) | Vendor-specific broadcast |
55+
| **Authentication** | WS-UsernameToken (standardized) | Varies per vendor |
56+
| **Streaming** | RTSP/RTP (standardized) | Mostly RTSP, but setup varies |
57+
| **PTZ Control** | Standardized commands | Vendor-specific commands |
58+
| **Event System** | WS-BaseNotification | Proprietary event systems |
59+
| **Camera Support** | Any ONVIF camera | Only that vendor's cameras |
60+
| **Development Effort** | One integration | One per vendor |
61+
| **Feature Coverage** | Common features standardized | Full vendor-specific features |
62+
| **Maintenance** | Standards-based, stable | Depends on vendor SDK updates |
63+
| **Advanced Features** | May not cover vendor-specific extras | Full access to proprietary features |
64+
65+
> **Important**: In practice, most professional VMS systems use ONVIF for discovery and basic setup, then switch to proprietary SDKs for advanced features when available. ONVIF is the universal baseline; proprietary integrations add the extras.
66+
67+
## Real-World Impact
68+
69+
ONVIF has fundamentally changed the surveillance industry:
70+
71+
- **Over 20,000 ONVIF-conformant products** exist across hundreds of manufacturers
72+
- **Major brands** like Hikvision, Dahua, Axis, Bosch, Hanwha, and many more all support ONVIF
73+
- **VMS platforms** like Milestone, Genetec, and open-source solutions like ZoneMinder support ONVIF
74+
- A VMS developer can support **thousands of camera models** with a single ONVIF implementation
75+
76+
## ONVIF Ecosystem Diagram
77+
78+
```mermaid
79+
graph TB
80+
subgraph Camera Manufacturers
81+
A[Axis]
82+
B[Hikvision]
83+
C[Dahua]
84+
D[Bosch]
85+
E[Hanwha]
86+
F[Other Brands...]
87+
end
88+
89+
subgraph ONVIF Standard
90+
G[Device Discovery<br/>WS-Discovery]
91+
H[Device Management<br/>SOAP Services]
92+
I[Media Streaming<br/>RTSP/RTP]
93+
J[PTZ Control]
94+
K[Events & Analytics]
95+
end
96+
97+
subgraph VMS / Client Software
98+
L[Milestone XProtect]
99+
M[Genetec Security Center]
100+
N[Custom VMS]
101+
O[Open Source VMS]
102+
end
103+
104+
A & B & C & D & E & F -->|Implement| G & H & I & J & K
105+
G & H & I & J & K -->|Consumed by| L & M & N & O
106+
107+
style G fill:#4a9eff,color:#fff
108+
style H fill:#4a9eff,color:#fff
109+
style I fill:#4a9eff,color:#fff
110+
style J fill:#4a9eff,color:#fff
111+
style K fill:#4a9eff,color:#fff
112+
```
113+
114+
## What ONVIF Covers
115+
116+
ONVIF standardizes the following operations:
117+
118+
| Category | Operations |
119+
|----------|-----------|
120+
| **Discovery** | Auto-detect cameras on the network |
121+
| **Device Management** | Get device info, set hostname, manage users, firmware upgrade |
122+
| **Media Configuration** | Configure video/audio profiles, encoding settings |
123+
| **Streaming** | Get RTSP stream URIs, start/stop streaming |
124+
| **PTZ** | Pan, tilt, zoom control with presets and tours |
125+
| **Events** | Motion detection events, analytics alerts, alarm triggers |
126+
| **Recording** | NVR recording control, playback, export |
127+
| **Access Control** | Door control, credential management |
128+
| **Analytics** | Video analytics metadata, object detection |
129+
130+
## What ONVIF Does NOT Cover
131+
132+
- Vendor-specific AI features (face recognition algorithms, etc.)
133+
- Proprietary compression codecs
134+
- Cloud service integrations
135+
- Mobile app push notifications
136+
- Vendor-specific storage formats
137+
138+
## Summary
139+
140+
For VMS developers, ONVIF is the essential starting point for IP camera integration. It provides:
141+
142+
1. **Discovery**: Find cameras on the network automatically
143+
2. **Configuration**: Set up video profiles and encoding parameters
144+
3. **Streaming**: Obtain RTSP URIs for live and recorded video
145+
4. **Control**: Pan-tilt-zoom, events, and recording management
146+
147+
By implementing ONVIF once, your VMS can work with any conformant camera out of the box. This tutorial will guide you through implementing each of these capabilities in Go.

0 commit comments

Comments
 (0)