deeme commited on
Commit
483202c
·
verified ·
1 Parent(s): 8b906ea

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -279,7 +279,10 @@ def create_video(project_dir, image_paths, caption_subtitle_file, speech_subtitl
279
 
280
  # 然后添加字幕 - 先添加caption字幕(底部)
281
  temp_video2 = os.path.join(project_dir, "temp_video2.mp4")
282
- caption_filter = f"subtitles='{caption_subtitle_file.replace(os.sep, '/').replace(':', '\\:')}':force_style='Fontname=Consolas,Alignment=2,FontSize=15,PrimaryColour=&H00E0FFFF,OutlineColour=&H80000000,BackColour=&H40000000,BorderStyle=1,Outline=0.8,Shadow=0.5,MarginV=10'"
 
 
 
283
 
284
  cmd2 = [
285
  "ffmpeg", "-y",
@@ -292,8 +295,10 @@ def create_video(project_dir, image_paths, caption_subtitle_file, speech_subtitl
292
  subprocess.run(cmd2, check=True)
293
 
294
  # 再添加speech字幕(顶部)
295
- speech_filter = f"subtitles='{speech_subtitle_file.replace(os.sep, '/').replace(':', '\\:')}':force_style='Fontname=Consolas,Alignment=6,FontSize=15,PrimaryColour=&H00FFCCE6,OutlineColour=&H80000000,BackColour=&H40000000,BorderStyle=1,Outline=0.8,Shadow=0.5,MarginV=10,MarginR=15'"
296
-
 
 
297
  cmd3 = [
298
  "ffmpeg", "-y",
299
  "-i", temp_video2,
 
279
 
280
  # 然后添加字幕 - 先添加caption字幕(底部)
281
  temp_video2 = os.path.join(project_dir, "temp_video2.mp4")
282
+
283
+ subtitle_path = caption_subtitle_file.replace(os.sep, '/')
284
+ subtitle_path = subtitle_path.replace(':', '\\:')
285
+ caption_filter = f"subtitles='{subtitle_path}':force_style='Fontname=Consolas,Alignment=2,FontSize=15,PrimaryColour=&H00E0FFFF,OutlineColour=&H80000000,BackColour=&H40000000,BorderStyle=1,Outline=0.8,Shadow=0.5,MarginV=10'"
286
 
287
  cmd2 = [
288
  "ffmpeg", "-y",
 
295
  subprocess.run(cmd2, check=True)
296
 
297
  # 再添加speech字幕(顶部)
298
+ subtitle_path = speech_subtitle_file.replace(os.sep, '/')
299
+ subtitle_path = subtitle_path.replace(':', '\\:')
300
+ speech_filter = f"subtitles='{subtitle_path}':force_style='Fontname=Consolas,Alignment=6,FontSize=15,PrimaryColour=&H00FFCCE6,OutlineColour=&H80000000,BackColour=&H40000000,BorderStyle=1,Outline=0.8,Shadow=0.5,MarginV=10,MarginR=15'"
301
+
302
  cmd3 = [
303
  "ffmpeg", "-y",
304
  "-i", temp_video2,