![]() |
VOOZH | about |
dotnet add package SharpRTSPClient --version 0.6.2
NuGet\Install-Package SharpRTSPClient -Version 0.6.2
<PackageReference Include="SharpRTSPClient" Version="0.6.2" />
<PackageVersion Include="SharpRTSPClient" Version="0.6.2" />Directory.Packages.props
<PackageReference Include="SharpRTSPClient" />Project file
paket add SharpRTSPClient --version 0.6.2
#r "nuget: SharpRTSPClient, 0.6.2"
#:package SharpRTSPClient@0.6.2
#addin nuget:?package=SharpRTSPClient&version=0.6.2Install as a Cake Addin
#tool nuget:?package=SharpRTSPClient&version=0.6.2Install as a Cake Tool
This is a thin wrapper around the fantastic SharpRTSP, mostly based off their sample code with some API enhancements to make it easier to use. Added support for streaming Opus, AV1 and H266.
Simple RTSP client that supports MJPEG, H264, H265, H266, AV1 for video and AAC, Opus, PCMU and PCMA for audio.
Create the RTSP client:
using (RTSPClient client = new RTSPClient())
{
...
}
Subscribe events for video:
client.NewVideoStream += (sender, e) => { ... }
client.ReceivedVideoData += (sender, e) => { ... }
The NewVideoStream callback will contain the video codec in e.StreamType as well as codec-specific info such as SPS/PPS from the SDP in e.StreamConfigurationData.
Subscribe events for audio:
client.NewAudioStream += (sender, e) => { ... }
client.ReceivedAudioData += (sender, e) => { ... }
The NewAudioStream callback will contain the audio codec in e.StreamType as well as codec-specific info from the SDP in e.StreamConfigurationData.
For re-connection, you can optionally subscribe the Stopped event:
client.Stopped += (sender, e) =>
{
client.TryReconnect();
}
Connect to the RTSP stream:
client.Connect("rtsp://localhost:8554/stream1", RTPTransport.TCP);
Now you will start receiving callbacks with audio/video payload.
To disconnect the RTSP stream, call Stop or just dispose the client:
client.Stop();
Simple RTSP server that supports MJPEG, H264, H265, H266, AV1 for video and AAC, Opus, PCMU and PCMA for audio.
Create the server on port 8554:
using(var server = new RTSPServer(8554, "admin", "password"))
{
...
}
Create tracks for the media you want to stream. For instance H264 video with AAC audio:
var h264Track = new H264Track();
h264Track.SetParameterSets(sps, pps); // Sequence Parameter Set (SPS) and Picture Parameter Set (PPS) are provided by your video source as byte[]
var aacTrack = new AACTrack(audioSpecificConfig, samplingRate, channelCount); // audioSpecificConfig is provided by your audio source as byte[], samplingRate and channelCount are also properties of the audio source
Create a stream source from the tracks an add it to the server:
var streamSource = new RTSPStreamSource("stream1", h264Track, aacTrack);
server.AddStreamSource(streamSource);
Multiple streams can be added, each identified by unique stream ID:
var streamSource2 = new RTSPStreamSource("stream2", h265Track, null);
server.AddStreamSource(streamSource2);
Start listening for incoming requests:
server.StartListen();
To stream video, use the track instances and call FeedInRawSamples in regular intervals:
h264Track.FeedInRawSamples(rtpVideoBaseTime + videoPTS, new List<byte[]> { nal1, nal2, ... });
The same applies to audio:
aacTrack.FeedInRawSamples(rtpAudioBaseTime + audioPTS, new List<byte[]> { aacFrame });
Simple RTSP server that supports streaming video from multiple MP4 files.
Demonstrates how to record RTSP and save it as mp4.
Sample RTSP server for ffmpeg RTP streams. Fully configurable in appsettings.json.
PoC of re-playing RTSP from a Wireshark PcapNg file.
Most of the work has been done by SharpRTSP (https://github.com/ngraziano/SharpRTSP), this is just a convenience wrapper around it.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 1 NuGet packages that depend on SharpRTSPClient:
| Package | Downloads |
|---|---|
|
SharpRTSPtoWebRTC
C# implementation of the RTSP to WebRTC gateway that allows you to stream RTSP from various sources to the web browser. Suppports H264, H265 and AV1 re-streaming. Audio transcoding from AAC to Opus is also supported. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.6.2 | 277 | 5/21/2026 |
| 0.6.1 | 101 | 5/20/2026 |
| 0.6.0 | 458 | 4/12/2026 |
| 0.5.4 | 466 | 2/12/2026 |
| 0.5.3 | 221 | 1/19/2026 |
| 0.5.2 | 171 | 1/10/2026 |
| 0.5.1 | 131 | 1/10/2026 |
| 0.5.0 | 124 | 1/4/2026 |
| 0.4.3 | 129 | 12/30/2025 |
| 0.4.2 | 129 | 12/30/2025 |
| 0.4.1 | 283 | 12/13/2025 |
| 0.4.0 | 368 | 11/15/2025 |
| 0.3.1 | 218 | 11/8/2025 |
| 0.3.0 | 2,878 | 11/1/2025 |
| 0.2.0 | 214 | 10/26/2025 |
| 0.1.4 | 1,012 | 8/30/2025 |
| 0.1.3 | 668 | 5/31/2025 |
| 0.1.2 | 394 | 5/15/2025 |
| 0.1.1 | 345 | 5/15/2025 |
| 0.1.0 | 1,008 | 4/5/2025 |