Module src.streaming.io.video_writer

Module for writing to video files

Classes

class VideoWriter (path: str, res: Tuple[int, int], fps: int = 30)

An instance is made with path to output file, resolution and framerate.

Contains methods for starting and stopping video output, and a method that takes in a image and writes it as a frame in videobuffer.

Args

path
Path to output file with file extension. Defaults to .mjpg
res
Resolution of the saved video.
fps
Desired framerate of output video, 30 fps yields realtime in most cases.

Methods

def begin(self) ‑> NoneType

Sets codec and starts video output

def end(self) ‑> NoneType

Stops generation of output file and safely saves it.

def write(self, img: numpy.ndarray) ‑> NoneType

Writes image to videobuffer

Takes input image, converts it from RGB to BGR color and writes it to videobuffer.

Args

img
image buffer as numpy ndarray.