grab a frame from a ffmpeg stream videocapture

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

grab a frame from a ffmpeg stream videocapture

Patrik
Hello!

How are you?
How can I get the video capture frame after I elapsed n milliseconds?
Eg. capture >> frame, then I wait like 1000 milliseconds, so the next frame
should be about 30th frame, but what actually is happening that I am
getting the 2nd frame.

try {
            while(running) {
                capture >> frame;

                if( frame.empty()) {
                    continue;
                }

                Mat frame1 = frame.clone();
                vector<Rect> facesResult = detectAndDraw( frame1, cascade);

                facesMutex.lock();
                faces = facesResult;
                facesMutex.unlock();

  GETTING THIS SLIPPING IF I USE SLEEPING

                //waitKey(250);
                //std::this_thread::sleep_for(std::chrono::milliseconds(1000));

            }
        } catch (std::exception &e) {
            facesMutex.unlock();
            Napi::AsyncWorker::SetError(e.what());
        }


*Patrik*
WWW <https://patrikx3.com> | GitHub <https://github.com/patrikx3/> | NPM
<https://www.npmjs.com/~patrikx3> | Corifeus <https://corifeus.com> | +36
20 342 8046