diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 38cb234..ec1567a 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -173,8 +173,7 @@ def make_final_video( ).overwrite_output().run(quiet=True) console.log(f"[bold green] Video Will Be: {length} Seconds Long") - # Create a screenshot_width variable to scale the screenshots to the correct size, the calculation is int((W * 90) // 100) - # Convert it to a ffmpeg one with iw- + screenshot_width = int((W * 45) // 100) audio = ffmpeg.input(f"assets/temp/{reddit_id}/audio.mp3") @@ -225,7 +224,7 @@ def make_final_video( ): image_clips.append( ffmpeg.input(f"assets/temp/{reddit_id}/png/img{i}.png")["v"].filter( - "scale", 1080, -1 + "scale", screenshot_width, -1 ) ) background_clip = background_clip.overlay( @@ -343,45 +342,6 @@ def make_final_video( pbar.update(100 - old_percentage) pbar.close() - if settingsbackground["background_thumbnail"]: - if not exists(f"./results/{subreddit}/thumbnails"): - print_substep("The results/thumbnails folder didn't exist so I made it") - os.makedirs(f"./results/{subreddit}/thumbnails") - # get the first file with the .png extension from assets/backgrounds and use it as a background for the thumbnail - first_image = next( - ( - file - for file in os.listdir("assets/backgrounds") - if file.endswith(".png") - ), - None, - ) - if first_image is None: - print_substep("No png files found in assets/backgrounds", "red") - - if settingsbackground["background_thumbnail"] and first_image: - font_family = settingsbackground["background_thumbnail_font_family"] - font_size = settingsbackground["background_thumbnail_font_size"] - font_color = settingsbackground["background_thumbnail_font_color"] - thumbnail = Image.open(f"assets/backgrounds/{first_image}") - width, height = thumbnail.size - thumbnailSave = create_thumbnail( - thumbnail, font_family, font_size, font_color, width, height, title_thumb - ) - thumbnailSave.save(f"./assets/temp/{reddit_id}/thumbnail.png") - print_substep( - f"Thumbnail - Building Thumbnail in assets/temp/{reddit_id}/thumbnail.png" - ) - - # get the thumbnail image from assets/temp/id/thumbnail.png and save it in results/subreddit/thumbnails - if settingsbackground["background_thumbnail"] and exists( - f"assets/temp/{reddit_id}/thumbnail.png" - ): - shutil.move( - f"assets/temp/{reddit_id}/thumbnail.png", - f"./results/{subreddit}/thumbnails/{filename}.png", - ) - save_data(subreddit, filename + ".mp4", title, idx, background_config[2]) print_step("Removing temporary files 🗑") cleanups = cleanup(reddit_id)