zhangyong 1 rok temu
rodzic
commit
fea8d7bb58
1 zmienionych plików z 5 dodań i 0 usunięć
  1. 5 0
      video_stitching/video_stitching.py

+ 5 - 0
video_stitching/video_stitching.py

@@ -124,9 +124,12 @@ class VideoStitching():
         included_videos = []
         # 提取视频的音频
         video1 = VideoFileClip(audio)
+        Common.logger().info(f"提取视频的音频")
+
         mp3 = video1.audio
         # 获取音频时长(以秒为单位)
         duration_limit = mp3.duration
+        Common.logger().info(f"获取音频时长")
 
         # 遍历每个视频并计算总时长
         for i, video in enumerate(videos):
@@ -138,6 +141,7 @@ class VideoStitching():
 
         # 如果总时长小于等于目标时长,则不做视频拼接
         if total_duration <= duration_limit:
+            Common.logger().info(f"时长小于等于目标时长,不做视频拼接")
             return ""
         else:
             remaining_time = duration_limit
@@ -165,6 +169,7 @@ class VideoStitching():
         final_clip = editor.CompositeVideoClip([final_clip, color_clip.set_position(("center", final_height - 100))])
         # 处理SRT字幕文件
         subtitle_file = f"./video_stitching/video/{srt}.srt"
+        Common.logger().info(f"处理SRT字幕文件")
         if os.path.isfile(subtitle_file):
             with open(subtitle_file, 'r') as file:
                 subtitles = file.read().strip().split('\n\n')