Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ from scenedetect.detectors import ContentDetector
|
|
6 |
|
7 |
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
|
8 |
|
|
|
9 |
|
10 |
def find_scenes(video_path, threshold=27.0):
|
11 |
# Open our video, create a scene manager, and add a detector.
|
@@ -16,7 +17,7 @@ def find_scenes(video_path, threshold=27.0):
|
|
16 |
scene_manager.detect_scenes(video, show_progress=True)
|
17 |
scene_list = scene_manager.get_scene_list()
|
18 |
|
19 |
-
|
20 |
#print(scene_list)
|
21 |
shots = []
|
22 |
|
@@ -26,11 +27,12 @@ def find_scenes(video_path, threshold=27.0):
|
|
26 |
target_name = str(i)+"_cut.mp4"
|
27 |
ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname=target_name)
|
28 |
shots.append(target_name)
|
|
|
29 |
#shot_in = scene_list[1][0].get_frames() / scene_list[1][0].get_framerate()
|
30 |
#shot_out = (scene_list[1][1].get_frames() - 1) / scene_list[1][0].get_framerate()
|
31 |
#print(shot_in, shot_out)
|
32 |
|
33 |
-
print(scene_list, *tuple(shots), sep=', ')
|
34 |
|
35 |
#ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname="cut.mp4")
|
36 |
|
|
|
6 |
|
7 |
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
|
8 |
|
9 |
+
outputs = []
|
10 |
|
11 |
def find_scenes(video_path, threshold=27.0):
|
12 |
# Open our video, create a scene manager, and add a detector.
|
|
|
17 |
scene_manager.detect_scenes(video, show_progress=True)
|
18 |
scene_list = scene_manager.get_scene_list()
|
19 |
|
20 |
+
outputs.append("json")
|
21 |
#print(scene_list)
|
22 |
shots = []
|
23 |
|
|
|
27 |
target_name = str(i)+"_cut.mp4"
|
28 |
ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname=target_name)
|
29 |
shots.append(target_name)
|
30 |
+
outputs.append("video")
|
31 |
#shot_in = scene_list[1][0].get_frames() / scene_list[1][0].get_framerate()
|
32 |
#shot_out = (scene_list[1][1].get_frames() - 1) / scene_list[1][0].get_framerate()
|
33 |
#print(shot_in, shot_out)
|
34 |
|
35 |
+
print(scene_list, *tuple(shots), sep=', ', outputs)
|
36 |
|
37 |
#ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname="cut.mp4")
|
38 |
|