Skip to content

Commit

Permalink
Merge branch 'main' into please_dont_modify_this_branch_unless_you_ar…
Browse files Browse the repository at this point in the history
…e_just_merging_with_main_
  • Loading branch information
NicolasHug authored May 29, 2024
2 parents da9d9ae + f0c94cd commit f49190e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions torchvision/io/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()
Expand Down

0 comments on commit f49190e

Please sign in to comment.