Spaces:
Sleeping
Sleeping
File size: 846 Bytes
8d2001a 8ce7fdb 8d2001a 8ce7fdb 8d2001a 8ce7fdb 86f6646 8ce7fdb af45f7f 86f6646 8d2001a 68a5c33 8d2001a af45f7f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from scenedetect import open_video, SceneManager, split_video_ffmpeg
from scenedetect.detectors import ContentDetector
from scenedetect.video_splitter import split_video_ffmpeg
def find_scenes(video_path, threshold=27.0):
# Open our video, create a scene manager, and add a detector.
video = open_video(video_path)
scene_manager = SceneManager()
scene_manager.add_detector(
ContentDetector(threshold=threshold))
scene_manager.detect_scenes(video, show_progress=True)
scene_list = scene_manager.get_scene_list()
split_list = split_video_ffmpeg(video_path, scene_list, show_progress=True)
return scene_list, split_list
video_input=gr.Video(source="upload", format="mp4", mirror_webcam="False");
gr.Interface(fn=find_scenes, inputs=video_input, outputs=["json", "video"]).launch() |