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
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:
- 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.
- 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.
- 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.
- 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.
- 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.
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
The 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:
- Encoding Blu-ray’s to MP4 with RipBot
- Avisynth And Its Plugins
- MeGUI One Click Encoder Intro Screencast


Hey Adub,
thanks for the short introduction.
“One last note, don’t forget to check the “Source is Anime” checkbox when dealing with anime content. Otherwise, you run the risk of getting some really false readings when you analyze your material.”
That sounds like I need to check the box before I press the “analyse”-button, is that right?
Greetings
Yes, exactly. I’ll add that to make it more clear.
Thanks for your guide…
Mayn thanks indeed. Upon discovering your article, I immediately compared your recommendations to my standard settings.
1. “Mpeg2 Deblocking”
I always enable it for MPEG2-content. Do you have negative experiences with that option?
2. “you all know how I feel about resizing”
Actually, I don’t know it ;-) After cropping, I am using the “suggest resolution (mod16)” option. If meGUI suggests e.g., “640″ instead of “720″ I “hope” that it says that 720 would not add quality but only increase file size. Is that correct?
I understand that your suggestion is to leave the resolution an to use the “CAM” to achieve mod16.
3. “Clever (TM) Anamorphic Encoding”
If I do it as described in 2., I have mod16 resolutions. Nevertheless, should I use one of the “CAM”-options in addition?
4. “Clever (TM) Anamorphic Encoding”
I have read many articles about “anamorphic” videos but still haven’t understood it and therefore leave it off. Is there a rule to know when a movie is anamorphic? (Most of my source material is simple captured TV-signal, therefore I don’t have much experience witn complex DVDs or BDs)
Greetings, Frank
1) Mpeg 2 Deblocking should really only be enabled when you actually have a blocky source. There is no point in using it on a source that is block-free. It only further degrades the quality unnecessarily.
2) Resizing unnecessarily will decrease quality. Period. Whether it is upsizing or downsizing. In case you don’t know, DVD’s come in a standard resolution of 720 pixels, so going to 640 will require a resize step.
3) Of course you are going to have mod-16 resolution when you resize. MeGUI makes sure of that in any resizing step it calculates. So if you are going to resize, and/or crop by hand, then you don’t need to use one of the “CAM” options. However, if you don’t need to resize, and want to automatically crop black bars using a mod-16 algorithm (as I like to do) then that is when you use the “CAM” option.
4) One way to think about anamorphic is with this definition: “Stored one way, displayed in another.” Also, with Home Theater Mag’s definition: “Process that horizontally condenses (squeezes) a 16:9 image into a 4:3 space, preserving 25 percent more vertical resolution than letterboxing into the 4:3 space. For the signal to appear with correct geometry, the display must either horizontally expand or vertically squish the image. …”
Basically the images is “squished” to meet DVD specs, even though it was shot with a wider lens. That data is then signaled to be anamorphic, so that the playback device (be it hardware or software) can “unsquish” it, thus presenting it in it’s original aspect ratio.
I am able to look at a video and tell if the aspect ratio is off, but that is from years of experience. One trick is to find a circular object in the video (think a clock, watch, porthole, etc). If it looks more like an egg than a circle, then the video is anamorphic, and needs to have it’s flags properly set so as to stretch the video out on playback.
Many thanks!
I think I will leave the MPEG2Deblock and resizing from now and and for the next anamorphic source (i.e. a DVD) I will try the CAM.
Man! I don’t know what the problem is but whenever I analyse the file everything seems to be fine…..but after I encode the MKV the Frame Rate is reduced to 14.38…something.
Can you please help me out?
Responded to via email.
Done. I’ve replied to your E-mail.
Hi Adub.
Thanks for your great work.
Please answer this-
–> How do i upload multiple .vob files in “DGIndex Project Creator” ?
[OR]
Will u please send me a Very good Tutorial for Latest Megui version.
I will be looking for your reply
Bye…
If you select the first vob in the sequence, DGindex should automatically select the remaining vobs for you.
thnks man.. i will try today.
Please comeup with new topics. bye
and please post a complete tutorial.
Alright, so I’m a bit stuck.
I was able to get the one click encoder to work with no problems at all, except I can’t combine the subtitles into the file.
The only way I’ve seen to do this so far is by going through the AVS script creator, which I can go through without any problems at this point, the problem comes along when I try to maux the Audio/AVS. It seems to be getting hung on the audio once the encoding begins. At first, I realized I forgot to download and install the Nero Codecs, so I did this, and i got past the initial “error loading codecs”, now whenever I try to encode, meGUI is just crashing.
I’ve tried using the following codecs:
Nero AAC: NDAAC-HE-Multichannel-128kbps
Nero AAC: NDAAC-HE-Multichannel-HQ-192kbps
So I’m a little stuck.
Obviously, I can easily just load the subtitle tracks when I start playing the file, but I’d rather have them in the file to begin with.
Oh, and if you need to know, for my source audio, I’m using the AC3 audio track I’m getting out of the demux with DGIndex.
Just an update, I think I may have found a temporary solution, the Aften codecs seem to work without issue, but I would like to still get the Nero codecs working correctly.
I have replied to your problem via email.
Responded to your e-mail.
Hey man, just wanted to let you know that I got everything worked out. I’m not sure if it was me messing with the bit rate, or the way I crated the d2v file for this last encode, but audio sync problems are completely gone.
@Chris,
That’s good to hear! I’m glad you got everything worked out.
Please, stupid question. How do I edit a loaded script? I can only create new ones.
One thing you can do is open the script in notepad or a similar program, and edit it by hand. Then drag and drop back onto MeGUI to load, and encode with your desired settings.
I would like to say that this tutorial is extremely well thought out and put together. I never really noticed the “Load DLL” option until I read this. Now I’m wondering what exactly I would use it for.
You use it to load external Avisynth filters. Here, I’ll even update the post with an explanation.
Hi Adub i got 2 prob
1- wen i open vts from dvd it says ( You can open such file with avisynth you have to index it first with dg indexer and open created file her
2- wen i anylize its says the input clip for source detection could not be open the script returns no video clip also i got error tivtc not found in plugins i did but no success
i hope u get what i mean and can u post how to creat avisynth
First of all, you have to open the right file from the DVD structure. Open the VTS….VOB files with DGIndex (either directly or through MeGUI’s indexer found under Tools->DG Indexer->D2V Creator). Run the program and save the index to a location you can remember. Then open your new index file using MeGUI’s Avisynth Script Creator. Everything should work fine.
i used dvdfab saved main movie as dvd9 uncompress then megui tool d2v did demux all tracks and start after 5min error Avisynth script error: There is no function named “DG decode_mpeg2source but d2v file its in directory so then avisynth script creator opens so i select that d2v input from directory same error ?
Make sure that you have the DGDecode.dll in your Avisynth Plugins folder, found under your Program Files folder.
Thanks Adub i put dll in plugins it works fine d2v created successfuly i crop it when i resize i press preview it says error: there is no function name ColorMatrix so i tried that dll but cant found any link or is there any manual way to make thanks a lot sir for helping
Adub i found that plz delete those double post included this thanks lot sir
Hi men excuse i am trying to encode a file .ts i got the same problem of ali about the dg indexer, i followed the steps and all was fine, but when i started the encoding of queue part, the megui inmediately closes, so can you give me a hand on this, thanks and good posting!
Sure Clemente, let’s look at this. What happens when you open the script that is generated with Media Player Classic or VirtualDub? Do you receive and error, or does the video open just fine?
Hi, im trying to load a .m2v file using DG indexer, but it wont reconise the Audio, says ” cannot find audio file info , audio will be disabled ” , i select the D2V option.
I normally set audio = true when creating my script so its quite important to get this to work, any ideas
thanks
chris
That would be because .m2v is video only. There is no audio in a .m2v file. I suggest you read this.
Its ok, its all working now, i just add the .mpa audio file later on in the process. Meguis is damme good – i can get a 2.2gbmovie down to just 384mb amazing stuff no loss of quality to the naked eye
the avs open fine, theres no problem, the problem was when i started the enconding. When i just clicked the start button it opens the normal window of the audio encoding and then the progam collapses, but i tried it again and there was no error, maybe was becuase the size, i was using 1440×1080, but when i used 1040×720 all did well. also in the first attempt i was using the deinterlacing option, and in the second time i didn’t. Also sometimes i get the message error on encoding aac. These are the changes i did in the second time. Please tell me what you think Thanks!!
well hi again now i am trying to encode the same video, and can’t do it. Once I click the star button for encoding, windows closes the megui. Why? tell me what could be becuase i am following the same steps that i did in the second time…mm also i use windows 7. thanks!!
this is the detail that i get of the reason that megui is closed
Problem signature:
Problem Event Name: APPCRASH
Application Name: MeGUI.exe
Application Version: 0.3.1.1056
Application Timestamp: 4aa6029b
Fault Module Name: StackHash_ae43
Fault Module Version: 6.1.7600.16385
Fault Module Timestamp: 4a5bdb3b
Exception Code: c0000374
Exception Offset: 000cdcbb
OS Version: 6.1.7600.2.0.0.256.48
Locale ID: 12298
Additional Information 1: ae43
Additional Information 2: ae43b75046e0fde3f40e0faa07ba74ef
Additional Information 3: 14c0
Additional Information 4: 14c04d6b836fd6bedb64c1c68d0456d3
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0×0409
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.txt
Hope it
You are using a broken and old version of MeGUI. Update to the latest version, as it fixed a number of these problems. You can find a link on the Doom9 forums. I would provide you one but I am typing this on a cell phone.
I am using the latest version 0.3.1.1056
the problem is just with the .ts files, because i tried with other video with the ts extension and it also had that problem. I also tried with vob and mpeg, and with those all did fine
The latest version is 3.1.1060.
You can see the development thread here.
Make sure that you have Haali’s Media Splitter properly installed, along with FFDShow.
Thanks for all but the same problem with the latest version of megui, i also reinstalled haali and ffdshow. Also with the latest version i had some problems with the updating. I had to updated it manually downloading the files. I don’t get it what could be if I did it one time.
Can you play the generated AVS script in something like Media Player Classic? Does it crash or run fine?
it doesn’t crash but it plays slow
Load the script that works (even if it is slow, which is okay) directly into MeGUI in the main window. Select a profile and Enqueue. Does that work?
nope it doesn’t i have already tried it
When you press start after enqueing the script, what happens? Does the whole program crash? Or does MeGUI produce an error log? Post which ever of these it is.
The whole program crashes, check this images
http://www.megaupload.com/?d=RM4MD56B
From those screenshots you are are still using the old version of MeGUI. Completely erase your current MeGUI folder, download and install the latest version from the link that I posted earlier, create your new directory and place that version in side of it. Run it, download all of the necessary updates (which should have no problems, mind you) and then try enqueing the script from the main window.
I have done that but the latest version gave me some problems not just on updating, but i will do it again to see what happens.