From 4c73d341a388006dcd29e36fbfc47a4b25c5329c Mon Sep 17 00:00:00 2001 From: David Dormagen Date: Mon, 29 Jun 2020 17:18:33 +0200 Subject: [PATCH] io.videos.get_first_frame_from_video: replae silent fail by exception --- bb_behavior/io/videos.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bb_behavior/io/videos.py b/bb_behavior/io/videos.py index d1439c9..1c6d467 100644 --- a/bb_behavior/io/videos.py +++ b/bb_behavior/io/videos.py @@ -52,7 +52,7 @@ def get_first_frame_from_video(vid_file): capture = cv2.VideoCapture(vid_file) success, image = capture.read() if not success: - return None + raise ValueError("Could not read first frame. Is the video file valid? ({})".format(vid_file)) return image def extract_frames_from_video(video_path, target_directory, start_frame=0, n_frames=1,codec="hevc_cuvid", command="ffmpeg", scale=1.0, framerate=3, output_format="bmp"):