AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

MJPEGStream for IP Camera

Forum to discuss AForge.NET Framework, its features, API, how-tos, etc.

MJPEGStream for IP Camera

Postby MetalJim » Sun Nov 11, 2018 9:50 pm

I am trying to display an mpeg image in a picture box in Visual C#.
IT works when I use "http://88.53.197.250/axis-cgi/mjpg/video.cgi?resolution=320×240"); but not when I use my camera address which is a trendnet camera.
Here is the code. Any idea why my trend net does not work ? If I type the source on a web browser an image pops up.

private void button1_Click(object sender, EventArgs e)
{
// create MJPEG video source
MJPEGStream stream = new MJPEGStream("http://192.168.110.2/Streaming/channels/1/picture");
// MJPEGStream stream = new MJPEGStream("http://88.53.197.250/axis-cgi/mjpg/video.cgi?resolution=320×240"); //< This one works !
// set event handlers
stream.NewFrame += new NewFrameEventHandler(video_NewFrame);
// start the video source

stream.Start();

}
private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
{

Bitmap bitmap = (Bitmap)eventArgs.Frame.Clone();

// process the frame
pictureBox1.Image = bitmap;

}
MetalJim
 
Posts: 2
Joined: Sun Nov 11, 2018 9:44 pm

Re: MJPEGStream for IP Camera

Postby andrew.kirillov » Mon Nov 12, 2018 7:57 am

MetalJim wrote:Any idea why my trend net does not work ?

Maybe it does not provide MJPEG stream. Maybe it is RTSP instead. Or maybe they have something custom in their MJPEG implementation. Try debugging and see what actually comes from that URL.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3327
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: MJPEGStream for IP Camera

Postby MetalJim » Sat Nov 24, 2018 10:38 pm

I had the same issue. My Trendnet camera and hikvision camera will only work with
JPEGStream stream = new JPEGStream("http://192.168.1.2/Streaming/channels/1/picture?snapShotImageType=JPEG?Resolution=1024x720");
stream.NewFrame += new NewFrameEventHandler(video_NewFrame1);
//IF you have a password, you will also need to supply that information as well.
//i.e.
stream.Login = "admin";
stream.Password = "password";
//and then start
stream.start();
MetalJim
 
Posts: 2
Joined: Sun Nov 11, 2018 9:44 pm




Return to AForge.NET Framework