开发者

Create a RTSP video stream on a .NET platform

I want to create a RTSP/h264 video stream from static images, and incorporate it into my .NET application. So far I have found two possible ways to do this:

  1. Use ffmpeg/ffserver, but I would need to compile ffserver on windows and then rely on it... and I don't necessarily want to rely on an external application

  2. Use the LIVE555 (http://www.live555.com) library, but they do not have any .NET libraries, so I would need to spend some effort to make it 开发者_运维百科work with the rest of my .NET application.

Can you comment on either #1, #2, or which is better. Is there a faster way to bring up a RTSP server in .NET? I do not mind putting in development time if there is a solid solution that takes time, but it would be good to have something we can work with fast, for prototyping and demos.

Thank you,


Does this need to be done on the fly or can you have the images uploaded, then a video created and then just serve an h264 video stream? I would just call FFMpeg from a command line in your code and output a video and skip the RTSP if you can. If you use qt-faststart you can also get seekable streams without requiring the entire MP4 being downloaded first.


1 You can use already compiled ffmpeg/ffserver for Windows. Just google it and you can find lots of precompiled libraries for Windows.

2 For live555 you can build libraries in VC6, YS2003 or VS2008. Refer link How to configure and build the code on Windows. Compiling it is very simple and its 1 hour job.

*These libraries are written in C/C++ (unmanaged code) to use these libraries in your managed code you may need to do marshalling or write some kind of interfaces.


The h264 transcoding part is going to be the difficult part. There aren't many wrappers for X264 for .Net.

After you have a way to encode your still going to have to packetize the data to get it working over Rtp which is what Rtsp uses to send the media to each client. This means putting the data into RtpPackets in the correct way which is determined by the RFC in this case https://www.rfc-editor.org/rfc/rfc6184

I have a RtspClient and RtspServer in c# which can get you the individual packets so you can get them to a decoder.

There is also a codeproject article for it here http://www.codeproject.com/Articles/507218/Managed-Media-Aggregation-using-Rtsp-and-Rtp

VLC is another option as it can do the transcode and provide you with a Rtsp stream for clients to consume at the same time.

Check out the VLC documentation http://www.videolan.org/doc/streaming-howto/en/ch05.html

If you need anything else let me know!


Although this is not a permament solution, the easiest way to do this so far was to embed vlc into the program using the .net Process libraries:

Dim p As New ProcessStartInfo
p.FileName = "vlc"  'Assuming vlc.exe is already in the path variable
p.Arguments = "vlc CLI options for setting up the stream"
p.WindowStyle = ProcessWindowStyle.Hidden
Process.Start(p)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜