screen recoding
import cv2
import numpy as np
import pyautogui
screen_size = (1920, 1080)
fourcc = cv2.VideoWriter_fourcc(*"XVID")
out = cv2.VideoWriter("screen_recording.avi", fourcc, 20.0, screen_size)
while True:
img = pyautogui.screenshot()
frame = np.array(img)
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
out.write(frame)
cv2.imshow("Screen recording", frame)
key = cv2.waitKey(1)
if key == ord("q"):
break
out.release()
cv2.destroyAllWindows()
import numpy as np
import pyautogui
screen_size = (1920, 1080)
fourcc = cv2.VideoWriter_fourcc(*"XVID")
out = cv2.VideoWriter("screen_recording.avi", fourcc, 20.0, screen_size)
while True:
img = pyautogui.screenshot()
frame = np.array(img)
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
out.write(frame)
cv2.imshow("Screen recording", frame)
key = cv2.waitKey(1)
if key == ord("q"):
break
out.release()
cv2.destroyAllWindows()
No comments:
Post a Comment
Tell us how you like it.