My code tries to get frames from webcam, detect faces and save video file simultaneously. I use Python, opencv for image and video processing, face_recognition library for face detection and recognition.
The problem is that recorder video is too slow - final FPS is about 1.3, however the camera has 30 FPS. I tried to use multithreading, but the problem didn’t disappear.
To create a video stream:
src="nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format=(string)NV12, framerate=(fraction)30/1 ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink" capture = cv2.VideoCapture(src, cv2.CAP_GSTREAMER)
Know I don’t even know what to do… Do you have any ideas, what should I try to process video and save it to file at the same time with normal speed?