Screen recording with Pillow and OpenCv

asked 2018-06-30 06:53:11 -0500

Hello! Something going wrong and this code doesnt save avi file (with screen record) normaly. When i try to open saved avi file Windows Media returns error. Can someone help me to solve this problem?

from PIL import ImageGrab
import cv2
import numpy as np

fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output.avi', fourcc, 20.0, (640, 480))

while True:
    img = ImageGrab.grab()
    imcv = cv2.cvtColor(np.asarray(img), cv2.COLOR_RGB2BGR)


    if cv2.waitKey(1) & 0xFF == 27:

edit retag flag offensive close merge delete