Spaces:
Sleeping
Sleeping
Update audio.py
Browse files
audio.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
|
2 |
from gtts import gTTS
|
3 |
from pydub import AudioSegment
|
4 |
import tempfile
|
5 |
import os
|
6 |
import pyttsx3
|
7 |
from ms_tts import ms_tts_gen
|
8 |
-
|
9 |
os.environ["IMAGEIO_FFMPEG_EXE"] = "/usr/local/bin/ffmpeg"
|
10 |
# os.environ["IMAGEMAGICK_BINARY"] = "/usr/local/bin/convert"
|
11 |
|
@@ -77,9 +77,9 @@ def gen_audio(subtitles, tmpdir):
|
|
77 |
final_audio = CompositeAudioClip(clips)
|
78 |
return final_audio
|
79 |
|
80 |
-
|
81 |
|
82 |
-
video_with_audio = video_with_subtitles
|
83 |
|
84 |
video_with_audio.write_videofile(tmpdir + '/output_with_subtitles.mp4', fps=24)
|
85 |
|
|
|
1 |
+
from moviepy.editor import *
|
2 |
from gtts import gTTS
|
3 |
from pydub import AudioSegment
|
4 |
import tempfile
|
5 |
import os
|
6 |
import pyttsx3
|
7 |
from ms_tts import ms_tts_gen
|
8 |
+
|
9 |
os.environ["IMAGEIO_FFMPEG_EXE"] = "/usr/local/bin/ffmpeg"
|
10 |
# os.environ["IMAGEMAGICK_BINARY"] = "/usr/local/bin/convert"
|
11 |
|
|
|
77 |
final_audio = CompositeAudioClip(clips)
|
78 |
return final_audio
|
79 |
|
80 |
+
audio_clip = generate_audio(subtitles, total_duration)
|
81 |
|
82 |
+
video_with_audio = video_with_subtitles.set_audio(audio_clip)
|
83 |
|
84 |
video_with_audio.write_videofile(tmpdir + '/output_with_subtitles.mp4', fps=24)
|
85 |
|