"docs/vscode:/vscode.git/clone" did not exist on "655ebdbcd71251ff6bbac89c4183f537db9aae2d"
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( ...@@ -244,7 +244,7 @@ def read_video(
Reads a video from a file, returning both the video frames and the audio frames Reads a video from a file, returning both the video frames and the audio frames
Args: 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): start_pts (int if pts_unit = 'pts', float / Fraction if pts_unit = 'sec', optional):
The start presentation time of the video The start presentation time of the video
end_pts (int if pts_unit = 'pts', float / Fraction if pts_unit = 'sec', optional): end_pts (int if pts_unit = 'pts', float / Fraction if pts_unit = 'sec', optional):
...@@ -267,10 +267,9 @@ def read_video( ...@@ -267,10 +267,9 @@ def read_video(
from torchvision import get_video_backend from torchvision import get_video_backend
if get_video_backend() != "pyav":
if not os.path.exists(filename): if not os.path.exists(filename):
raise RuntimeError(f"File not found: {filename}") raise RuntimeError(f"File not found: {filename}")
if get_video_backend() != "pyav":
vframes, aframes, info = _video_opt._read_video(filename, start_pts, end_pts, pts_unit) vframes, aframes, info = _video_opt._read_video(filename, start_pts, end_pts, pts_unit)
else: else:
_check_av_available() _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