Spaces:
Sleeping
Sleeping
Update video_processing.py
Browse files- video_processing.py +10 -2
video_processing.py
CHANGED
@@ -20,9 +20,17 @@ def process_video(video_url, description):
|
|
20 |
# Combine best scenes into a final clip
|
21 |
final_clip = combine_scenes(video_path, best_scenes)
|
22 |
|
|
|
|
|
|
|
|
|
|
|
23 |
# Save and return the final clip
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
26 |
return final_clip_path
|
27 |
|
28 |
def detect_scenes(video_path):
|
|
|
20 |
# Combine best scenes into a final clip
|
21 |
final_clip = combine_scenes(video_path, best_scenes)
|
22 |
|
23 |
+
# Ensure the output directory exists
|
24 |
+
output_dir = "output"
|
25 |
+
os.makedirs(output_dir, exist_ok=True)
|
26 |
+
final_clip_path = os.path.join(output_dir, "final_clip.mp4")
|
27 |
+
|
28 |
# Save and return the final clip
|
29 |
+
try:
|
30 |
+
final_clip.write_videofile(final_clip_path)
|
31 |
+
except Exception as e:
|
32 |
+
return str(e)
|
33 |
+
|
34 |
return final_clip_path
|
35 |
|
36 |
def detect_scenes(video_path):
|