SJSSoft
SJSSoft

Reputation: 743

convert rtsp stream to http stream

In c# is there possibility that rtsp video stream is used "System.net.httpwebrequest" if not plz tell me another alternative . // the URL to download the file from

        string basepath = @"rtsp://ip.worldonetv.com:1935/live/ ";

        // the path to write the file to

        //            string sFilePathToWriteFileTo = "d:\\Download";



        // first, we need to get the exact size (in bytes) of the file we are downloading

        Uri url = new Uri(basepath);

        System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);

        System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();

        response.Close();

Upvotes: 4

Views: 6704

Answers (2)

Jay
Jay

Reputation: 3355

You can formulate RtspRequests with my library.

You can then base64 encode the RtspRequest and put that as the body to the HttpRequest.

Add the content-length header which would be equal to the length of the base64 encoded rtsp request in the body.

Add the header rtsp/x-tunneled to HttpRequest and then sent it along.

You should get back a HttpResponse with the body containing a base64 encoded RtspResponse.

Base64 decode the Body of the HttpResponse and then use the RtspResponse class in my library to parse it.

The .net core version of the library is @ https://github.com/juliusfriedman/net7mma_core

And there is a codeproject article @ http://www.codeproject.com/Articles/507218/Managed-Media-Aggregation-using-Rtsp-and-Rtp

If you need anything else let me know!

Upvotes: 1

Brannon
Brannon

Reputation: 5424

There's no standard C# library to do this. You can't even do it with the various .NET DirectShow wrappers. I just had a coworker spend a month on this problem and he ended up writing his own C# wrapper on GStreamer. If you're planning to display the video, the easiest option is to embed the VLC ActiveX control.

Upvotes: 0

Related Questions