Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I display an MJPEG stream in a Windows Form application?

I have a video stream which comes as an MJPEG over HTTP.

Is there a way to display such stream in a Windows Form application?

I already have a set of routines for displaying simple JPEGs from a webserver, but not continuous MJPEGs. Maybe the two problems are related.

like image 835
malber Avatar asked Feb 18 '23 19:02

malber


1 Answers

I have found a library which works rather nicely: http://channel9.msdn.com/coding4fun/articles/MJPEG-Decoder

You can use it as follows in a C# solution

// class attribute
MjpegDecoder m_mjpeg;

// In the constructor
m_mjpeg = new MjpegDecoder();
m_mjpeg.FrameReady += mjpeg_FrameReady;

// Private method
private void mjpeg_FrameReady(object sender, FrameReadyEventArgs e)
{

        yourPictureBox.Image = e.Bitmap;
}

Source is also available for debugging.

like image 193
malber Avatar answered Apr 27 '23 19:04

malber