This guide will start what will be a 3 guide series to help encoders,leechers and practically everyone to max out on their MT experience.
What we do on Minitheatre i.e Video Processing is a Three way process,
1.)Pre processing
2.)Processing aka Encoding
3.)Post processing aka Muxing, etc..
In this Guide 1 we will discuss pre-processing and how to accomplish it. Why it is necesarry and why it should not be merged with Step 2 i.e Encoding
PRE PROCESSING
Pre processing involves getting the source in perfect condition beforehand. It doesn't involve encoding, it only involves using proper filters, cropping/resizing and trimming video if required etc and finally previewing it on Media Player Classic or any compatible player
_____________________________________________
Requirements
Avisynth and its Plugins
AvsPmod (For previewing)
Install Avisynth, and put the 'Plugins' you just downloaded into Avisynth's plugin folder(Usually Here:"C:\Program Files\AviSynth 2.5\Plugins\").
It contains all the 225 files I gathered for Avisynth plugins
__________________________________________________ _______
WHAT ARE FILTERS?
Filters are like make up. You use them to fix anything ugly in the video, so that your encodes turn out prettier than the source.
However, overdoing it with these filters, you'll end up with an even uglier encode, and by uploading it, you would have wasted your time, as well as the downloader's.
Therefore, it is important to spend some time when filtering, and not use the same filters everywhere. what works for one video might not work for the other.
So in the end, you really want to try a couple of filters when you start out with a series, to see what works and what does not.
__________________________________________________ _
HOW TO MAKE A AVISYNTH SCRIPT
To make an avisynth script
1.)Open up your text editor (i.e:Notepad) or fire up AVSPmod
3.)Now type something like this
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ffms2.dll")FFVideoSource("C:\Users\abc \Desktop\MySource.mkv")
4.)Save the text with the extension '.avs'
What we did now is called "loading" our video in avisynth. Using FFVideoSource like so, we can now play the saved '*.avs' file in any compatible player (i.e:MPC-HC)
To load images, you "ImageReader" instead of "FFVideoSource")
** At this point we haven't used any filters.
__________________________________________________ _
ADDING FILTERS
First off, if you check the plugins folder, you'll see a lot of '.dll' files. These files are the filters we can use.
As long as you have a '.dll' file in the plugins folder, you can directly use it inside an avisynth file because it will be used/loaded automatically.
If you have this '.dll' file elsewhere, you have to load it manually inside the script using the "LoadPlugin" function like so:
LoadPlugin("C:\Users\abc\Desktop\masked_Tools.dll" ) #This allows us to use the 'masked_tools' filter now
Don't worry if you use a filter without loading its dll, avisynth will report this error
Beside '.dll' files, there are also '.avs' and '.avsi' files that carry inside of them scripts that act as filters.
The difference between '.avs' and '.avsi' is that the latter doesn't need to be loaded manually if it resides in the 'Plugins' folder, while '.avs' needs to be loaded manually each time.
And to do so, we use the 'Import' function like so:
Import("C:\Users\abc\Desktop\vmtoon.avs") #We can now use vmtoon anywhere in the script
** At this point, we learnt how we can load filters in a script. Note that we still haven't technically used them yet.
__________________________________________________ _
[BASIC FILTERS] ~ Optional
CROP
As the name suggests, this filter can be used to crop of the black edges off the video source left by the original encoder
To use this:
crop(0,0,-0,-0)
From left to right, the values indicate how much to crop off the video starting from the: Left, Top, Right, Bottom. Note how Right and Bottom values are negatives.
RESIZING
To use it, the pattern is: RESIZER(WIDTH,HEIGHT)
RESIZERS: Bicubic, Spline36Resize, Spline64Resize(use this one), etc..
WIDTH,HEIGHT: together, they are the new resolution.
Putting this all together:
spline64resize(1280,720)
Don't forget to keep the aspect ratio intact. (AVSPmod can help a lot with this kind of filters)
What not to use--> Lanczos4Resize | PointResize | BilinearResize
TRIM
This filter allows you to cut the video from one point to another. Very useful if you want to test your filters with a sample encode.
trim(2000,4000)#trim(starting_frame,ending_frame)
Incase you want to trim different sections from the video, you can use the '+' operator like so:
trim(2000,4000) + trim(16000,18000)
Every 2000 frames approximate to like 1 minute of video footage so you should have a good enough sample to check beforehand ^_^
DEBANDING
I don't think most of you know what banding is... Banding happens when video is compressed and similar colors get posterized.
Theses undesirable, visible bands of color can be distracting, and in some cases downright ugly, especially on dark scenes.
And this is not rare at all... infact almost every single source has it in some frames if not all.
For example, Check Morita San no Mukuchi from 5-6 fansubs, all had the same issue somewhere or the other
To remove this banding, we use the filter Gradfun2DB
Gradfun2db()
You may wonder why don't fansubs use this filter then. The answer is that the video size will skyrock.
With 10bit making its way into encoding....very soon no banding issues will arise
** At this point, we have learnt a couple of filters that alter the video's global "shape".
__________________________________________________ _
DENOISE FILTERS
Before we start, we need to lay down the difference between NOISE and GRAIN.
NOISE is bad for you. It takes additional bitrate and does not help you at all.
GRAIN is good for you. It helps with preserving details, and also helps on the banding case.
And so, denoising, as the its name, involves NOISE removal only.
A source with grain won't usually have noise, and recently with BDrips and all, noise isn't that much common anymore.
There are many denoise filters, ranging from subtle easy-going denoising, to strong and detail erasing denoising.
To name a few:
Subtle: UnDot, Unfilter(- ,- ), RemoveGrain, RemoveGrainHD, Msmooth
Strong: FT3DFilter, Edeen or strong DEEN
X264 has a built-in denoiser too, invoked by '--nr VALUE' which goes in the subtle category.
Back to avisynth, we can use removegrainHD like so on not so noisy videos:
LoadPlugin("C:\Program Files\AviSynth 2.5\Plugins\removegrainHD.dll")removegrainHD()
For very noisy sources, we have to use one of the strong denoisers, and here you should spend some time to watch over detail loss.
Here's a noisy screenshot:
i3.lulzimg.com/735d21f85b.png
and here are the results:
i3.lulzimg.com/c3783b519a.png > Deen(mode="a3d",rad=4)
i3.lulzimg.com/319451f070.png > eDeen(r=7,tuv=12,ty=10,luv=1,ly=1,hqc=true)
i3.lulzimg.com/991e7f4459.png > FFT3DFilter(sigma=6.0)
Note how FFT3D blurs the picture, and Edeen creates a bit of aliasing. For this pic I'd go for Edeen. Deen isn't enough for this. I should also mention that Deen isn't suitable as a denoiser, it is more of a deblocker, it does a good job in removing blocks from a video.
PS: Unless you have this kind of noise, don't even think about using Edeen, it is too strong.
The strong denoisers should usually get rid of all noise, but there's always that nifty touch to add. You can add a very light denoiser then (undot or removegrain(1))
** At this point, we have looked at some Denoise filters.
__________________________________________________ __
SHARPENING FILTERS
When the edges of the source are blurred out and aren't really solid, you can sharpen them. Sharp edges are always very nice to look at, and give you that HD feel, even on mini-encodes.
However, sharpness = size, which is not something we can afford on a mini-sized encode. Therefore, we can't sharpen to our liking and with mini-encodes in mind, the sharpening must be subtle.
Filters that create this effect can be devided into 2:
Pure Sharpners: MSharpen, Unfilter(+,+), LSF(mod)
Line Darkening: Toon, MFtoonlite, VMtoon, Hysteria, FastLineDarken(mod)
Read about some HERE
Also, there's a "warpsharper", which makes the lines more thin: Warpsharp, Awarpsharp
Sharpners require tweaking, else they will create "aliasing", a stairs-like effect on lines that become a mess of jaggies.
Sharpener work in different ways and produce different results:
- LSFmod has better percieved quality but slowish
- MSharpen has a mode (mask=true) that allows you to easily tweak the settings so you can sharpen exactly what you want.
I do not like its sharpening though, as it has a tendancy to produce white dots and alias.
- Unfilter, fast and simple, a low positive value can be used for a subtle effect.
- Toon family, MFlite is super nice when tweaked, vmtoon is -IMO- the best in darkening but veryslow. The normal Toon at low values (0.x) is usually enough.
- Awarpsharp, a "controversial" filter. By making the lines thiner, you cut on bitrate and have a better looking video. Unfortunatly, the video won't look normal anymore, since it is way different now.
Go with low values for this (<10), unless you know what you are doing ^^
Let's look at some of these filters at work:
Plain:
i3.lulzimg.com/9c30fc3da7.png
Filtered
i3.lulzimg.com/c52cf11125.png > Awarpsharp(depth=8 )
i3.lulzimg.com/9ff1d2f623.png > lsfmod(defaults="slow")
i3.lulzimg.com/0510b28ad1.png > mftoonlite()
i3.lulzimg.com/e5e18340cd.png > toon()
i3.lulzimg.com/5e93eee70e.png > vmtoon()
** At this point, we have looked on different sharpeners.
__________________________________________________ __
ADJUSTMENT FILTERS
TWEAK FILTER
A straight-forward coloring filter, you can adjust the saturation, brightness, contrast and hue of you video.
Default is like this: Tweak(cont=1.0,sat=1.10,bright=0,hue=0)
Let's try to use Tweak on this:
And with the following:
Tweak(hue=0.0, sat=1.1, bright=-10, cont=1.05)
We get:
I find it a nice adjustment.
The above will make the source more Saturated with colours so faded out sources will look better.
Similarly read more about tweak HERE
Try to avoid colour changing, recent encodes won't need them. But a 1998 rip, well...
__________________________________________________ _
LEVELS FILTER(DrAbdelkader Contribution)
As for the level filter,
Use it to give some sharpness/darkening/ decrease the contrast or brightness in the source:
levels(5,1,250,0,250) #--> more effective on black (like black hair, lines, eyes)levels(0,1,250,0,255) #--> makes white brighterlevels(0,1,250,-5,250) #--> more effective on dark colors (brown, dark blue, dark red and so on) ,+ve values make the brighter it wont help sharpeninglevels(0,1,255,0,250) #--> makes bright colors darker too (white will turn grayish,pink,cyan will be darkened)
__________________________________________________ _
ANTIALIASING FILTERS
In case you had to use a strong sharpening value, or the source natuarally suffers from aliasing, then this kind of filters is the way to go.
There are many AA scripts, and all of them are slow, so don't make it a habit of using.
More on AA scripts here
Since they're not much tweakable, they're pretty easy to use, just know when to use them.
So basically this is it. You know the filters to fix your source.
Note that encoding from ISOs involve more work than this, and will require further documentation
__________________________________________________ ___
[BRINGING EVERYTHING TOGETHER]]
Let's take the denoising picture we had earlier and fix it up with everything we learnt so far:
Before:
After:
eDeen(r=6,tuv=1q2,ty=10,luv=1,ly=1,hqc=true)unfilt er(20,20)Vmtoon()aaa()Tweak(hue=0.0, sat=1.1, bright=-5, cont=1.05)
Even when upscaled to 4:3 HD it doesn't look that bad
Before/After: i3.lulzimg.com/b625a6d74d.png || i3.lulzimg.com/f5e1e26712.png
eDeen(r=6,tuv=12,ty=10,luv=1,ly=1,hqc=true)unfilte r(20,20)Vmtoon()aaa()Tweak(hue=0.0, sat=1.1, bright=-5, cont=1.05)Spline64resize(960,720)aWarpSharp(8)
Note how I used awarpsharp only after I upscaled to counter the bluriness of upscaling.
Still, avoid upscaling please, it will still be artificial.
__________________________________________________
So your script is now ready. Depending on the filters you put in it, the avs file might not play smoothly (or at all) in a mediaplayer.
I recommand you to use AVSPmod to preview changes to your file. Just load 2 tabs, one without any filters (just load the source) and the other with your final script.
Now you need to encode this avs script on any AviSynth supporting encoder(Will show it to you on next guide) ^_^
__________________________________________________
Q.)Why Pre-processing and Processing need to be separated?
Pre-processing is a totally different thing when compared with processing or encoding.
Specialised attention should be paid to it and Megui or StaxRip should not be used for both these purposes.
Most of the time it will crash megui while loading preview and if you were encoding something all your progress will be lost.
It's better to use Pre-processing be done on pre-processing software and processing on processing ones
__________________________________________________
Some interesting stuff to read about filters--->
1.)Complete guide LINK1 || LINK2
2.)Working with DVD Footage LINK1
3.)Smootheners LINK1
4.)Sharpeners LINK1
5.)Interlace Removal LINK1
6.)Avisynth Wiki Here
7.)About Filters: Internal|External
8.)Filters Download: Here
10.)Animesuki's Avisynth Thread here
Screenshots on this guide Here
----------------
Note -- most of the guides refer it to as Post Processing instead of Pre processing because they are Working with a DVD source and have already done the pre-processing separately
I will keep adding links when I find more interesting stuff to add ^_^