Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -42,7 +42,7 @@ def get_video_length(video_path):
|
|
42 |
video = cv2.VideoCapture(video_path)
|
43 |
fps = video.get(cv2.CAP_PROP_FPS) # Frames per second
|
44 |
total_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT)) # Total frames in the video
|
45 |
-
duration = total_frames / fps if fps > 0 else 0 # Duration in seconds
|
46 |
video.release()
|
47 |
return duration
|
48 |
|
|
|
42 |
video = cv2.VideoCapture(video_path)
|
43 |
fps = video.get(cv2.CAP_PROP_FPS) # Frames per second
|
44 |
total_frames = int(video.get(cv2.CAP_PROP_FRAME_COUNT)) # Total frames in the video
|
45 |
+
duration = int(total_frames / fps) if fps > 0 else 0 # Duration in seconds, as an integer
|
46 |
video.release()
|
47 |
return duration
|
48 |
|