IP camera frames and motion over ONVIF right in the chat
Connect ONVIF IP cameras to the AI agent: a snapshot on request and motion sensor history through a gateway. The agent checks the gate or warehouse for motion.
How the agent works with ONVIF
Data is collected on site by the gateway: a service on a computer in the site network that sends data out over an outgoing connection only. The connection takes the camera address, such as http://192.168.1.64 or the full …/onvif/device_service address, and the ONVIF user's name and password. The connection is assigned to a gateway on the Gateways tab.
The gateway reads the camera the way the standard's clients do: first the camera's clock, then its service addresses, the profiles and each profile's snapshot address (Media 1 or Media 2). Every login is stamped by the camera's own clock, so a camera whose clock has drifted does not refuse it. Motion arrives through a pull-point subscription that lives about a minute and is renewed, so it does not hold one of the camera's subscription slots.
The connection only reads. The gateway sends the camera only requests from a closed list: clock, services, profiles, events and snapshot. It does not control pan and zoom, settings, recording or the camera's users. The event subscription changes nothing the camera captures, records or shows, and ends by itself.
A frame is taken from the camera's snapshot address (JPEG), not from the video stream: a camera without such an address is named as such. The gateway does not take clips or the RTSP stream and does not search the network for cameras; the address is entered by hand. If the camera refuses the event subscription, the gateway goes on with profiles and frames without motion.
Integration scenarios
A frame on request
The agent takes one frame from the chosen camera, looks at what is happening at the gate, in the warehouse or in the server room now, and sends the frame to the chat.
Camera round
The agent takes a frame from several cameras in a row and briefly describes what each one shows.
Was there motion
The agent reads the camera's motion history and names when it saw motion overnight or over the weekend and how long it lasted.
Where motion is now
The agent checks the current motion state of every video source of the connected cameras and names the ones where there is motion.
Frame and last motion
The agent takes a frame and names beside it when this camera last saw motion.
Camera profiles
The agent lists the camera's profiles: name, codec, resolution and whether the profile has a snapshot, so you can choose which one to take frames from.
ONVIF examples
Да, дважды: в 01:12 на 40 секунд и в 04:55 на 3 минуты.
Снял свежий кадр с камеры склада: ворота закрыты, посторонних нет. Кадр прислал в чат.
How to connect
Before you connect
- An IP camera with ONVIF (Profile S) and the ONVIF service turned on
- A camera ONVIF user with a password
- A computer in the site network running the gateway service
- Access from that computer to the camera over HTTP or HTTPS
- Server admits listed addresses only? Allow connections from 158.160.205.91 and 87.228.27.163.
- 1
Turn ONVIF on in the camera
Hikvision: Configuration → Network → Advanced Settings → Integration Protocol, tick Enable ONVIF and save. Axis: System → ONVIF. Recent firmware ships with ONVIF off.
- 2
Add a separate ONVIF user
Hikvision and Axis keep ONVIF users apart from the web login. Add a user in the ONVIF list and enter its name and password in the connection fields.
- 3
Set the camera's time by NTP
Motion events carry the camera's time. Without NTP its clock drifts, and some cameras restart at 1970 after a power cut.
- 4
For https, trust the camera's certificate
If the camera's address is https:// with a self-signed certificate, put the certificate into pki/onvif/trusted/ in the gateway's data folder.
FAQ
Turn ONVIF on in the camera and add an ONVIF user there. Install the gateway service on a computer in the site network and add it on the Gateways tab. In the connection enter the camera address, for example http://192.168.1.64, the ONVIF user's name and password, and assign the connection to the gateway.
The camera's profiles with codec and resolution, the motion state of each video source and its history when the camera's events carry motion, and one frame on request taken from the camera's snapshot address.
No. The gateway sends no pan or zoom commands and does not change the camera's settings, recording or users. It only reads the clock, profiles and events and takes a frame.
Many cameras keep ONVIF users apart from the web login: check that the user exists in the ONVIF list itself. Also check that ONVIF is turned on in the camera: recent firmware ships with it off.