Describe the bug
When using the example code, the output .mp4 has a much faster speed than the recording length. For example, I use a 20s sleep to invoke the stop_recording() method, but the output file is 4s with everything sped up. Using 60fps, and default fps. Using standard file name. Not sure what's causing this behavior.
To Reproduce
Run the following chunk
import time
import pyscreenrec
from tkinter import filedialog
from tkinter import *
from datetime import datetime
# get file save location from user
root = Tk()
root.withdraw()
folder_selected = filedialog.askdirectory()
# get timestamp and config save loc
now = datetime.now().strftime("%d-%m-%y-%H%M%S")
fullpath = f"{folder_selected}/recording-{now}.mp4"
# Start recording
print(f"File will be saved in {fullpath}. Recording starting...\n")
rec = pyscreenrec.ScreenRecorder()
rec.start_recording(fullpath)
# Stop recording
time.sleep(20)
rec.stop_recording()
print(f"File should be saved in {fullpath}. Recording done.\n")
Expected behavior
A 20s mp4 in my fullpath directory. Actual behavior: 1s.
Desktop (please complete the following information):
macOS Big Sur 11.3
Python 3.8
Pyscreenrec 0.3
Additional context
Would be happy to contribute a fix, just not sure why it is doing this.
Hello, I need to show you one error I am facing.
the error shows as below:
File "C:\Users\Abdesol\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyscreenrec\__init__.py", line 29, in __init__
os.mkdir(self.screenshot_folder)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\Abdesol\\Documents//pyscreenrec_data'
and I am using the code below
import pyscreenrec, time
recorder = pyscreenrec.ScreenRecorder()
recorder.start_recording('rec.mp4')
time.sleep(10)
print("Created")
recorder.stop_recording()
I don't need that much help but I just need to show you this error
thanks
Record Start
^CException in thread Thread-1 (_start_recording):
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/home/archkubi/.local/lib/python3.10/site-packages/pyscreenrec/init.py", line 75, in _start_recording
screenshot(os.path.join(self.screenshot_folder, f"s{i}.jpg"))
File "/home/archkubi/.local/lib/python3.10/site-packages/pyscreeze/init.py", line 506, in _screenshot_linux
im = Image.open(tmpFilename)
File "/usr/lib/python3.10/site-packages/PIL/Image.py", line 3068, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/home/archkubi/pyscreenrec_data/s587.jpg'
Record Finish
some times this problem but this is works and so fast bro keep going
import pyscreenrec, time
recorder = pyscreenrec.ScreenRecorder()