OpenCV is so slow on video encoding, like 20 frames per minute, (On 8GB Pi4, 256MB GPU memory, 850MHz GPU Clock, and 2147MHz on CPU Clock)
I think, threading it to one core for taking frames, another one for saving to video will make a better performance but I don't know how I can do it
The code:
#include <opencv4/opencv2/opencv.hpp>
using namespace cv;
int main() {
Mat image;
VideoWriter video("outcpp.mp4", cv::VideoWriter::fourcc('H','V','C','1'), 30, Size(640, 480));
namedWindow("main");
VideoCapture cap(0);
while (1) {
cap >> image;
video.write(image);
imshow("main", image);
if ((char)waitKey(1) == 27)
break;
}
cap.release();
}
Manjaro ARM, OpenCV with FFMPEG.
First post, if anything is wrong, kindly write, thanks.