Programatically video record a window as a context manager
Project description
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.
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for window_recorder-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d69b2a792d49501548948bb5bb716a35eb039f55af56a01fef36935235f0548e |
|
MD5 | 168fe150e611a930e2be8c0383a76e33 |
|
BLAKE2b-256 | 9c5db98af363c0a0e7724a9c0a21bb3bd38528ce38655884f63b500e8ed379e6 |