vuba.Writer
- class vuba.Writer(output, footage=None, fps=None, resolution=None, codec=None, grayscale=False)[source]
Create an encoder for exporting frames at a given output.
Regardless of input format, this encoder can encode footage to both individual images and to video files. For encoding to individual images, a sequence of filenames needs to be supplied that will match the length of the number of frames that need to be encoded. Conversely, for encoding to a video file, a filename to the video file needs to be provided.
- Parameters
output (str or list) – Output to export frames.
footage (Video) – Instance of Video to create writer based on. If this is not supplied then you must supply all encoder specific arguments.
fps (float) – Framerate to export footage at, default is the fps of the video supplied. Note that this argument must be supplied if working with individual images.
resolution (tuple) – Width and height to export footage at (both must be supplied as integers). Default is the resolution of the footage supplied.
codec (str) – Codec to encode footage with. Default is to encode with MJPG codec or that of the Video instance supplied (if any).
grayscale (bool) – Whether to export footage as grayscale. Default is False.
- Returns
encoder – Encoder to export frames to a given output.
- Return type
- Raises
ValueError – If a frame-rate is not supplied when encoding to a movie using individual images.
See also
Examples
For example usage of this handler please see example scripts located at
examples/writing
.Methods
__init__
(output[, footage, fps, resolution, ...])close
()Close/teardown declared encoders.
write
(frame)Write a frame using the declared encoder.