JustForWorld commited on
Commit
8b2e214
·
1 Parent(s): 1f4bfad

fix: crossfadein

Browse files
Files changed (1) hide show
  1. video_assembler.py +7 -3
video_assembler.py CHANGED
@@ -84,8 +84,12 @@ def assemble_video_with_narration(image_contents: list, audio_chunks: list, outp
84
  if not video_clips:
85
  raise ValueError("Не удалось создать ни одного видеоклипа.")
86
 
87
- # Собираем видеоряд с переходами
88
- final_video = concatenate_videoclips(video_clips, transition=CrossFadeIn, method="compose")
 
 
 
 
89
 
90
  # Рендеринг
91
  final_video.write_videofile(
@@ -96,7 +100,7 @@ def assemble_video_with_narration(image_contents: list, audio_chunks: list, outp
96
  temp_audiofile="temp-audio.m4a",
97
  remove_temp=True,
98
  threads=os.cpu_count() or 2,
99
- preset="medium"
100
  )
101
  return output_path
102
 
 
84
  if not video_clips:
85
  raise ValueError("Не удалось создать ни одного видеоклипа.")
86
 
87
+ # Применяем эффект перехода .crossfadein() к каждому клипу, начиная со второго
88
+ clips_with_transitions = [video_clips[0]] + [
89
+ clip.crossfadein(TRANSITION_DURATION) for clip in video_clips[1:]
90
+ ]
91
+ # Собираем видеоряд, указывая отрицательный padding, чтобы клипы наложились друг на друга
92
+ final_video = concatenate_videoclips(clips_with_transitions, padding=-TRANSITION_DURATION, method="compose")
93
 
94
  # Рендеринг
95
  final_video.write_videofile(
 
100
  temp_audiofile="temp-audio.m4a",
101
  remove_temp=True,
102
  threads=os.cpu_count() or 2,
103
+ preset="fast"
104
  )
105
  return output_path
106