Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,9 +2,9 @@ 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 |
-
from moviepy.video.io.
|
| 8 |
|
| 9 |
def find_scenes(video_path, threshold=27.0):
|
| 10 |
# Open our video, create a scene manager, and add a detector.
|
|
@@ -21,12 +21,10 @@ def find_scenes(video_path, threshold=27.0):
|
|
| 21 |
shot_out = scene_list[0][1].get_frames()
|
| 22 |
#print(shot_in, shot_out)
|
| 23 |
|
| 24 |
-
input_video_path = video_path
|
| 25 |
-
output_video_path = 'video_out.mp4'
|
| 26 |
|
| 27 |
-
|
| 28 |
-
new = video.subclip(shot_in, shot_out)
|
| 29 |
-
new.write_videofile(output_video_path, audio_codec='aac')
|
| 30 |
|
| 31 |
return scene_list, output_video_path
|
| 32 |
|
|
|
|
| 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 |
+
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
|
| 8 |
|
| 9 |
def find_scenes(video_path, threshold=27.0):
|
| 10 |
# Open our video, create a scene manager, and add a detector.
|
|
|
|
| 21 |
shot_out = scene_list[0][1].get_frames()
|
| 22 |
#print(shot_in, shot_out)
|
| 23 |
|
| 24 |
+
#input_video_path = video_path
|
| 25 |
+
#output_video_path = 'video_out.mp4'
|
| 26 |
|
| 27 |
+
output_video_path = ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname="output_video.mp4")
|
|
|
|
|
|
|
| 28 |
|
| 29 |
return scene_list, output_video_path
|
| 30 |
|