Update app.py
Browse files
app.py
CHANGED
@@ -89,15 +89,16 @@ def infer(video_input, manual_caption, duration_in, seed, caption_output):
|
|
89 |
duration = video_in.duration
|
90 |
if duration > 5:
|
91 |
video_in = video_in.subclip(0,5)
|
92 |
-
|
|
|
93 |
# Make the audio the same length as the video
|
94 |
-
|
95 |
|
96 |
# Combine the audio and video
|
97 |
-
result = video_in.set_audio(
|
98 |
|
99 |
# Save the result
|
100 |
-
result.write_videofile("result.mp4")
|
101 |
|
102 |
|
103 |
#return cap, sound[1], gr.Textbox.update(placeholder=f"{ph_update}{ph_message}"), gr.Group.update(visible=True)
|
|
|
89 |
duration = video_in.duration
|
90 |
if duration > 5:
|
91 |
video_in = video_in.subclip(0,5)
|
92 |
+
|
93 |
+
new_audio = AudioFileClip("sound.mp3")
|
94 |
# Make the audio the same length as the video
|
95 |
+
new_audio = new_audio.set_duration(video_in.duration)
|
96 |
|
97 |
# Combine the audio and video
|
98 |
+
result = video_in.set_audio(new_audio)
|
99 |
|
100 |
# Save the result
|
101 |
+
result.write_videofile("result.mp4", codec='libx264', audio_codec='aac')
|
102 |
|
103 |
|
104 |
#return cap, sound[1], gr.Textbox.update(placeholder=f"{ph_update}{ph_message}"), gr.Group.update(visible=True)
|