Uploaded by hegopic548

minor project 5 sem (1)

advertisement
Ambedkar Institute
Of Technology
Project :
Screen Recoder
Presented By :
Pawan Kumar, 03324818119
Manish Mittal, 05924818119
Aryan Pal, 06024818119
How Screen Recorder Record Your
Screen

1.
Capture a Screenshot using PIL Module

2.
Convert that screenshot to a array Using numpy Module.

3.
Write that numpy array to a file with proper format using a video writer in
cv2 or OpenCV Module.

Many Function Written for Pause, Play, Hide, Unhide, Timer, etc
Steps To Run This Program Another Devices..

Step 1: Install Python.

Step 2: Download the given source code below.

Step 3: Open the project in your Vs Code, Pycharm and Python IDE.

Step 4: Import Module like (cv2, PIL, numpy). Some Modules you
don’t need to import because some modules already exist in
Python.

Step 3: Run the project in Vs Code.

You Can Run This Program By Using Command
Prompt.
Installed Libraries
Create a Screen recorder using python

Python is a widely used general-purpose language. It allows
performing a variety of tasks.

It provides a modules named cv2 , PIL, Tkinter, etc Modules
which can be used for the Images to Video Convert, Taking Screen
Shots, GUI. This module along NumPy and OpenCV provides the
way to manipulate and save the images (screenshot in this case)
Modules needed

Numpy
pip install numpy (press Enter)

cv2
pip install opencv-python (press Enter)

PIL
pip install pillow (press Enter)

Keyboard
pip install numpy (press Enter)

Now, before recording the screen

We have to create a videoWriter object. Also, we have to specify
the output file name, Video codec, FPS, and video resolution. In
video codec we have to specify a 4- byte (such as XVID ,MJPG,
X264, etc.). We'll be Using XVID here.

Frame Resolution set By The User Before Starting Screen
Recording.

#
Specify video codec

codec = cv2.VideoWriter_fourcc(*"XVID")

#
Specify name of Output file filename =
“according today date & time” for example
(yearmonthdatehourminuteseconds.avi)


#
#


#
Creating a VideoWriter object
out
=
cv2.VideoWriter(filename,
resolution)
Specify frames rate. We can choose
any value and experiment with it fps = 30.0
codec,
fps,

Now, let's start recording our screen. We will be running an infinite loop and
in each iteration of the loop, we will take a screenshot and write it to output
file with the help of the video writer.

while True:

# Take screenshot using PIL
img = ImageGrab.grab(bbox=(x,y,x+width,y+height))

# Convert the screenshot to a numpy array
frame = np.array(img)

After Stoping Recording everything is done, we will release the writer and
destoy all windows opened by OpenCV.
Output
Conclusion
In this Python project was developed and designed using Python OpenCV,
Screen recording enables you to create demonstration videos, record
gaming achievements and create videos that can be shared online on social
media. Many industrial softwares exist out there that can help you do that
very easily though.
In this tutorial, you will learn how to make your own simple screen recorder in
Python with GUI that you can further extend to your own needs. and this
Python OpenCV Project also includes a downloadable Python Project With
Source Code for free.
Download