Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
-
|
|
|
|
|
|
|
3 |
|
4 |
def find_scenes(video_path, threshold=27.0):
|
|
|
5 |
video = open_video(video_path)
|
6 |
scene_manager = SceneManager()
|
7 |
scene_manager.add_detector(
|
8 |
-
|
9 |
-
|
10 |
-
scene_manager.detect_scenes(video)
|
11 |
scene_list = scene_manager.get_scene_list()
|
12 |
-
|
13 |
-
# for each scene that was found.
|
14 |
|
15 |
-
split_list = video_splitter.split_video_ffmpeg(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)
|
16 |
return scene_list, split_list
|
17 |
|
18 |
video_input=gr.Video(source="upload", format="mp4", mirror_webcam="False");
|
|
|
1 |
import gradio as gr
|
2 |
+
|
3 |
+
from scenedetect import open_video, SceneManager, split_video_ffmpeg
|
4 |
+
from scenedetect.detectors import ContentDetector
|
5 |
+
from scenedetect.video_splitter import split_video_ffmpeg
|
6 |
|
7 |
def find_scenes(video_path, threshold=27.0):
|
8 |
+
# Open our video, create a scene manager, and add a detector.
|
9 |
video = open_video(video_path)
|
10 |
scene_manager = SceneManager()
|
11 |
scene_manager.add_detector(
|
12 |
+
ContentDetector(threshold=threshold))
|
13 |
+
scene_manager.detect_scenes(video, show_progress=True)
|
|
|
14 |
scene_list = scene_manager.get_scene_list()
|
15 |
+
split_list = split_video_ffmpeg(video_path, scene_list, show_progress=True)
|
|
|
16 |
|
|
|
17 |
return scene_list, split_list
|
18 |
|
19 |
video_input=gr.Video(source="upload", format="mp4", mirror_webcam="False");
|