From 150d23a5798416663a9db7a087fa76c3692c49fc Mon Sep 17 00:00:00 2001 From: spartan289 <60476934+spartan289@users.noreply.github.com> Date: Sat, 15 Oct 2022 13:44:26 +0530 Subject: [PATCH] Screen Recorder using python --- screen_recorder.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 screen_recorder.py diff --git a/screen_recorder.py b/screen_recorder.py new file mode 100644 index 00000000..a73e9110 --- /dev/null +++ b/screen_recorder.py @@ -0,0 +1,17 @@ +from PIL import ImageGrab +import cv2 +import numpy as np +image = ImageGrab.grab(bbox=None,all_screens=True) +imcv = cv2.cvtColor(np.asarray(image),cv2.COLOR_BGR2RGB) +h,w,l = imcv.shape +size = (w,h) +recording = cv2.VideoWriter('project1.avi',cv2.VideoWriter_fourcc(*'DIVX'),15,size) +import time +timeout = time.time()+20 +while True: + if time.time()>timeout: + break + image = ImageGrab.grab(bbox=None, all_screens=True) + imcv = cv2.cvtColor(np.asarray(image), cv2.COLOR_BGR2RGB) + recording.write(imcv) +recording.release() \ No newline at end of file