|
@@ -123,13 +123,6 @@ class VideoStitching():
|
|
|
else:
|
|
|
return False
|
|
|
|
|
|
- def get_io_bps(cls):
|
|
|
- io_counters = psutil.Process().io_counters()
|
|
|
- read_bps = io_counters.read_bytes / 5 # 每秒读取的字节数
|
|
|
- write_bps = io_counters.write_bytes / 5 # 每秒写入的字节数
|
|
|
- Common.logger().info(f"当前读取速度:{read_bps} B/s")
|
|
|
- Common.logger().info(f"当前写入速度:{write_bps} B/s")
|
|
|
-
|
|
|
|
|
|
# 视频拼接
|
|
|
@classmethod
|
|
@@ -191,7 +184,6 @@ class VideoStitching():
|
|
|
Common.logger().info(f"处理SRT字幕文件")
|
|
|
if os.path.isfile(subtitle_file):
|
|
|
with open(subtitle_file, 'r') as file:
|
|
|
- cls.get_io_bps()
|
|
|
subtitles = file.read().strip().split('\n\n')
|
|
|
# 从SRT字幕文件中获取字幕
|
|
|
subtitle_clips = []
|
|
@@ -226,9 +218,7 @@ class VideoStitching():
|
|
|
)
|
|
|
# 把 `文本剪贴板` 贴在视频上
|
|
|
video_with_subtitles = editor.CompositeVideoClip([final_clip, text_clip])
|
|
|
-
|
|
|
# 生成视频
|
|
|
- cls.get_io_bps()
|
|
|
video_with_subtitles.write_videofile(output_path, codec='libx264', fps=24)
|
|
|
if os.path.isfile(output_path):
|
|
|
Common.logger().info("视频生成成功!生成路径为:", output_path)
|