diff --git a/torchvision/io/video.py b/torchvision/io/video.py index 73e61dac18e..9b2eacbab11 100644 --- a/torchvision/io/video.py +++ b/torchvision/io/video.py @@ -244,7 +244,7 @@ def read_video( Reads a video from a file, returning both the video frames and the audio frames Args: - filename (str): path to the video file + filename (str): path to the video file. If using the pyav backend, this can be whatever ``av.open`` accepts. start_pts (int if pts_unit = 'pts', float / Fraction if pts_unit = 'sec', optional): The start presentation time of the video end_pts (int if pts_unit = 'pts', float / Fraction if pts_unit = 'sec', optional): @@ -267,10 +267,9 @@ def read_video( from torchvision import get_video_backend - if not os.path.exists(filename): - raise RuntimeError(f"File not found: {filename}") - if get_video_backend() != "pyav": + if not os.path.exists(filename): + raise RuntimeError(f"File not found: {filename}") vframes, aframes, info = _video_opt._read_video(filename, start_pts, end_pts, pts_unit) else: _check_av_available()