first video filter will add padding to input if has width or height with odd numbers

This commit is contained in:
iLLiCiTiT 2020-10-01 15:19:01 +02:00
parent 76a241afe9
commit dbf0881415

View file

@ -633,6 +633,26 @@ class ExtractReview(pyblish.api.InstancePlugin):
input_width = int(input_data["width"])
input_height = int(input_data["height"])
# Make sure input width and height is not an odd number
input_width_is_odd = bool(input_width % 2 != 0)
inputh_height_is_odd = bool(input_height % 2 != 0)
if input_width_is_odd or inputh_height_is_odd:
# Add padding to input and make sure this filter is at first place
filters.append("pad=width=ceil(iw/2)*2:height=ceil(ih/2)*2")
# Change input width or height as first filter will change them
if input_width_is_odd:
self.log.info((
"Converting input width from odd to even number. {} -> {}"
).format(input_width, input_width + 1))
input_width += 1
if inputh_height_is_odd:
self.log.info((
"Converting input height from odd to even number. {} -> {}"
).format(input_height, input_height + 1))
input_height += 1
self.log.debug("pixel_aspect: `{}`".format(pixel_aspect))
self.log.debug("input_width: `{}`".format(input_width))
self.log.debug("input_height: `{}`".format(input_height))