Open SDP File in .Net C# - c#

I'm developing a C#’s application with the ability to view an MJPEG encoded video stream, from an encoder (Teleste MPX-E8).
I can see a stream through the Encoder’s Video Encoding Settings page, and I’ve read the stream is encapsulated in an SDP file.
So, into my C# application, I’ve tried to implement the SDP protocol, but the only documentations / examples I found all relates to SIP protocol.
With Wireshark, I can see that when I made an HTTP request to the encoder, it responds with a 200 OK, and SDP.
I suppose that I need to send an acknowledge to my encoder to receive stream, but I can't figure out how to send it.
Does anyone can help me ?!
Thanks in advance for your response !

You can use SDPLib Session Description Protocol library library to read SDP file

The video encoder implements RTSP protocol, SDP is a part of it that describes details of video feed. The RTSP configuration is set up on the device, see P6I_MPX_E.pdf page 45, and remotely you connect with RTSP client software, such as VLC.
In C# you need a library that implements RTSP client - it will do all networking you need and delvier you JPEG frames from the device, either compressed or already decoded. You will present the frames on the application UI.

https://net7mma.codeplex.com/ Does Sdp..
It also contains a RtspClient and RtspServer all in pure C#
There is an article here
http://www.codeproject.com/Articles/507218/Managed-Media-Aggregation-using-Rtsp-and-Rtp
Let me know if you need anything else!

Related

Streaming L.711 m-Law Audio using RTP

I'm new in audio streaming.
I have a stream of audio data, encoded into G.711 m-Law format (from a 3rd party device). And I need to provide an access to it via RTP protocol.
Could you advise me some free library, which would allow me to create a RTP server and feed it with my data?
Everything I found seems to be a RTP client but not a server.
I would use libVLC with a C# wrapper (like https://github.com/videolan/libvlcsharp).
Depending on your source audio format - you may need a μ-law audio encoder. Which should be pretty straight forward to implement or find.

Stream video to an RTMP based Media Server (Red5) using C#

I am writing an C#.Net based application which requires publishing video and audio streams to Red 5 Media Server and retrieving the same published stream in another application on a local network and later on on internet.
In short, I intend to use Red5 as intermediate or proxy for the transmission of video and audio data between two clients.
[client 1] <-Video and Audio -> <- Video and Audio -> [Client 2]
I am looking for .NET implementation(library) of the RTMP protocol that can help me publish the stream to Media Server and retirve the published stream and play it back on my application.
I searched over SOF and came to these options:
Borrocoli RTMP Client Library
FlourineFx.NET
WebORb.Net
Each has some limitations.
Borrocoli RTMP Library has only plyback support for audio/video streams but there is no option of publishing a video/audio stream to the media server. I have played with the library and seen its examples but no avail. If i am wrong please correct me.
FlourinFx.Net says that supports NetStream.Publish(), NetStream.AttachAudio() and NetStream.AttachVideo() methods. But in latest snapshot of code, there is nothing like this. Same is true for their production release. The NetStream class doesn't have the stated methods and/or does not have any methods that can help publish streaming content TO the media server.
WebOrb.Net: I have not explored it, but as evident from their licensing page, the free version works with IIS only. The enterprise version seems to have all the support for publishing streaming video...
Questions:
Is it possible that I can use WebOrb.Net library in conjunction with Red5 Media Server?
Will the free version allow me to publish audio and video to Red5 media server?
Is there any other free alternative I can use if the above questions are not valid?
You can use ffmpeg to send stream to Red 5 MediaServer..
Set the source video to ffmpeg and the output to rtmp of red5, something like this:
ffmpeg -re -i file.mp4 -c copy -f flv rtmp://server/live/streamName
See this answer for an examples to integrate ffmpeg in c#.
you can use weborb.lib for peer to peer video streaming by using flex and .net via RTMP protocol.you can use for the peer to peer streaming.your process can be done by as follows...
1.develop a Flex client code connecting to the server and subscribing to receive server-side updates with the CPU readings.
The code also includes a chart to visualize the received data.
2.The server-side 'Application handler' which plugs into WebORB, polls CPU and delivers data to the client.It will works try it.
Use RTMPdump's librtmp. It's written in C but you should be able to write C# wrappers for it easily enough.

Playing streamed audio data (C#)

I an trying to develop a windows application using C# that can play streamed audio data. Basically, I will have a client application that is responsible for playing different audio files. Currently, from the client application, I am extracting the hardware config param from the file header and then will stream the file data (PCM stream) over network.
So is it possible to use the hardware config params sent from client to configure the actual hardware (on the server end) and then give it the file data stream to it so that it can play the audio data.
While searching, I got to know about NAudio. Is NAudio capable of doing this stuff or the better option for me would be to switch to nativ C/C++ code using Directsound APIS.
update:
By configuring hardware, I mean setting the param related to audio playback. These param would include sample rate (eg: 44100 Hz), number of channels (eg: stereo), storage format (eg: 16 bit little endian) etc.
My client application is on Linux and I have planted an ALSA driver that intercepts PCM stream and hw_params configuration and then send them to server.
update ends
Thanks.
If you look at the latest NAudio code, you will see there are two examples in the NAudioDemo sample app that play streaming audio. One is a rudimentary chat application that sends compressed voice via UDP, the other plays streaming MP3 internet radio. I'd suggest you have a look at that and try the sample app to see if it meets your needs.

Efficient way to stream Webcam from client to a server C#

I've set up a custom tcp connection between my client and the server.
I'm making a simple chat program. So far the users are able to talk to each other and send files.
I'm adding a webcam chat and I've used AForge.Net for grabbing the frames from my webcam. But sending these captured frames from the client to the server is taking too long and uses up too much bandwidth. the server is receiving about 1 frame every 2~4 seconds.
I've tried using a Jpeg encoder and setting the quality to 30 but that doesn't improve anything
Do you guys know a good way of encoding a webcam stream for sending to a server?
Cheers
Roman
You need to send the webcam content as a video stream, not a series of images. I would recommend H264 as it's compact and is the most common video codec used on the web today. Encoding, streaming, receiving, and displaying the video is not simple though. There are plenty of open source projects that can help like X264 and VLC, but this is definitely a lot more complicated than grabbing jpgs and sending them. It would be a lot easier to use an existing video chat component that supports webcams.
Flash apps with an RTMP server can support webcams and there are many open-source/free RTMP servers available (I'm not 100% they support live webcam streams though--the commercial Adobe Flash Media Server definitely does). A Flash video component can be integrated into another app, either windows or web.

Handling / receiving live video webcam stream from WebRTC or any browser based capturing mechanism to the server using ASP.NET MVC

We need to capture a live video stream from WebRTC (or any other capturing mechanism from the client webcam, even if it is not supported on all browsers, but as a PoC).
This live video needs to be handled by a server component (ASP.Net MVC / Web API), I imagine that the code on the server will look like:
[HttpPost]
public ActionResult HandleVideoStream(Stream videoStream)
{
//Handle the live stream
}
Looking for any keyword or helpful link.
We have already implemented a way to send individual frames using base64 jpg, but this is not useful at all, because there is a huge overhead of the base64 encoding and because we could use any video encoding to send the video more efficiently (send the difference between the frames using VPx -vp8- for example), the required solution needs to capture a video from the webcam of the client and send it live (not recorded) to the server (asp.net) as a stream -or chunks of data representing the new video data-.
Your question is too broad and asking for off-site resources is considered off-topic on stackoverflow. In order to avoid opinion-prone statements I will restrict the answer to general concepts.
Flash/RTMP
WebRTC is not yet available on all browser so the most widely used way of capturing webcam input from a browser currently in use is via a plugin. The most common solution uses the Adobe Flash Player, whether people like it or not. This is due to the H.264 encoding support in recent versions, along with AAC, MP3 etc. for audio.
The streaming is accomplished using the RTMP protocol which was initially designed for Flash communication. The protocol works on TCP and has multiple flavors like RTMPS (RTMP over TLS/SSL for encryption), RTMPT(RTMP encapsulated in HTTP for firewall traversal).
The stream usually uses the FLV container format.
You can easily find open-source projects that use Flash to capture webcam input and stream it to an RTMP server.
On the server-side you have two options:
implement a basic RTMP server to talk directly to the sending library and read the stream
use one of the open-source RTMP servers and implement just a client in ASP (you can also transcode the incoming stream on the fly depending on what you're trying to do with your app).
WebRTC
With WebRTC you can either:
record small media chunks on a timer and upload them on the server where the stream is reconstructed (needs concatenating and re-stamping the chunks to avoid discontinuities). See this answer for links.
use the peer-to-peer communication features of WebRTC with the server being one of the peers.
A possible solution for the second scenario, which I haven't personally tested yet, is offered by Adam Roach:
Browser retrieves a webpage with javascript in it.
Browser executes javascript, which:
Gets a handle to the camera using getUserMedia,
Creates an RTCPeerConnection
Calls createOffer and setLocalDescription on the
RTCPeerConnection
Sends an request to the server containing the offer (in SDP format)
The server processes the offer SDP and generates its own answer SDP,
which it returns to the browser in its response.
The JavaScript calls setRemoteDescription on the RTCPeerConnection
to start the media flowing.
The server starts receiving DTLS/SRTP packets from the browser,
which it then does whatever it wants to, up to and including storing
in an easily readable format on a local hard drive.
Source
This will use VP8 and Vorbis inside WebM over SRTP (UDP, can also use TCP).
Unless you can implement RTCPeerConnection directly in ASP with a wrapper you'll need a way to forward the stream to your server app.
The PeerConnection API is a powerful feature of WebRTC. It is currently used by the WebRTC version of Google Hangouts. You can read: How does Hangouts use WebRTC.
Agreed that this is an off-topic question, but I recently bumped into the same issue/requirement, and my solution was to use MultiStreamRecorder from WebRTCExperiments. This basically gives you a "blob" of the audio/video stream every X seconds, and you can upload this to your ASP.NET MVC or WebAPI controller as demonstrated here. You can either live-process the blobs on the server part by part, or concatenate them to a file and then process once the stream stops. Note that the APIs used in this library are not fully supported in all browsers, for example there is no iOS support as of yet.
My server side analysis required user to speak full sentences, so in addition I used PitchDetect.js to detect silences in the audio stream before sending the partial blob to server. With this type of setup, you can configure your client to send partial blobs to server after they finish talking, rather than every X seconds.
As for achieving 1-2 second delay, I would suggest looking into WebSockets for delivery, rather than HTTP POST - but you should play with these options and choose the best channel for your requirements.
Most IP cameras these days will use H264 encoding, or MJPEG. You aren't clear about what sort of cameras are being used.
I think the real question is, what components are out there for authoring/editing video and which video format does it require. Only once you know what format you need to be in, can you transcode/transform your video as necessary so you can handle it on the server side.
There are any number of media servers to transform/transcode, and something like FFMPEG or Unreal Media Server can transform, decode, etc on server side to get it to some format you can work with. Most of the IP cameras I have seen just use an H264 web based browser player.
EDIT: Your biggest enemy is going to be your delay. 1-2 seconds of delay is going to be difficult to achieve.

Categories