From 055137d9c5d1ad94777ae64ffc71a10810d93d17 Mon Sep 17 00:00:00 2001 From: KyleBoyer Date: Thu, 23 Nov 2023 00:16:32 -0600 Subject: [PATCH] Comments --- utils/ffmpeg.py | 6 ++++++ video_creation/final_video.py | 12 ++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/utils/ffmpeg.py b/utils/ffmpeg.py index 3f93177..3d2747f 100644 --- a/utils/ffmpeg.py +++ b/utils/ffmpeg.py @@ -57,6 +57,12 @@ def get_duration(filename, skip_accurate_decode=False): # print(f"Returning duration {duration} from ffprobe for {filename}...") return duration +def ffmpeg_get_bit_rate(filename): + probe_info=ffmpeg.probe(filename) + duration=float(probe_info["format"]["bit_rate"]) + return duration + + def ffmpeg_progress_run(ffmpeg_cmd, length, progress_text='Rendering...'): progress_bar_columns = [ TextColumn("[progress.description]{task.description}"), diff --git a/video_creation/final_video.py b/video_creation/final_video.py index 280e38a..e89d8c4 100644 --- a/video_creation/final_video.py +++ b/video_creation/final_video.py @@ -51,8 +51,8 @@ def prepare_background(reddit_id: str, W: int, H: int) -> str: an=None, **{ "c:v": "h264", - "b:v": "20M", - "b:a": "192k", + "b:v": "20M", # TODO fetch highest bitrate from inputs + "b:a": "192k", # TODO fetch highest bitrate from inputs "threads": multiprocessing.cpu_count(), }, ) @@ -335,8 +335,8 @@ def make_final_video( f="mp4", **{ "c:v": "h264", - "b:v": "20M", - "b:a": "192k", + "b:v": "20M", # TODO fetch highest bitrate from inputs + "b:a": "192k", # TODO fetch highest bitrate from inputs "threads": multiprocessing.cpu_count(), }, ).overwrite_output(), @@ -362,8 +362,8 @@ def make_final_video( f="mp4", **{ "c:v": "h264", - "b:v": "20M", - "b:a": "192k", + "b:v": "20M", # TODO fetch highest bitrate from inputs + "b:a": "192k", # TODO fetch highest bitrate from inputs "threads": multiprocessing.cpu_count(), }, ).overwrite_output(),