          """ Load a requested frame from video """
          frame = os.path.splitext(filename)[0]
          logger.trace("Loading video frame: '%s'", frame)
          frame_no = int(frame[frame.rfind("_") + 1:]) - 1
          self.vid_cap.set(cv2.CAP_PROP_POS_FRAMES, frame_no)  # pylint: disable=no-member
          _, image = self.vid_cap.read()
          return image
  
      @staticmethod
      def save_image(output_folder, filename, image):
          """ Save an image """
 
</s> remove         cap = cv2.VideoCapture(self.args.input_dir)  # pylint: disable=no-member
        cap.set(cv2.CAP_PROP_POS_FRAMES, frame_no - 1)  # pylint: disable=no-member
        ret, frame = cap.read()
        if not ret:
            logger.error("Unable to read from %s from video %s", frame_no, self.args.input_dir)
            exit(1)
        cap.release()
 </s> add         reader = imageio.get_reader(self.args.input_dir)
        reader.set_image_index(frame_no - 1)
        frame = reader.get_next_data()[:, :, ::-1]
        reader.close() </s> remove         cap.release()
 </s> add         reader.close() </s> remove         if self.vid_cap:
 </s> add         if self.vid_reader is not None: </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 frames folder contains a video file return video capture object """
 </s> add             If frames folder contains a video file return imageio reader object """
        self.vid_reader.set_image_index(frame_no)
        image = self.vid_reader.get_next_data()[:, :, ::-1]
          """ Load a requested frame from video """
          frame = os.path.splitext(filename)[0]
          logger.trace("Loading video frame: '%s'", frame)
          frame_no = int(frame[frame.rfind("_") + 1:]) - 1
        self.vid_reader.set_image_index(frame_no)
        image = self.vid_reader.get_next_data()[:, :, ::-1]
        self.vid_reader.set_image_index(frame_no)
        image = self.vid_reader.get_next_data()[:, :, ::-1]
          return image
  
      @staticmethod
      def save_image(output_folder, filename, image):
          """ Save an image """
keep keep keep keep replace replace keep keep keep keep keep
 Replace CV2 video loading with ImageIO 
tools/lib_alignments/media.py