Movatterモバイル変換


[0]ホーム

URL:


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

Commite4135bc

Browse files
committed
update screen recorder tutorial
1 parent16ad39e commite4135bc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎general/screen-recorder/screen_recorder.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
importnumpyasnp
33
importpyautogui
44

5-
# display screen resolution, get itfrom your OS settings
6-
SCREEN_SIZE=(1920,1080)
5+
# display screen resolution, get itusing pyautogui itself
6+
SCREEN_SIZE=tuple(pyautogui.size())
77
# define the codec
88
fourcc=cv2.VideoWriter_fourcc(*"XVID")
9+
# frames per second
10+
fps=12.0
911
# create the video write object
10-
out=cv2.VideoWriter("output.avi",fourcc,20.0, (SCREEN_SIZE))
12+
out=cv2.VideoWriter("output.avi",fourcc,fps, (SCREEN_SIZE))
13+
# the time you want to record in seconds
14+
record_seconds=10
1115

12-
whileTrue:
16+
foriinrange(int(record_seconds*fps)):
1317
# make a screenshot
1418
img=pyautogui.screenshot()
1519
# convert these pixels to a proper numpy array to work with OpenCV

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp