[英]OpenCV extracts less frames from video file compared to MATLAB
I have an AVI video which I need to process in C++ using OpenCV.我有一个 AVI 视频,我需要使用 OpenCV 在 C++ 中处理它。 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.
问题是 OpenCV 检测到 30 的 FrameRate,而在 Matlab 中,VideoReader 检测到同一视频文件的 FrameRate 为 60。 As a result, I can only extract half the frames in C++ compared to Matlab.
因此,与 Matlab 相比,我只能在 C++ 中提取一半的帧。
I tried setting the FPS to 60 in C++ with cv::VideoCapture::set(cv::CAP_PROP_FPS) but it does not affect it.我尝试在 C++ 中使用 cv::VideoCapture::set(cv::CAP_PROP_FPS) 将 FPS 设置为 60,但它不影响它。 I read that it also has to do with VideoCapture Backends (mine uses FFMPEG).
我读到它也与 VideoCapture 后端有关(我使用的是 FFMPEG)。
Is there a way to increase the FPS rate in OpenCV, since the video file supports it according to MATLAB?有没有办法提高 OpenCV 中的 FPS 率,因为视频文件根据 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/
考虑将帧的读取和处理分离到不同的线程以提高 FPS,如: https : //www.pyimagesearch.com/2017/02/06/faster-video-file-fps-with-cv2-videocapture-and -opencv/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.