Spaces:
Running
on
Zero
Running
on
Zero
debug
Browse files
app.py
CHANGED
@@ -167,11 +167,19 @@ def print_image_info(img):
|
|
167 |
print(f"{key}: {value}")
|
168 |
|
169 |
def extract_frames(video_path):
|
|
|
|
|
|
|
170 |
# Open the video file
|
171 |
cap = cv2.VideoCapture(video_path)
|
|
|
|
|
|
|
172 |
frames = []
|
173 |
success, frame = cap.read()
|
|
|
174 |
while success:
|
|
|
175 |
# Convert frame from BGR (OpenCV default) to RGB
|
176 |
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
177 |
# Convert the numpy array (frame) to a PIL Image
|
|
|
167 |
print(f"{key}: {value}")
|
168 |
|
169 |
def extract_frames(video_path):
|
170 |
+
if not os.path.exists(video_path):
|
171 |
+
print("Video file does not exist:", video_path)
|
172 |
+
return None
|
173 |
# Open the video file
|
174 |
cap = cv2.VideoCapture(video_path)
|
175 |
+
if not cap.isOpened():
|
176 |
+
print(f"Error: Could not open video file {video_path}")
|
177 |
+
return []
|
178 |
frames = []
|
179 |
success, frame = cap.read()
|
180 |
+
print(f"cap read status {success}")
|
181 |
while success:
|
182 |
+
print("getting frame")
|
183 |
# Convert frame from BGR (OpenCV default) to RGB
|
184 |
frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
185 |
# Convert the numpy array (frame) to a PIL Image
|