Update util.py

fix bug
This commit is contained in:
smthemex
2024-08-12 14:36:30 +08:00
committed by GitHub
parent 35e151bf53
commit d2911e115b
+4 -1
View File
@@ -1697,7 +1697,10 @@ def read_frames_with_moviepy(video_path, max_frame_nums=None):
frames.append(frame)
if max_frame_nums is not None:
frames_idx = np.linspace(0, len(frames) - 1, max_frame_nums, dtype=int)
clip.close()
try:
clip.close()
except:
pass
return np.array(frames)[frames_idx, ...], duration,frames