Name | window-recorder JSON |
Version |
0.3.0
JSON |
| download |
home_page | None |
Summary | Programatically video record a window as a context manager |
upload_time | 2024-07-08 20:37:31 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | Copyright (c) 2024 Sheng Zhong Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
video
recording
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
## Installation
This only works on Linux systems. You should have `xwininfo` installed by default.
```shell
pip install window-recorder
```
If the above does not work (OpenCV can be finicky), then you can install the dependencies manually.
Install `opencv` and `mss` as dependencies (recommended with conda):
```
conda install opencv
conda install -c conda-forge python-mss
```
Then clone this repository anywhere and install locally with
```
pip install -e .
```
## Usage
The `WindowRecorder` class comes as a context manager.
You pass in a list of window names to record and it will try to find them
in the order given, recording the first one with a valid window configuration.
If you pass in None as the first argument, then instead it will prompt you
to click on a window (cursor turns into a cross and blocks until you click).
The video will start and end recording according to the life cycle of the
context manager.
```python
from window_recorder import WindowRecorder
import time
# passing in nothing as the window name will allow you to select the window by clicking
# want to capture an RViz window, which could have name "RViz*" as well
with WindowRecorder(["RViz*", "RViz"], frame_rate=30.0, name_suffix="rviz"):
# do things...
time.sleep(0.1)
start = time.time()
while time.time() - start < 2:
time.sleep(0.1)
```
You can test it out with `scripts/text.py` which will prompt you to
click a window that it will then record for 2 seconds
(see the log for the default location the video will be saved to)
To not record, a `record=False` argument can be passed to the constructor for better convenience than unindenting the block
and not using the context manager.
```python
from window_recorder import WindowRecorder
import time
with WindowRecorder(["RViz*", "RViz"], frame_rate=30.0, name_suffix="rviz", record=False):
# will not record; the arguments above also won't be checked and you won't be asked to click a window
time.sleep(0.1)
start = time.time()
while time.time() - start < 2:
time.sleep(0.1)
```
### Limitations
The original location of the window will be what is actually recorded,
so if you move the window during the recording or another window comes
in front of it, that will also be recorded.
Raw data
{
"_id": null,
"home_page": null,
"name": "window-recorder",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "Sheng Zhong <zhsh@umich.edu>",
"keywords": "video, recording",
"author": null,
"author_email": "Sheng Zhong <zhsh@umich.edu>",
"download_url": "https://files.pythonhosted.org/packages/a2/66/e34f5f8ec57ec1da3eec33ab64aa3bdc917e4cb973d8caa47233b6e7860e/window_recorder-0.3.0.tar.gz",
"platform": null,
"description": "## Installation\nThis only works on Linux systems. You should have `xwininfo` installed by default.\n\n```shell\npip install window-recorder\n```\n\nIf the above does not work (OpenCV can be finicky), then you can install the dependencies manually.\nInstall `opencv` and `mss` as dependencies (recommended with conda):\n```\nconda install opencv\nconda install -c conda-forge python-mss\n```\nThen clone this repository anywhere and install locally with\n```\npip install -e .\n```\n\n## Usage\nThe `WindowRecorder` class comes as a context manager.\nYou pass in a list of window names to record and it will try to find them\nin the order given, recording the first one with a valid window configuration.\nIf you pass in None as the first argument, then instead it will prompt you\nto click on a window (cursor turns into a cross and blocks until you click).\n\nThe video will start and end recording according to the life cycle of the\ncontext manager.\n\n```python\nfrom window_recorder import WindowRecorder\nimport time\n\n# passing in nothing as the window name will allow you to select the window by clicking\n# want to capture an RViz window, which could have name \"RViz*\" as well\nwith WindowRecorder([\"RViz*\", \"RViz\"], frame_rate=30.0, name_suffix=\"rviz\"):\n # do things...\n time.sleep(0.1)\n start = time.time()\n while time.time() - start < 2:\n time.sleep(0.1)\n```\n\nYou can test it out with `scripts/text.py` which will prompt you to\nclick a window that it will then record for 2 seconds\n(see the log for the default location the video will be saved to)\n\nTo not record, a `record=False` argument can be passed to the constructor for better convenience than unindenting the block\nand not using the context manager.\n```python\nfrom window_recorder import WindowRecorder\nimport time\nwith WindowRecorder([\"RViz*\", \"RViz\"], frame_rate=30.0, name_suffix=\"rviz\", record=False):\n # will not record; the arguments above also won't be checked and you won't be asked to click a window\n time.sleep(0.1)\n start = time.time()\n while time.time() - start < 2:\n time.sleep(0.1)\n```\n\n### Limitations\nThe original location of the window will be what is actually recorded,\nso if you move the window during the recording or another window comes\nin front of it, that will also be recorded.\n",
"bugtrack_url": null,
"license": "Copyright (c) 2024 Sheng Zhong Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "Programatically video record a window as a context manager",
"version": "0.3.0",
"project_urls": {
"Bug Reports": "https://github.com/LemonPi/window_recorder/issues",
"Homepage": "https://github.com/LemonPi/window_recorder",
"Source": "https://github.com/LemonPi/window_recorder"
},
"split_keywords": [
"video",
" recording"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6e7d80ea6d483c736ee90bc276396197c329b1189cd773f95a9e000735e461b5",
"md5": "1489ace390ad68d34f01cba7e4f0d14e",
"sha256": "c63186937d1edbeffc9d5234d7c487b2dc6d592848dbbe51cd73085ab1a18e96"
},
"downloads": -1,
"filename": "window_recorder-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1489ace390ad68d34f01cba7e4f0d14e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 5820,
"upload_time": "2024-07-08T20:37:27",
"upload_time_iso_8601": "2024-07-08T20:37:27.918148Z",
"url": "https://files.pythonhosted.org/packages/6e/7d/80ea6d483c736ee90bc276396197c329b1189cd773f95a9e000735e461b5/window_recorder-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a266e34f5f8ec57ec1da3eec33ab64aa3bdc917e4cb973d8caa47233b6e7860e",
"md5": "56fe9ed33aebd5d35c9c5b979b189944",
"sha256": "daaf014103767669ec49775b64ebea44e7f219502d3ffc9cf659b7868bf93f59"
},
"downloads": -1,
"filename": "window_recorder-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "56fe9ed33aebd5d35c9c5b979b189944",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 5986,
"upload_time": "2024-07-08T20:37:31",
"upload_time_iso_8601": "2024-07-08T20:37:31.701232Z",
"url": "https://files.pythonhosted.org/packages/a2/66/e34f5f8ec57ec1da3eec33ab64aa3bdc917e4cb973d8caa47233b6e7860e/window_recorder-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-08 20:37:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LemonPi",
"github_project": "window_recorder",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "window-recorder"
}