Abu1998 commited on
Commit
0e59726
·
verified ·
1 Parent(s): ebce458

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -15,6 +15,7 @@ def extract_frames(video_path):
15
 
16
  extracted_images = []
17
  frame_count = 0
 
18
 
19
  frame_interval = max(1, int(fps / 60)) # Avoid division by zero
20
 
@@ -24,9 +25,10 @@ def extract_frames(video_path):
24
  break
25
 
26
  if frame_count % frame_interval == 0: # Extract 60 frames per second
27
- image_path = os.path.join(output_folder, f"frame_{frame_count}.jpg")
28
  cv2.imwrite(image_path, frame)
29
  extracted_images.append(image_path)
 
30
 
31
  frame_count += 1
32
 
 
15
 
16
  extracted_images = []
17
  frame_count = 0
18
+ saved_frame_count = 1 # Start naming frames from 1
19
 
20
  frame_interval = max(1, int(fps / 60)) # Avoid division by zero
21
 
 
25
  break
26
 
27
  if frame_count % frame_interval == 0: # Extract 60 frames per second
28
+ image_path = os.path.join(output_folder, f"{saved_frame_count}.jpg")
29
  cv2.imwrite(image_path, frame)
30
  extracted_images.append(image_path)
31
+ saved_frame_count += 1 # Increment file name sequentially
32
 
33
  frame_count += 1
34