RecorderNode¶
- class mmpose.apis.webcam.nodes.RecorderNode(name: str, input_buffer: str, output_buffer: Union[str, List[str]], out_video_file: str, out_video_fps: int = 30, out_video_codec: str = 'mp4v', buffer_size: int = 30, enable: bool = True)[source]¶
Record the video frames into a local file.
RecorderNode
uses OpenCV backend to record the video. Recording is performed in a separate thread to avoid blocking the data stream. A buffer queue is used to cached the arrived frame images.- Parameters
name (str) – The node name (also thread name)
input_buffer (str) – The name of the input buffer
output_buffer (str|list) – The name(s) of the output buffer(s)
out_video_file (str) – The path of the output video file
out_video_fps (int) – The frame rate of the output video. Default: 30
out_video_codec (str) – The codec of the output video. Default: ‘mp4v’
buffer_size (int) – Size of the buffer queue that caches the arrived frame images.
enable (bool) – Default enable/disable status. Default:
True
.
- Example::
>>> cfg = dict( ... type='RecorderNode', ... name='recorder', ... out_video_file='webcam_demo.mp4', ... input_buffer='display', ... output_buffer='_display_' ... # `_display_` is an executor-reserved buffer ... )
>>> from mmpose.apis.webcam.nodes import NODES >>> node = NODES.build(cfg)
- on_exit()[source]¶
This method will be invoked on event _exit_.
Subclasses should override this method to specifying the exiting behavior.
- process(input_msgs)[source]¶
The method that implements the function of the node.
This method will be invoked when the node is enabled and the input data is ready. All subclasses of Node should override this method.
- Parameters
input_msgs (dict[str,
Message
]) – The input data collected from the buffers. For each item, the key is the input_name of the registered input buffer, and the value is a Message instance fetched from the buffer (or None if the buffer is non-trigger and not ready).- Returns
The output message of the node which will be send to all registered output buffers.
- Return type