Python make Screen recoder

 import cv2
import numpy
import pyautogui as pgi
cc=cv2.VideoWriter_fourcc(*"XVID")
screen=pgi.size()
output=cv2.VideoWriter("output.avi",cc,20.0,screen)
while True:
    img=pgi.screenshot()
    frames=numpy.array(img)
    frames=cv2.cvtColor(frames,cv2.COLOR_BGR2RGB)
    output.write(frames)
    cv2.imshow("Recording",frames)
    if cv2.waitKey(1)== ord("q"):
        break

cv2.destroyAllWindows()
output.release()

No comments

Powered by Blogger.