Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -85,14 +85,14 @@ def find_scenes(video_path, threshold=27.0):
|
|
85 |
|
86 |
# STEP 2
|
87 |
# extract first frame of each shot with cv2
|
88 |
-
|
89 |
-
fps =
|
90 |
print('frames per second =',fps)
|
91 |
|
92 |
frame_id = shot[0].get_frames() # value from scene_list from step 1
|
93 |
|
94 |
-
|
95 |
-
ret, frame =
|
96 |
|
97 |
# Save frame as PNG file
|
98 |
img = str(frame_id) + '_screenshot.png'
|
|
|
85 |
|
86 |
# STEP 2
|
87 |
# extract first frame of each shot with cv2
|
88 |
+
vid = cv2.VideoCapture(video_path)
|
89 |
+
fps = vid.get(cv2.CAP_PROP_FPS)
|
90 |
print('frames per second =',fps)
|
91 |
|
92 |
frame_id = shot[0].get_frames() # value from scene_list from step 1
|
93 |
|
94 |
+
vid.set(cv2.CAP_PROP_POS_FRAMES, frame_id)
|
95 |
+
ret, frame = vid.read()
|
96 |
|
97 |
# Save frame as PNG file
|
98 |
img = str(frame_id) + '_screenshot.png'
|