Check out the Latest Articles:
Basics of MeGUI’s Avisynth Creator

Okay, I thought I would go ahead and post this little explanation of MeGUI’s excellent Avisynth Creator tool. It’s a fantastic tool, and not just with respect to use with MeGUI. I (and many others, I’m sure) have used the Avisynth Script Creator to create scripts for their personal use in a number of different situations. It is a nicely versatile tool with a number of useful features varying from Anamorphic encoding to an interlacing detector. Well, let’s get started.

First, start MeGUI and go to Tools -> AVS Script Creator. You will see a window like the one pictured below. This is the main window were the magic starts brewing!

Options

MeGUI-Avisynth-script-creator_options

Right away, I’m sure many of you can already guess what most of this is for. For those of you who can’t, or those of you who just feel like reading something here is an explanations of each option:

Video Input

Yep, you guessed it. You select the input file here. You can select pretty much anything from a vob to an avi to an mkv here. Once you have selected your desired file, you should receive a preview window of your input clip. You can close it if you want, or just move it out of the way.

Input DAR

This little box just shows the input Display Aspect Ratio of your source. Useful for those of you who know what that means, but not a big deal for those of you who don’t.

Clever (TM) Anamorphic Encoding

Ah, one of the sweet features of MeGUI. This little box simplifies encoding anamorphic clips immensely. It offers 5 drop-down options:

  1. Resize to mod16: Pretty simple. When creating an anamorphic video, this will force any output video to be mod-16 compliant. This means that the width and height will both be equally divisible by 16. No remainder. So, if you do any cropping (usually of black bars) and your cropped output is not mod-16, MeGUI will automatically resize to mod-16 for you, fixing any funky problems.
  2. Overcrop to mod16: Again, a pretty simple idea. This is similar to #1, but instead of resizing after you have finished your cropping, this option will increase your crop values to result in a mod-16 output. This is my personal favorite, as I usually prefer to lose a little bit of the perimeter of the image instead of resizing the whole output. Saves time and results in a better quality output.
  3. Encode non mod16: This is almost like turning off Clever Anamorphic Encoding option in the first place. The main difference is that the output DAR (Display Aspect Ratio, remember?) is still signaled to the encoder (which is a good thing). In fact, that signaling is often the most important part. If the signaling is not sent to the encoder, your encodes will not playback their proper aspect ratio, thus defeating the whole purpose of anamorphic encoding. Every option in the Clever Anamorphic Encoding drop-down will signal the aspect ratio, so you don’t have to worry about that.
  4. Crop mod4 horizontally: All this option really does is make sure that any cropping you do is mod-4 with respect to the width. So, say if you crop 3 pixels from the right of your source video, then this option sees that 3 is not mod-4, and crops an extra pixel from the right to make it safely mod-4.
  5. Under crop to mod16: This acts similar to Overcrop to mod16, just in reverse. So essentially, after you have finished cropping, if your crop values are not mod-16, MeGUI will decrease your cropping values to reach a mod-16 value. Get it?

Avisynth Profile

This is a quick selection box for loading your favorite Avisynth profile. If you click on the “Config” button, you can see what I am talking about. It’s a pretty self explanatory little setup, but if you guys want me to write up a post about it, I would be more than happy too. Just let me know in the comments section. You can usually leave this option alone if you don’t know what it is or how to use it.

Crop

Ah yes, this little option. Well it’s this really new-fangled uber-delta-super cool way to…crop. Okay, you get it. Each box represents the number of pixels to be cropped from the top, left, right, and bottom of your source video. If you have the preview window open (and if you don’t, just press the “Re-open original video player” button), you can get a live preview of your cropping values. Freakin’ awesome, ain’t it? For those of you who are super lazy, you can even use the “Auto Crop” button to automatically detect and crop black bars from your source video (which are most often seen in DVD sources). Just be sure to check that the “Auto Crop” didn’t crop too much of your source, as it can screw up a little some times (hey, it ain’t exactly a perfect science, so give it a break). Although in all honesty, it’s pretty accurate about 95% of the time.

Resize

And here you get to transmorgify your video to what ever resolution you like!! (Queue evil laugh). Okay seriously, you can use this option to resize your video to another output resolution if you are so inclined. Most of the time I don’t use this (you all know how I feel about resizing), but if you are encoding for an iPod for example, this little option can be dead useful! It will even “suggest” a mod16 resolution for you if you are so inclined (I’m usually not, but who cares). Use it if you want to, otherwise keep it disabled.

Apply Auto Preview

You need this checked if you are going to be live-previewing your cropping/resizing like I talked about earlier. It’s usually on by default, so only turn it off if you don’t want it. It’s a pretty harmless option, so don’t fret over it too much.

Filters

Okay, next up is the Filters section. This is where most of the magic happens.

MeGUI-Avisynth-script-creator_filters

Look at all o’ them cool options! Let’s start at the top shall we!

MPEG2 Source / AVI Source / DSSource / DGx Source

Right oh! These tabs at the very top act on a per-source-filter basis. It should be pretty self explanatory actually. For the most part, the defaults are fine. For example, I always leave Color Correction on, but leave Mpeg2 Deblocking off (which is default anyways). When dealing with AVI’s or MKV’s/MP4′s, you may want to look at the AVI Source / DSSsource tab if you are having trouble loading your file correctly. Again, all options should be pretty self explanatory. The one exception is the Prefer DSSource2… option. This is used when you have Haali’s Media Splitter installed, and want a frame accurate DirectShow source with no audio. Actually, I would recommend DSSource2 in that instance as it can really help with sync issues, or when dealing with Variable Frame Rate material.

Deinterlacing

Admittedly one of the cooler features of MeGUI is it’s “automagic” deinterlacing routine. What this do-hickey does is analyse your input file for interlacing patterns, and suggest proper Deinterlacing/DeIVTCing techniques. I have to disclaim, however, that it isn’t always 100% accurate. Obviously, the best option is to analyze your source material by hand, but who has time to do that? Usually MeGUI’s recommendations are pretty spot on (except when dealing with really tricky material), and should work fine in most cases. Just test the output script first by playing it and see if the output has any artifacts or anything of that sort before encoding.

Most people just use the big rosy Analyse button, but if you happen to know the source type and field order, you can greatly speed up the process. Of course, if you already do know these tidbits of info, then chances are you already know how to handle the deinterlacing/deIVTCing process yourself.

One last note, don’t forget to check the “Source is Anime” checkbox before you press Analyse when dealing with anime content. Otherwise, you run the risk of getting some really false readings when you analyze your material.

Resize Filter

This is where you can select your resizing filter. If you know what your doing (or even if you don’t), you can use this drop down box to select your preferred resizer. The defaults are just fine, but play around with the options if you have some time to find something you like. I’m a little partial to Spline64resize myself.

Noise Filter

Again, pretty self explanatory. I don’t use this option that much, as I prefer to select my own denoiser (since I have tested so many and know which ones I like). You are more than welcome to give the four options a spin for yourself. You can even see which denoiser is used for which setting by selecting a particular profile and then clicking on the Edit tab and looking at the denoiser line.

Subtitles

Use this option if you want to “hardcode” or “burn in” your subtitles into your source material. Useful for encoding videos for devices that don’t support soft subtitles, such as an iPod or your grandmother’s ancient PC.

Edit

MeGUI-Avisynth-script-creator_editThe Edit tab shows what your final script will look like. You can edit each line by hand if you so desire, or leave it right at default. Each line is labeled corresponding to its function in the script, so it should be very clear.

Load DLL

Use this button to navigate to a desired plugin for direct loading into the script. You will know what this is if you know about plugin loading in Avisynth. Otherwise, don’t stress over it. It’s just a “Make your life slightly easier when scripting” option.

[UPDATE]

Examples of external plugins include RemoveGrain.dll, awarpsharp.dll, mvtools2.dll, fft3dfilter.dll, etc… But Avisynth plugins are for another tutorial.

And so we have come to the end! You can either save your script and get encoding, or give it one last preview before your done! It’s your choice! Happy encoding!

Related posts:

  1. Encoding Blu-ray’s to MP4 with RipBot
  2. Avisynth And Its Plugins
  3. MeGUI One Click Encoder Intro Screencast


  1. Clemente on Sunday 3, 2010

    well I have finished updating and the same problem. some doesn’t update like data, x264, dgindex, dgavindex. The problem is that I updated them it says finished and that megui needs to restart, but when i restart it it says again that there are some updates of those files.
    Now i retried with this version and the same problem. but for some reason i retried the encoding without doing everything of adding the avs and the audio..etc. And the time i did this the program didn’t crash but now in the status of the audio says error

  2. Clemente on Sunday 3, 2010

    The problem about updating persist, this 4 files doesn’t update data, x264, dgindex, and dgavcindex. I update them but it says megui should restart. I restart it and then the messages appears again saying that those files has an update.
    Well I tried again adding just the avs, and the audio. The first time megui crashed. Then I tried again but restarting the last process, I mean just clicking again start beacuse the other times i was redoing all the job of creating the avs, adding the audio…etc. And this time the program didn’t crashed, But in the status of the audio says error, i tried with mp3 acc mp4, and in all i get an error

  3. Clemente on Sunday 3, 2010

    I could run it. Now what i did was adding in the audio part the video and not the audio that i got when i index it with the dgindexer

  4. Adub on Sunday 3, 2010

    If you got an error in your queue, you can switch over to the log tab to find out the details of each error. My guess is that you either don’t have your audio encoders downloaded, or your settings are not pointing to them properly. What I find interesting are your update issues. Nobody else seems to have them. You did completely erase all of your previous MeGUI installs, correct? I’m going to update MeGUI on an older machine of mine to see if I have similar problems.

    Also, make sure that you follow the install instructions in the post that I linked to. Mainly this part:

    Recommended install instructions:
    1. Install Avisynth 2.5.8 (if not already installed)
    2. Extract the build to a new/empty directory
    3. Run the program and let it update all necessary files from the development server. Attention: You have to switch to the development server in the settings!

  5. Clemente on Sunday 3, 2010

    I have the codecs downloaded if not i couldn’t have done the encoding..maybe is as you say that are not pointing to them properly. Please try about the update and tell me.

  6. Clemente on Sunday 3, 2010

    oooh guess what, when I open the megui it ask me for update, i click yes, then i close it, and then says “error Could not save the settings” maybe that’s the reason. But that doesn’t happen with the old version

  7. Clemente on Sunday 3, 2010

    forget what i said, that’s not the reason

  8. Ali on Sunday 3, 2010

    Clemente Megui update through xml ur windows must be updated fully, i had same issue when i update my windows now its fine anyways…

    Hi adbub thanks for your help i am happy with Megui want to ask you about Avisynth filters and scirpt I do encode at 1/3 from 7gb dvd but there are some shadow at back and some noise i have used some filters which Megui suggest but not works fine like colorcorrection. noise. deblocking etc can i have some help from u about script with some exampled will be great

    bye sir

  9. Ali on Sunday 3, 2010
  10. Adub on Sunday 3, 2010

    @Ali
    Thanks for the sample, you are going about getting help the right way. However, for complete scripting advice, I suggest that you head over to the Doom9 forums for expert scripting advice. There are a couple of guru’s on there that will be able to fix just about anything. I don’t have the time unfortunately, but I’m sure that they will.
    As for your compression, I would highly suggest that you use the H.264 codec instead of Xvid, as it will produce a much higher quality video at the same file size. This will also help with the blocking in the background. As for denoising, you can’t go wrong with a motion compensated denoiser, or a compound script like MCTemporalDenoise (which can be found on Doom9′s forums).

    @Clemente
    You should be able to save the settings without error. It may not be the main reason, but it may be tied to it.
    As for my update test, it worked 100% fine. Something appears to be wrong with your system setup which is preventing MeGUI from acting properly.

    Also don’t forget to enable the Development updates and remember that you must download the NeroAAC codec yourself.

  11. Clemente on Sunday 3, 2010

    The nero codec i have already download it, if it where my system then the old version could not get updated too, but it does. mmm I will explore my sistem, but I don’t think so beacause just that 4 files don’t get updated. Let me look something then I’ll tell you…and ali my windows is updated so it can’t be that, thanks!

  12. Adub on Monday 4, 2010

    Clemente, it may be a permissions issue. Vista and Windows 7 have a funny way of enabling certain permissions. For best results, it’s best to use this program as an Administrator.

  13. Clemente on Monday 4, 2010

    I always run them as administrator. Thanks.. so that’s not the problem. If it were that the reason, the old version could not get updated.

  14. chris on Wednesday 13, 2010

    hi sir, i was reading a post here about MCTemporalDenoise, ive found the latest version and saved it, how do i use it in MeGUI ?

    thanks for the help

  15. Adub on Wednesday 13, 2010

    First make sure that you have downloaded and loaded all of the necessary plugins to run MCTemporalDenoise. Simply read the MCTemporalDenoise header to find out which plugins you need.

    Then, simply add a call to MCTemporalDenoise in your avisynth script.

    Ex.

    MCTemporalDenoise(settings=”medium”)

  16. Morris on Thursday 3, 2010

    Hi Adub,
    Excellent tutorial, i have been trying to learn how to use Megui at it’s best and i been stuck for days trying to comprehend how to use the filters and pluggins with avisynth, at the end of your tutorial you said “But Avisynth plugins are for another tutorial.”
    is there a chance of you making this tutorial?
    Thank you!

  17. Adub on Thursday 3, 2010

    Morris, I’ll add it to my todo list (which is getting pretty long actually).

    In the mean time, I suggest that you look at the Avisynth Wiki as a starting point. It has a couple of example tutorials that I think you will appreciate.

  18. Morris on Thursday 3, 2010

    Thank you so much Adub,
    I will be checking that link.