rogerxavier
commited on
Commit
•
09c7add
1
Parent(s):
1bf315b
Update 3mergeDialogToVideo.py
Browse files- 3mergeDialogToVideo.py +2 -2
3mergeDialogToVideo.py
CHANGED
@@ -149,7 +149,7 @@ def get_audio_data(text:str)-> "返回audio data io句柄, duration":
|
|
149 |
# print("音频持续时间是",response.audio_duration)
|
150 |
# print("音频数据是",response.content)
|
151 |
# 创建临时文件 -当前路径下面
|
152 |
-
with tempfile.NamedTemporaryFile(dir='/mp3_out',delete=False) as temp_file:
|
153 |
temp_file.write(response.content)
|
154 |
temp_file.close()
|
155 |
audio = MP3(temp_file.name)
|
@@ -270,7 +270,7 @@ if __name__ == '__main__':
|
|
270 |
|
271 |
##获取当前图片对应的临时音频文件名称和文案时长
|
272 |
filename, duration = get_audio_data(cur_copywrite)
|
273 |
-
|
274 |
clip = ImageClip(img).set_duration(duration).resize((width, height)) # 初始clip
|
275 |
|
276 |
txt_clip = TextClip(cur_copywrite, fontsize=40, color='white', bg_color='black',
|
|
|
149 |
# print("音频持续时间是",response.audio_duration)
|
150 |
# print("音频数据是",response.content)
|
151 |
# 创建临时文件 -当前路径下面
|
152 |
+
with tempfile.NamedTemporaryFile(dir='/mp3_out/',delete=False) as temp_file:
|
153 |
temp_file.write(response.content)
|
154 |
temp_file.close()
|
155 |
audio = MP3(temp_file.name)
|
|
|
270 |
|
271 |
##获取当前图片对应的临时音频文件名称和文案时长
|
272 |
filename, duration = get_audio_data(cur_copywrite)
|
273 |
+
print("存放临时mp3文件的路径是",filename)
|
274 |
clip = ImageClip(img).set_duration(duration).resize((width, height)) # 初始clip
|
275 |
|
276 |
txt_clip = TextClip(cur_copywrite, fontsize=40, color='white', bg_color='black',
|