rss

Saturday, March 20, 2010

Real Time Anime Postprocessing with Avisynth and FFDshow

Here's a simple guide on how to make your anime to play like I've demonstrated before, I'll focus on getting the job done as there are many better avisynth ffdshow guide out there if you intend to learn more in depth.


Prerequisites :
- brain
- patience
- powerful computer, especially the processor (you can't play h.264/mkv/720/1080 files? no chance this will ever work for you)
- ffdshow x86
- avisynth 2.5.8 x86
- mediaplayer that support external filters (no vlc or mplayer) preferably mpc-hc


Optional :
- coreavc (not free)
- or divx h.264 (free!)
- madvr (highly recommended)


First thing first, install all the required softwares, you can find them easily from
http://www.videohelp.com or
http://www.free-codecs.com

Second, install these avisynth plugin (just put them in the avisynth/plugins folder)
hqdn3d
awarpsharp2
deband
masktools 2 (required for awarpsharp2)
multi thread module for avisynth
http://www.mediafire.com/download.php?mddqu0zmmzq
(this is what I currently use there may be newer version but I won't bother searching it since the one I have is working already, plus the locations is a mess to look for)

Third, replace the avisynth.dll in your system32 (or syswow64 if you have x64) with this
http://www.mediafire.com/download.php?z2yinyrajgw

Now (almost) all is set, go to video configuration of ffdshow select avisynth tab, set it like the picture

Set the buffer ahead according to your cores or experiment what best

and put this avisynth code :

SetMemoryMax(512)
SetMTMode(3,X)
ffdshow_source()
SetMTMode(2,X)
mt("toonLite(0.66)",X)
spline36resize(width,height)
mt("hqdn3d().GradFunkMirror()",X)
awarpsharp2()
SetMTMode(1)
GetMTMode(false) > 0 ? distributor() : last

with X is your number of cores and width and height is your resolution.

I'll try to explain what each syntax does :

spline36resize is a resizing filter builtin in avisynth and imo gives the best sharpness with least ringing
toonlite is a pure line darkening filter (no other function builtin thus it's fast)
hqdn3d is a fast denoising filter
gradfunkmirror is a debanding filter
and awarsharp is an awesome sharpening filter

You can delete the spline36resize (and merge the two mt) if your monitor and the source anime is of the same resolution, this will decrease the burden of your cpu and possibly give more power for other filter.

Each plugin has respecting option which you can see yourself in the readme (may not be included :p), inside the syntax body, or the respecting avisynt wiki entry.

NOTE: yes, hqdn3d and deband is built-in ffdshow already but I found that avisynth counterpart is faster since it support mt.

And finally we have to set the media player option, and for convenient sake I'll only use mpc-hc as a reference, you can use any video player of your liking as long as it support ffdshow.

Set the external filter option to ffdshow video decoder and set it to prefer as seen here :

Andddd you're done!

Or, alternatively you can make the ffdshow function only as a processing filter and use your favorite codec to decode (only recommended with h.264)
Set the h.264/AVC (or your preferred codec) option in ffdshow video configuration to disabled

Set the raw video in codec option of ffdshow "to all supported"

then set your favorite codec to prefer in mpc-hc

anddd you're done, again!

This is just an example of how to exploit ffdshow and avisynth, there are still many possibilities regarding how to use and combine the filter, if you found interesting combination please let me know. :)

1 comment:

dhruv meena said...

Excuse me sir
I have a doubt

I want to use your settings with SVP settings

I am getting the point of your avisynth scripting....

But pls help me with svp

If u want....i can import the auto generated ffdshow.avs file

Post a Comment