Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4ad5438

Browse files
Record Your Screen Using Python
1 parent ca57f4e commit 4ad5438

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

‎Screen-Recorder/screen-recorder.py‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import cv2
2+
import numpy as np
3+
from PIL import ImageGrab
4+
import time
5+
6+
def screenrecorder():
7+
fourcc = cv2.VideoWriter_fourcc(*'XVID')
8+
name = int(round(time.time() * 1000))
9+
name = '{}.avi'.format(name)
10+
out = cv2.VideoWriter(name, fourcc, 5.0, (1920,1080))
11+
12+
while True:
13+
img = ImageGrab.grab()
14+
img_np = np.array(img)
15+
frame = cv2.cvtColor(img_np, cv2.COLOR_BGR2RGB)
16+
cv2.imshow("Screen Recorder", frame)
17+
out.write(frame)
18+
19+
if cv2.waitKey(1) == 27:
20+
break
21+
22+
out.release()
23+
cv2.destroyAllWindows()
24+
25+
screenrecorder()
26+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /