      def write(self, filename, image):
          """ Frames come from the pool in arbitrary order, so cache frames
              for writing out in correct order """
          logger.trace("Received frame: (filename: '%s', shape: %s", filename, image.shape)
          if not self.output_dimensions:
              logger.info("Outputting to: '%s'", self.video_file)
              self.set_dimensions(image.shape[:2])
              self.writer = self.get_writer()
          self.cache_frame(filename, image)
          self.save_from_cache()
  
      def set_dimensions(self, frame_dims):
          """ Set the dimensions based on a given frame frame. This protects against different
 
</s> remove     def write(self, filename, image):
        """ Frames come from the pool in arbitrary order, so cache frames
            for writing out in correct order """
 </s> add     def write(self, filename: str, image) -> None:
        """ Frames come from the pool in arbitrary order, so frames are cached for writing out
        in the correct order.

        Parameters
        ----------
        filename: str
            The incoming frame filename.
        image: :class:`numpy.ndarray`
            The converted image to be written
        """ </s> remove                                   output_params=self.output_params)
 </s> add                                   output_params=self._output_params) </s> remove         self.save_from_cache()
 </s> add         self._save_from_cache() </s> remove     def set_dimensions(self, frame_dims):
        """ Set the dimensions based on a given frame frame. This protects against different
            sized images coming in and ensure all images go out at the same size for writers
            that require it and mapped to a macro block size 16"""
 </s> add     def _set_dimensions(self, frame_dims) -> None:
        """ Set the attribute :attr:`_output_dimensions` based on the first frame received.
        This protects against different sized images coming in and ensures all images are written
        to ffmpeg at the same size. Dimensions are mapped to a macro block size 16. """ </s> remove         self.output_dimensions = "{}:{}".format(
            int(ceil(frame_dims[1] / 16) * 16),
            int(ceil(frame_dims[0] / 16) * 16))
        logger.debug("Set dimensions: %s", self.output_dimensions)

    def save_from_cache(self):
        """ Save all the frames that are ready to be output from cache """
        while self.frame_order:
            if self.frame_order[0] not in self.cache:
 </s> add         self._output_dimensions = (f"{int(ceil(frame_dims[1] / 16) * 16)}:"
                                   f"{int(ceil(frame_dims[0] / 16) * 16)}")
        logger.debug("Set dimensions: %s", self._output_dimensions)

    def _save_from_cache(self) -> None:
        """ Writes any consecutive frames to the video container that are ready to be output
        from the cache. """
        while self._frame_order:
            if self._frame_order[0] not in self.cache:
        if not self._output_dimensions:
            self._set_dimensions(image.shape[:2])
            self._writer = self._get_writer()
      def write(self, filename, image):
          """ Frames come from the pool in arbitrary order, so cache frames
              for writing out in correct order """
          logger.trace("Received frame: (filename: '%s', shape: %s", filename, image.shape)
        if not self._output_dimensions:
            self._set_dimensions(image.shape[:2])
            self._writer = self._get_writer()
        if not self._output_dimensions:
            self._set_dimensions(image.shape[:2])
            self._writer = self._get_writer()
        if not self._output_dimensions:
            self._set_dimensions(image.shape[:2])
            self._writer = self._get_writer()
        if not self._output_dimensions:
            self._set_dimensions(image.shape[:2])
            self._writer = self._get_writer()
          self.cache_frame(filename, image)
          self.save_from_cache()
  
      def set_dimensions(self, frame_dims):
          """ Set the dimensions based on a given frame frame. This protects against different
keep keep keep keep replace replace replace replace keep keep keep keep keep
 ffmpeg writer: Create new filename if output pre-exists 
plugins/convert/writer/ffmpeg.py