bencher.video_writer ==================== .. py:module:: bencher.video_writer Classes ------- .. autoapisummary:: bencher.video_writer.VideoWriter Functions --------- .. autoapisummary:: bencher.video_writer.add_image Module Contents --------------- .. py:class:: VideoWriter(filename: str = 'vid') .. py:attribute:: images :value: [] .. py:attribute:: image_files :value: [] .. py:attribute:: video_files :value: [] .. py:attribute:: filename :value: '/vid.mp4' .. py:method:: append(img) .. py:method:: write() -> str .. py:method:: create_label(label, width=None, height=16, color=(255, 255, 255)) :staticmethod: .. py:method:: label_image(path: pathlib.Path, label, padding=20, color=(255, 255, 255)) -> pathlib.Path :staticmethod: .. py:method:: convert_to_compatible_format(video_path: str) -> str :staticmethod: .. py:method:: write_video_raw(video_clip: moviepy.video.VideoClip, fps: int = 30) -> str .. py:method:: extract_frame(video_path: str, time: float | None = None, output_path: str | None = None) -> str :staticmethod: Extract a frame from a video at a specific time. :param video_path: Path to the video file :param time: Time in seconds to extract frame. If None, uses last frame :param output_path: Optional path where to save the image. If None, uses video name with _frame.png :returns: Path to the saved PNG image :rtype: str .. py:function:: add_image(np_array: numpy.ndarray, name: str = 'img') -> str Creates a file on disk from a numpy array and returns the created image path