|
@@ -131,7 +131,7 @@ class VideoStitching():
|
|
total_duration = 0
|
|
total_duration = 0
|
|
included_videos = []
|
|
included_videos = []
|
|
# 设置最大可使用的内存限制(单位:字节)
|
|
# 设置最大可使用的内存限制(单位:字节)
|
|
- memory_limit = 4 * 1024 * 1024 * 1024 # 4GB
|
|
|
|
|
|
+ memory_limit = 2 * 1024 * 1024 * 1024 # 2GB
|
|
resource.setrlimit(resource.RLIMIT_AS, (memory_limit, memory_limit))
|
|
resource.setrlimit(resource.RLIMIT_AS, (memory_limit, memory_limit))
|
|
# 提取视频的音频
|
|
# 提取视频的音频
|
|
Common.logger().info(f"开始提取视频的音频{audio}")
|
|
Common.logger().info(f"开始提取视频的音频{audio}")
|
|
@@ -149,12 +149,16 @@ class VideoStitching():
|
|
total_duration += clip.duration
|
|
total_duration += clip.duration
|
|
if total_duration >= duration_limit:
|
|
if total_duration >= duration_limit:
|
|
break
|
|
break
|
|
|
|
+ # 处理完毕后释放视频剪辑对象
|
|
|
|
+ clip.close()
|
|
|
|
+ Common.logger().info(f"处理完毕后释放视频剪辑对象")
|
|
|
|
|
|
# 如果总时长小于等于目标时长,则不做视频拼接
|
|
# 如果总时长小于等于目标时长,则不做视频拼接
|
|
if total_duration <= duration_limit:
|
|
if total_duration <= duration_limit:
|
|
Common.logger().info(f"时长小于等于目标时长,不做视频拼接")
|
|
Common.logger().info(f"时长小于等于目标时长,不做视频拼接")
|
|
return ""
|
|
return ""
|
|
else:
|
|
else:
|
|
|
|
+ Common.logger().info(f"总时长大于目标时长")
|
|
remaining_time = duration_limit
|
|
remaining_time = duration_limit
|
|
final_clips = []
|
|
final_clips = []
|
|
|
|
|
|
@@ -199,7 +203,7 @@ class VideoStitching():
|
|
# /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(
|
|
("center", final_height - 80)).set_opacity(0.8)
|
|
("center", final_height - 80)).set_opacity(0.8)
|
|
@@ -321,12 +325,12 @@ class VideoStitching():
|
|
time.sleep(120)
|
|
time.sleep(120)
|
|
count += 1
|
|
count += 1
|
|
Common.logger().info(f"视频添加到对应用户成功")
|
|
Common.logger().info(f"视频添加到对应用户成功")
|
|
- if count >= 20:
|
|
|
|
|
|
+ if count >= 13:
|
|
break
|
|
break
|
|
except Exception as e:
|
|
except Exception as e:
|
|
Common.logger().warning(f"新拼接视频发送oss失败:{e}\n")
|
|
Common.logger().warning(f"新拼接视频发送oss失败:{e}\n")
|
|
continue
|
|
continue
|
|
- if count >= 20:
|
|
|
|
|
|
+ if count >= 13:
|
|
break
|
|
break
|
|
|
|
|
|
@classmethod
|
|
@classmethod
|