fffiloni's picture
Create new file
8d2001a
raw
history blame
642 Bytes
import gradio as gr
from scenedetect import SceneManager, open_video, ContentDetector
def find_scenes(video_path, threshold=27.0):
video = open_video(video_path)
scene_manager = SceneManager()
scene_manager.add_detector(
ContentDetector(threshold=threshold))
# Detect all scenes in video from current position to end.
scene_manager.detect_scenes(video)
# `get_scene_list` returns a list of start/end timecode pairs
# for each scene that was found.
return scene_manager.get_scene_list()
video_input=gr.Video(source="upload", format="mp4");
gr.Interface(fn=find_scenes, inputs=video_input, outputs="json")