Skip to main content

A small and cross-platform python library for recording screen.

Project description

pyscreenrec

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

PyPI Downloads


Installation

Install on Windows: pip install -U pyscreenrec

Install on Linux/macOS: pip3 install -U pyscreenrec


Example usage

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

>>> # to start recording
>>> recorder.start_recording("recording.mp4", 30, {
	"mon": 1,
	"left": 100,
	"top": 100,
	"width": 1000,
	"height": 1000
}) 
>>> # '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 is the FPS for the recording
>>> # the third parameter (optional) is the monitor and the dimensions that needs to be recorded,
# here we're capturing the first monitor, 100px from left, 100px from right, and then 1000px each in resp. axes
# refer https://python-mss.readthedocs.io/examples.html#part-of-the-screen-of-the-2nd-monitor for more information


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

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

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

Take a look at the example GUI screen recorder here for more information.

Keep in mind that the start_recording method is non-blocking, it will start a thread in the background to capture the screenshots.

The stop_recording saves the video. So calling the stop_recording method is necessary when start_recording is called.

You'd ideally need some sort of a timeout or a callback to call the stop_recording function after start_recording, to give the program some time to capture the screen.

If a screen recording session is already running, calling the start_recording and resume_recording methods raises a ScreenRecodingInProgress warning.

Similarly, if a screen recording session is not running, calling the stop_recording and pause_recording methods raises a NoScreenRecodingInProgress warning.


Known limitations

pyscreenrec is not able to:

  • capture the system sound during screen recording

Change Log

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

  • Write screenshots directly to the video stream instead of the disk.
  • Delegate image writing to a separate thread.
  • Use mss library instead of pyscreeze for capturing screenshots.
  • Capture a part of the screen.
  • Performance improvements.
  • Internal refactors.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyscreenrec-0.6.tar.gz (455.0 kB view details)

Uploaded Source

Built Distribution

pyscreenrec-0.6-py3-none-any.whl (582.6 kB view details)

Uploaded Python 3

File details

Details for the file pyscreenrec-0.6.tar.gz.

File metadata

  • Download URL: pyscreenrec-0.6.tar.gz
  • Upload date:
  • Size: 455.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.4 Windows/10

File hashes

Hashes for pyscreenrec-0.6.tar.gz
Algorithm Hash digest
SHA256 82fedfe16879af4cc762987769354a1258859b15652d4d463c0ffd01bcb4347e
MD5 28a6ed7c9e1ef93fb111e8ead0f0f27e
BLAKE2b-256 0504fe126e7d119556bc081c2789a0bae31cb026c283ef31c4ad1be7504fed75

See more details on using hashes here.

File details

Details for the file pyscreenrec-0.6-py3-none-any.whl.

File metadata

  • Download URL: pyscreenrec-0.6-py3-none-any.whl
  • Upload date:
  • Size: 582.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.4 Windows/10

File hashes

Hashes for pyscreenrec-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 98141829724a238563a466f7c00c03faf04a7735a21fb84e08cd17a0920bf84f
MD5 81f0827be537800edfb11b12234b703b
BLAKE2b-256 4d455350004fe53dbaf7f3408dda0144053957aae314edc64abb0b82ee4697b8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page