Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Streaming Audio from video server c#

I have a video server with an IP:192.168.1.XX It has 3 possible formats JPEG, MPEG-4 or H.264

The video server is broadcasting a video(with audio) on real time

I have no problems streaming the video with AFORGE lib but i also need to stream the audio

the video server has several protocols: HTTP,RTSP,RTP,RTCP

according to the user's manual RTSP is the protocol I should use to get MPEG-4(Audio and video), but I haven't found anything to stream by RTSP on C# so I'm trying to stream audio and video separate

the ports are:

RTSP: 554 RTP(Video): 5556 RTP(Audio):5558 RTCP(Video): 5557 RTCP(Audio): 5559

Does any body know how RTP works or how can I get the sound from the video server?

like image 236
Francisco Gutiérrez Avatar asked Dec 05 '25 05:12

Francisco Gutiérrez


1 Answers

I would learn gstreamer. I am assuming that you are using windows since you are doing this in C#. It has a fairly stable windows port with a nice .net wrapper. If you aren't using Windows, then gstreamer is most certainly your best bet.

In gstreamer you would most likely use a pipeline like:

your video src -> x264enc or ffenc_mpv4 -> rtph264pay or rtpmp4vpay -> udpsink

your audio src  -> ffenc_aac or preferably a lower latency codec like mULaw -> rtppay -> udpsink

and so on. It is very easy to use. They even have a nice rtpbin for your to use if you want to actually manage an rtp session.

More information can be found here:

http://gstreamer.freedesktop.org/

Here is a nice sample of how to do rtp:

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-gstrtpbin.html

I have done this sort of thing with the direct show filters but it is much more involved. You usually have to manually handle the rtp payloading and the transport--not to mention deal with COM--whereas GStreamer provides those mechanisms for you out of the box.

like image 119
Jonathan Henson Avatar answered Dec 07 '25 19:12

Jonathan Henson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!