how to read and release after each frames is processed in streaming video using pafy and cv2

asked 2020-06-29 22:51:11 -0500

rariwa gravatar image

updated 2020-06-30 03:13:02 -0500

supra56 gravatar image

I use pafy and cv2 to read video streaming from youtube and process the frames using object detection. The default method is to read each frame from the stream. however, if I would like to read only one frame then close the loop (release) and start to re-read again and close the loop ,and so on the process is repeated between read and close for each frame. I did this because I have bottleneck problem due to slow object detection and I don't need to detect all frames (it is ok to have gap frames). is it possible to do that ?

edit retag flag offensive close merge delete


Show your code, pls.

supra56 gravatar imagesupra56 ( 2020-06-30 06:03:55 -0500 )edit