Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,18 +17,22 @@ def find_scenes(video_path, threshold=27.0):
|
|
| 17 |
scene_list = scene_manager.get_scene_list()
|
| 18 |
|
| 19 |
#print(scene_list)
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
#print(shot_in, shot_out)
|
| 24 |
|
| 25 |
-
|
| 26 |
-
#
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
#print(output_video_path)
|
| 30 |
-
return scene_list, "cut.mp4"
|
| 31 |
|
| 32 |
video_input=gr.Video(source="upload", format="mp4");
|
| 33 |
|
| 34 |
-
gr.Interface(fn=find_scenes, inputs=video_input, outputs=["json", "
|
|
|
|
| 17 |
scene_list = scene_manager.get_scene_list()
|
| 18 |
|
| 19 |
#print(scene_list)
|
| 20 |
+
shots = []
|
| 21 |
|
| 22 |
+
for i, scene in enumerate(scene_list):
|
| 23 |
+
shot_in = scene[0].get_frames() / scene[0].get_framerate()
|
| 24 |
+
shot_out = (scene[1].get_frames() - 1) / scene[0].get_framerate()
|
| 25 |
+
shot = ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname=i+"_cut.mp4")
|
| 26 |
+
shots.append(shot)
|
| 27 |
+
#shot_in = scene_list[1][0].get_frames() / scene_list[1][0].get_framerate()
|
| 28 |
+
#shot_out = (scene_list[1][1].get_frames() - 1) / scene_list[1][0].get_framerate()
|
| 29 |
#print(shot_in, shot_out)
|
| 30 |
|
| 31 |
+
|
| 32 |
+
#ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname="cut.mp4")
|
| 33 |
+
|
| 34 |
+
return scene_list, shots
|
|
|
|
|
|
|
| 35 |
|
| 36 |
video_input=gr.Video(source="upload", format="mp4");
|
| 37 |
|
| 38 |
+
gr.Interface(fn=find_scenes, inputs=video_input, outputs=["json", "files"]).launch()
|