diff --git a/twitch_chat_vod.py b/twitch_chat_vod.py index 9d6595b..450a1aa 100644 --- a/twitch_chat_vod.py +++ b/twitch_chat_vod.py @@ -1,13 +1,28 @@ #!/usr/bin/env python3 import os +import cv2 import linux +def get_video_height(video_path: str) -> int: + # Open the video file + video = cv2.VideoCapture(video_path) + + # Get the height property + height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT)) + + # Always release the video object + video.release() + + return height + def combine_twitch_vod_and_chat(vod_path: str, layout: str = "side-by-side", force: bool = False) -> bool: """ Renders Twitch chat JSON to video and combines it with the source VOD. Provides real-time terminal feedback for all processing steps. """ - threads = "8" + threads = 8 + + video_height = 1080 video_path = vod_path video_chat = "" @@ -53,11 +68,13 @@ def combine_twitch_vod_and_chat(vod_path: str, layout: str = "side-by-side", for print("====================================================") print("🚀 STEP 1: Rendering Chat JSON to Video Layer") print("====================================================") + + video_height = get_video_height(vod_path) chat_cmd = ( f"TwitchDownloaderCLI chatrender " f"-i {chat_path} " - f"-w 400 -h 1080 " + f"-w 400 -h {video_height} " f"--collision Overwrite " f"--temp-path download/temp " f"--font-size 20 "