- Home /
AForge ipcam image stutter
Hi, I have a question about Aforge for IPCam (remote).
First off, I already can integrate it with unity (2019.1.7), the problem is the image stream is stuttering like what you can see from the video attachment.
video stutter
Here's the script I'm using to get the stream
private void OnEnable()
{
transform.eulerAngles = initRot;
if (mjpegStream != null)
mjpegStream.Start();
}
// Use this for initialization
void Start () {
camTexture = new Texture2D(2 , 2);
// create MJPEG video source
mjpegStream = new MJPEGStream(camIPAddress);
// set event handlers
mjpegStream.NewFrame += new NewFrameEventHandler(StreamImage);
// start the video source
mjpegStream.Start();
}
// Update is called once per frame
void Update()
{
if (dataGet)
{
camTexture.LoadImage(jpegstream.ToArray());
if(screenDisplay.texture != camTexture)
screenDisplay.texture = camTexture;
counter = 0;
dataGet = false;
}
}
void StreamImage(object sender, NewFrameEventArgs eventArgs)
{
jpegstream = eventArgs.Frame;
dataGet = true;
}
The question is, does anyone know how to make the image to not stutter? Is it a problem from the stream I'm getting or from ToArray() function of MemoryStream?
(PS: I don't really know if my tags are right, do forgive me if the tags I'm using are wrong)
Your answer
Follow this Question
Related Questions
External terrain model performance. 0 Answers
Unity keeps reverting to visual studio as source editor 0 Answers
Stream WebCamTexture over network 1 Answer
Windows build for game using named pipes hangs on Stream.BeginRead 0 Answers
Can you stream directly to Oculus Quest without building the project? 1 Answer