I am trying to make an opensource screen recorder app and this is the code i have written till now
'''Import All the stuff below'''
from tkinter import *
from PIL import ImageGrab
import numpy as np
import cv2
from datetime import datetime
import time
'''Import All the stuff above'''
# Tk() class's instance below
app = Tk()
# Tk() class's instance above
# Vid Name
date_and_time = datetime.now().strftime('%Y-%m-%d %H-%M-%S')
vid_name = f'Simple Recorder {date_and_time}.mp4'
# Vid Name
# Getting screen size below
width = app.winfo_screenwidth()
height = app.winfo_screenheight()
#getting screen size above
vid_writer = cv2.VideoWriter_fourcc('m', 'p', '4', 'v')
captured_vid = cv2.VideoWriter(vid_name, vid_writer, 30.0, (width, height))
while 1:
img = ImageGrab.grab(bbox = (0, 0, width, height))
img_np = np.array(img)
img_final = cv2.cvtColor(img_np, cv2.COLOR_BGR2RGB)
cv2.imshow('Simple Recorder', img_final)
cv2.waitKey(33)
captured_vid.write(img_final)
if cv2.getWindowProperty('Simple Recorder', cv2.WND_PROP_VISIBLE) < 1:
break
The problem is whenever i run the recorded .mp4 file it is fastforwarded and i have no idea how to handle this problem
can any one help me??
ThankYou in Advance!!!