          if (loadtype == "Frames" and
                  os.path.isfile(self.folder) and
                  os.path.splitext(self.folder)[1] in _video_extensions):
              logger.verbose("Video exists at : '%s'", self.folder)
              retval = cv2.VideoCapture(self.folder)  # pylint: disable=no-member
          else:
              logger.verbose("Folder exists at '%s'", self.folder)
              retval = None
          return retval
  
 
</s> remove         if self.vid_cap:
 </s> add         if self.vid_reader is not None: </s> remove             If frames folder contains a video file return video capture object """
 </s> add             If frames folder contains a video file return imageio reader object """ </s> remove         cap = cv2.VideoCapture(self.args.input_dir)  # pylint: disable=no-member
        i = 0
        while True:
            ret, frame = cap.read()
            if not ret:
                logger.debug("Video terminated")
                break
            i += 1
            # Keep filename format for outputted face
            filename = "{}_{:06d}.png".format(vidname, i)
 </s> add         reader = imageio.get_reader(self.args.input_dir)
        for i, frame in enumerate(reader):
            # Convert to BGR for cv2 compatibility
            frame = frame[:, :, ::-1]
            filename = "{}_{:06d}.png".format(vidname, i + 1) </s> remove         if self.vid_cap:
 </s> add         if self.vid_reader is not None: </s> remove         self.vid_cap.set(cv2.CAP_PROP_POS_FRAMES, frame_no)  # pylint: disable=no-member
        _, image = self.vid_cap.read()
 </s> add         self.vid_reader.set_image_index(frame_no)
        image = self.vid_reader.get_next_data()[:, :, ::-1]
            retval = imageio.get_reader(self.folder)
          if (loadtype == "Frames" and
                  os.path.isfile(self.folder) and
                  os.path.splitext(self.folder)[1] in _video_extensions):
              logger.verbose("Video exists at : '%s'", self.folder)
            retval = imageio.get_reader(self.folder)
          else:
              logger.verbose("Folder exists at '%s'", self.folder)
              retval = None
          return retval
  
keep keep keep keep replace keep keep keep keep keep
 Replace CV2 video loading with ImageIO 
tools/lib_alignments/media.py