Ask Your Question

Revision history [back]

Latency with mjpg

Hi,

I want to calibrate my Ip cam using calibration sample but I have got some latency 1 s when I run program and when I start calibration sometime 10s (ten seconds!).

I have write this small program and try to understand what happen :

Mat view0;
for(i = 0;i<tps.size();i++)
{
    if( capture.isOpened() )
    {
        tps[i] = getTickCount();
        while (!capture.grab());
        capture.retrieve(view0);
        //view0.copyTo(view);
    }
}
for(i = 1;i<tps.size();i++)
{
    cout << (tps[i] - tps[i-1])/getTickFrequency() << "\n";
}

and it gives me these results : 22 values like 0.04s (first images) and after 0.852972s and many values like 0.5s (when buffer is empty?)

I understand that MJPG is a flow and you have to read all flow to have last image. Is it right?

Is it possible to flush flow before reading?

Thanks for yours answers

Latency with mjpg

Hi,

I want to calibrate my Ip cam using calibration sample but I have got some latency 1 s when I run program and when I start calibration sometime 10s (ten seconds!).

I have write this small program and try to understand what happen :

Mat view0;
for(i = 0;i<tps.size();i++)
{
    if( capture.isOpened() )
    {
        tps[i] = getTickCount();
        while (!capture.grab());
        capture.retrieve(view0);
        //view0.copyTo(view);
    }
}
for(i = 1;i<tps.size();i++)
{
    cout << (tps[i] - tps[i-1])/getTickFrequency() << "\n";
}

and it gives me these results : 22 values like 0.04s (first images) and after 0.852972s and many values like 0.5s (when buffer is empty?)

I understand that MJPG is a flow and you have to read all flow to have last image. Is it right?

Is it possible to flush flow before reading?

Now I have got a switch so my network is clean. i have a record a small video where we can see

  1. using mozilla to display my IPcam (upper left) bottom left opencv
  2. using opencv my ipcam (bottom left)
  3. a wab cam (Logitech 270) upper right

As you can see latency for each link are different. It seems that opencv with ffmpeg has got greater latency time than mozilla and webcam (for webcam it is logical).

have you got same latency time?

Thanks for yours answers

Latency with mjpg

Hi,

I want to calibrate my Ip cam using calibration sample but I have got some latency 1 s when I run program and when I start calibration sometime 10s (ten seconds!).

I have write this small program and try to understand what happen :

Mat view0;
for(i = 0;i<tps.size();i++)
{
    if( capture.isOpened() )
    {
        tps[i] = getTickCount();
        while (!capture.grab());
        capture.retrieve(view0);
        //view0.copyTo(view);
    }
}
for(i = 1;i<tps.size();i++)
{
    cout << (tps[i] - tps[i-1])/getTickFrequency() << "\n";
}

and it gives me these results : 22 values like 0.04s (first images) and after 0.852972s and many values like 0.5s (when buffer is empty?)

I understand that MJPG is a flow and you have to read all flow to have last image. Is it right?

Is it possible to flush flow before reading?

Now I have got a switch so my network is clean. i have a record a small video video where we can see

  1. using mozilla to display my IPcam (upper left) bottom left opencv
  2. using opencv my ipcam (bottom left)
  3. a wab cam (Logitech 270) upper right

As you can see latency for each link are different. It seems that opencv with ffmpeg has got greater latency time than mozilla and webcam (for webcam it is logical).

have you got same latency time?

Thanks for yours answers