Send Bitmaps via RTSP encoded with H264

Topics: Question
Feb 5, 2015 at 3:04 AM
Hi,

First of all, what you have done is quite commendable - well done!

I'm working on a project using Emgu CV (C# wrapper for Open CV) which grabs frames from video files, usb cams, IP camera live streams and processes them. I then want to stream these processed frames via RTSP, encoded using an efficient codec (H264 for example). I already have a solution which streams MJPEG stream, however the bandwidth required is quite high, so the reason for using H264 is to minimise bandwidth but have reasonable quality.

I understand that Packetizing bitmaps to H264 is only experimental but I'm wondering if you actually managed to get it working. So far I have managed to create a server and source. I can fetch bitmaps to the source (I made some modifications to your code to get this working). I can connect client (VLC) to the server and VLC logs say that I'm starting to buffer data but after a while buffer just hangs and nothing else happens.

Do you have any sample code specifically for using bitmaps with H264 via RTSP?

I also found that method "public override void Packetize(System.Drawing.Image image)" in RCF6184 was very slow (+100ms per bitmap). It turned out the problem was with calling newFrame.Packetize(macroBlocks.SelectMany(mb => mb).ToArray()); The SelectMany was taking too long. I have been able to speed it up a little bit by using LINQ Parallel: newFrame.Packetize(macroBlocks.AsParallel().SelectMany(mb => mb).ToArray());

I would appreciate if you had some words of wisdom in how to get these bitmaps streamed via RTSP using H264 (or any other efficient encoder).

Thanks.
Coordinator
Feb 5, 2015 at 3:27 AM
Hello and thanks!

I had it working at one point but it's possible I changed something to break it because I haven't setup unit tests for as many things or in the ways that I should.

I will be addressing this also in the coming releases.

In short no, what you have is it.

If you post up your code I can take a look when time permits.

Yout can always use another encoder e.g. setup vlc to transcode the mjpeg to the type of your choice and then using the sdp from the transcode operation and RtpSource you should be good to go.

I don't mean to be short but I am also working on a decent sized so I need to get back to work:-)

If you run into any issues or need any more information let me know.
Marked as answer by juliusfriedman on 2/4/2015 at 7:27 PM
Feb 5, 2015 at 4:26 AM
No worries, thanks for the feedback and keep up the good work.
Coordinator
Feb 5, 2015 at 11:33 PM
https://net7mma.codeplex.com/SourceControl/latest has been updated with the latest release.

There are a number of performance and API improvements.

Let me know how you like it!