Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ 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.
|
8 |
|
9 |
def find_scenes(video_path, threshold=27.0):
|
10 |
# Open our video, create a scene manager, and add a detector.
|
@@ -23,10 +23,20 @@ def find_scenes(video_path, threshold=27.0):
|
|
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 |
print(output_video_path)
|
29 |
-
return scene_list,
|
30 |
|
31 |
video_input=gr.Video(source="upload", format="mp4", mirror_webcam="False");
|
32 |
|
|
|
4 |
from scenedetect.detectors import ContentDetector
|
5 |
#from scenedetect.video_splitter import split_video_ffmpeg
|
6 |
|
7 |
+
from moviepy.editor import *
|
8 |
|
9 |
def find_scenes(video_path, threshold=27.0):
|
10 |
# Open our video, create a scene manager, and add a detector.
|
|
|
23 |
|
24 |
#input_video_path = video_path
|
25 |
#output_video_path = 'video_out.mp4'
|
26 |
+
# Import everything needed to edit video clips
|
27 |
+
|
28 |
+
|
29 |
+
# loading video gfg
|
30 |
+
clip = VideoFileClip(video_path)
|
31 |
+
# getting only first 5 seconds
|
32 |
+
clip = clip.subclip(shot_in, shot_out)
|
33 |
+
# showing clip
|
34 |
+
clip.ipython_display(width = 360)
|
35 |
+
clip.write_videofile("clip.mp4")
|
36 |
+
|
37 |
output_video_path = ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname="output_video.mp4")
|
38 |
print(output_video_path)
|
39 |
+
return scene_list, "clip.mp4"
|
40 |
|
41 |
video_input=gr.Video(source="upload", format="mp4", mirror_webcam="False");
|
42 |
|