Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,6 +20,8 @@ def extract_all_frames(video_input):
|
|
| 20 |
ret, frame = cap.read()
|
| 21 |
if not ret:
|
| 22 |
break
|
|
|
|
|
|
|
| 23 |
frames.append(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
| 24 |
except (OSError, TypeError, ValueError, KeyError, SyntaxError) as e:
|
| 25 |
print("read_frame_source:{} error. {}\n".format(video_path, str(e)))
|
|
@@ -29,7 +31,7 @@ def extract_all_frames(video_input):
|
|
| 29 |
"fps": fps,
|
| 30 |
"count_frames": count_frames,
|
| 31 |
}
|
| 32 |
-
video_info = f'FPS: {video_state["fps"]} , Кадров: {video_state["count_frames"]}'
|
| 33 |
return frames[0], frames, video_state, video_info
|
| 34 |
|
| 35 |
|
|
|
|
| 20 |
ret, frame = cap.read()
|
| 21 |
if not ret:
|
| 22 |
break
|
| 23 |
+
if len(frames) == 100:
|
| 24 |
+
break
|
| 25 |
frames.append(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
|
| 26 |
except (OSError, TypeError, ValueError, KeyError, SyntaxError) as e:
|
| 27 |
print("read_frame_source:{} error. {}\n".format(video_path, str(e)))
|
|
|
|
| 31 |
"fps": fps,
|
| 32 |
"count_frames": count_frames,
|
| 33 |
}
|
| 34 |
+
video_info = f'FPS: {video_state["fps"]} , Кадров: {video_state["count_frames"]}, Будет обработано: {len(frames)}'
|
| 35 |
return frames[0], frames, video_state, video_info
|
| 36 |
|
| 37 |
|