Browse Source

修改读取字体文件目录

zhangyong 1 year ago
parent
commit
571b5a228a
1 changed files with 3 additions and 3 deletions
  1. 3 3
      video_stitching/video_stitching.py

+ 3 - 3
video_stitching/video_stitching.py

@@ -202,7 +202,7 @@ class VideoStitching():
                 # /System/Library/Fonts/Hiragino Sans GB.ttc 本地字体
                 # /usr/share/fonts/truetype/wqy/wqy-zenhei.ttc 服务器地址
                 Common.logger().info(f"字幕:{text}")
-                sub = editor.TextClip(text, font="/System/Library/Fonts/Hiragino Sans GB.ttc",
+                sub = editor.TextClip(text, font="/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",
                                       fontsize=18, color="black").set_duration(end - start).set_start(
                     start).set_position(
                     ("center", final_height - 60)).set_opacity(0.8)
@@ -213,7 +213,7 @@ class VideoStitching():
         else:
             Common.logger().info(f"添加固定字幕")
             text_clip = (
-                editor.TextClip("分享、转发给群友", font="/System/Library/Fonts/Hiragino Sans GB.ttc",
+                editor.TextClip("分享、转发给群友", font="/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",
                                 fontsize=30, color="black").
                     set_position(("center", final_height - 70)).
                     set_duration(duration_limit).
@@ -222,7 +222,7 @@ class VideoStitching():
             # 把 `文本剪贴板` 贴在视频上
             video_with_subtitles = editor.CompositeVideoClip([final_clip, text_clip])
         # 生成视频
-        video_with_subtitles.write_videofile(output_path)
+        video_with_subtitles.write_videofile(output_path, fps=35)
         if os.path.isfile(output_path):
             Common.logger().info("视频生成成功!生成路径为:", output_path)
             return included_videos, video_with_subtitles