Subscribe overlay to end of video

Add subscribe overlay
pull/1174/head
RapidStoned 3 years ago
parent 1189f84bd8
commit 02d3598d70

@ -17,6 +17,9 @@ from video_creation.background import (
chop_background_video,
get_background_config,
)
from video_creation.subOverlay import download_suboverlay
from video_creation.final_video import make_final_video
from video_creation.screenshot_downloader import download_screenshots_of_reddit_posts
from video_creation.voices import save_text_to_mp3
@ -49,6 +52,7 @@ def main(POST_ID=None):
download_screenshots_of_reddit_posts(reddit_object, number_of_comments)
bg_config = get_background_config()
download_background(bg_config)
download_suboverlay() # Check for suboverlay and download if not found!
chop_background_video(bg_config, length, reddit_object)
make_final_video(number_of_comments, length, reddit_object, bg_config)

@ -22,6 +22,7 @@ times_to_run = { optional = false, default = 1, example = 2, explanation = "Used
opacity = { optional = false, default = 0.9, example = 0.8, explanation = "Sets the opacity of the comments when overlayed over the background", type = "float", nmin = 0, nmax = 1, oob_error = "The opacity HAS to be between 0 and 1", input_error = "The opacity HAS to be a decimal number between 0 and 1" }
transition = { optional = true, default = 0.2, example = 0.2, explanation = "Sets the transition time (in seconds) between the comments. Set to 0 if you want to disable it.", type = "float", nmin = 0, nmax = 2, oob_error = "The transition HAS to be between 0 and 2", input_error = "The opacity HAS to be a decimal number between 0 and 2" }
storymode = { optional = true, type = "bool", default = false, example = false, options = [true, false,], explanation = "Only read out title and post content, not yet implemented" }
sub_overlay = { optional = true, type = "bool", default = false, example = false, options = [true, false], explanation = "This will add a subscribe animation overlay to the end of the video" }
[settings.background]

@ -108,6 +108,11 @@ def make_final_video(
.crossfadeout(new_transition)
)
#Subscribe Overlay
if settings.config["settings"]["sub_overlay"]:
subOverlayClip = VideoFileClip((f"assets/subOverlay/subOverlayClip.mov"), has_mask=True)
subOverlayClip.set_pos('center')
# if os.path.exists("assets/mp3/posttext.mp3"):
# image_clips.insert(
# 0,
@ -119,9 +124,16 @@ def make_final_video(
# )
# else: story mode stuff
img_clip_pos = background_config[3]
image_concat = concatenate_videoclips(image_clips).set_position(img_clip_pos) # note transition kwarg for delay in imgs
image_concat.audio = audio_composite
final = CompositeVideoClip([background_clip, image_concat])
if settings.config["settings"]["sub_overlay"]:
final = CompositeVideoClip([background_clip, image_concat, subOverlayClip.set_start(background_clip.duration - subOverlayClip.duration)])
else:
final = CompositeVideoClip([background_clip, image_concat])
title = re.sub(r"[^\w\s-]", "", reddit_obj["thread_title"])
idx = re.sub(r"[^\w\s-]", "", reddit_obj["thread_id"])

@ -0,0 +1,28 @@
import requests
from os import makedirs
from fileinput import filename
from utils.console import print_step, print_substep
from utils import settings
from pathlib import Path
# Checks if suboverlay is a thing, if not it downloads the file
# Uses Google Drive Direct Link to store the file
# Source of the animation https://fortatelier.com/free-youtube-subscribe-animation-overlays/
def download_suboverlay():
if settings.config["settings"]["sub_overlay"]:
if Path(f"assets/subOverlay/subOverlayClip.mov").is_file():
return
#Generate path and folders
makedirs(f'assets/subOverlay')
URL = "https://drive.google.com/u/0/uc?id=16ajH0maciiWgWNgA-PNh29GZe9xqZmZR&export=download"
print_step("We need to download the subscribe overlay, this only needs to be done once!")
print_substep("Downloading subscribe overlay please wait....")
subOverlayFile = requests.get(URL, verify=False)
open(f'assets/subOverlay/subOverlayClip.mov', 'wb').write(subOverlayFile.content)
print_substep("Subscribe overlay has been downloaded!", style="bold green")
Loading…
Cancel
Save