bencher.video_writer

Classes

VideoWriter

Functions

add_image(→ str)

Creates a file on disk from a numpy array and returns the created image path

Module Contents

class bencher.video_writer.VideoWriter(filename: str = 'vid')
images = []
image_files = []
video_files = []
filename = '/vid.mp4'
append(img)
write() str
static create_label(label, width=None, height=16, color=(255, 255, 255))
static label_image(path: pathlib.Path, label, padding=20, color=(255, 255, 255)) pathlib.Path
static convert_to_compatible_format(video_path: str) str
write_video_raw(video_clip: moviepy.video.VideoClip, fps: int = 30) str
static extract_frame(video_path: str, time: float | None = None, output_path: str | None = None) str

Extract a frame from a video at a specific time.

Parameters:
  • video_path – Path to the video file

  • time – Time in seconds to extract frame. If None, uses last frame

  • output_path – Optional path where to save the image. If None, uses video name with _frame.png

Returns:

Path to the saved PNG image

Return type:

str

bencher.video_writer.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