{"id":18006522,"url":"https://github.com/jimm98y/sharprealtimestreaming","last_synced_at":"2026-01-04T17:14:49.017Z","repository":{"id":244590650,"uuid":"812055522","full_name":"jimm98y/SharpRealTimeStreaming","owner":"jimm98y","description":"Simple RTSP server and client. Supports H264, H265 and AAC.","archived":false,"fork":false,"pushed_at":"2025-03-20T23:27:21.000Z","size":10651,"stargazers_count":20,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-20T23:41:59.372Z","etag":null,"topics":["aac","ffmpeg-server","h264","h265","netstandard","rtp","rtsp","streaming","video"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jimm98y.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-07T21:27:59.000Z","updated_at":"2025-03-20T23:23:35.000Z","dependencies_parsed_at":"2024-08-05T00:17:44.119Z","dependency_job_id":"23721295-88f4-4d9c-9bd2-4ea9ca0dab41","html_url":"https://github.com/jimm98y/SharpRealTimeStreaming","commit_stats":null,"previous_names":["jimm98y/sharprealtimestreaming"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimm98y%2FSharpRealTimeStreaming","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimm98y%2FSharpRealTimeStreaming/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimm98y%2FSharpRealTimeStreaming/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jimm98y%2FSharpRealTimeStreaming/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jimm98y","download_url":"https://codeload.github.com/jimm98y/SharpRealTimeStreaming/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245653777,"owners_count":20650750,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aac","ffmpeg-server","h264","h265","netstandard","rtp","rtsp","streaming","video"],"created_at":"2024-10-30T01:08:44.054Z","updated_at":"2026-01-04T17:14:49.012Z","avatar_url":"https://github.com/jimm98y.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SharpRTSP client and server\nThis 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.\n\n## SharpRTSPClient\nSimple RTSP client that supports MJPEG, H264, H265, H266, AV1 for video and AAC, Opus, PCMU and PCMA for audio.\n\n[![NuGet version](https://img.shields.io/nuget/v/SharpRTSPClient.svg?style=flat-square)](https://www.nuget.org/packages/SharpRTSPClient)\n\nCreate the RTSP client:\n```cs\nusing (RTSPClient client = new RTSPClient())\n{\n...\n}\n```\n\nSubscribe events for video:\n```cs\nclient.NewVideoStream += (sender, e) =\u003e { ... }\nclient.ReceivedVideoData += (sender, e) =\u003e { ... }\n```\n\nThe `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`.\n\nSubscribe events for audio:\n```cs\nclient.NewAudioStream += (sender, e) =\u003e { ... }\nclient.ReceivedAudioData += (sender, e) =\u003e { ... }\n```\n\nThe `NewAudioStream` callback will contain the audio codec in `e.StreamType` as well as codec-specific info from the SDP in `e.StreamConfigurationData`.\n\nFor re-connection, you can optionally subscribe the `Stopped` event:\n```cs\nclient.Stopped += (sender, e) =\u003e \n{ \n   client.TryReconnect();\n}\n```\nConnect to the RTSP stream:\n```cs\nclient.Connect(\"rtsp://localhost:8554/stream1\", RTPTransport.TCP); \n```\nNow you will start receiving callbacks with audio/video payload. \n\nTo disconnect the RTSP stream, call `Stop` or just dispose the client:\n```cs\nclient.Stop();\n```\n\n## SharpRTSPServer\nSimple RTSP server that supports MJPEG, H264, H265, H266, AV1 for video and AAC, Opus, PCMU and PCMA for audio. \n\n[![NuGet version](https://img.shields.io/nuget/v/SharpRTSPServer.svg?style=flat-square)](https://www.nuget.org/packages/SharpRTSPServer)\n\nCreate the server on port 8554:\n```cs\nusing(var server = new RTSPServer(8554, \"admin\", \"password\"))\n{\n...\n}\n```\n\nCreate tracks for the media you want to stream. For instance H264 video with AAC audio:\n```cs\nvar h264Track = new H264Track();\nh264Track.SetParameterSets(sps, pps); // Sequence Parameter Set (SPS) and Picture Parameter Set (PPS) are provided by your video source as byte[] \n\nvar 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\n```\n\nCreate a stream source from the tracks an add it to the server:\n```cs\nvar streamSource = new RTSPStreamSource(\"stream1\", h264Track, aacTrack);\nserver.AddStreamSource(streamSource);\n```\n\nMultiple streams can be added, each identified by unique stream ID:\n```cs\nvar streamSource2 = new RTSPStreamSource(\"stream2\", h265Track, null);\nserver.AddStreamSource(streamSource2);\n```\n\nStart listening for incoming requests:\n```cs\nserver.StartListen();\n```\n\nTo stream video, use the track instances and call `FeedInRawSamples` in regular intervals:\n```cs\nh264Track.FeedInRawSamples(rtpVideoBaseTime + videoPTS, new List\u003cbyte[]\u003e { nal1, nal2, ... });\n```\n\nThe same applies to audio:\n```cs\naacTrack.FeedInRawSamples(rtpAudioBaseTime + audioPTS, new List\u003cbyte[]\u003e { aacFrame });\n```\n\n## Samples\n\n### RTSP Server App\nSimple RTSP server that supports streaming video from multiple MP4 files.\n\n### RTSP Recorder App\nDemonstrates how to record RTSP and save it as mp4.\n\n### FFmpeg RTSP Server\nSample RTSP server for ffmpeg RTP streams. Fully configurable in appsettings.json.\n\n### PCAPNG RTSP Server\nPoC of re-playing RTSP from a Wireshark PcapNg file. \n\n## Credits\nMost of the work has been done by SharpRTSP (https://github.com/ngraziano/SharpRTSP), this is just a convenience wrapper around it.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimm98y%2Fsharprealtimestreaming","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjimm98y%2Fsharprealtimestreaming","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjimm98y%2Fsharprealtimestreaming/lists"}