|
@@ -183,8 +183,8 @@ class VideoStitching():
|
|
final_clip = editor.CompositeVideoClip([final_clip, color_clip.set_position(("center", final_height - 100))])
|
|
final_clip = editor.CompositeVideoClip([final_clip, color_clip.set_position(("center", final_height - 100))])
|
|
# 处理SRT字幕文件
|
|
# 处理SRT字幕文件
|
|
subtitle_file = f"./video_stitching/video/{srt}.srt"
|
|
subtitle_file = f"./video_stitching/video/{srt}.srt"
|
|
- Common.logger().info(f"处理SRT字幕文件")
|
|
|
|
- if os.path.exists(subtitle_file):
|
|
|
|
|
|
+ if os.path.isfile(subtitle_file):
|
|
|
|
+ Common.logger().info(f"处理SRT字幕文件")
|
|
with open(subtitle_file, 'r') as file:
|
|
with open(subtitle_file, 'r') as file:
|
|
subtitles = file.read().strip().split('\n\n')
|
|
subtitles = file.read().strip().split('\n\n')
|
|
# 从SRT字幕文件中获取字幕
|
|
# 从SRT字幕文件中获取字幕
|
|
@@ -201,7 +201,6 @@ class VideoStitching():
|
|
text = cls.split_text(text, 10)
|
|
text = cls.split_text(text, 10)
|
|
# /System/Library/Fonts/Hiragino Sans GB.ttc 本地字体
|
|
# /System/Library/Fonts/Hiragino Sans GB.ttc 本地字体
|
|
Common.logger().info(f"字幕:{text}")
|
|
Common.logger().info(f"字幕:{text}")
|
|
-
|
|
|
|
sub = editor.TextClip(text, font="/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",
|
|
sub = editor.TextClip(text, font="/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",
|
|
fontsize=30, color="black").set_duration(end - start).set_start(
|
|
fontsize=30, color="black").set_duration(end - start).set_start(
|
|
start).set_position(
|
|
start).set_position(
|