Skip to content

Commit 634b95c

Browse files
committed
Fix pyav 14 error
1 parent 36e219b commit 634b95c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

torchvision/io/video.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,13 @@ def write_video(
155155

156156
for img in video_array:
157157
frame = av.VideoFrame.from_ndarray(img, format="rgb24")
158-
frame.pict_type = "NONE"
158+
try:
159+
frame.pict_type = "NONE"
160+
except TypeError:
161+
from av.video.frame import PictureType # noqa
162+
163+
frame.pict_type = PictureType.NONE
164+
159165
for packet in stream.encode(frame):
160166
container.mux(packet)
161167

0 commit comments

Comments
 (0)