src/transformers/pipelines/video_classification.py/VideoClassificationPipeline/preprocess
class VideoClassificationPipeline:    def preprocess(self, video, num_frames=None, frame_sampling_rate=1):
        if num_frames is None:
            num_frames = self.model.config.num_frames

        if video.startswith("http://") or video.startswith("https://"):
            video = BytesIO(requests.get(video).content)

        videoreader = VideoReader(video)
        videoreader.seek(0)

        start_idx = 0
        end_idx = num_frames * frame_sampling_rate - 1
        indices = np.linspace(start_idx, end_idx, num=num_frames, dtype=np.int64)

        video = videoreader.get_batch(indices).asnumpy()
        video = list(video)

        model_inputs = self.image_processor(video, return_tensors=self.framework)
        return model_inputs