Starting with version 1.7.15.10276, our video SDK supports SRT streaming.
What is SRT?
Secure Reliable Transport (SRT) is an open source software protocol and technology stack designed for live video streaming over the public internet. If you want to learn more about its history, read our interview with the architect and evangelist of SRT.
SRT provides connection and control, reliable transmission similar to TCP, however, it does so at the application layer, using UDP protocol as an underlying transport layer. It supports packet recovery while maintaining low latency (default: 120 ms). SRT also supports encryption using AES.
Source
https://en.wikipedia.org/wiki/Secure_Reliable_Transport
Git
https://github.com/Haivision/srt
Medialooks SRT
There are two modes in the case of SRT streaming
- caller - requester side
srt://ip_address:port?mode=caller
- listener - listener side
srt://ip_address:port?mode=listener
These modes specify the network connection type - who is sending the request for connection and who is waiting for a request, it doesn't relative to the encoding or decoding processes, so your encoder could act as a listener and your decoder could be the requester.
Pay attention listener should be run before the caller and wait for a caller connection.
In most cases, the decision about how is going to be a requester and who is going to be the listener should be based on your network NAT firewall rules i.e caller in most cases doesn't need any additional rules, meanwhile, with listener mode, you should be sure that you have a specific port forward rule.
In our next examples, we are going to use the encoder (Writer Sample) as caller and the decoder (Network Playback Sample) as a listener.
You can use SRT with Medialooks SDKs in the same way as commonly known UDP/DVB protocols. On the streamer side
- Run Sample Writer x86 / Sample File Writer x86
- Choose the SRT as the video protocol
- Set desirable encoder (MPEG-2 in the current sample)
- Set URL value by the following pattern
srt://ip_address:port?mode=caller
There is a lot of settings available for the SRT (e.g., latency, passphrase) - you should set them directly in the target URL, and not in _bsProps parameter of the WriterNameSet (or WriterSet) method, for example:
srt://127.0.0.1:1234?mode=listener
On the receiver side:
- Run the Network Playback Sample
- URL should be the following srt://ip_address:port?mode=listener
SRT statistics
MWriter/MFWriter object instances able to provide encoder statistics via "encoder::muxer::stat"
m_objMFWriter.PropsGet("encoder::muxer::stat", out strValue)
MFReader object instances could provide the SRT decoder statistics via splitter::current::stat
m_objMFreader.PropsGet("splitter::current::stat", out strValue)
For MFileClass object instances could provide the SRT decoder statistics via file::splitter::current::stat
m_objMFileClass.PropsGet("file::splitter::current::stat", out strValue)
In both cases for encoder and decoder statistics,
Video SDK will return default SRT stats, you can find statistics description on HaivisionGitHub https://github.com/Haivision/srt/blob/master/docs/API/statistics.md#summary-table
Rendezvous mode
Writer (Encoder):
srt://dest_external_IP:5000?mode=rendezvous&localip=local_IP
Reader (Decoder)
srt://source_external_IP:5000?mode=rendezvous&localip=local_IP
where mode
- should be equal to rendezvouslocal_IP
- required parameter- it's the local IP address for the current workstationdest_external_IP
- destination public IPsource_external_IP
- source public IP