简体   繁体   中英

OpenCV extracts less frames from video file compared to MATLAB

I have an AVI video which I need to process in C++ using OpenCV. The problem is that OpenCV detects a FrameRate of 30, while in Matlab the VideoReader detects a FrameRate of 60 for the same video file. As a result, I can only extract half the frames in C++ compared to Matlab.

I tried setting the FPS to 60 in C++ with cv::VideoCapture::set(cv::CAP_PROP_FPS) but it does not affect it. I read that it also has to do with VideoCapture Backends (mine uses FFMPEG).

Is there a way to increase the FPS rate in OpenCV, since the video file supports it according to MATLAB?

Is it like the "read" and "processing" of frames both from a single/main thread of your program? consider separating the read and processing of frames to different threads to increase FPS, as suggested in: https://www.pyimagesearch.com/2017/02/06/faster-video-file-fps-with-cv2-videocapture-and-opencv/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM