Author: Milan Falešník ([email protected], [email protected]) Generic X window and recording for headless setups.
pip install Beheaded
Requires Runner
python package to be installed (pip handles that).
The basic step is to import required objects into namespace
from Beheaded import Headless, Record
Obviously, if you don't need recording, the do not import Record
.
Headless's constructor signature:
Headless(display="auto", width=1280, height=1024, bit_depth=24)
Headless
can be used both in normal and context-managed mode.
X = Headless()
X.start()
... do stuff ...
X.stop()
and
with Headless() as X:
... do stuff ...
are functionally equivalent.
Record's constructor signature:
Record(filename, xvfb, framerate=25)
filename
specifies the target video file namexvfb
specifies theHeadless
object, or anything that provideswidth
,height
anddisplay
attributes.
Record
can be used both in normal and context-managed mode.
rec = Record("filename.webm", X)
rec.start()
... do stuff ...
rec.stop()
and
with Record():
... do stuff ...
are functionally equivalent.
Works obviously as expected:
with Headless() as X:
with Record("filename.webm", X):
... do stuff ...
- add checks whether Xvfb or ffmpeg really run