|
@@ -21,7 +21,7 @@ def generate_video(image_files, output_path):
|
|
start_xvfb.delay() # 确保 Xvfb 已经启动
|
|
start_xvfb.delay() # 确保 Xvfb 已经启动
|
|
try:
|
|
try:
|
|
video_files = []
|
|
video_files = []
|
|
- music_path = "static/temp/music.mp3"
|
|
|
|
|
|
+ music_path = "/web/test/ASJServer/static/temp/music.mp3"
|
|
# 定义特效列表
|
|
# 定义特效列表
|
|
transitions = [
|
|
transitions = [
|
|
"BowTieHorizontal.glsl",
|
|
"BowTieHorizontal.glsl",
|
|
@@ -44,7 +44,7 @@ def generate_video(image_files, output_path):
|
|
'ffmpeg', '-loop', '1', '-i', image_files[i],
|
|
'ffmpeg', '-loop', '1', '-i', image_files[i],
|
|
'-loop', '1', '-i', image_files[i + 1],
|
|
'-loop', '1', '-i', image_files[i + 1],
|
|
'-filter_complex',
|
|
'-filter_complex',
|
|
- f'gltransition=duration=1:offset=0.7:source=static/gl-transitions/{transitions[i]}',
|
|
|
|
|
|
+ f'gltransition=duration=1:offset=0.7:source=/web/test/ASJServer/static/temp/{transitions[i]}',
|
|
'-t', '2', output_video
|
|
'-t', '2', output_video
|
|
]
|
|
]
|
|
|
|
|
|
@@ -57,8 +57,10 @@ def generate_video(image_files, output_path):
|
|
|
|
|
|
# 拼接视频
|
|
# 拼接视频
|
|
final_output = os.path.join(output_path, 'final_output.mp4')
|
|
final_output = os.path.join(output_path, 'final_output.mp4')
|
|
- subprocess.run(['ffmpeg', '-f', 'concat', '-safe', '0', '-i', 'filelist.txt', '-c', 'copy', final_output],
|
|
|
|
- check=True)
|
|
|
|
|
|
+ subprocess.run(
|
|
|
|
+ ['ffmpeg', '-f', 'concat', '-safe', '0', '-i', '/web/test/ASJServer/static/temp/filelist.txt', '-c', 'copy',
|
|
|
|
+ final_output],
|
|
|
|
+ check=True)
|
|
|
|
|
|
# 添加背景音乐
|
|
# 添加背景音乐
|
|
final_output_with_music = os.path.join(output_path, 'final_output_with_music.mp4')
|
|
final_output_with_music = os.path.join(output_path, 'final_output_with_music.mp4')
|
|
@@ -68,7 +70,7 @@ def generate_video(image_files, output_path):
|
|
# 清理临时文件
|
|
# 清理临时文件
|
|
for video in video_files:
|
|
for video in video_files:
|
|
os.remove(video)
|
|
os.remove(video)
|
|
- os.remove('static/temp/filelist.txt')
|
|
|
|
|
|
+ os.remove('/web/test/ASJServer/static/temp/filelist.txt')
|
|
except Exception as e:
|
|
except Exception as e:
|
|
LOGGER.info(f'视频合成失败: {e}')
|
|
LOGGER.info(f'视频合成失败: {e}')
|
|
|
|
|