Time delay in dequeing v4l2-buffer

238 Views Asked by At

When dequeing a image data of resolution 1920x1200 in UYVY format at 20fps (50 ms frametime) from a USB camera in a python script using linux v4l2-buffer (using memory map) and display it using imshow api, there is a delay of 300ms for the 3rd frame if we allocate number of buffers to dequeue as 2. I could check the time taken for the image to leave the camera and it says 50ms frametime for all the frame (including the 3rd frame). So there is no delay from the camera side. My question is why is there a initial delay of dequeue in getting the image. Note: The delay doesn't occur for every 3rd frame, this delay is only for the first 3rd frame.

Actually I found the root cause for the issue. This is due to the imshow in the python script, if I remove the imshow this issue doesn't seems to occur but there is another way to resolve this issue. i.e. increase the number of buffers allocated for v4l2, if I increase that to 8 there is no delay in the 3rd frame even if we include imshow api in the script. So, I just wanted to understand why this delay issue gets resolved if I increase my number of buffer allocated, what is the working behind the queue and dequeue of image frames from the kernel space in case of using more than 2 buffers? Thank you in advance.

0

There are 0 best solutions below