SRT streaming
The Secure Reliable Transport (SRT) protocol is an open-source communication protocol that facilitates high-quality, secure video streaming over unreliable networks like the Internet. It is designed to handle video transport in scenarios where low latency and secure data transfer are crucial, making it ideal for broadcasting and streaming applications. SRT optimizes streaming performance by adapting to varying network conditions, providing packet loss recovery, and ensuring content security through end-to-end encryption. This protocol supports point-to-point and point-to-multipoint transmissions, offering a robust solution for modern streaming needs.
Using this block, you can send video/audio streams using most of the available formats over the SRT protocol.
You can use the [SRTMPEGTSSinkBlock](SRT MPEG-TS Sink block) to stream muxed video and audio data over the SRT protocol.
Use the SRTMPEGTSSinkSettings
class to set the parameters.
Block info
Name: SRTSinkBlock.
Pin direction | Media type | Pins count |
---|---|---|
Input | Any | one |
The sample pipeline
Sample code
// Pipeline
var pipeline = new MediaBlocksPipeline();
// video source
var virtualVideoSource = new VirtualVideoSourceSettings
{
Width = 1280,
Height = 720,
FrameRate = VideoFrameRate.FPS_25,
};
var videoSource = new VirtualVideoSourceBlock(virtualVideoSource);
// H264 encoder
var h264Encoder = new H264EncoderBlock(new OpenH264EncoderSettings());
h264Encoder.Settings.ParseStream = false; // we have to disable parsing for SRT for H264 and HEVC encoders
pipeline.Connect(videoSource.Output, h264Encoder.Input);
// SRT sink
var sink = new SRTSinkBlock(new SRTSinkSettings() { Uri = "srt://:8888" });
pipeline.Connect(h264Encoder.Output, sink.CreateNewInput(MediaBlockPadMediaType.Video));
// Start
await pipeline.StartAsync();
Platforms
Windows, macOS, Linux, iOS, Android.