Hi, I'm trying to set up a script that will resize my video to 720 pixels wide and then proportionally resize the height automatically based on mod4.
So if my source is 1920x1080 the result would be 720x404 and if my source is 1920x800 it would be 720x300.
Any ideas how do so this? I tried adding math into the script using mod operators, but then it got too confusing since I'm not a math wiz.
+ Reply to Thread
Results 1 to 11 of 11
-
Last edited by syrist; 25th Apr 2020 at 12:33.
-
Note that 404 and 300 are mod4, not mod8.
To get a mod8 siz caluculate a height then divide by 8, and multiply by 8. To get a rounded height calculate the height add 4 (half the modulus), then divide by 8 and multiply by 8.
Code:Spline36Resize(720, ((720 * height / width) + 4) / 8 * 8)
Code:function ResizeToWidth(clip v, int width, int "modulus") { modulus = default(modulus, 4) # default to mod4 if not specified Spline36Resize(v, width, ((width * v.height / v.width) + modulus/2) / modulus * modulus) }
Code:ResizeToWidth(720, 8)
Last edited by jagabo; 25th Apr 2020 at 12:43.
-
-
-
The advantage of using CropResize is if the new width and height don't match the original aspect ratio, it'll crop a little from the width or height (whatever is required) to prevent aspect error. The default is mod4 so if you want to resize the width to 720 with a mod4 height, and the source is not anamorphic and you don't want to specify any cropping, all you need to specify is the new width.
CropResize(720)
If you're resizing by a large amount I'd recommend using the Resize8 function for resizing, as it corrects the slight chroma shift caused by Avisynth's resizers (the more you resize the larger the shift). You can use it this way.
CropResize(720, Resizer="Resize8")
There's also an included script named "CropResize Resizer Functions". It includes a wrapper function for Resize8 that's easily edited so Resize8 will use your preferred options, such as your preferred resizing method. The Resize8 script is still required. You use it this way.
CropResize(720, Resizer="CR_Resize8")
Or you can also use one of the "CropResize Wrapper Functions" to call an alternative resizer (if that script is loaded) by adding an X to the end of the function name. The default alternative resizer is Resize8 (the help file tells you how to change that).
CropResizeX(720) uses Resize8 for resizing by default.
For 16:9 have you considered a width of 704 rather than 720?
704x396 is exactly 16:9 and mod4, whereas 720x404 is close to, but not quite 16:9.
CropResize(704,396) would force the script to crop the source to exactly 16:9 before resizing.Last edited by hello_hello; 26th Apr 2020 at 06:40.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
Thanks for the info hello_hello. This works great... it's just as fast as LanczosResize plus is produces slightly smaller file sizes. So this is what I'm going to use for all my future projects that involve re-scaling.
As for 720 vs 704... I think I would prefer the extra bit of resolution than having a perfectly matched 16x9 aspect ratio. 720 is what the scene uses for SD content plus I'm used to 720 representing SD from the DVD authoring days.Last edited by syrist; 26th Apr 2020 at 08:42.
-
In case you haven't read the whole help file yet (there's a lot of it) Spline36Resize is the default resizing. If you specify the Resize8 script, it's defaults are Spline36Resize for upscaling and Lanczos4Resize for downscaling (I'm pretty sure) but you can use the included wrapper function and change that if you prefer.
Of course it's up to you, but if you can see a detail difference between 704x396 & 720x404 I think you might have bionic eyes.
Back in the days of Xvid I used to compare the two for non 16:9 sources to see which resulted in the most picture being cropped to prevent aspect error. Sometimes a 720 width would require more cropping (often from the width, so 704 could result in the same or a greater height), but what you may have lost in resolution with a 704 width you sometimes made up for by retaining some extra picture. Admittedly that was back in the days of mod16 so it's probably not very relevant now.
If you're not married to a 720 width, I think 768x432 is the next exact 16:9, mod4 resizing "up" from there. A width of 720 seems a bit miserly these days.Especially when you consider the display dimensions of a 16:9 DVD if you stretch the width rather than reduce the height for "square pixel" dimensions. 1024x576 or 852x480. Not that I've paid much attention, but I think for x264 encoding, 576p and 480p are quite common for the scene now (implying a width of 1024 or 852 after cropping the black and resizing, the same way 720p implies a width of 1280). Each to their own though....
Last edited by hello_hello; 26th Apr 2020 at 14:00.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview)
Similar Threads
-
How to increase just the height and not width?
By navarannan in forum EditingReplies: 20Last Post: 18th Feb 2019, 08:15 -
WMP ignores video display height/width in MKV header
By draig-llofrudd in forum Video ConversionReplies: 2Last Post: 6th Dec 2016, 09:35 -
Avidemux: changing width and height don't change video-size
By Tedbax in forum Newbie / General discussionsReplies: 5Last Post: 12th Mar 2016, 14:18 -
no frame info (height/width) shown in the movie properties/details
By endercollins in forum Newbie / General discussionsReplies: 8Last Post: 26th Oct 2015, 11:15 -
width and height are different between videos
By jalea148 in forum Newbie / General discussionsReplies: 5Last Post: 20th Jul 2015, 22:15