Encoding H.264 Stream from Bitmap images

Topics: Question
Oct 1, 2015 at 11:56 AM
Hello, in my app I need to braodcast rtsp stream from bitmap images,
I do it with code like this:
            using (RtspServer server = new RtspServer())
                var jpegMedia = new JPEGMedia("jpegsource", new Uri("", UriKind.Relative));


                    Bitmap bmp = GetImage();


it produces rtsp stream with motion-jpeg video
Is it possible to explicitly set codec to h264 with JPEGMedia and RtspServer?
Oct 1, 2015 at 5:55 PM
Thanks for checking out the library!

There is a layman example for H.264 encoding, see the RFC6184Media class, there is more planned but nothing I can release as of yet.
Marked as answer by juliusfriedman on 10/1/2015 at 10:55 AM
Oct 5, 2015 at 11:30 AM
Hello, Julius! Thanks, the RFC6184Media class seems to be what I need, but Ihave some troubles with it.
Packetize method always throws NotSupportedException "Only ARGB is currently supported" though
I pass a bitmap with pixelformat Format32bppArgb.
var bitmap32 = new Bitmap(_width, _height, PixelFormat.Format32bppArgb);

using (var g = Graphics.FromImage(bitmap32))
    g.DrawImage(myBitmap, new Rectangle(0, 0, _width, _height));

Packetize uses Image.GetThumbnailImage which seems to return a bitmap of fromat PixelFormat.Format32bppPArgb
no matter of original bitmap format.

Am I missing something or doing something wrong?
Oct 6, 2015 at 2:44 PM
See the API for GetThumbnailImage

DrawImage is a better candidate function for now, I eventually have plans to add my own Image construct.
Marked as answer by juliusfriedman on 10/6/2015 at 7:44 AM
Mar 11, 2016 at 5:19 PM
Hey, I have started to work out the basics for raw image formats and would like to know if your still interested in this.

I would also be able to implement a small I frame only decoder as its the reverse of the encoding.

I could probably do the same for mpeg 1 / 2 as well.

Let me know if your still interested in this!
Marked as answer by juliusfriedman on 3/11/2016 at 10:19 AM