Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from scenedetect.detectors import ContentDetector
|
|
6 |
|
7 |
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
|
8 |
|
9 |
-
outputs = ["json", "
|
10 |
data_outputs = []
|
11 |
|
12 |
def fn(list):
|
@@ -27,6 +27,7 @@ def find_scenes(video_path, threshold=27.0):
|
|
27 |
data_outputs.append(scene_list)
|
28 |
#print(scene_list)
|
29 |
|
|
|
30 |
|
31 |
for i, scene in enumerate(scene_list):
|
32 |
shot_in = scene[0].get_frames() / scene[0].get_framerate()
|
@@ -34,6 +35,7 @@ def find_scenes(video_path, threshold=27.0):
|
|
34 |
target_name = str(i)+"_cut.mp4"
|
35 |
ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname=target_name)
|
36 |
data_outputs.append(target_name)
|
|
|
37 |
#outputs.append("video")
|
38 |
#shot_in = scene_list[1][0].get_frames() / scene_list[1][0].get_framerate()
|
39 |
#shot_out = (scene_list[1][1].get_frames() - 1) / scene_list[1][0].get_framerate()
|
@@ -43,7 +45,7 @@ def find_scenes(video_path, threshold=27.0):
|
|
43 |
print(results)
|
44 |
#ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname="cut.mp4")
|
45 |
|
46 |
-
return
|
47 |
|
48 |
video_input=gr.Video(source="upload", format="mp4");
|
49 |
|
|
|
6 |
|
7 |
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
|
8 |
|
9 |
+
outputs = ["json", "file"]
|
10 |
data_outputs = []
|
11 |
|
12 |
def fn(list):
|
|
|
27 |
data_outputs.append(scene_list)
|
28 |
#print(scene_list)
|
29 |
|
30 |
+
shots = []
|
31 |
|
32 |
for i, scene in enumerate(scene_list):
|
33 |
shot_in = scene[0].get_frames() / scene[0].get_framerate()
|
|
|
35 |
target_name = str(i)+"_cut.mp4"
|
36 |
ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname=target_name)
|
37 |
data_outputs.append(target_name)
|
38 |
+
shots.append(target_name)
|
39 |
#outputs.append("video")
|
40 |
#shot_in = scene_list[1][0].get_frames() / scene_list[1][0].get_framerate()
|
41 |
#shot_out = (scene_list[1][1].get_frames() - 1) / scene_list[1][0].get_framerate()
|
|
|
45 |
print(results)
|
46 |
#ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname="cut.mp4")
|
47 |
|
48 |
+
return scene_list, shots
|
49 |
|
50 |
video_input=gr.Video(source="upload", format="mp4");
|
51 |
|