|
|
|
@ -119,6 +119,7 @@ def make_final_video(
|
|
|
|
|
|
|
|
|
|
# Gather all audio clips
|
|
|
|
|
audio_clips = list()
|
|
|
|
|
audio_clips_durations = list()
|
|
|
|
|
if number_of_clips == 0 and settings.config["settings"]["storymode"] == "false":
|
|
|
|
|
print(
|
|
|
|
|
"No audio clips to gather. Please use a different TTS or post."
|
|
|
|
@ -128,6 +129,11 @@ def make_final_video(
|
|
|
|
|
if settings.config["settings"]["storymodemethod"] == 0:
|
|
|
|
|
audio_clips = [ffmpeg.input(f"assets/temp/{reddit_id}/mp3/title.mp3")]
|
|
|
|
|
audio_clips.insert(1, ffmpeg.input(f"assets/temp/{reddit_id}/mp3/postaudio.mp3"))
|
|
|
|
|
|
|
|
|
|
audio_clips_durations = [
|
|
|
|
|
get_duration(f"assets/temp/{reddit_id}/mp3/title.mp3"),
|
|
|
|
|
get_duration(f"assets/temp/{reddit_id}/mp3/postaudio.mp3")
|
|
|
|
|
]
|
|
|
|
|
elif settings.config["settings"]["storymodemethod"] == 1:
|
|
|
|
|
audio_clips = [
|
|
|
|
|
ffmpeg.input(f"assets/temp/{reddit_id}/mp3/postaudio-{i}.mp3")
|
|
|
|
@ -135,6 +141,15 @@ def make_final_video(
|
|
|
|
|
]
|
|
|
|
|
audio_clips.insert(0, ffmpeg.input(f"assets/temp/{reddit_id}/mp3/title.mp3"))
|
|
|
|
|
|
|
|
|
|
audio_clips_durations = [
|
|
|
|
|
get_duration(f"assets/temp/{reddit_id}/mp3/postaudio-{i}.mp3")
|
|
|
|
|
for i in track(range(number_of_clips + 1), "Calculating the audio file durations...")
|
|
|
|
|
]
|
|
|
|
|
audio_clips_durations.insert(
|
|
|
|
|
0,
|
|
|
|
|
get_duration(f"assets/temp/{reddit_id}/mp3/title.mp3")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
audio_clips = [
|
|
|
|
|
ffmpeg.input(f"assets/temp/{reddit_id}/mp3/{i}.mp3") for i in range(number_of_clips)
|
|
|
|
@ -150,11 +165,14 @@ def make_final_video(
|
|
|
|
|
get_duration(f"assets/temp/{reddit_id}/mp3/title.mp3")
|
|
|
|
|
)
|
|
|
|
|
audio_concat = ffmpeg.concat(*audio_clips, a=1, v=0)
|
|
|
|
|
ffmpeg.output(
|
|
|
|
|
audio_concat, f"assets/temp/{reddit_id}/audio.mp3", **{"b:a": "192k"}
|
|
|
|
|
).overwrite_output().run(quiet=True)
|
|
|
|
|
ffmpeg_progress_run(
|
|
|
|
|
ffmpeg.output(
|
|
|
|
|
audio_concat, f"assets/temp/{reddit_id}/audio.mp3", **{"b:a": "192k"}
|
|
|
|
|
).overwrite_output(),
|
|
|
|
|
sum(audio_clips_durations)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
print_substep(f"Video will be: {format_timespan(length)}", style="bold green")
|
|
|
|
|
print_substep(f"Video will be {format_timespan(length)} long", style="bold green")
|
|
|
|
|
|
|
|
|
|
screenshot_width = int((W * 45) // 100)
|
|
|
|
|
audio = ffmpeg.input(f"assets/temp/{reddit_id}/audio.mp3")
|
|
|
|
|