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

JPEGStream IP Camera Help

The forum is to discuss topics related to different areas of image processing and computer vision.

JPEGStream IP Camera Help

Postby wijic# » Sun Jul 07, 2019 9:41 pm

Hello everyone,

I am having some trouble trying to use JPEGStream for an IP camera. It is not possible to use MJPEGStream because it is H.264. But it has a snapshot URL for a JPEG image. Is my code below correct? I keep getting "Object is currently in use elsewhere." I have looked for examples online but they are all for MJPEGStream, it is hard to find one for JPEGStream. I apologise in advance for my noob/naive questions.

Thank you

Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using AForge.Video;

namespace IP_camera
    public partial class Form1 : Form
        JPEGStream stream;
        public Form1()
            stream = new JPEGStream("");
            stream.NewFrame += new NewFrameEventHandler(video_NewFrame);

        private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
            Bitmap bitmap = eventArgs.Frame;
            pictureBox1.Image = bitmap;

        private void Form1_Load(object sender, EventArgs e)


        private void BtnStart_Click(object sender, EventArgs e)

        private void BtnStop_Click(object sender, EventArgs e)

Posts: 1
Joined: Sun Jul 07, 2019 9:34 pm

Re: JPEGStream IP Camera Help

Postby andrew.kirillov » Mon Jul 08, 2019 7:45 am


Try clonning the image you set to picture box.

There is no difference in working with JPEGs or MJPEG stream - all same. Only the init part is different, where you create different object.
With best regards,

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

Return to Image Processing and Computer Vision