Skip to content

Commit

Permalink
feat(tools): add python scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
trystan2k committed May 14, 2022
1 parent cd94bb1 commit e51c69a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tools/python/video-recording.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import pyautogui
import numpy as np
import cv2
import keyboard
# pip install opencv-python
# pip install pyautogui
# pip install keyboard
# pip install numpy


def Screen_Recording():
while True:
# Press R to Start Recording
if keyboard.is_pressed('r'):
print("Recording Has been Started...")
# resolution
capture_area = (1920, 1080)

codec = cv2.VideoWriter_fourcc(*'mp4v')
filename = "Your_Recording.mp4"

# Frame per Second
fps = 60.0
output_video = cv2.VideoWriter(filename, codec, fps, capture_area)
while True:
image = pyautogui.screenshot()
Image_frame = np.array(image)
Image_frame = cv2.cvtColor(Image_frame, cv2.COLOR_BGR2RGB)
output_video.write(Image_frame)
cv2.waitKey(1)
# Press Q button to Stop recording
if keyboard.is_pressed('q'):
print("Recording Has been Stopped...")
break


output_video.release()
cv2.destroyAllWindows()
Screen_Recording()

0 comments on commit e51c69a

Please sign in to comment.