  """ Video output writer for faceswap.py converter """
  import os
  from collections import OrderedDict
  from math import ceil
  
  import imageio
  import imageio_ffmpeg as im_ffm
  from ffmpy import FFmpeg, FFRuntimeError
 
</s> remove     """ Video output writer using imageio """
    def __init__(self, output_folder, total_count, frame_ranges, source_video, **kwargs):
 </s> add     """ Video output writer using imageio-ffmpeg.

    Parameters
    ----------
    output_folder: str
        The folder to save the output video to
    total_count: int
        The total number of frames to be converted
    frame_ranges: list or ``None``
        List of integers for any explicit frame ranges to be converted or ``None`` if all frames
        are to be converted
    source_video: str
        The full path to the source video for obtaining fps and audio
    kwargs: dict
        Any additional standard :class:`plugins.convert.writer._base.Output` key word arguments.
    """
    def __init__(self,
                 output_folder: str,
                 total_count: int,
                 frame_ranges: Optional[List[int]],
                 source_video: str,
                 **kwargs) -> None: </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: </s> remove     """ Parent class for scaling adjustments """
    def __init__(self, output_folder, configfile=None):
 </s> add     """ Parent class for writer plugins.

    Parameters
    ----------
    output_folder: str
        The full path to the output folder where the converted media should be saved
    configfile: str, optional
        The full path to a custom configuration ini file. If ``None`` is passed
        then the file is loaded from the default location. Default: ``None``.
    """
    def __init__(self, output_folder: str, configfile: Optional[str] = None) -> None: </s> remove     def pre_encode(self, image):  # pylint: disable=unused-argument,no-self-use
        """ If the writer supports pre-encoding then override this to pre-encode
            the image in lib/convert.py to speed up saving """
 </s> add     def pre_encode(self, image) -> None:  # pylint: disable=unused-argument,no-self-use
        """ Some writer plugins support the pre-encoding of images prior to saving out. As
        patching is done in multiple threads, but writing is done in a single thread, it can
        speed up the process to do any pre-encoding as part of the converter process.

        If the writer supports pre-encoding then override this to pre-encode the image in
        :module:`lib.convert` to speed up saving.

        Parameters
        ----------
        image: :class:`numpy.ndarray`
            The converted image that is to be run through the pre-encoding function

        Returns
        -------
        python function or ``None``
            If ``None`` then the writer does not support pre-encoding, otherwise return the python
            function that will pre-encode the image
        """
from typing import Optional, List
  """ Video output writer for faceswap.py converter """
  import os
  from collections import OrderedDict
  from math import ceil
from typing import Optional, List
  
  import imageio
  import imageio_ffmpeg as im_ffm
  from ffmpy import FFmpeg, FFRuntimeError
keep keep keep add keep keep keep keep
 ffmpeg writer: Create new filename if output pre-exists 
plugins/convert/writer/ffmpeg.py