rogerxavier commited on
Commit
d8b1ce2
1 Parent(s): a5bd649

Update 3mergeDialogToVideo.py

Browse files
Files changed (1) hide show
  1. 3mergeDialogToVideo.py +20 -7
3mergeDialogToVideo.py CHANGED
@@ -291,17 +291,30 @@ if __name__ == '__main__':
291
  filename, duration = get_audio_data(cur_copywrite)
292
  if filename is not None:
293
  print("存放临时mp3文件的路径是",filename)
294
- clip = ImageClip(img).set_duration(duration).resize((width, height)) # 初始clip
 
 
295
 
296
- txt_clip = TextClip(cur_copywrite, fontsize=40, color='white', bg_color='black',
297
- font=font_path) ##文本clip后加入视频
298
 
299
- txt_clip = txt_clip.set_pos(('center', 'bottom')).set_duration(duration)
300
- # 创建音频剪辑
 
 
 
 
 
 
 
 
 
 
 
301
  audio_clip = AudioFileClip(filename)
302
- clip = clip.set_audio(audio_clip) # 将音频与视频片段关联
303
- clip = CompositeVideoClip([clip, txt_clip])
304
  video_clips.append(clip)
 
305
  else:
306
  pass ##音频特殊字符或者其他原因无法生成跳过
307
 
 
291
  filename, duration = get_audio_data(cur_copywrite)
292
  if filename is not None:
293
  print("存放临时mp3文件的路径是",filename)
294
+
295
+ #含字幕版
296
+ # clip = ImageClip(img).set_duration(duration).resize((width, height)) # 初始clip
297
 
298
+ # txt_clip = TextClip(cur_copywrite, fontsize=40, color='white', bg_color='black',
299
+ # font=font_path) ##文本clip后加入视频
300
 
301
+ # txt_clip = txt_clip.set_pos(('center', 'bottom')).set_duration(duration)
302
+ # # 创建音频剪辑
303
+ # audio_clip = AudioFileClip(filename)
304
+ # clip = clip.set_audio(audio_clip) # 将音频与视频片段关联
305
+ # clip = CompositeVideoClip([clip, txt_clip])
306
+ # video_clips.append(clip)
307
+ #含字幕版
308
+
309
+ #不含字幕版
310
+ clip = ImageClip(img).set_duration(duration).resize((width, height))
311
+
312
+ # 去掉添加字幕的部分(原文太长了,再加上音频都是一整个原图(即多个漫画块)的全部内容,也没法分割)
313
+
314
  audio_clip = AudioFileClip(filename)
315
+ clip = clip.set_audio(audio_clip)
 
316
  video_clips.append(clip)
317
+ #不含字幕版
318
  else:
319
  pass ##音频特殊字符或者其他原因无法生成跳过
320