Skip to content
@deckyard/onvif

onvif cheatsheet

Every export of @deckyard/onvif. Guides are listed in the introduction.

jennifer
import "@deckyard/onvif/" as onvif;

Device and settings

FunctionReturnsDoes
device(address, user, password)Devicea device, not contacted yet; user "" for none
connect(dev)Deviceread the clock offset, find the services, settle the auth method
withPlainHttp(dev)Deviceallow plain http to any host
withCaCert(dev, pem)Devicetrust a certificate for https
withInsecure(dev)Deviceaccept any certificate
withTimeout(dev, ms)Deviceidle timeout per request, 100 to 300000 ms
withMaxBytes(dev, n)DeviceSOAP reply cap
withMaxMediaBytes(dev, n)Devicesnapshot cap
withAuth(dev, method)Device"wsse", "digest" (plus HTTP Digest) or "" (find out per call)
withService(dev, name, address)Deviceset a service address by hand; connect keeps it
withMedia(dev, name)Deviceuse media or media2
serviceAddress(dev, name)stringa service's URL
passwordDigest(nonce, created, password)stringthe WS-Security PasswordDigest
call(dev, service, action, body)xml.Valueany operation; the reply's first Body element

Device service

FunctionReturnsDoes
systemDateAndTime(dev)Clockthe camera's clock (unsigned)
syncClock(dev)Devicemeasure the clock offset again
deviceInformation(dev)DeviceInfomanufacturer, model, firmware, serial
services(dev)list of Serviceevery service with address and version
scopes(dev)list of stringthe scope URIs
reboot(dev)stringrestart; the device's message

Discovery

FunctionReturnsDoes
discover(timeoutMs)list of DiscoveredProbe the LAN, collect answers
discoveryOptions()DiscoveryOptions3 s, the multicast group, both types
discoverWith(options)list of DiscoveredProbe with options

Media

FunctionReturnsDoes
profiles(dev)list of Profilethe media profiles (Media2, else Media)
streamUri(dev, profile)Streamthe RTSP URL as given and on the device's host
snapshotUri(dev, profile)stringthe snapshot URL, without user information
snapshot(dev, profile)bytesthe snapshot image

PTZ

FunctionReturnsDoes
continuousMove(dev, profile, pan, tilt, zoom)move at a speed, -1.0 to 1.0 (VelocityGenericSpace)
absoluteMove(dev, profile, pan, tilt, zoom)move to a position (PositionGenericSpace)
relativeMove(dev, profile, pan, tilt, zoom)move by an amount (TranslationGenericSpace)
stopMove(dev, profile)stop pan, tilt and zoom
ptzStatus(dev, profile)PtzStatusposition and movement
presets(dev, profile)list of Presetthe stored positions
gotoPreset(dev, profile, preset)move to a preset
setPreset(dev, profile, name)stringstore the position; the new token
removePreset(dev, profile, preset)delete a preset

Imaging

FunctionReturnsDoes
imagingSettings(dev, source)ImagingSettingsbrightness, contrast, ..., focus mode
brightnessRange(dev, source)Rangethe brightness range
setBrightness(dev, source, value)set it, checked against the range
setFocusMode(dev, source, mode)AUTO or MANUAL
focusSpeedRange(dev, source)Rangethe continuous focus speed range
focusMove(dev, source, speed)start a continuous focus move
focusStop(dev, source)stop it

Events

FunctionReturnsDoes
subscribe(dev, seconds)Subscriptioncreate a pull-point subscription
pull(dev, sub, timeoutSeconds, limit)Pulledwait for events; the subscription with its new times
renew(dev, sub, seconds)Subscriptionextend it
unsubscribe(dev, sub)end it

Constants

NameValue
ERROR_KIND"onvif"
NS_DEVICE"http://www.onvif.org/ver10/device/wsdl"
NS_MEDIA"http://www.onvif.org/ver10/media/wsdl"
NS_MEDIA2"http://www.onvif.org/ver20/media/wsdl"
NS_PTZ"http://www.onvif.org/ver20/ptz/wsdl"
NS_IMAGING"http://www.onvif.org/ver20/imaging/wsdl"
NS_EVENTS"http://www.onvif.org/ver10/events/wsdl"
NS_SCHEMA"http://www.onvif.org/ver10/schema"
NS_ERROR"http://www.onvif.org/ver10/error"
SERVICES{"device": NS_DEVICE, "media": NS_MEDIA, ...}: device, media, media2, ptz, imaging, events, deviceio, recording, search, replay, analytics
DEFAULT_TIMEOUT_MS10000
DEFAULT_MAX_BYTES8388608
DEFAULT_MAX_MEDIA_BYTES16777216
DISCOVERY_ADDRESS"239.255.255.250:3702"
MAX_DEVICES256
PANTILT_SPACES"http://www.onvif.org/ver10/tptz/PanTiltSpaces/"
ZOOM_SPACES"http://www.onvif.org/ver10/tptz/ZoomSpaces/"

Structs

Device

Field
address as stringthe device service URL
user as stringthe user name
password as stringthe password
offsetMs as intcamera clock minus this machine's
clockSynced as boolthe offset was read from the camera
services as map of string to stringservice name to URL
media as stringmedia2 or media
auth as string"wsse", "digest", or "" not known yet
plainHttp as boolplain http to any host
tls as http.TlsOptionscertificate checking
timeoutMs as intidle timeout per request
maxBytes as intSOAP reply cap
maxMediaBytes as intsnapshot cap
overrides as list of stringservices set by withService

OnvifError

Field
kind as string"onvif"
message as stringonvif: ...
status as intHTTP status; 0 for none
code as stringSOAP fault code, Sender / Receiver
subcode as stringfirst subcode, ter:NotAuthorized
subcodes as list of stringevery subcode level
reason as stringthe camera's reason

Clock

Field
utc as stringYYYY-MM-DDTHH:MM:SSZ; "" when not sent
dateTimeType as stringNTP or Manual
daylightSavings as boolDST on
timeZone as stringPOSIX time zone

DeviceInfo

Field
manufacturer as string
model as string
firmwareVersion as string
serialNumber as string
hardwareId as string

Service

Field
name as stringname in SERVICES; "" for others
namespace as stringthe service namespace
address as stringits URL; on the device's origin when it names another host
version as stringMAJOR.MINOR

Discovered

Field
endpoint as stringurn:uuid:...
address as stringthe first http(s) XAddr
xaddrs as list of stringevery XAddr
types as list of stringthe types
scopes as list of stringthe scope URIs
name as stringthe name scope, decoded
hardware as stringthe hardware scope, decoded
from as stringthe answering host:port

DiscoveryOptions

Field
timeoutMs as int100 to 30000
target as stringhost:port the Probes go to
iface as stringinterface to send on; "" for any
types as list of stringNetworkVideoTransmitter, Device

Profile

Field
token as stringthe profile token
name as string
fixed as boolnot deletable
videoSource as stringthe video source token
encoding as stringH264, H265, JPEG, ...
width as int
height as int
ptz as stringPTZ configuration token; "" for none

PtzStatus

Field
pan as float
tilt as float
zoom as float
panTiltMoving as bool
zoomMoving as bool
error as stringthe device's error text
utcTime as string

Preset

Field
token as stringthe preset token
name as string
pan as float
tilt as float
zoom as float

ImagingSettings

Field
values as map of string to floatBrightness, ColorSaturation, Contrast, Sharpness
focusMode as stringAUTO / MANUAL
irCutFilter as stringON / OFF / AUTO

Range

Field
min as float
max as float

Subscription

Field
address as stringthe subscription manager's URL, where requests go
reference as stringthe address as the camera gave it, sent as To
parameters as list of stringreference parameters, as XML
currentTime as string
terminationTime as string

Pulled

Field
events as list of Eventoldest first; empty when none came
subscription as Subscriptionwith the reply's currentTime and terminationTime

Stream

Field
address as stringthe RTSP URI as the camera gave it
rebased as stringthe same on the device's host, port kept

Event

Field
topic as stringtns1:VideoSource/MotionAlarm
utcTime as string
operation as stringInitialized, Changed, Deleted
source as map of string to string
key as map of string to string
data as map of string to string