You can use custom dataset, where you will separate the videos into frames and associate them with labels in method def __getitem__(self, idx): : Writing Custom Datasets, DataLoaders and Transforms — PyTorch Tutorials 1.7.1 documentation 14
You can use also the ready-to-use code like: GitHub - YuxinZhaozyx/pytorch-VideoDataset: Tools for loading video dataset and transforms on video in pytorch. You can directly load video files without preprocessing. 49