add hight var to chatrender for 720p videos

This commit is contained in:
2026-08-22 13:13:54 +00:00
parent 33ea2b7fcf
commit 7f1f1e7b4f
+19 -2
View File
@@ -1,13 +1,28 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
import cv2
import linux 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: 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. Renders Twitch chat JSON to video and combines it with the source VOD.
Provides real-time terminal feedback for all processing steps. Provides real-time terminal feedback for all processing steps.
""" """
threads = "8" threads = 8
video_height = 1080
video_path = vod_path video_path = vod_path
video_chat = "" video_chat = ""
@@ -53,11 +68,13 @@ def combine_twitch_vod_and_chat(vod_path: str, layout: str = "side-by-side", for
print("====================================================") print("====================================================")
print("🚀 STEP 1: Rendering Chat JSON to Video Layer") print("🚀 STEP 1: Rendering Chat JSON to Video Layer")
print("====================================================") print("====================================================")
video_height = get_video_height(vod_path)
chat_cmd = ( chat_cmd = (
f"TwitchDownloaderCLI chatrender " f"TwitchDownloaderCLI chatrender "
f"-i {chat_path} " f"-i {chat_path} "
f"-w 400 -h 1080 " f"-w 400 -h {video_height} "
f"--collision Overwrite " f"--collision Overwrite "
f"--temp-path download/temp " f"--temp-path download/temp "
f"--font-size 20 " f"--font-size 20 "