fffiloni commited on
Commit
f50a5fd
1 Parent(s): a10d32a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
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
- shot_in = scene_list[1][0].get_frames() / scene_list[1][0].get_framerate()
22
- shot_out = (scene_list[1][1].get_frames() - 1) / scene_list[1][0].get_framerate()
 
 
 
 
 
23
  #print(shot_in, shot_out)
24
 
25
- #input_video_path = video_path
26
- #output_video_path = 'video_out.mp4'
27
- # ffmpeg_extract_subclip("full.mp4", start_seconds, end_seconds, targetname="cut.mp4")
28
- ffmpeg_extract_subclip(video_path, shot_in, shot_out, targetname="cut.mp4")
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", "video" * 2]).launch()
 
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()