From 58a825655fc9376cbaca66c323fc7408d48aeef4 Mon Sep 17 00:00:00 2001 From: abhiTronix Date: Thu, 30 May 2024 18:19:02 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20StreamGear:=20Remove=20?= =?UTF-8?q?non-essential=20aspect=20ratio=20parameter=20(Fixes=20#385)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 🏗️ Removed the `-aspect` parameter from the default FFmpeg pipeline - Previously, StreamGear would enforce a simplified aspect ratio using this parameter, which forces FFmpeg to use non-square pixels, leading to unwanted distortion on the output. - 🎨 Updated warning messages for better clarity. --- vidgear/gears/streamgear.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/vidgear/gears/streamgear.py b/vidgear/gears/streamgear.py index d4b162597..ead6a0867 100644 --- a/vidgear/gears/streamgear.py +++ b/vidgear/gears/streamgear.py @@ -466,17 +466,14 @@ def __PreProcess(self, channels=0, rgb=False): if output_parameters["-vcodec"] != "copy": # NOTE: these parameters only supported when stream copy not defined output_parameters["-vf"] = self.__params.pop("-vf", "format=yuv420p") - aspect_ratio = Fraction( - self.__inputwidth / self.__inputheight - ).limit_denominator(10) - output_parameters["-aspect"] = ":".join(str(aspect_ratio).split("/")) + # Non-essential `-aspect` parameter is removed from the default pipeline. else: # log warnings for these parameters self.__params.pop("-vf", False) and logger.warning( - "Filtering and stream copy cannot be used together. Discarding `-vf` parameter!" + "Filtering and stream copy cannot be used together. Discarding specified `-vf` parameter!" ) self.__params.pop("-aspect", False) and logger.warning( - "Overriding aspect ratio with stream copy may produce invalid files. Discarding `-aspect` parameter!" + "Overriding aspect ratio with stream copy may produce invalid files. Discarding specified `-aspect` parameter!" ) # enable optimizations w.r.t selected codec