Skip to content

Commit

Permalink
fall back to width/height
Browse files Browse the repository at this point in the history
  • Loading branch information
zfleeman committed Mar 11, 2024
1 parent a9aeff4 commit 1a2c603
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ffmpeg4discord/twopass.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ def __init__(
for stream in self.probe["streams"]:
ix = stream["index"]
if stream["codec_type"] == "video":
display_aspect_ratio = self.probe["streams"][ix]["display_aspect_ratio"].split(":")
self.ratio = int(display_aspect_ratio[0]) / int(display_aspect_ratio[1])
width = self.probe["streams"][ix]["width"]
height = self.probe["streams"][ix]["height"]
self.ratio = width / height
elif stream["codec_type"] == "audio":
audio_stream = ix

Expand Down Expand Up @@ -265,13 +266,13 @@ def run(self) -> float:

# First Pass
ffOutput = ffmpeg.output(video, "pipe:", **params["pass1"])
ffOutput = ffOutput.global_args("-loglevel", "quiet", "-stats")
# ffOutput = ffOutput.global_args("-loglevel", "quiet", "-stats")
print("Performing first pass")
std_out, std_err = ffOutput.run(capture_stdout=True)

# Second Pass
ffOutput = ffmpeg.output(video, audio, self.output_filename, **params["pass2"])
ffOutput = ffOutput.global_args("-loglevel", "quiet", "-stats")
# ffOutput = ffOutput.global_args("-loglevel", "quiet", "-stats")
print("\nPerforming second pass")
ffOutput.run(overwrite_output=True)

Expand Down

0 comments on commit 1a2c603

Please sign in to comment.