code: def get_thumbnail(self, video_path, at_time=0.5):
          
          filename = os.path.basename(video_path)
          filename, __ = os.path.splitext(filename)
          _, image_path = tempfile.mkstemp(suffix='_{}.jpg'.format(filename))
  
          video_duration = self.get_media_info(video_path)['duration']
          if at_time > video_duration:
              raise exceptions.InvalidTimeError()
          thumbnail_time = at_time
  
          cmds = [self.ffmpeg_path, '-i', video_path, '-vframes', '1']
          cmds.extend(['-ss', str(thumbnail_time), '-y', image_path])
  
          process = self._spawn(cmds)
          self._check_returncode(process)
  
          if not os.path.getsize(image_path):
              # we somehow failed to generate thumbnail
              os.unlink(image_path)
              raise exceptions.InvalidTimeError()
  
          return image_path
docs: Extracts an image of a video and returns its path.
  
          If the requested thumbnail is not within the duration of the video
          an `InvalidTimeError` is thrown.