  # ################### #
  # <<< VIDEO UTILS >>> #
  # ################### #
  
  def count_frames(filename):
      """ Count the number of frames in a video file
  
      Unfortunately there is no guaranteed accurate way to get a count of video frames
      without iterating through the video.
  
 
</s> remove     Unfortunately there is no guaranteed accurate way to get a count of video frames
    without iterating through the video.
 </s> add     There is no guaranteed accurate way to get a count of video frames without iterating through
    a video and decoding every frame. </s> remove     This counts the frames, displaying a progress bar to keep the user abreast of progress
 </s> add     :func:`count_frames` can return an accurate count (albeit fairly slowly) or a possibly less
    accurate count, depending on the :attr:`fast` parameter. A progress bar is displayed. </s> remove         if isinstance(record.msg, str) and ("\n" in record.msg or "\r" in record.msg):
            record.msg = record.msg.replace("\n", "\\n").replace("\r", "\\r")
        if any(self.reformat_check(arg) for arg in record.args):
            record.args = self.reformat_args(record.args)
        return super().format(record)

    @staticmethod
    def reformat_check(arg):
        """ Check if the argument should be reformatted
            The argument is a string with a line break
            The argument is a numpy array
        """
        return ((isinstance(arg, str) and ("\n" in arg or "\r" in arg))
                or isinstance(arg, ndarray))

    @staticmethod
    def reformat_args(args):
        """ Reformat args that require new lines removing """
        new_args = []
        for arg in args:
            if isinstance(arg, ndarray):
                # Convert numpy arrays to string for reformatting
                arg = str(ndarray)
            if isinstance(arg, str) and ("\n" in arg or "\r" in arg):
                arg = arg.replace("\n", "\\n").replace("\r", "\\r")
            new_args.append(arg)
        return tuple(new_args)
 </s> add         record.message = record.getMessage()
        # strip newlines
        if "\n" in record.message or "\r" in record.message:
            record.message = record.message.replace("\n", "\\n").replace("\r", "\\r")

        if self.usesTime():
            record.asctime = self.formatTime(record, self.datefmt)
        msg = self.formatMessage(record)
        if record.exc_info:
            # Cache the traceback text to avoid converting it multiple times
            # (it's constant anyway)
            if not record.exc_text:
                record.exc_text = self.formatException(record.exc_info)
        if record.exc_text:
            if msg[-1:] != "\n":
                msg = msg + "\n"
            msg = msg + record.exc_text
        if record.stack_info:
            if msg[-1:] != "\n":
                msg = msg + "\n"
            msg = msg + self.formatStack(record.stack_info)
        return msg </s> remove     int: The number of frames in the given video file.
 </s> add     int:
        The number of frames in the given video file.

    Example
    -------
    >>> filename = "/path/to/video.mp4"
    >>> frame_count = count_frames(filename)
def count_frames(filename, fast=False):
  # ################### #
  # <<< VIDEO UTILS >>> #
  # ################### #
  
def count_frames(filename, fast=False):
      """ Count the number of frames in a video file
  
      Unfortunately there is no guaranteed accurate way to get a count of video frames
      without iterating through the video.
  
keep keep keep keep replace keep keep keep keep keep
 lib.logger - Remove newlines from log messages 
lib/image.py