Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
f0c94cdc
"docs/vscode:/vscode.git/clone" did not exist on "655ebdbcd71251ff6bbac89c4183f537db9aae2d"
Unverified
Commit
f0c94cdc
authored
May 29, 2024
by
Nicolas Hug
Committed by
GitHub
May 29, 2024
Browse files
read_video: accept BytesIO on pyav backend (#8442)
parent
45e053b2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
torchvision/io/video.py
torchvision/io/video.py
+3
-4
No files found.
torchvision/io/video.py
View file @
f0c94cdc
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment