I am creating a python program to record my desktop screen.
But the output of this code is in very low quality and blurry.
Can anyone help me in capturing (screen capturing) in high quality.
Like the screen recorder like OBS studio and Camtasia do.
what can i do improve my quality change my extention ,codec ,etc. please mention.
import cv2
import numpy as np
import datetime
from PIL import Image, ImageTk, ImageGrab
date = datetime.datetime.now()
filename='rec_%s-%s-%s-%s%s%s.mp4' % (date.year, date.month, date.day,
date.hour, date.minute, date.second)
fourcc = cv2.VideoWriter_fourcc(*'X264')
frame_rate = 16
SCREEN_SIZE = (960,540)
out = cv2.VideoWriter(filename, fourcc,framerate, SCREEN_SIZE)
while True:
img = ImageGrab.grab()
frame = np.array(img)
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
out.write(frame)
cv2.imshow('screenshot', frame)
if cv2.waitKey(1) == ord("q"):
break
cv2.destroyAllWindows()
out.release()