VideoHelp Forum
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. AnyResizerMeGUI & CropResizeMeGUI 2022-10-04.zip

    I wanted to solve an issue with MeGUI's resizing... the inability to use the Script Creator for cropping and resizing using a non-Avisynth resizer, without having to manually edit the scripts it creates, which can be annoying, as every time a change is made in the AVS Script Cretaor GUI, it re-writes the script.

    This post is dedicated to the AnyResizerMeGUI script and the functions it contains.
    The next post will be dedicated to using the CropResizeMeGUI function as it requires images, so it'll also be a substitute for a help file.

    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.

    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.

    The AnyResizerMeGUI script contains the following functions. I won't go into too much detail as it comes with a help file. Instead I'll just offer some usage examples. The functions are intended to be used after creating appropriate AVS Profiles (templates) in the Script Creator.

    AnyResizerMeGUI()
    Returns MeGUI's resizing width and height as a string. The width and height are separated by a comma.
    ie 640,480
    AnyResizerTooMeGUI()
    The same as for AnyResizerMeGUI, only the "a" and "b" arguments are included in the string when a Bicubic resizing option is selected.
    ResizerMeGUI()
    Returns the selected resizer in the AVS Script Creator as a string.
    ie "Spline36Resize"
    WidthMeGUI()
    Returns MeGUI's resizing width as an integer.
    HeightMeGUI()
    Returns MeGUI's resizing height as an integer.
    CropMod4WMeGUI()
    Automatically crops the source to a Mod4 width. See the help file for usage details.

    Here's how the above functions are used in an AVS Profile (template).
    The first example specifies the Resize8 function for resizing. I use it regularly as it corrects the slight chroma shift that the Avisynth resizers can introduce. It also tells the Resize8 function which resizing kernel to use according to the resizing method specified in the Script Creator profile, or selected in it's GUI.

    Code:
    <input>
    <deinterlace>
    <crop>
    <denoise>
    Eval("Resize8("+AnyResizerMeGUI(Last,"<resize>")+",Kernel="+"""ResizerMeGUI("<resize>")"""+")")
    The above would result in the following, assuming MeGUI is resizing to 1280x720 and Spline36Resize is the selected method in MeGUI's script creator.

    Code:
    <input>
    <deinterlace>
    <crop>
    <denoise>
    Resize8(1280,720,Kernel="Spline36Resize")
    The next example gives MeGUI the ability to upscale with NNEDI3.

    Code:
    <input>
    <deinterlace>
    <crop>
    <denoise>
    nnedi3_rpow2(rfactor=2,cshift=ResizerMeGUI(Last,"<resize>"),fwidth=WidthMeGUI(Last,"<resize>"),fheight=HeightMeGUI(Last,"<resize>"))
    The above would result in the following, assuming MeGUI is resizing to 1280x720 and Spline36Resize is the selected method in MeGUI's script creator.

    Code:
    <input>
    <deinterlace>
    <crop>
    <denoise>
    nnedi3_rpow2(rfactor=2,cshift="Spline36Resize",fwidth=1280,fheight=720)
    With any luck the included functions should allow the creation of templates that allow MeGUI to use any resizer.

    If you don't have Avisynth installed and/or you don't auto-load plugins and scripts, you'll need to include importing the AnyResizerMeGUI script in the template, along with the appropriate resizing plugin or script and it's dependencies.
    Last edited by hello_hello; 3rd Oct 2022 at 10:48.
    Quote Quote  
  2. 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 Jan 2022 at 12:35.
    Quote Quote  
  3. There's a new version dated 2020-06-01 in the opening post. It now includes Avisynth Profiles that can be imported into Avisynth, and there's a help file explaining each profile in more detail.

    There's also some slight changes to the CropResizeMeGUI function.
    CropResizeMeGUI now switches the CropResize function to NoResize=true when MeGUI isn't adding resizing to the script. Because of this, it now also sets Mod2 as the default width and height Mod for CropResize (which is normally Mod4). This prevents CropResize from adjusting the cropping to make the width or height Mod4 when resizing is disabled, even though Script Creator's cropping might only be Mod2.
    Some error messages have been added to hopefully make it harder to use CropResize incorrectly (the OutType argument needs to be used correctly).
    Last edited by hello_hello; 9th Jun 2020 at 06:08.
    Quote Quote  
  4. I've re-written a lot of the CropResizeMeGUI function. It still works exactly as before (the examples posted earlier will still work) but it now includes all the CropResize arguments, so it can be used in a similar way, only with MeGUI doing the cropping and resizing.

    There's also a new version of CropResize here.

    There's MeGUI limitations that are hard to work around.... mainly not being able to automatically add the original source aspect ratio to a script before cropping so CropResize can see it, or not being able to freely resize with MeGUI when anamorphic encoding is enabled (you can only choose the width)... so having the CropResize arguments available for CropResizeMeGUI will really only be useful for experienced users of the CropResize function. Here's one example though.....

    I want to take a 720p source (1280x544), crop the side crud, and resize for a 16:9 DVD while adding borders to suit. If you don't want to be playing with a calculator you could start with the following template, normally used for resizing a non anamorphic source with CropResize.

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

    This would be the 720p source (thumbnails):



    With MeGUI you'd crop and resize to (NTSC) DVD dimensions.
    CropResize crops a heap of picture from the sides to prevent aspect error (which we don't want to do) and it looks like this:



    The resizing line has become:
    CropResizeMeGUI("Spline36Resize(720,480) # Spline36 (Neutral)",OutType=1,Mod=2,HMod=2,Resizer="")

    Next we add a couple of new arguments to the resizing line for CropResize:
    CropResizeMeGUI("Spline36Resize(720,480) # Spline36 (Neutral)",OutType=1,Mod=2,HMod=2,Resizer="", OutDAR=16.0/9.0,Borders=true,ColorMode="709-601")

    And finally we refresh the preview and have an NTSC 16:9 picture with borders:



    I added the CropResize arguments to CropResizeMeGUI after realising for me they'd be useful, but they probably won't mean much unless you're familiar with the CropResize function and know how to use it.

    The new version is dated 2020-06-23.
    Last edited by hello_hello; 22nd Jun 2020 at 16:17.
    Quote Quote  
  5. The included MeGUISource function is now dated 2020-11-19, although the zip file in the opening post is still dated 2020-06-03.
    The purpose of the MeGUISource function is to remove the FFVideoSource frame rate conversion MeGUI adds to scripts, but previously it also removed the Threads and ColorSpace arguments. It no longer does so, and only the frame rate arguments are removed.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!