      def load_video_frames(self):
          """ Return frames from a video file """
          logger.debug("Input is video. Capturing frames")
          vidname = os.path.splitext(os.path.basename(self.args.input_dir))[0]
          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)
              logger.trace("Loading video frame: '%s'", filename)
              yield filename, frame
          cap.release()
  
      def load_one_image(self, filename):
 
</s> remove         cap.release()
 </s> add         reader.close() </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         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] </s> remove         iterator = self.process_video if self.vid_cap else self.process_frames
 </s> add         iterator = self.process_video if self.vid_reader is not None else self.process_frames </s> remove         if self.vid_cap:
 </s> add         if self.vid_reader is not None:
        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)
      def load_video_frames(self):
          """ Return frames from a video file """
          logger.debug("Input is video. Capturing frames")
          vidname = os.path.splitext(os.path.basename(self.args.input_dir))[0]
        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)
        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)
        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)
        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)
        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)
        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)
        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)
        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)
        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)
        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)
              logger.trace("Loading video frame: '%s'", filename)
              yield filename, frame
          cap.release()
  
      def load_one_image(self, filename):
keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Replace CV2 video loading with ImageIO 
scripts/fsmedia.py