rogerxavier
commited on
Commit
•
d2d2a7f
1
Parent(s):
3b99f69
Update 3mergeDialogToVideo.py
Browse files- 3mergeDialogToVideo.py +1 -8
3mergeDialogToVideo.py
CHANGED
@@ -273,9 +273,6 @@ if __name__ == '__main__':
|
|
273 |
|
274 |
image_files = filtered_image_files
|
275 |
|
276 |
-
#为了保证读完一句话显示下一句字幕,当前字幕消失,需要设置一个start time
|
277 |
-
start_time = 0 # 初始化字幕起始时间
|
278 |
-
|
279 |
for idx, image_file in enumerate(image_files):
|
280 |
print("现在处理的图片是"+image_file)
|
281 |
#后面是视音频生成部分-这里图片需要用到完整的去水印的而不是对话框用于识别的
|
@@ -286,8 +283,6 @@ if __name__ == '__main__':
|
|
286 |
cur_copywrite = get_image_copywrite(image_file,dialog_img_path) # image_file就是6.jpg了
|
287 |
#cur_copywrite = gpt_polish(cur_copywrite)#不用gpt,只用新版漫画块得到的100%识别原文即可
|
288 |
|
289 |
-
|
290 |
-
|
291 |
if cur_copywrite is not None:
|
292 |
|
293 |
##获取当前图片对应的临时音频文件名称和文案时长
|
@@ -299,9 +294,7 @@ if __name__ == '__main__':
|
|
299 |
txt_clip = TextClip(cur_copywrite, fontsize=40, color='white', bg_color='black',
|
300 |
font=font_path) ##文本clip后加入视频
|
301 |
|
302 |
-
txt_clip = txt_clip.set_pos(('center', 'bottom')).set_duration(duration)
|
303 |
-
start_time += duration # 更新字幕起始时间为当前文本片段的结束时间
|
304 |
-
|
305 |
# 创建音频剪辑
|
306 |
audio_clip = AudioFileClip(filename)
|
307 |
clip = clip.set_audio(audio_clip) # 将音频与视频片段关联
|
|
|
273 |
|
274 |
image_files = filtered_image_files
|
275 |
|
|
|
|
|
|
|
276 |
for idx, image_file in enumerate(image_files):
|
277 |
print("现在处理的图片是"+image_file)
|
278 |
#后面是视音频生成部分-这里图片需要用到完整的去水印的而不是对话框用于识别的
|
|
|
283 |
cur_copywrite = get_image_copywrite(image_file,dialog_img_path) # image_file就是6.jpg了
|
284 |
#cur_copywrite = gpt_polish(cur_copywrite)#不用gpt,只用新版漫画块得到的100%识别原文即可
|
285 |
|
|
|
|
|
286 |
if cur_copywrite is not None:
|
287 |
|
288 |
##获取当前图片对应的临时音频文件名称和文案时长
|
|
|
294 |
txt_clip = TextClip(cur_copywrite, fontsize=40, color='white', bg_color='black',
|
295 |
font=font_path) ##文本clip后加入视频
|
296 |
|
297 |
+
txt_clip = txt_clip.set_pos(('center', 'bottom')).set_duration(duration)
|
|
|
|
|
298 |
# 创建音频剪辑
|
299 |
audio_clip = AudioFileClip(filename)
|
300 |
clip = clip.set_audio(audio_clip) # 将音频与视频片段关联
|