-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
504 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package main | ||
|
||
import ( | ||
"log" | ||
"net" | ||
"net/url" | ||
"os" | ||
|
||
"github.com/AlexxIT/go2rtc/pkg/onvif" | ||
) | ||
|
||
func main() { | ||
var rawURL = os.Args[1] | ||
var operation = os.Args[2] | ||
var token string | ||
if len(os.Args) > 3 { | ||
token = os.Args[3] | ||
} | ||
|
||
client, err := onvif.NewClient(rawURL) | ||
if err != nil { | ||
log.Panic(err) | ||
} | ||
|
||
var b []byte | ||
|
||
switch operation { | ||
case onvif.ServiceGetServiceCapabilities: | ||
b, err = client.MediaRequest(operation) | ||
case onvif.DeviceGetCapabilities, | ||
onvif.DeviceGetDeviceInformation, | ||
onvif.DeviceGetDiscoveryMode, | ||
onvif.DeviceGetDNS, | ||
onvif.DeviceGetHostname, | ||
onvif.DeviceGetNetworkDefaultGateway, | ||
onvif.DeviceGetNetworkInterfaces, | ||
onvif.DeviceGetNetworkProtocols, | ||
onvif.DeviceGetNTP, | ||
onvif.DeviceGetScopes, | ||
onvif.DeviceGetServices, | ||
onvif.DeviceGetSystemDateAndTime, | ||
onvif.DeviceSystemReboot: | ||
b, err = client.DeviceRequest(operation) | ||
case onvif.MediaGetProfiles, onvif.MediaGetVideoSources: | ||
b, err = client.MediaRequest(operation) | ||
case onvif.MediaGetProfile: | ||
b, err = client.GetProfile(token) | ||
case onvif.MediaGetVideoSourceConfiguration: | ||
b, err = client.GetVideoSourceConfiguration(token) | ||
case onvif.MediaGetStreamUri: | ||
b, err = client.GetStreamUri(token) | ||
case onvif.MediaGetSnapshotUri: | ||
b, err = client.GetSnapshotUri(token) | ||
default: | ||
log.Printf("unknown action\n") | ||
} | ||
|
||
if err != nil { | ||
log.Printf("%s\n", err) | ||
} | ||
|
||
u, err := url.Parse(rawURL) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
host, _, _ := net.SplitHostPort(u.Host) | ||
|
||
if err = os.WriteFile(host+"_"+operation+".xml", b, 0644); err != nil { | ||
log.Printf("%s\n", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# ONVIF | ||
|
||
A regular camera has a single video source (`GetVideoSources`) and two profiles (`GetProfiles`). | ||
|
||
Go2rtc has one video source and one profile per stream. | ||
|
||
## Tested clients | ||
|
||
Go2rtc works as ONVIF server: | ||
|
||
- Happytime onvif client (windows) | ||
- Home Assistant ONVIF integration (linux) | ||
- Onvier (android) | ||
- ONVIF Device Manager (windows) | ||
|
||
PS. Support only TCP transport for RTSP protocol. UDP and HTTP transports - unsupported yet. | ||
|
||
## Tested cameras | ||
|
||
Go2rtc works as ONVIF client: | ||
|
||
- Dahua IPC-K42 | ||
- OpenIPC | ||
- Reolink RLC-520A | ||
- TP-Link Tapo TC60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## Profiles | ||
|
||
- Profile A - For access control configuration | ||
- Profile C - For door control and event management | ||
- Profile S - For basic video streaming | ||
- Video streaming and configuration | ||
- Profile T - For advanced video streaming | ||
- H.264 / H.265 video compression | ||
- Imaging settings | ||
- Motion alarm and tampering events | ||
- Metadata streaming | ||
- Bi-directional audio | ||
|
||
## Services | ||
|
||
https://www.onvif.org/profiles/specifications/ | ||
|
||
- https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl | ||
- https://www.onvif.org/ver20/imaging/wsdl/imaging.wsdl | ||
- https://www.onvif.org/ver10/media/wsdl/media.wsdl | ||
|
||
## TMP | ||
|
||
| | Dahua | Reolink | TP-Link | | ||
|------------------------|---------|---------|---------| | ||
| GetCapabilities | no auth | no auth | no auth | | ||
| GetServices | no auth | no auth | no auth | | ||
| GetServiceCapabilities | no auth | no auth | auth | | ||
| GetSystemDateAndTime | no auth | no auth | no auth | | ||
| GetNetworkInterfaces | auth | auth | auth | | ||
| GetDeviceInformation | auth | auth | auth | | ||
| GetProfiles | auth | auth | auth | | ||
| GetScopes | auth | auth | auth | | ||
|
||
- Dahua - onvif://192.168.10.90:80 | ||
- Reolink - onvif://192.168.10.92:8000 | ||
- TP-Link - onvif://192.168.10.91:2020/onvif/device_service | ||
- |
Oops, something went wrong.
f601c47
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can I add cameras from go2rtc as onvif now?