Giter VIP home page Giter VIP logo

pyscreenrec's Introduction

pyscreenrec

pyscreenrec is a small and cross-platform python library for recording screen.

NO LONGER MAINTAINED.

Downloads


Installation

Install on Windows: pip install pyscreenrec

Install on Linux/macOS: pip3 install pyscreenrec


Example usage

>>> import pyscreenrec
>>> recorder = pyscreenrec.ScreenRecorder()

>>> # to start recording
>>> recorder.start_recording("recording.mp4", 10) 
>>> # 'recording.mp4' is the name of the output video file, may also contain full path like 'C:/Users/<user>/Videos/video.mp4'
>>> # the second parameter(10) is the FPS. You can specify the FPS for the screen recording using the second parameter. It must not be greater than 60.

>>> # to pause recording
>>> recorder.pause_recording()

>>> # to resume recording
>>> recorder.resume_recording()

>>> # to stop recording
>>> recorder.stop_recording()

The stop_recording saves the video and deletes all screenshots used in the session. So calling the stop_recording method is necessary when start_recording is called.


Known limitations

pyscreenrec is yet not able to:

  • capture the system sound during screen recording
  • capture only a certain part of the screen

Change Log

Changes made in the latest version (v0.3) are:

  • Manually set FPS for the screen recording, by an extra fps argument in start_recording method.
  • Introduced a one more exception class named InvalidFPS.
  • Minor bug fixes.

View CHANGELOG for more details.


Contribution

Pull requests are welcome. If you want to make a major change, open an issue first to discuss about the change.

For further details, view CONTRIBUTING.md.

pyscreenrec's People

Contributors

shravanasati avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pyscreenrec's Issues

this project is dead ?

this is cool project don't stop bro

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()

recorder.start_recording('rec.mp4', 30)
print("Record Start")

try:
while True:
pass
except KeyboardInterrupt:
recorder.stop_recording()
print("Record Finish")

rec.mp4

Recordings are sped up significantly

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.

Errors on the code os.mkdir

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.