I have found an issue in the torchvision API while reading a video in diffferent formats. I am aware the backend of
torchvision.io.read_video is based on
pyAV. The problem is that reading a file with an AVI extension, frames get somehow swapped between them (not temporal consistent - flickering). If the file is transformed to an MP4 file format, frames are loaded/saved correctly.
To test this funcionality I am reading a video with
read_video and saving it with
write_video. Can anyone please help me on this and replicate the results I am having? Here’s the quick code to do it (you just need the same video in .avi and .mp4 format).
from torchvision.io import read_video, write_video video_avi, _, fps = read_video("video_sample.avi", pts_unit='sec') write_video("video_saved_avi.avi", video_avi, fps['video_fps']) video_mp4, _, fps = read_video("video_sample.mp4", pts_unit='sec') write_video("video_saved_mp4.avi", video_mp4, fps['video_fps'])
Thank you very much for the help.