fffiloni commited on
Commit
af45f7f
1 Parent(s): 68a5c33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import gradio as gr
2
- from scenedetect import SceneManager, open_video, ContentDetector
3
 
4
  def find_scenes(video_path, threshold=27.0):
5
  video = open_video(video_path)
@@ -10,8 +10,10 @@ def find_scenes(video_path, threshold=27.0):
10
  scene_manager.detect_scenes(video)
11
  # `get_scene_list` returns a list of start/end timecode pairs
12
  # for each scene that was found.
13
- return scene_manager.get_scene_list()
 
 
14
 
15
  video_input=gr.Video(source="upload", format="mp4", mirror_webcam="False");
16
 
17
- gr.Interface(fn=find_scenes, inputs=video_input, outputs="json").launch()
 
1
  import gradio as gr
2
+ from scenedetect import SceneManager, open_video, detect, ContentDetector, split_video_ffmpeg
3
 
4
  def find_scenes(video_path, threshold=27.0):
5
  video = open_video(video_path)
 
10
  scene_manager.detect_scenes(video)
11
  # `get_scene_list` returns a list of start/end timecode pairs
12
  # for each scene that was found.
13
+
14
+ split_list=scenedetect.video_splitter.split_video_ffmpeg(input_video_path, scene_list, output_file_template='$VIDEO_NAME-Scene-$SCENE_NUMBER.mp4', video_name=None, arg_override='-c:v libx264 -preset fast -crf 21 -c:a aac', show_progress=False, show_output=False, suppress_output=None, hide_progress=None)
15
+ return scene_manager.get_scene_list(), split_list
16
 
17
  video_input=gr.Video(source="upload", format="mp4", mirror_webcam="False");
18
 
19
+ gr.Interface(fn=find_scenes, inputs=video_input, outputs=["json", "video"]).launch()