Skip to content

Camera discovery

device.onvif.discovery

Sapsan can discover ONVIF cameras on the network, receive their events (motion, human and vehicle detection), and check a camera for compliance.

Camera discovery

Sapsan discovers cameras via WS-Discovery (multicast Probe requests and ProbeMatch responses) and additionally understands Hikvision's proprietary discovery protocol. For each camera it collects addresses (XAddrs), name, and model; repeated observations of the same camera are merged.

When working through NAT, the addresses a camera reports about itself (snapshot URL, RTSP URL) are automatically rewritten to the actually reachable device address.

Configuring a camera through ONVIF

After discovering a camera, Sapsan can retrieve its RTSP URL and configure the camera itself through ONVIF. Available settings depend on the camera model and the permissions of its account.

  1. Read camera profiles with media/GetProfiles and identify the required encoder configuration token.
  2. Read media/GetVideoEncoderConfigurations and obtain permitted values with media/GetVideoEncoderConfigurationOptions.
  3. Change the required fields in the complete configuration and submit it with media/SetVideoEncoderConfiguration. This configures resolution and frame rate, bitrate and GOP settings, and a codec supported by the camera.
  4. Read the configuration again and check the RTSP input. Applying changes may restart the camera encoder.

Use POST /flussonic/api/onvif_call/{camera}/{service}/{method} on the Sapsan HTTP interface. {camera} is the name of a configured stream whose input supplies the camera address; MBR uses its first nested source. Example profile request:

curl --user admin -X POST \
  'http://sapsan.example.com:5080/flussonic/api/onvif_call/camera1/media/GetProfiles' \
  -H 'Content-Type: application/json' --data '{}'

Authorization to Sapsan and the camera account are independent. Camera credentials default to those in the input URL, and ONVIF uses port 80. The x-onvif-auth: user:password header overrides camera credentials; x-onvif-port overrides its ONVIF port. The JSON body supplies ONVIF method arguments; keys with $ represent XML attributes, such as $token.

Updating stream configuration through central controls ingest in Sapsan. Calling SetVideoEncoderConfiguration changes the camera itself. For PTZ and other operations, see ONVIF control.

Next steps