A Short Guide About Using Avisynth & MeGUI

18
Tutorial A Short Guide About Using Avisynth & MeGUI

description

For them who want to encode their DVD/Blu-Ray/BDRips to create better and sharper looking DVDRips/BDRips/BRRips.

Transcript of A Short Guide About Using Avisynth & MeGUI

Page 1: A Short Guide About Using Avisynth & MeGUI

Tutorial

A Short Guide About Using Avisynth & MeGUI

Page 2: A Short Guide About Using Avisynth & MeGUI

How to Filter using Avisynth & Encode using MeGUI

Here I am going to try to explain how to filter and encode your DVD/Blu-Ray/BDRips to create better and

sharper looking DVDRips/BDRips/BRRips. I will try my best to explain everything.

You need to extract the Plugins for Avisynth to "C:\Program Files\AviSynth 2.5\plugins". A Readme file is

included with most of the plugins. You can know more about these plugins and more on the Doom9 Forum.

If you have a PC which has Multithreading (Core i7, Core2Duo, Dual Core, etc.) look at these two threads:

Use the one which is updated to know how to use Avisynth Filters Multithreaded.

I will try to describe the usage of some of the softwares mentioned here.

At first you need Copy your Blu-Ray DVD/DVD to your Hard Disk. AnyDVD-HD removes all encryption and copy

protection on the fly from your Blu-ray, HD-DVD or DVD as soon as you load a disc into your drive. This

application will allow you to rip your movie onto to your Hard Drive.

Running MeGUI requires having Microsoft's .NET Framework 2.0 installed. Once that's installed the MeGUI

installer is very straight forward. When MeGUI is installed you should run it right away. MeGUI will

immediately check for updates to various components. Click the Yes button and the updates will be

downloaded. Most files will be put in subfolders of C:\Program Files\megui\tools.

Required Software’s: 1.AnyDVD-HD(Shareware) - http://www.slysoft.com/en/anydvdhd.html 2.AviSynth - http://sourceforge.net/projects/avisynth2/ 3.AvsP - http://avisynth.org/qwerpoi 4.BD Rebuilder - http://www.videohelp.com/tools/BD_Rebuilder 5.EVOdemux - http://www.videohelp.com/tools/EVOdemux 6.GraphEdit - http://www.videohelp.com/tools/GraphEdit 7.MeGUI (Use the latest version) - http://sourceforge.net/projects/megui/ 8.MKVToolnix (Use the latest version) - http://www.bunkus.org/videotools/mkvtoolnix/downloads.html#windows 9.Microsoft .NET Framework 2.0 - http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en 10.Nero Digital Audio Encoder - http://www.mediafire.com/file/t2xbkdz1eiy/NeroDigitalAudio.zip 11.SubRip - http://www.afterdawn.com/software/video_software/subtitle_tools/subrip.cfm 12.TsRemux - http://www.videohelp.com/tools/TsRemux 13.K-LiteMega Codec Pack (You can use your own separate Codecs if you want) - http://www.codecguide.com/ 14.Plugins for Avisynth - http://www.mediafire.com/?mmnjkgljm0z 15.ChapterXtractor - http://www.videohelp.com/tools/ChapterXtractor

http://forum.doom9.org/showthread.php?t=144852 http://forum.doom9.org/showthread.php?t=148117

Page 3: A Short Guide About Using Avisynth & MeGUI

Nero AAC Encoder:

Nero AAC Encoder doesn't come with MeGUI and the auto-update feature won't download it. Once you

downloaded it you need to copy the ‘win32’ folder from the NeroDigitalAudio.zip file and paste it into

C:\Program Files\megui\tools and rename the ‘win32’ folder to ‘NeroAACenc’ and you need to select it inside

MeGUI.

Open MeGUI and then go to Options>Settings>Program Paths>Audio and select neroAacEnc.exe

1.Start MeGUI and go to Tools > DG Indexer and select D2V Creator. If D2V Creator cannot open your file try

the other ones from DG Indexer.

2.From the D2V Project Creator window click on the button for Video Input and select the first .m2ts file which

was created when you copied the Blu-Ray to your Hard Drive or .d2v file if your source is a DVD.

3.Select the Audio Tracks you want to Include in your final video file or if you want to include all the Audio

files select Demux All Tracks. This program separates the Audio file from your Source and creates a d2v file

Nero AAC Encoder - http://www.mediafire.com/file/t2xbkdz1eiy/NeroDigitalAudio.zip

Page 4: A Short Guide About Using Avisynth & MeGUI

which can be opened by AVS Script Creator.

Select your d2v Project Output and tick ‘On completion load files’ and ‘and close’. Click Queue.

4.Go to Queue tab and click on start and after Demuxing is over, the d2v/dga etc. will automatically load in

Avisynth Script Creator.

Avisynth Script Creator:

Options Tab:

Once you select your Source .D2V file in the AVISynth Script Creator, you will see a preview window. The

preview window size can be changed by dragging the window edges. Bigger sources makes the window

unwieldy so I would suggest you make it small enough so that you can see the MEGUI interface underneath.

Leave the preview window open as we'll be modifying some elements on the preview screen.

1.Clever ™ Anamorphic Encoding and select Resize to Mod 16. 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.Below that, you'll see the 'Auto Crop' button. This function will easily remove any letterboxing that may be

Page 5: A Short Guide About Using Avisynth & MeGUI

present. It will also remove any wasted black or noisy edges on your video. I would suggest you use it every

time, even if your video appears to fill the preview with no letterboxing.

3.Check the Resize button and resize if you want. At the moment you can see that the renowned BDRip/BRRip

release groups are releasing BDRips or BRRips of either 720 x 304 or 1280 x 544. So you can select these

resolutions or you can select the resolution of your own choice.

Filters Tab:

From here you should analyze your source video for interlacing and field order by clicking the "Analyze"

button on the top left.This is important and not something you should skip. I can't say how many times I've

encoded a project that seemed to be entirely progressive only to find a scene that was mixed. Getting the field

order right is also important. Note that if your source is Anime/CGI then you should Tick the option "Source is

Anime (isn't detected automatically)" before analyzing your material. Once the analysis is completed you can

also choose what Resizing and noise filtering options you want.

The Colour Correction option ensures the colors are calibrated properly. It is better to select it every time.

Now Click on Preview AVS Script to make sure everything looks Good. If you like how it looks you can click

Page 6: A Short Guide About Using Avisynth & MeGUI

Save and then close MeGUI.

Filtering with Avisynth using AvsP:

Now we need to use AvsP which was mentioned at the beginning of the guide to work with Avisynth. Extract

it to a Folder and you can use it right away.

Open AvsP, and open the script you created using MeGUI. Hit the F5 button to Refresh and show the video.

To hide the video press Shift+F5. Sometimes when you try out different filters you will see a error window

appear. Sometimes they are temporary problems and you can just close the error window and continue

working. But if the error window keeps on appearing, then you should try to change the filters or you can try

saving the script and re-open it using AvsP.

Remember I am using Iron.Man.720p.BluRay.x264-SEPTiC and that is why it says .dga at the end. My script

looks something like this at the moment:

This is just a basic script. When you add a #(Hash) in front of a line it becomes disabled. Here I am going to

mention some Sharpening and Denoising Filters which will help you make your video look Sharp & Clean.

I personally Prefer these filters and all these filters and more are included in Plugins for Avisynth:

LSFmod: A LimitedSharpenFaster MOD with new features.

SeeSaw: More of a detail enhancer than a regular sharpener. Also lets you really turn up the denoising

without the typical ringing and haloing.

GradFun2DBmod: Gradfun2dbMod is a banding removal filter.

FFT3DFilter: 3D Frequency Domain filter-denoiser.( You MUST put FFTW3.DLL file from this package to some

directory in path (for example, C:\WINDOWS). It may be downloaded from -

Filter will NOT work without it!

fft3dGPU: FFT3dGPU is a GPU version of Fizick's FFT3DFilter. To use this filter you need directx 9.0c or better

and a graphics card supporting directx 9 in hardware. That is at least an ATI Radeon 95xx or Nvidia Geforce fx

5xxx. Geforce 6xxx or better is recommended.

AVCSource("D:\Movies\Ironman\Ironman_Track1.dga") global MeGUI_darx = 73 global MeGUI_dary = 30 Crop(0,0,-0,-2) Spline36Resize(1280,544) #Spline36Resize(720,304)

Plugins for Avisynth - http://www.mediafire.com/?mmnjkgljm0z

ftp://ftp.fftw.org/pub/fftw/fftw3win32mingw.zip

Page 7: A Short Guide About Using Avisynth & MeGUI

DeGrainMedian: DeGrainMedian plugin is mainly for film grain removal, but may be used for general

denoising.

MCTemporalDenoise: Another great Denoiser.

Convolution3D: Another Denoiser.

Undot: A light Denoiser.

FluxSmooth: Another Denoiser

Grainfactory3: Noise generator that tries to simulate the behavior of silver grain on film.

By using a Denoiser you can do this:

SOURCE:

FILTERED:

This was done using the MCTemporalDenoise Filter and using it like this:

Page 8: A Short Guide About Using Avisynth & MeGUI

Now I am going to show you how I denoised and sharpened the Iron Man Source using the above mentioned

filters.

Open the Script created using MeGUI’s Avisynth Script Creator using AVsP. Mine looks like this:

This is how the Source looks like:

But after I add this line the Noises in the video become less:

fft3dGPU(mode=1,precision=2, sigma=1.25, bt=4, bw=32, bh=32, ow=16, oh=16)

MCTemporalDenoise(settings="high")

AVCSource("D:\Movies\Ironman\Ironman_Track1.dga") global MeGUI_darx = 73 global MeGUI_dary = 30 Crop(0,0,-0,-2) Spline36Resize(1280,544)

Page 9: A Short Guide About Using Avisynth & MeGUI

Now the video looks like this:

You can increase the sigma value to remove heavy noise.

Alternatively you can also use this filter:

Now the video looks like this:

Convolution3D(preset="moviehq") fluxsmoothT(3)

Page 10: A Short Guide About Using Avisynth & MeGUI

As you can see both denoising filters does a great job and the difference is minor. That is why you should try

different filters to see which one works best for your source.

Now that we were able to remove the Grain/Noise, let us sharpen it. Always Sharpen after denoising.

You can increase or decrease the strength. Read the LSFmod.v1.8.avsi to know more about the parameters.

Alternatively you can use the SeeSaw Filter to sharpen your source.

Here I am using DegrainMedian & VagueDenoiser to denoise and using SeeSaw to sharpen at the same time.

Basically you can add any denoiser in the second line after “b=a.” You can use

fft3dgpu(sigma=1.25)/fft3dfilter(sigma=1.25) or Convolution3D(preset="moviehq"). fluxsmoothT(3) or

MCTemporalDenoise (settings="low/medium/high")

Now the video looks like this:

If there is banding in the video source you can use GradFunkMirror which is a Modified version of

Gradfun2db.

In the end I am going to add some grain to make the details look good:

LSFMod(Strength=80, Smode=5)

a= last b=a.degrainmedian(limitY=3, limitUV=5,mode=0).VagueDenoiser(threshold=1.2, method=1, nsteps=6, chromaT=0.8) SeeSaw(a,b, NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=5, Spower=5, Sdamplo=6, Szp=16, sootheS=20)

Grainfactory3(1,1,1)

Page 11: A Short Guide About Using Avisynth & MeGUI

You can use 2,2,2 or 3,3,3 instead of 1,1,1 if you want. It depends how much grain you can add without

making the video look bad.

So here is what my final script looks like:

Final

Here is the end of our Work with Avisynth. Save the script and close AvsP.

Import("C:\Program Files\AviSynth 2.5\plugins\GradFunkMirror.avs") Import("C:\Program Files\AviSynth 2.5\plugins\SeeSaw.avs") AVCSource("D:\Movies\Ironman\Ironman_Track1.dga") global MeGUI_darx = 73 global MeGUI_dary = 30 Crop(0,0,-0,-2) Spline36Resize(1280,544) a= last b=a.degrainmedian(limitY=3, limitUV=5,mode=0).VagueDenoiser(threshold=1.2, method=1, nsteps=6, chromaT=0.8) SeeSaw(a,b, NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=5, Spower=5, Sdamplo=6, Szp=16, sootheS=20) Undot() GradFunkMirror() Grainfactory3(1,1,1)

Page 12: A Short Guide About Using Avisynth & MeGUI

Encoding using MeGUI:

Open MeGUI and Load the Extracted Audio by using the "..." Button under the Audio of MeGUI’s Input Tab.

From Encoder Settings Select Nero AAC: NDAAC-LC-MultiChannel-192Kbps and click on Config. Now Uncheck

"Normalize Peaks to" Now click on "New" and give the preset a name.

Then Click on Enqueue to encode the Audio.

After the Audio encoding is finished go to Input Tab> Video Encoding > Avisynth Script click the “…” button

and open the script you created.

A preview window will open. Close the preview window and from the Encoder Settings select DXVA-HD-HQ if

your source was Blu-ray DVD or BDRip. If you are encoding from a DVD select DXVA-SD-HQ.

Page 13: A Short Guide About Using Avisynth & MeGUI

Click on Config and Use the settings from the screenshot for DXVA-HD-HQ:

You can change the "Tunings" Option to whatever your source is, if it is a Film use "Film" or keep it at

"Default" if you want. From the Rate Control Tab check on "Use MB-Tree". On the Analysis Tab You can

increase the M.E. Range between 18-24.

After you are done with the settings click on the “New” and save the modified preset with your own name like

DXVA-HD-HQ Custom or DXVA-SD-HQ Custom.

For DXVA-SD-HQ use the same settings mentioned above. You can decrease the bitrate because you are using

a DVD as a Source and the resolution is smaller.

Page 14: A Short Guide About Using Avisynth & MeGUI

Now Click on Tools > Bitrate Calculator.

From the Audio 1 select the Audio File you just encoded. You can select more than one Audio Track by Right

Clicking near Audio 1 and Selecting “Add Track”. In this way you will be able to know the file size if you add a

AC3 audio and a MP4(Nero AAC) audio so that users of Xbox 360 & PS3 will be able to play your video.

Now select the “Average Bitrate” and use at least 1500 kbit/s if your source is Blu-Ray/BDRip/HD-DVD so

that all the details will be preserved in the encoded file.

Click on Apply & then Click on Yes. Click the Enqueue button from the Video Encoding part of the Input Tab.

Go to Queue Tab and Click on Start.

Now you just need to wait for the Encoding to finish and then we can move on to the Video & Audio Muxing.

Running Test Encodes:

I always run test encodes to find out which filter produces best results and which is the minimum bitrate I can

use without making the video look bad.

Page 15: A Short Guide About Using Avisynth & MeGUI

Just copy and paste the .avs script you Created using AvsP and rename it to Sample.avs and add these two

lines at the end of the script.

Trim: The first value of Trim should be the starting Frame of the movie. I mean after showing the starting

credits. Then second value is before the End Credits start. You can get these frame numbers by opening your

script using AVsP and using the Bar to move your video from starting to end. Alternatively you can select a

particular scene by using the starting and ending Frame number of that scene.

SelectRangeEvery: In this example, 250 frames will be encoded every 4000 frames. So frame 0-250, 4000-

4250, 8000-8250, etc., would be encoded. You can adjust those values as you please to encode a larger or

smaller portion of the video. Just change the two values so that you end up with a 5 minute sample. Change

the numbers and use the bar to see how much video time have you selected.

Muxing:

Once the video has finished encoding, you now need to "mux" the separate video and audio streams together

to create one file. You can use MeGUI's Muxer to make an MP4 File or you can use MKV Merge

GUI(MKVToolnix) to create a MKV File.

I am going to explain both here.

Trim(1000,168438) SelectRangeEvery(4000,250)

Page 16: A Short Guide About Using Avisynth & MeGUI

Muxing using MeGUI to create a MP4:

Open MeGUI and go to Tools > Muxer > MP4 Muxer.

1.From Video Input select the video file you just encoded using MeGUI. If you want, you can give it a name on

the Name box.

2.Add the audio file you encoded using MeGUI from Audio 1 > Input. You can add multiple audio tracks by

Right Clicking near Audio and selecting “Add Track”

3.From the Output> Muxed Output select a folder where the output file will be created and click on Queue.

4.Go to the Queue tab of MeGUI and click on Start. After the muxing is finished you can enjoy and share your

Video with everyone.

Note: It is better not to add a Subtitle and Chapter to a MP4 file before muxing. You can still use a subtitle by

Page 17: A Short Guide About Using Avisynth & MeGUI

placing it in the same folder of your MP4 file and renaming it to the name you used on your MP4 file.

Muxing using MKVMerge GUI to create a MKV:

Open MKVMerge GUI and add the Video, Audio, Subtitles by clicking the “Add” Button of Input Files.

1.Under the “Tracks, chapters and tags:” Move the video to the Top, then Audio and in the bottom the

Subtitles.

2.Now highlight your audio stream by left clicking on it once, and from General Track Options change the

audio language to the appropriate language. I also suggest doing this for any subtitles that you include. You

can also change the track name for the audio to whatever you desire. For instance, if you have multiple audio

Page 18: A Short Guide About Using Avisynth & MeGUI

tracks, you might want to name the main audio as "Audio 1", and name the commentary or additional

language tracks as "Audio 2", and so on. You can of course get even more specific with the track name, such as

"Track 1 – 768kbps DTS", "Track 2 – 360kbps AC3", “Track 3 – 192kbps AAC”.

3.If you have Extracted the chapters when you Decrypted and copied the Blu-Ray or DVD to your Hard Disk,

you can use that Chapters.txt file now by going to the Global Tab and the adding the Chapters.txt from

Chapters>Chapter File section. I got my Chapters file while i decrypted using DVD Decryptor. You can use

ChapterXtractor to extract chapters also.

4.On the Input tab click on the Start Muxing button. The output file that mkvmerge gui creates is your final

file.

Now you too can release your very own BDRip/BRRip/DVDRip which looks better than everyone else’s.