fffiloni commited on
Commit
c49015b
·
verified ·
1 Parent(s): 68c6b17

limit to 10 seconds upload video in

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -61,12 +61,18 @@ def preprocess_video_in(video_path):
61
  print("Error: Could not open video.")
62
  return None
63
 
 
 
 
 
 
 
64
  frame_number = 0
65
  first_frame = None
66
 
67
  while True:
68
  ret, frame = cap.read()
69
- if not ret:
70
  break
71
 
72
  # Format the frame filename as '00000.jpg'
 
61
  print("Error: Could not open video.")
62
  return None
63
 
64
+ # Get the frames per second (FPS) of the video
65
+ fps = cap.get(cv2.CAP_PROP_FPS)
66
+
67
+ # Calculate the number of frames to process (10 seconds of video)
68
+ max_frames = int(fps * 10)
69
+
70
  frame_number = 0
71
  first_frame = None
72
 
73
  while True:
74
  ret, frame = cap.read()
75
+ if not ret or frame_number >= max_frames:
76
  break
77
 
78
  # Format the frame filename as '00000.jpg'