l5kit.visualization.video module¶
- l5kit.visualization.video.write_video(output_filepath: str, images: Iterable[numpy.ndarray], resolution: Tuple[int, int], fps: float = 24.0, codec: str = 'FMP4', interpolation: int = 2) None ¶
Writes input RGB images to given output video filepath using OpenCV. It resizes images if necessary using given interpolation (default=``cv2.INTER_CUBIC``).
Note that as this function uses OpenCV, your image’s color channels will be inverted (RGB -> BGR) prior to writing.
- Parameters
output_filepath (str) – output filepath, generally this should end in .mp4 or .avi
used. (depending on the codec) –
images (Iterable[np.ndarray]) – a list or other iterable of images.
resolution (Tuple[int, int]) – video resolution, e.g. (512, 512), the input frames are resized to this.
- Keyword Arguments
fps (float) – Frames per second (default: {24.0})
codec (str) – Codec to be used. Note that with X264 codec only certain resolutions may work (default: {“FMP4”})
interpolation (int) – Interpolation to be used when resizing (default: {cv2.INTER_CUBIC})