From de5556f21bacd934e5ce19d19f42804b44794919 Mon Sep 17 00:00:00 2001 From: Talmo Pereira Date: Thu, 30 Nov 2023 12:25:06 -0800 Subject: [PATCH] Add check for empty videos --- sleap/io/video.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sleap/io/video.py b/sleap/io/video.py index 39de1972f..f64373d37 100644 --- a/sleap/io/video.py +++ b/sleap/io/video.py @@ -1450,7 +1450,9 @@ def encode(img): for i in range(len(frame_numbers)): frames.append(encode(frame_data[i])) - max_frame_size = max([len(x) for x in frames]) + max_frame_size = ( + max([len(x) if len(x) else 0 for x in frames]) if len(frames) else 0 + ) dset = f.create_dataset( dataset + "/video",