From d2911e115bf3ecba74ad5ef8f800db60c7f797f9 Mon Sep 17 00:00:00 2001 From: smthemex <138738845+smthemex@users.noreply.github.com> Date: Mon, 12 Aug 2024 14:36:30 +0800 Subject: [PATCH] Update util.py fix bug --- foleycrafter/utils/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/foleycrafter/utils/util.py b/foleycrafter/utils/util.py index e01a353..8d3d2d7 100644 --- a/foleycrafter/utils/util.py +++ b/foleycrafter/utils/util.py @@ -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