class_docstr: VideoRecorder renders a nice movie of a rollout, frame by frame.
  
  It comes with an ``enabled`` option, so you can still use the same code on episodes where you don't want to record video.
  
  Note:
      You are responsible for calling :meth:`close` on a created VideoRecorder, or else you may leak an encoder process.
class_docstr_tok: ["VideoRecorder","renders","a","nice","movie","of","a","rollout",",","frame","by","frame",".","It","comes","with","an","``","enabled","``","option",",","so","you","can","still","use","the","same","code","on","episodes","where","you","do","n't","want","to","record","video",".","Note",":","You","are","responsible","for","calling",":","meth",":","`","close","`","on","a","created","VideoRecorder",",","or","else","you","may","leak","an","encoder","process","."]
docstr: Render the given `env` and add the resulting frame to the video.
docstr_tok: ["Render","the","given","`","env","`","and","add","the","resulting","frame","to","the","video","."]
code: def capture_frame(self):
      """Render the given `env` and add the resulting frame to the video."""
      frame = self.env.render()
      if isinstance(frame, List):
          self.render_history += frame
          frame = frame[-1]
  
      if not self.functional:
          return
      if self._closed:
          logger.warn(
              "The video recorder has been closed and no frames will be captured anymore."
          )
          return
      logger.debug("Capturing video frame: path=%s", self.path)
  
      if frame is None:
          if self._async:
              return
          else:
              # Indicates a bug in the environment: don't want to raise
              # an error here.
              logger.warn(
                  "Env returned None on `render()`. Disabling further rendering for video recorder by marking as "
                  f"disabled: path={self.path} metadata_path={self.metadata_path}"
              )
              self.broken = True
      else:
          self.recorded_frames.append(frame)
  
file_path: gym/gym/wrappers/monitoring/video_recorder.py
imports: import json
  import os
  import os.path
  import tempfile
  from typing import List, Optional
  from gym import error, logger
label_desc: Use image node_id 3 for calling the VideoRecorder obj's underlying member method code with example usage: obj.capture_frame() without return types