pull/1873/head
KyleBoyer 2 years ago
parent aa1275865d
commit 055137d9c5

@ -57,6 +57,12 @@ def get_duration(filename, skip_accurate_decode=False):
# print(f"Returning duration {duration} from ffprobe for {filename}...") # print(f"Returning duration {duration} from ffprobe for {filename}...")
return duration 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...'): def ffmpeg_progress_run(ffmpeg_cmd, length, progress_text='Rendering...'):
progress_bar_columns = [ progress_bar_columns = [
TextColumn("[progress.description]{task.description}"), TextColumn("[progress.description]{task.description}"),

@ -51,8 +51,8 @@ def prepare_background(reddit_id: str, W: int, H: int) -> str:
an=None, an=None,
**{ **{
"c:v": "h264", "c:v": "h264",
"b:v": "20M", "b:v": "20M", # TODO fetch highest bitrate from inputs
"b:a": "192k", "b:a": "192k", # TODO fetch highest bitrate from inputs
"threads": multiprocessing.cpu_count(), "threads": multiprocessing.cpu_count(),
}, },
) )
@ -335,8 +335,8 @@ def make_final_video(
f="mp4", f="mp4",
**{ **{
"c:v": "h264", "c:v": "h264",
"b:v": "20M", "b:v": "20M", # TODO fetch highest bitrate from inputs
"b:a": "192k", "b:a": "192k", # TODO fetch highest bitrate from inputs
"threads": multiprocessing.cpu_count(), "threads": multiprocessing.cpu_count(),
}, },
).overwrite_output(), ).overwrite_output(),
@ -362,8 +362,8 @@ def make_final_video(
f="mp4", f="mp4",
**{ **{
"c:v": "h264", "c:v": "h264",
"b:v": "20M", "b:v": "20M", # TODO fetch highest bitrate from inputs
"b:a": "192k", "b:a": "192k", # TODO fetch highest bitrate from inputs
"threads": multiprocessing.cpu_count(), "threads": multiprocessing.cpu_count(),
}, },
).overwrite_output(), ).overwrite_output(),

Loading…
Cancel
Save