View Full Version : Any way auto resize to 1080p while keeping aspect ratio with AVISynth?
lavans
16th March 2013, 22:52
I'm trying to figure out a script where AVISynth resizes a video to 1080p and adjusts the width to match the scale while maintaining the aspect ratio. Basic math says that a script like this should work.
spline64resize(last.width/last.height*1080,1080)
For whatever reason, AVISynth isn't calculating the math, and ends up resizing the video to 1080x1080.
Any ideas?
Guest
16th March 2013, 23:26
Maybe like this :
spline64resize(Int(Float(last.width)/last.height*1080))
Groucho2004
16th March 2013, 23:31
Try this:
x = float(width) / float(height)
spline64resize(round(x * 1080.0),1080)
Some background info here (http://avisynth.org/mediawiki/Internal_functions/Numeric_functions).
lavans
16th March 2013, 23:43
Maybe like this :
spline64resize(Int(Float(last.width)/last.height*1080))
Invalid arguments for Spline64Resize :(
Try this:
x = float(width) / float(height)
spline64resize(round(x * 1080.0),1080)
Some background info here (http://avisynth.org/mediawiki/Internal_functions/Numeric_functions).
This worked like a charm. Thanks!
TheSkiller
17th March 2013, 11:15
@ lavans
That doesn't work because you don't tell AviSynth to calculate in float (and round the result to an integer in the end).
Sparktank
17th March 2013, 12:46
Try this:
x = float(width) / float(height)
spline64resize(round(x * 1080.0),1080)
Some background info here (http://avisynth.org/mediawiki/Internal_functions/Numeric_functions).
Is there any way to get this to round to nearest multiple of 4 for YV12?
Groucho2004
17th March 2013, 13:02
Is there any way to get this to round to nearest multiple of 4 for YV12?
x = float(width) / float(height)
spline64resize(round(x * 1080.0 / 4.0) * 4, 1080)
Sparktank
17th March 2013, 13:16
Thank you! I had the *4 in the wrong place.
Found an old post using ratio for factor and quite different for script.
I had thought /4.0 and *4 had a role in it.
Much obliged! :)
lavans
17th March 2013, 18:34
@ lavans
That doesn't work because you don't tell AviSynth to calculate in float (and round the result to an integer in the end).
I figured something like this was the case. What was throwing me for a loop is that I was getting different widths depending on how I ordered the values on my original code. Good to know that AVISynth requires float calculations.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.