# pyscreenrec
*pyscreenrec* is a small and cross-platform python library for recording screen.
![PyPI Downloads](https://static.pepy.tech/badge/pyscreenrec)
<br>
## Installation
Install on Windows:
`pip install -U pyscreenrec`
Install on Linux/macOS:
`pip3 install -U pyscreenrec`
<br>
## Example usage
``` python
>>> 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](examples/gui_recorder.py) 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.
<br>
## Known limitations
*pyscreenrec* is not able to:
- capture the system sound during screen recording
<br>
## 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](https://github.com/shravanasati/pyscreenrec/blob/master/CHANGELOG) for more details.
<br>
## 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](https://github.com/shravanasati/pyscreenrec/blob/master/CONTRIBUTING.md).
Raw data
{
"_id": null,
"home_page": null,
"name": "pyscreenrec",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "python, screen recording, screen, recording, screenshots",
"author": "Shravan Asati",
"author_email": "dev.shravan@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/05/04/fe126e7d119556bc081c2789a0bae31cb026c283ef31c4ad1be7504fed75/pyscreenrec-0.6.tar.gz",
"platform": null,
"description": "# pyscreenrec\n\n*pyscreenrec* is a small and cross-platform python library for recording screen.\n\n\n![PyPI Downloads](https://static.pepy.tech/badge/pyscreenrec)\n\n<br>\n\n## Installation\nInstall on Windows: \n`pip install -U pyscreenrec`\n\nInstall on Linux/macOS: \n`pip3 install -U pyscreenrec`\n\n<br>\n\n## Example usage\n\n\n``` python\n>>> import pyscreenrec\n>>> recorder = pyscreenrec.ScreenRecorder()\n\n>>> # to start recording\n>>> recorder.start_recording(\"recording.mp4\", 30, {\n\t\"mon\": 1,\n\t\"left\": 100,\n\t\"top\": 100,\n\t\"width\": 1000,\n\t\"height\": 1000\n}) \n>>> # 'recording.mp4' is the name of the output video file, may also contain full path like 'C:/Users/<user>/Videos/video.mp4'\n>>> # the second parameter is the FPS for the recording\n>>> # the third parameter (optional) is the monitor and the dimensions that needs to be recorded,\n# here we're capturing the first monitor, 100px from left, 100px from right, and then 1000px each in resp. axes\n# refer https://python-mss.readthedocs.io/examples.html#part-of-the-screen-of-the-2nd-monitor for more information\n\n\n>>> # to pause recording\n>>> recorder.pause_recording()\n\n>>> # to resume recording\n>>> recorder.resume_recording()\n\n>>> # to stop recording\n>>> recorder.stop_recording()\n```\n\n> Take a look at the example GUI screen recorder [here](examples/gui_recorder.py) for more information.\n\nKeep in mind that the `start_recording` method is non-blocking, it will start a thread in the background to capture the screenshots.\n\n\nThe `stop_recording` saves the video. So calling the `stop_recording` method is necessary when `start_recording` is called.\n\nYou'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.\n\nIf a screen recording session is already running, calling the `start_recording` and `resume_recording` methods raises a `ScreenRecodingInProgress` warning.\n\nSimilarly, if a screen recording session is not running, calling the `stop_recording` and `pause_recording` methods raises a `NoScreenRecodingInProgress` warning.\n\n\n<br>\n\n## Known limitations\n\n*pyscreenrec* is not able to:\n- capture the system sound during screen recording\n\n<br>\n\n## Change Log\n\nChanges made in the latest version (*v0.6*) are:\n\n- Write screenshots directly to the video stream instead of the disk.\n- Delegate image writing to a separate thread.\n- Use mss library instead of pyscreeze for capturing screenshots.\n- Capture a part of the screen.\n- Performance improvements.\n- Internal refactors.\n\n\n\nView [CHANGELOG](https://github.com/shravanasati/pyscreenrec/blob/master/CHANGELOG) for more details.\n\n<br>\n\n## Contribution\n\nPull requests are welcome. If you want to make a major change, open an issue first to discuss about the change.\n\nFor further details, view [CONTRIBUTING.md](https://github.com/shravanasati/pyscreenrec/blob/master/CONTRIBUTING.md).",
"bugtrack_url": null,
"license": "MIT",
"summary": "A small and cross-platform python library for recording screen.",
"version": "0.6",
"project_urls": null,
"split_keywords": [
"python",
" screen recording",
" screen",
" recording",
" screenshots"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4d455350004fe53dbaf7f3408dda0144053957aae314edc64abb0b82ee4697b8",
"md5": "81f0827be537800edfb11b12234b703b",
"sha256": "98141829724a238563a466f7c00c03faf04a7735a21fb84e08cd17a0920bf84f"
},
"downloads": -1,
"filename": "pyscreenrec-0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "81f0827be537800edfb11b12234b703b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 582568,
"upload_time": "2024-11-09T04:48:05",
"upload_time_iso_8601": "2024-11-09T04:48:05.149322Z",
"url": "https://files.pythonhosted.org/packages/4d/45/5350004fe53dbaf7f3408dda0144053957aae314edc64abb0b82ee4697b8/pyscreenrec-0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0504fe126e7d119556bc081c2789a0bae31cb026c283ef31c4ad1be7504fed75",
"md5": "28a6ed7c9e1ef93fb111e8ead0f0f27e",
"sha256": "82fedfe16879af4cc762987769354a1258859b15652d4d463c0ffd01bcb4347e"
},
"downloads": -1,
"filename": "pyscreenrec-0.6.tar.gz",
"has_sig": false,
"md5_digest": "28a6ed7c9e1ef93fb111e8ead0f0f27e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 455021,
"upload_time": "2024-11-09T04:48:09",
"upload_time_iso_8601": "2024-11-09T04:48:09.431497Z",
"url": "https://files.pythonhosted.org/packages/05/04/fe126e7d119556bc081c2789a0bae31cb026c283ef31c4ad1be7504fed75/pyscreenrec-0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-09 04:48:09",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pyscreenrec"
}