fffiloni commited on
Commit
fee1e82
·
1 Parent(s): 97a8787

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -17,6 +17,10 @@ def extract_video_frames(video_in):
17
 
18
  # Calculate the total duration of the video
19
  total_duration = clip.duration
 
 
 
 
20
 
21
  # Set the intervals to extract the frames
22
  intervals = [0, 2, 4, total_duration]
@@ -80,9 +84,12 @@ def infer(video_input, manual_caption, duration_in, seed, caption_output):
80
 
81
  # Load the input video file
82
  video_in = VideoFileClip(video_input)
 
 
 
83
 
84
  # Make the audio the same length as the video
85
- audio = audio.set_duration(video.duration)
86
 
87
  # Combine the audio and video
88
  result = video_in.set_audio(audio)
 
17
 
18
  # Calculate the total duration of the video
19
  total_duration = clip.duration
20
+
21
+ if total_duration > 5:
22
+ clip = clip.subclip(0,5)
23
+ total_duration = clip.duration
24
 
25
  # Set the intervals to extract the frames
26
  intervals = [0, 2, 4, total_duration]
 
84
 
85
  # Load the input video file
86
  video_in = VideoFileClip(video_input)
87
+ duration = video_in.duration
88
+ if duration > 5:
89
+ video_in = video_in.subclip(0,5)
90
 
91
  # Make the audio the same length as the video
92
+ audio = audio.set_duration(video_in.duration)
93
 
94
  # Combine the audio and video
95
  result = video_in.set_audio(audio)