jschwab21 commited on
Commit
5ff01ce
·
verified ·
1 Parent(s): a8c338d

Update video_processing.py

Browse files
Files changed (1) hide show
  1. video_processing.py +6 -3
video_processing.py CHANGED
@@ -120,8 +120,12 @@ def extract_best_scene(video_path, scene):
120
  video_clip = VideoFileClip(video_path).subclip(start_seconds, end_seconds)
121
  return video_clip
122
 
123
- def process_video(video_url, description):
124
- video_path = download_video(video_url)
 
 
 
 
125
  scenes = find_scenes(video_path)
126
  best_scene = analyze_scenes(video_path, scenes, description)
127
  final_clip = extract_best_scene(video_path, best_scene)
@@ -145,4 +149,3 @@ def cleanup_temp_files():
145
  os.unlink(file_path)
146
  except Exception as e:
147
  print(f"Error: {e}")
148
-
 
120
  video_clip = VideoFileClip(video_path).subclip(start_seconds, end_seconds)
121
  return video_clip
122
 
123
+ def process_video(video_input, description, is_url=True):
124
+ if is_url:
125
+ video_path = download_video(video_input)
126
+ else:
127
+ video_path = sanitize_filename(video_input)
128
+
129
  scenes = find_scenes(video_path)
130
  best_scene = analyze_scenes(video_path, scenes, description)
131
  final_clip = extract_best_scene(video_path, best_scene)
 
149
  os.unlink(file_path)
150
  except Exception as e:
151
  print(f"Error: {e}")