def end_location(n_frames, n_feats, duration, end_time):
  """Computes the start location of a video segment.

  Args:
    n_frames: The number of frames in the original video.
    n_feats: The number of extracted from the original video.
    duration: The duration of the original video.
    end_time: The end time of a segment.

  Returns:
    location: The end location in the feature list of the original video.
  """
  location = int((n_frames * end_time / duration) // 16)
  location = min(n_feats, location + 1)
  return location