-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScreen_Recorder.py
More file actions
47 lines (35 loc) · 933 Bytes
/
Screen_Recorder.py
File metadata and controls
47 lines (35 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import pyautogui
import cv2
import numpy as np
import time
resolution = (1920, 1080)
codec = cv2.VideoWriter_fourcc(*"XVID")
filename = "Recording2.avi"
fps = 60.0
out = cv2.VideoWriter(filename, codec, fps, resolution)
cv2.namedWindow("Live", cv2.WINDOW_NORMAL)
start = time.time()
while(True):
img = pyautogui.screenshot()
end = time.time()
if (end-start == 5):
break
print(end - start)
frame = np.array(img)
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
out.write(frame)
cv2.imshow('Live', frame)
if (end-start == 5):
break
Capturer=cv2.VideoCapture('/home/Halivious/Desktop/Recording2.avi')
frameNr = 0
while (True):
success, frame = capture.read()
if success:
cv2.imwrite(f'/home/Halivious/Desktop/output/frame_{frameNr}.jpg', frame)
else:
break
frameNr = frameNr+1
capture.release()
out.release()
cv2.destroyAllWindows()