Ask Your Question

Revision history [back]

How to parallelize video file frames decoding using OpenMP?

Hi,

I'm very fresh user of OpenCV, so forgive me please naive question:)

Problem I'm working on is to speedup video reading&decoding . So far I used cv::VideoCapture::read() . But I read in doc that read is a sequence of grab and retrieve. So I though I could execute number of grab calls and then using OpenMP I could decode previously grabbed frames. Something like that:

VideoCapture cap("<my video="" file="">");
#pragma omp parallel single no wait
while(NOT <end of="" video="" file="">)
{

   cap.grab();
  // clone/store somehow grabbed frame 
  #pragma omp task firstprivate(encoded_image)
  {
      cap.retrieve(Image_to_write_to);
  }
}

It does not work. It seems that problem is that opencv does not allow to get to capture buffer and copy this encoded image to my omp task so decoding can be done in parallel.

Any advice how to make it working ?