      -------
      >>> video = "/path/to/video.mp4"
      >>> frames, secs = count_frames_and_secs(video)
      """
      # https://stackoverflow.com/questions/2017843/fetch-frame-count-with-ffmpeg
  
      assert isinstance(filename, str), "Video path must be a string"
      exe = im_ffm.get_ffmpeg_exe()
      iswin = sys.platform.startswith("win")
      logger.debug("iswin: '%s'", iswin)
      cmd = [exe, "-i", filename, "-map", "0:v:0", "-c", "copy", "-f", "null", "-"]
 
</s> remove     attempts = 3
    for attempt in range(attempts):
        try:
            logger.debug("attempt: %s of %s", attempt + 1, attempts)
            out = subprocess.check_output(cmd,
                                          stderr=subprocess.STDOUT,
                                          shell=iswin,
                                          timeout=timeout)
            logger.debug("Succesfully communicated with FFMPEG")
 </s> add     process = subprocess.Popen(cmd,
                               stderr=subprocess.STDOUT,
                               stdout=subprocess.PIPE,
                               universal_newlines=True)
    pbar = None
    duration = None
    init_tqdm = False
    update = 0
    frames = 0
    while True:
        output = process.stdout.readline().strip()
        if output == "" and process.poll() is not None: </s> remove             self._count = int(count_frames_and_secs(self.folder)[0])
 </s> add             self._count = int(count_frames(self.folder))
      -------
      >>> video = "/path/to/video.mp4"
      >>> frames, secs = count_frames_and_secs(video)
      """


      assert isinstance(filename, str), "Video path must be a string"
      exe = im_ffm.get_ffmpeg_exe()
      iswin = sys.platform.startswith("win")
      logger.debug("iswin: '%s'", iswin)
      cmd = [exe, "-i", filename, "-map", "0:v:0", "-c", "copy", "-f", "null", "-"]
keep keep keep keep replace replace keep keep keep keep keep
 bugfix: lib.image - Ensure video frame count is always read correctly 
lib/image.py