Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

General: Extract review aspect ratio scale is calculated by ffmpeg #3620

Merged
merged 2 commits into from
Aug 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 6 additions & 25 deletions openpype/plugins/publish/extract_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -1369,33 +1369,14 @@ def rescaling_filters(self, temp_data, output_def, new_repre):
or input_width != output_width
or pixel_aspect != 1
):
if input_res_ratio < output_res_ratio:
self.log.debug(
"Input's resolution ratio is lower then output's"
)
width_scale = int(input_width * scale_factor_by_height)
width_half_pad = int((output_width - width_scale) / 2)
height_scale = output_height
height_half_pad = 0
else:
self.log.debug("Input is heigher then output")
width_scale = output_width
width_half_pad = 0
height_scale = int(input_height * scale_factor_by_width)
height_half_pad = int((output_height - height_scale) / 2)

self.log.debug("width_scale: `{}`".format(width_scale))
self.log.debug("width_half_pad: `{}`".format(width_half_pad))
self.log.debug("height_scale: `{}`".format(height_scale))
self.log.debug("height_half_pad: `{}`".format(height_half_pad))

filters.extend([
"scale={}x{}:flags=lanczos".format(
width_scale, height_scale
),
"pad={}:{}:{}:{}:{}".format(
(
"scale={}x{}"
":flags=lanczos"
":force_original_aspect_ratio=decrease"
).format(output_width, output_height),
"pad={}:{}:(ow-iw)/2:(oh-ih)/2:{}".format(
output_width, output_height,
width_half_pad, height_half_pad,
overscan_color_value
),
"setsar=1"
Expand Down