How media server supports srtp?

Happytiem media server supports Secure Real-time Transport Protocol (secure RTP or SRTP) for rtsp publishing and playback. The encryption keys can be passed in the SDP data. The open-source tools FFmpeg and FFplay can be used for SRTP testing.

1.SRTP for rtsp publishing


Happytime RTSP Pusher supports SRTP publishing.
Modify the RTSP Pusher configuration file to set <SRTP> under the <Pusher> tag to 1, and RTSP Pusher will use SRTP for data publishing:
RTSP Pusher uses SRTP to publish configuration examples:

<pusher>
    <src>test.mp4</src>
    <transfer>
        <mode>RTSP</mode>
        <rtspurl>rtsp://192.168.3.36/myapp/live</rtspurl>
        <user>admin</user>
        <pass>admin</pass>
    </transfer>
    <video>
        ……
    </video>
    <audio>
        ……
    </audio>
    <metadata>0</metadata>
    <srtp>1</srtp>
</pusher>

You will see SDP information in the ANNOUNCE request message of rsp pusher.
It should look something like this:

v=0
o=- 0 0 IN IP4 192.168.3.36
c=IN IP4 192.168.3.36
s=session
t=0 0
a=control:*
m=video 0 RTP/SAVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=42801F;sprop-parameter-sets=Z0KAH5ZSAKALdJQEBAUAAAMAAQAAAwAyhA==,aMuNSA==
a=control:realvideo
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:KSO+hOFs1q5SkEnx8bvp67Om2zyHDD6ZJF4NHAa3
m=audio 0 RTP/SAVP 97
a=rtpmap:97 MPEG4-GENERIC/44100/2
a=fmtp:97 streamtype=5;profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3;config=121056E500
a=control:realaudio
a=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:R96zEk3IQ7uLph8DWn0JOCUfXdTL/Jb1RTsTDYkK


2.SRTP for rtsp playback


The media server supports the URL parameter SRTP to specify whether rtsp SRTP playback is enabled or not.
Example:
Enable SRTP to play test.mp4 files:

rtsp://[serverip]:[serverport]/[application-name]/test.mp4?srtp=1

Use FFplay or Happytime rtsp client to test playback.