View Single Post
Old 27th May 2020, 23:37   #2  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 4,829
CropResizeMeGUI

Link at the top of the opening post.

Here's a function for integrating CropResize into MeGUI a little. You crop and resize with MeGUI as usual (almost), but the resizing is done via CropResize (for aspect error free resizing). Naturally the CropResize script is required.

The new version includes a zip file containing Avisynth profiles. It can be imported directly into MeGUI via the "File/Import Presets" menu, so the Avisynth templates don't need to be created manually. Should you not wish to keep them, they're easily deleted.
A bonus function called MeGUISource.avsi is now included. It's sole purpose is to automatically remove the frame rate conversion MeGUI adds to a script for FFVideoSource.

None of this will be likely to work with DGI Source configured to do the cropping and resizing in the AVS profile. I don't know how that's added to a script.

To use CropResizeMeGUI, you need to create an AVS template, or two or three (AVS Profiles in the script creator). If you don't have Avisynth installed and therefore can't auto-load plugins, importing the two scripts needs to be included in the template(s).

Don't change or remove the OutType argument in the resize line. It tells the function how to behave.

The Resizer argument can be modified or removed. Any resizer with the same cropping arguments as Avisynth's resizers should work, as will the wrapper functions for resizing with different resizers supplied with the CropResize function. If nothing else, CropResizeMeGUI is a way to crop and resize with MeGUI while using a non-Avisynth resizer. If Resizer="" is used for the resizer argument, or it's removed entirely, the resizer specified in the script creator's GUI will be used.

=================================================================================

The first two are for non-anamorphic sources and non-anamorphic encoding only.

Template 1:

Code:
<input>
<deinterlace>
<crop>
<denoise>
CropResizeMeGUI("<resize>",OutType=1,Mod=2,HMod=2,Resizer="")
Template 2:

Code:
<input>
<deinterlace>
<crop>
<denoise>
CropResizeMeGUI("<resize>",OutType=1,Mod=2,HMod=2,Resizer="",Info=true)
Here's what they do:

Template 1 gets CropResize to do the resizing, but MeGUI works in the usual way, only without any aspect error.
Here's a pic of a 1080p source being cropped and resized to 16:9 dimensions. There's a bit of aspect error I could reduce by adjusting the top and bottom cropping, but to demonstrate, I won't (click on the thumbnails or the direct links).



How do you know there's no aspect error? That's what the second template above is for. Switch to it, and CropResize will show you what it's done. Under "Total Cropping" you'll see an extra 4.5 pixels were cropped top and bottom to fix the aspect error.



https://i.postimg.cc/kGH0jJ4y/1-MeGUI.jpg
https://i.postimg.cc/TYLMKD7N/2-MeGUI.jpg

=================================================================================

For anamorphic sources only.
Anamorphic encoding must be enabled, but the source is resized to square pixel dimensions.
The height shown in the script creator's resizing section is ignored.


The only way I could work-around not being able to obtain the original source display aspect ratio from MeGUI in a script automatically was to use it's anamorphic encoding ability to encode non-anamorphically, so it's highly recommended that anamorphic encoding be enabled in the AVS profile when creating the templates. A little confusing at first, but if you give the templates appropriate names you get used to it.

Anamorphic encoding is enabled, but the source is resized to square pixel dimensions. You choose the width in the script creator and CropResize picks the height. The result is pretty much the same as resizing an anamorphic source to square pixels with MeGUI on it's own, minus any aspect error, plus external resizer support. You can specify the height mod when creating the template independently of the mod setting in the script creator. I set it to a Mod4 height here (without the HMod argument the default is Mod2).

It's highly recommended that anamorphic encoding be enabled in the AVS profile when creating the templates.

Code:
<input>
<deinterlace>
<crop>
<denoise>
CropResizeMeGUI("<resize>",OutType=2,Mod=2,HMod=4,Resizer="")
Code:
<input>
<deinterlace>
<crop>
<denoise>
CropResizeMeGUI("<resize>",OutType=2,Mod=2,HMod=4,Resizer="",Info=true)




https://i.postimg.cc/Qd12brrp/5-MeGUI.jpg
https://i.postimg.cc/T1h8qLRw/6-MeGUI.jpg

=================================================================================

For anamorphic encoding only.

The next two are only for anamorphic encoding, so it's highly recommended that anamorphic encoding be enabled in the AVS profile when creating the templates. The second one provides information MeGUI doesn't, such as the dimensions of the cropped picture, and the output pixel/sample aspect ratio and display dimensions. It doesn't need to fix aspect error. If the acceptable aspect error is set to zero in the AVS profile, there won't be any, but regardless of that, the output DAR used by CropResize is the same as the DAR specified by MeGUI in the script. MeGUI's cropping can't be displayed by CropResize as it only sees the cropped source, so everything shown is post cropping.

Code:
<input>
<deinterlace>
<crop>
<denoise>
CropResizeMeGUI("<resize>",OutType=3,Mod=2,HMod=2,Resizer="")
Code:
<input>
<deinterlace>
<crop>
<denoise>
CropResizeMeGUI("<resize>",OutType=3,Mod=2,HMod=2,Resizer="",Info=true)




https://i.postimg.cc/tRmGR55V/3-MeGUI.jpg
https://i.postimg.cc/BQrWHnRS/4-MeGUI.jpg

=================================================================================

For all the above, the resizer selected in the AVS Script creator will be used when no resizer is included in the template, however for the Bicubic options, the additional parameters can't be passed along to CropResize (it was designed to handle that sort of thing differently) so no matter which Bicubic resizing you select, the end result will be Bicubic resizing with the default Avisynth arguments.

Last edited by hello_hello; 28th January 2022 at 18:34.
hello_hello is offline   Reply With Quote