Installation
This only works on Linux systems. You should have xwininfo installed by default.
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.
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.
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.
Metadata
Release files for window-recorder 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| window_recorder-0.3.0.tar.gz | 6.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| window_recorder-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.8 kB
Release files / window_recorder-0.3.0.tar.gz
| Download URL | window_recorder-0.3.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
daaf014103767669ec49775b64ebea44e7f219502d3ffc9cf659b7868bf93f59
|
|
BLAKE2b-256 checksum How to use checksums |
a266e34f5f8ec57ec1da3eec33ab64aa3bdc917e4cb973d8caa47233b6e7860e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.10
|
Release files / window_recorder-0.3.0-py3-none-any.whl
| Download URL | window_recorder-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c63186937d1edbeffc9d5234d7c487b2dc6d592848dbbe51cd73085ab1a18e96
|
|
BLAKE2b-256 checksum How to use checksums |
6e7d80ea6d483c736ee90bc276396197c329b1189cd773f95a9e000735e461b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.10
|
Security for window-recorder 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.