Skip to content

Commit

Permalink
Fix pyav 14 error
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasHug committed Dec 2, 2024
1 parent 36e219b commit 634b95c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion torchvision/io/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@ def write_video(

for img in video_array:
frame = av.VideoFrame.from_ndarray(img, format="rgb24")
frame.pict_type = "NONE"
try:
frame.pict_type = "NONE"
except TypeError:
from av.video.frame import PictureType # noqa

frame.pict_type = PictureType.NONE

for packet in stream.encode(frame):
container.mux(packet)

Expand Down

0 comments on commit 634b95c

Please sign in to comment.