Unverified Commit f0c94cdc authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

read_video: accept BytesIO on pyav backend (#8442)

parent 45e053b2
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment