Skip to main content

ONVIF driver overview

SRTP

Last Updated: 2 minute read

This section outlines the implementation of Secure Real-time Transport Protocol (SRTP) within ONVIF, including capability discovery, streaming methods, and URI retrieval, ensuring secure video and audio transmission.

If the device supports SRTP, information about SRTP support should be retrieved from the device using the Media2 service specification. Specifically, the GetServiceCapabilitiesResponse should contain the StreamingCapabilities capability, as per Section 5.11 (GetServiceCapabilities).

Example Response for Service Capabilities:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<s:Envelope
    xmlns:sc="http://www.w3.org/2003/05/soap-encoding"
    xmlns:s="http://www.w3.org/2003/05/soap-envelope"
    xmlns:tr2="http://www.onvif.org/ver20/media/wsdl"
    xmlns:tt="http://www.onvif.org/ver10/schema">

    <s:Header/>

    <s:Body>
        <tr2:GetServiceCapabilitiesResponse>
            <tr2:Capabilities
                SnapshotUri="true"
                Rotation="true"
                VideoSourceMode="true"
                OSD="true"
                TemporaryOSDText="false"
                Mask="false"
                SourceMask="true">
                <tr2:ProfileCapabilities
                    MaximumNumberOfProfiles="12"
                    ConfigurationsSupported="VideoSource VideoEncoder AudioSource AudioEncoder Metadata Analytics PTZ"/>
                <tr2:StreamingCapabilities
                    SecureRTSPStreaming="true"
                    RTSPStreaming="true"
                    RTPMulticast="true"
                    RTP_RTSP_TCP="true"
                    NonAggregateControl="false"
                    AutoStartMulticast="false"/>
            </tr2:Capabilities>
        </tr2:GetServiceCapabilitiesResponse>
    </s:Body>
</s:Envelope>

If the device supports SRTP, the following streaming methods for Video, Audio In, and Metadata will be available:

  • SRTP/TCP

  • SRTP/UDP

  • SRTP/UDP multicast

Important: The ONVIF device (acting as the sender/server) should use the Multimedia Internet KEYing (MIKEY) protocol for SRTP key management.

It should generate and provide the MIKEY message. This message should contain the necessary cryptographic material and security parameters for establishing the SRTP session (RFC 3830).

The MIKEY message should be embedded within the a=key-mgmt parameter in the Session Description Protocol (SDP) during session initiation, as described in RFC4567.

Retrieving SRTP Stream URIs

The device should return correct URLs for SRTP in response to a GetStreamUri request. This response should include RtspsUnicast and RtspsMulticast protocols as defined in Section 5.4.1 (GetStreamUri). 

Example Request for SRTP Stream URI:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" xmlns:wsa5="http://www.w3.org/2005/08/addressing">
    <SOAP-ENV:Body>
        <tr2:GetStreamUri>
            <tr2:Protocol>RtspsUnicast</tr2:Protocol>
            <tr2:ProfileToken>MediaProfile00000</tr2:ProfileToken>
        </tr2:GetStreamUri>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Example Response for SRTP Stream URI:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<s:Envelope xmlns:sc="http://www.w3.org/2003/05/soap-encoding" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" xmlns:tt="http://www.onvif.org/ver10/schema">
    <s:Header/>
    <s:Body>
        <tr2:GetStreamUriResponse>
            <tr2:Uri>rtsps://10.5.2.63:9554/rtsp_tunnel?srtp=1&p=0&line=1&inst=1&aon=1&aud=1&vcd=2
           </tr2:Uri>
        </tr2:GetStreamUriResponse>
    </s:Body>
</s:Envelope>

Handling SRTP Ports

  • The port number is extracted from the SRTP stream URL.

  • If the port is not present, the default port 322 will be used.

  • Some cameras may require RTSP over TLS (RTSPS enabled) on camera web page to support SRTP streaming.