class_docstr: A class for exporting videos.
docstr: Args:
      cache_dir: A directory for storing the video frames. If `None`,
          a temporary directory will be used.
      ffmpeg_bin: The path to an `ffmpeg` executable.
      out_path: The path to the output video.
      fps: The speed of the generated video in frames-per-second.
      output_format: Format of the output video. Currently only `"visdom"`
          is supported.
      rmdir_allowed: If `True` delete and create `cache_dir` in case
          it is not empty.
docstr_tok: ["Args",":","cache_dir",":","A","directory","for","storing","the","video","frames",".","If","`","None","`",",","a","temporary","directory","will","be","used",".","ffmpeg_bin",":","The","path","to","an","`","ffmpeg","`","executable",".","out_path",":","The","path","to","the","output","video",".","fps",":","The","speed","of","the","generated","video","in","frames-per-second",".","output_format",":","Format","of","the","output","video",".","Currently","only","`","``","visdom","''","`","is","supported",".","rmdir_allowed",":","If","`","True","`","delete","and","create","`","cache_dir","`","in","case","it","is","not","empty","."]
code: def __init__(
      self,
      cache_dir: Optional[str] = None,
      ffmpeg_bin: str = _DEFAULT_FFMPEG,
      out_path: str = "/tmp/video.mp4",
      fps: int = 20,
      output_format: str = "visdom",
      rmdir_allowed: bool = False,
      **kwargs,
  ) -> None:
      """
      Args:
          cache_dir: A directory for storing the video frames. If `None`,
              a temporary directory will be used.
          ffmpeg_bin: The path to an `ffmpeg` executable.
          out_path: The path to the output video.
          fps: The speed of the generated video in frames-per-second.
          output_format: Format of the output video. Currently only `"visdom"`
              is supported.
          rmdir_allowed: If `True` delete and create `cache_dir` in case
              it is not empty.
      """
      self.rmdir_allowed = rmdir_allowed
      self.output_format = output_format
      self.fps = fps
      self.out_path = out_path
      self.cache_dir = cache_dir
      self.ffmpeg_bin = ffmpeg_bin
      self.frames = []
      self.regexp = "frame_%08d.png"
      self.frame_num = 0
  
      if self.cache_dir is not None:
          self.tmp_dir = None
          if os.path.isdir(self.cache_dir):
              if rmdir_allowed:
                  shutil.rmtree(self.cache_dir)
              else:
                  warnings.warn(
                      f"Warning: cache directory not empty ({self.cache_dir})."
                  )
          os.makedirs(self.cache_dir, exist_ok=True)
      else:
          self.tmp_dir = tempfile.TemporaryDirectory()
          self.cache_dir = self.tmp_dir.name
  
file_path: pytorch3d/pytorch3d/implicitron/tools/video_writer.py
imports: import os
  import shutil
  import subprocess
  import tempfile
  import warnings
  from typing import Optional, Tuple, Union
  import matplotlib
  import matplotlib.pyplot
  import numpy
  from PIL import Image
label_desc: Use image node_id 1 to create a new VideoWriter object  with example: obj = VideoWriter(cache_dir, ffmpeg_bin, out_path, fps, output_format, rmdir_allowed)