Skip to content

Commit

Permalink
πŸš‘οΈ StreamGear: Remove non-essential aspect ratio parameter (Fixes #385)
Browse files Browse the repository at this point in the history
- πŸ—οΈ 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.
  • Loading branch information
abhiTronix committed May 30, 2024
1 parent 19cf611 commit 58a8256
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions vidgear/gears/streamgear.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 58a8256

Please sign in to comment.