wilson1yan / VideoGPT

MIT License
968 stars 119 forks source link

video formatting #21

Closed a-antoniades closed 3 years ago

a-antoniades commented 3 years ago

Wondering if you have also encountered the

assert len(video) == self.num_frames error in torchvision/datasets/vid_utils.py .

I tried converting from avi to mp4 but it did not help, Thanks again.

wilson1yan commented 3 years ago

Unfortunately, I haven't seen this issue before. Maybe the video is too short and there aren't enough frames?

Or, to debug, you could try reading in the video yourself as a numpy array, and then save it using something like scikit-video or cv2, since I know mp4 files saved from those should definitely have no issues be read using VideoClips

a-antoniades commented 3 years ago

thanks, tried that, still nothing. Ended up changing

/torchvision/datasets/video_utils.py

assert len(video) == self.num_frames, "{} x {}".format(
video.shape, self.num_frames
)

to:

if len(video) != self.num_frames:
    video = video[:self.num_frames]