Spaces:
Sleeping
Sleeping
Update video_processing.py
Browse files- video_processing.py +4 -1
video_processing.py
CHANGED
@@ -104,10 +104,13 @@ def convert_timestamp_to_seconds(timestamp):
|
|
104 |
return int(h) * 3600 + int(m) * 60 + s
|
105 |
|
106 |
def extract_frames(video_path, start_time, end_time):
|
|
|
|
|
|
|
|
|
107 |
def extract_frame_at_time(t):
|
108 |
return video_clip.get_frame(t / video_clip.fps)
|
109 |
|
110 |
-
video_clip = VideoFileClip(video_path).subclip(start_seconds, end_seconds)
|
111 |
frame_times = range(0, int(video_clip.duration * video_clip.fps), int(video_clip.fps / 10))
|
112 |
|
113 |
# Create a pool of workers to extract frames in parallel
|
|
|
104 |
return int(h) * 3600 + int(m) * 60 + s
|
105 |
|
106 |
def extract_frames(video_path, start_time, end_time):
|
107 |
+
start_seconds = convert_timestamp_to_seconds(start_time)
|
108 |
+
end_seconds = convert_timestamp_to_seconds(end_time)
|
109 |
+
video_clip = VideoFileClip(video_path).subclip(start_seconds, end_seconds)
|
110 |
+
|
111 |
def extract_frame_at_time(t):
|
112 |
return video_clip.get_frame(t / video_clip.fps)
|
113 |
|
|
|
114 |
frame_times = range(0, int(video_clip.duration * video_clip.fps), int(video_clip.fps / 10))
|
115 |
|
116 |
# Create a pool of workers to extract frames in parallel
|