Screen Recording using python.

        Welcome to Screen recording code.

This is screen recording code. You can use this code firstly import these modules like :- cv2, numpy, and pyautogui.   you can exit this screen recording   press    ' q '.


file name is ' screen_recording.avi '.   


import pyautogui
import cv2
import numpy as np

screen_size = pyautogui.size()

fourcc = cv2.VideoWriter_fourcc(*"XVID")
out = cv2.VideoWriter("screen_recording.avi", fourcc, 20.0, screen_size)

try:
while True:
screenshot = pyautogui.screenshot()

frame = np.array(screenshot)

frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)

out.write(frame)

# Break the loop on 'q' key press
if cv2.waitKey(1) & 0xFF == ord('q'):
break

except KeyboardInterrupt:
pass


out.release()
cv2.destroyAllWindows()

Comments

Popular posts from this blog

wallpaper changer.

Find any color from image using python