View Full Version : Restoring low-quality Youtube/similar videos
Dark Shikari
23rd January 2008, 23:53
I was looking at this (http://forum.doom9.org/showthread.php?t=132240) older thread and decided to try a slight modification of his script on some low quality Youtube and Nicovideo sources that I wanted to restore.
After and Before, respectively:
http://i29.tinypic.com/2ug1b11.png
Script:
Deblock()
dfttest()
FastLineDarken()
deen("a3d",4,8,9)
Spline36Resize(last.width*2,last.height*2)
AddBorders(4, 0, 4, 0)
aWarpSharp(depth=12,blurlevel=4,thresh=0.2,cm=1)
FastLineDarken()
aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
Crop(4,0,-4,0)
FastLineDarken()
DeHalo_Alpha()
fft3dgpu(bt=3,sigma=8,sharpen=1.3)
Spline36Resize(last.width/2,last.height/2)
This script is surprisingly effective :eek: It even works on blocky gradients, strangely enough, even though the original author designed it for cartoons.
Ranguvar
24th January 2008, 00:40
That is DISTURBINGLY good quality.
*runs away to use the script for his own nefarious purposes*
Thanks, O Mighty One!
Ranguvar
24th January 2008, 00:50
Heh? Won't encode.
MeGUI reports that there is an expected comma or end parentheses at the end quotes in "a3d" in the deen() line.
Dark Shikari
24th January 2008, 00:56
Heh? Won't encode.
MeGUI reports that there is an expected comma or end parentheses at the end quotes in "a3d" in the deen() line.Do you have all the necessary plugins and scripts (and latest versions thereof)? See the linked thread for links to all of these.
Ranguvar
24th January 2008, 02:10
Just ignore this please >.<
scharfis_brain
24th January 2008, 02:11
I restored a lot of youtube clips as well for a students video project.
I needed to upsample them to PAL 50i.
Source: http://www.youtube.com/watch?v=eN85MDSYiv4
Filtered: http://rapidshare.com/files/86115836/peugeot_206_kaza.mpg.html
http://home.arcor.de/scharfis_brain/samples/youtube.png
But the script is REALLY bruteforce:
loadplugin("c:\x\dgdecode.dll")
loadplugin("c:\x\mvtools.dll")
loadplugin("c:\x\ttempsmooth.dll")
loadplugin("c:\x\nnedi.dll")
#load A&V
v=avisource("get_video.avi")
a=wavsource("get video.wav")
audiodub(v,a)
#correct video to true fps
assumefps(30,true)
resampleaudio(48000).getchannel(1,1)
#deblock/dering
s=DeBlock(quant=35).Blindpp(cpu2="ooooxx")
# very strong temporal denoising (stabilisation)
bv2 = s.MVAnalyse(isb = true, truemotion=true, delta = 2, idx = 10, blksize=16)
bv1 = s.MVAnalyse(isb = true, truemotion=true, delta = 1, idx = 10, blksize=16)
fv1 = s.MVAnalyse(isb = false, truemotion=true, delta = 1, idx = 10, blksize=16)
fv2 = s.MVAnalyse(isb = false, truemotion=true, delta = 2, idx = 10, blksize=16)
fc2 = s.MVFlow(fv2, idx=10, thSCD1=500)
fc1 = s.MVFlow(fv1, idx=10, thSCD1=500)
bc1 = s.MVFlow(bv1, idx=10, thSCD1=500)
bc2 = s.MVFlow(bv2, idx=10, thSCD1=500)
interleave(fc2, fc1, s, bc1, bc2)
ttempsmooth(maxr=2, lthresh=40, cthresh=50)
selectevery(5,2)
#decimate out duped frames
selectevery(6,1,2,3,4,5)
#upscale to double size
source=nnedi(dh=true,field=0).turnleft().nnedi(dh=true,field=0).turnright().sharpen(0.5)
#interpolate to 50fps for fluent motion
backward_vec = source.MVAnalyse(isb = true, truemotion=true, pel=2, idx=1,blksize=8)
forward_vec = source.MVAnalyse(isb = false, truemotion=true, pel=2, idx=1,blksize=8)
cropped = source.crop(4,4,-4,-4) # by half of block size 8
backward_vec2 = cropped.MVAnalyse(isb = true, truemotion=true, pel=2, idx=2,blksize=8)
forward_vec2 = cropped.MVAnalyse(isb = false, truemotion=true, pel=2, idx=2,blksize=8)
source.MVFlowFps2(backward_vec,forward_vec,backward_vec2,forward_vec2,num=50,idx=1,idx2=2)
bicubicresize(720,576) #resize to PAL
converttoyuy2()
assumebff() #for PAL-DV
separatefields().selectevery(4,0,3).weave() #reinterlace
EDIT: I played a bit around with MvTools and made this nice 5x slowmotion of it:
http://www.youtube.com/watch?v=2Dag6BTFB2s
Sagekilla
24th January 2008, 02:20
I use a similar script whenever I'm working with animated video. As you can see, it's not perfect but it does remarkably well.
Input
http://img.photobucket.com/albums/v621/Sagekilla/futurama_bad.png
Output
http://img.photobucket.com/albums/v621/Sagekilla/Futurama_good.png
Ranguvar
24th January 2008, 02:23
Pretty cool stuff, Sagekilla. You hvae that script hiding anywhere? Still learning ways to spruce up anime :)
Sagekilla
24th January 2008, 02:27
Come to think of it, that sounds EXACTLY like what my filter is doing. Was my filter chain the one you based yours off of? :p
toon(0.15)
Deblock(quant=33, bOffset=14)
dfttest()
AAA(Chroma=true)
Spline36Resize(1536,864)
aWarpSharp(depth=12,blurlevel=4,thresh=0.3,cm=1)
LimitedSharpenFaster(edgemode=1,strength=200)
deen("a2d",3,6,6)
Dehalo_alpha()
Spline36Resize(1024,576)
Ranguvar
24th January 2008, 02:36
Green screen problem... got the script working, but VirtualDubMod and MPC play it all greenish.
Sagekilla
24th January 2008, 02:37
Whose script is that bugging out on?
Ranguvar
24th January 2008, 02:38
*points at DS*
Slightly modified for my purposes.
LoadPlugin("C:\Anime\WarpSharp\warpsharp.dll")
AviSource("MD_01.avi", audio=false)
Deblock()
dfttest()
FastLineDarken()
deen("a3d",4,8,9)
Spline36Resize(last.width*2,last.height*2)
AddBorders(4, 0, 4, 0)
aWarpSharp(depth=12,blurlevel=4,thresh=0.2,cm=1)
FastLineDarken()
aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
Crop(14,10,-14,-10)
FastLineDarken()
DeHalo_Alpha()
fft3dgpu(bt=3,sigma=8,sharpen=1.3)
Spline36Resize(640,480)
Tweak(sat=1.1, bright=0.0, cont=1.1)
TextSub("MD_01.ass")
Dup(threshold=4)
Sagekilla
24th January 2008, 02:40
It seems like the problem is related to dfttest(). By sheer random luck, I was testing dfttest() as a replacement for one of the denoisers in my script and found it to produce odd output. It output an overtly green image, as you said.
Don't know why, but it did.
Dark Shikari
24th January 2008, 02:47
It seems like the problem is related to dfttest(). By sheer random luck, I was testing dfttest() as a replacement for one of the denoisers in my script and found it to produce odd output. It output an overtly green image, as you said.
Don't know why, but it did.Well I've found dfttest to be an important part of that script--its effect is astounding.
Check that you have the latest fft3w library?
Sagekilla
24th January 2008, 02:51
Well I've found dfttest to be an important part of that script--its effect is astounding.
Check that you have the latest fft3w library?
Indeed, I tried dfttest alone on that clip and it's effects were amazing. But when I used either your filter chain or mine with dfttest instead of the first deen call, I got green screens. Annoyingly enough, I have the fft3w library from FFT3Dfilter and I get this effect with our filter chains.
Dark Shikari
24th January 2008, 02:53
Indeed, I tried dfttest alone on that clip and it's effects were amazing. But when I used either your filter chain or mine with dfttest instead of the first deen call, I got green screens.Video dimensions?
Sagekilla
24th January 2008, 02:55
Video dimensions?
That could probably be it. My source input is 720x416 though, mod 16. Unless it requires mod 32?
Edit: That makes no sense, I called this before I did any changes to the dimensions and it gave me a green tinted screen. When I used it standalone, I got the normal (and amazing at that) effects.
Ranguvar
24th January 2008, 02:57
I have a 640x480 video, and am using 3.1.2 of fftw.
Swapped out fft3dgpu for fft3dfilter, because it sped things up a good deal. Still green screens. And other color weirdness.
Ranguvar
24th January 2008, 03:09
Update. At least on my end, FastLineDarken() is causing the green-screens. I can comment out only the FLDs and it will work. Even one FLD seems to bork it.
The interesting thing is, depending on which FLD I don't comment out, different things happen. Leaving in the last FLD only will cause green screens everywhere. Leaving in the second only causes weird bubbles of color in the first few frames after you seek somewhere new in MPC. Leaving in the first one only causes the color bubbling for a frame or two, then permanent green screens.
Sagekilla
24th January 2008, 03:15
Oops, yeah it's FastLineDarken that causes the problem.. Not dfttest. I got the names mixed up when I posted, sorry! Swapped out deen and removegrain for dfttest on my first filter call. Much better results and I think it's slightly faster.
Ranguvar
24th January 2008, 03:17
FOUND IT.
Sorry for triple posting.
http://www.animemusicvideos.org/phpBB/viewtopic.php?p=1074640&sid=eeceb268bf3051752b650cefbea32147
Sagekilla
24th January 2008, 03:27
Alright.. I've made a function out of my filter chain, except for one minor annoyance it's otherwise at where I'd like it to be.
#####################################################################
# Animation Restoration v 1.06 (Jan 23, 2008) #
# aka "Remation" (No idea how I came up with the name) #
# Created by Sagekilla #
# #
# WHAT IT DOES: #
# Filters most animated content to remove blocking, noise, color #
# artifacts, ringing, haloing, sharpen and antialias lines walk #
# your dog, and generally make your video look a lot better. #
# #
# The defaults seem to work very well across most of my animated #
# content. Only setting you'll need to provide is width and height. #
# Otherwise, if you have any questions/comments/suggestions/etc #
# please see me on MSN. My email for it is zeratual2004@hotmail.com #
# #
# Required plugins: aWarpSharp.avsi / AAA.avsi / Deblock.dll #
# deen.dll / dftest.dll / DeHalo_Alpha.avsi #
# LimitedSharpenFaster.avsi / Toon.dll #
# #
# #
#####################################################################
function Remation ( clip input, int "Xres", int "Yres", float "scale", float "linestr",
\ int "dQuant", int "bOffset", int "dBlur", int "qBlur", float "thBlur",
\ int "shrpstr", bool "Deblock", bool "AA", bool "Sharp", bool "Dehalo" )
{
o = input
Xres = default( Xres, 1280 ) # Output width
Yres = default( Yres, 720 ) # Output height
scale = default( scale, 1.5 ) # Scales resolution for filtering
linestr = default( linestr, 0.15 ) # Line darken strength
dQuant = default( dQuant, 33 ) # Deblock strength
bOffset = default( bOffset, 0 ) # Deblock Offset
dBlur = default( dBlur, 12 ) # Blur strength
qBlur = default( qBlur, 4 ) # Blur "quality"
thBlur = default( thBlur, 0.3 ) # Blur threshold
shrpstr = default( shrpstr, 200 ) # Sharpen strength
Deblock = default( deblock, true ) # Toggle deblock
AA = default( AA, true ) # Toggle AA
Sharp = default( Sharp, true ) # Toggle Sharpening
Dehalo = default( Dehalo, true ) # Toggle Dehaloing
Xres2 = Floor(m2(Xres*scale))
Yres2 = Floor(m2(Yres*scale))
# Darken the lines before hand with toon, otherwise they fade.
# Then remove any blocking. Tweak to tastes if it's too strong.
o = (linestr > 0) ? o.Toon(linestr) : o
o = (Deblock==true) ? o.Deblock(quant=dQuant, bOffset=bOffset) : o
# Get rid of most of the color artifacts and noise.
o = o.dfttest()
# Antialias the lines so they don't look like crap, and
# then upscale so that the following steps filter better.
o = (AA==true) ? o.AAA(Chroma=true) : o
o = o.Spline36Resize(Xres2,Yres2)
# Light blurring and sharpen the edges
o = o.aWarpSharp(depth=dBlur,blurlevel=qBlur,thresh=thBlur,cm=1)
o = (Sharp==true) ? o.LimitedSharpenFaster(edgemode=1,strength=shrpstr) : o
# Get rid any other artifacts
o = o.deen("a2d",3,6,6)
o = o.Dehalo_alpha()
# Scale to intended resolution
o = o.Spline36Resize(Xres,Yres)
Return(o)
}
function m2(float num)
{
return int(num / 2) * 2
}
Ranguvar
24th January 2008, 04:12
Yeah, just tried over and over to fix it, couldn't.
I just modified it so the user has to do the calculation themself.
function RestoreAnimation ( clip input, int "Xres", int "Yres", int "Xres2", int "Yres2", float "linestr", int "dQuant")
{
o = input
Xres = default( Xres, 1280 )
Yres = default( Yres, 720 )
linestr = default( linestr, 0.15 )
dQuant = default( dQuant, 33 )
Xres2 = default( Xres2, 1920)
Yres2 = default( Yres2, 1080)
# Darken the lines before hand, otherwise they fade into nothingness
o = o.Toon(linestr)
# Remove any blocking. Tweak to tastes if it's too strong
o = o.Deblock(quant=dQuant, bOffset=14)
# Get rid of most of the artifacts
o = o.dfttest()
# Antialias the lines so they don't look like crap, and then upscale
# so that the next step filters better.
o = o.AAA(Chroma=true)
o = o.Spline36Resize(Xres2,Yres2)
# Light blurring and sharpen the edges
o = o.aWarpSharp(depth=24,blurlevel=4,thresh=0.3,cm=1)
o = o.LimitedSharpenFaster(edgemode=1,strength=200)
# Get rid any other artifacts
o = o.deen("a2d",3,6,6)
o = o.Dehalo_alpha()
# Scale to intended resolution
o = o.Spline36Resize(Xres,Yres)
Return(o)
}
Unearthly
24th January 2008, 04:12
Xres2 = m2(Xres*scale)
Yres2 = m2(Yres*scale)
function m2(float num)
{
return int(num / 2) * 2
}
You can of course change it to mX, whatever you need.
Sagekilla
24th January 2008, 04:20
Xres2 = m2(Xres*scale)
Yres2 = m2(Yres*scale)
function m2(float num)
{
return int(num / 2) * 2
}
You can of course change it to mX, whatever you need.
Thanks.. that seems to do the job nicely. Updated the function to include this.
Update: Added floor so it rounds to a whole number. I don't know what will happen if Spline36 gets a float number, but I added it just to be safe.
Ranguvar
24th January 2008, 04:23
*snaps fingers*
Knew there was a simple solution out there somewhere. Forgot the scale was a float, multiplying it by the normal res would make a float.
Thanks Unearthly!
Sagekilla
24th January 2008, 04:26
*snaps fingers*
Knew there was a simple solution out there somewhere. Forgot the scale was a float, multiplying it by the normal res would make a float.
Thanks Unearthly!
Indeed, check the updated function above by the way ;) I added some more functionality so you can tweak to tastes.
Edit: Function updated again. New with v1.03 is the ability to toggle AA, Deblocking, Sharpening, and Dehaloing if you don't need them.
Didée
24th January 2008, 08:25
The "Green screen with FastLineDarken" is caused by some MaskTools' U,V-parameters in the script. Addressed and solved (http://forum.doom9.org/showthread.php?p=1060077#post1060077).
Unearthly
24th January 2008, 12:46
Update: Added floor so it rounds to a whole number. I don't know what will happen if Spline36 gets a float number, but I added it just to be safe.
You get the error you got before, that is why my function made it work. My function makes it mod2, which must be an integer, so you don't need the floor.
Ranguvar
24th January 2008, 16:52
The "Green screen with FastLineDarken" is caused by some MaskTools' U,V-parameters in the script. Addressed and solved (http://forum.doom9.org/showthread.php?p=1060077#post1060077).
Yeah, I posted about that a bit earlier ;)
I'm gonna try Sagekilla's script too, but Dark Shikari, how would one improve the speed of yours while sacrificing the least amount of quality? I'm getting about .5fps, which doesn't cut it.
Sagekilla
24th January 2008, 17:07
Yeah, I posted about that a bit earlier ;)
I'm gonna try Sagekilla's script too, but Dark Shikari, how would one improve the speed of yours while sacrificing the least amount of quality? I'm getting about .5fps, which doesn't cut it.
Well, on mine you can disable certain filters if you don't need them so that would provide a (small) speed boost. Mine supports MT as well, so you can add SetMTMode(2) at the top of your script if you have more than one CPU. I don't know if Dark Shikari's is MT capable.
20-40
24th January 2008, 22:04
It's very, very good, even if I must use "plain" FFT3D (gpu do not support my 9200SE) and even if I get 2.74-4.26 fps. It borders with miracle what this script performs. Thank you for sharing it, because it supplies solution and that's what lately missed most.
Ikasu
21st February 2008, 06:01
I'm so damn confused, I guess that's what I get for never really taking the time to learn AVIsynth. I am trying to give this a go. Could anyone help me out? this is what my script looks like so far....So If I'm missing anything, please to comment.
LoadPlugin("C:\mpg2\MPEGDecoder.dll")
LoadPlugin("C:\mpg2\extra\Deen.dll")
LoadPlugin("C:\mpg2\extra\aWarpSharp.dll")
LoadPlugin("C:\mpg2\extra\FFT3dGPU.dll")
LoadPlugin("C:\mpg2\extra\MaskTools\MaskTools.dll")
LoadPlugin("C:\mpg2\extra\masktoolsv2\mt_masktools.dll")
LoadPlugin("C:\mpg2\extra\RemoveGrain\RemoveGrain.dll")
MPEGSource("C:\Documents and Settings\Kamroozius\My Documents\my amvs\truth.mpg")
Deblock()
dfttest()
FastLineDarken()
deen("a3d",4,8,9)
Spline36Resize(last.width*2,last.height*2)
AddBorders(4, 0, 4, 0)
aWarpSharp(depth=12,blurlevel=4,thresh=0.2,cm=1)
FastLineDarken()
aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
Crop(4,0,-4,0)
FastLineDarken()
DeHalo_Alpha()
fft3dgpu(bt=3,sigma=8,sharpen=1.3)
Spline36Resize(last.width/2,last.height/2)
Any advice? When I try to play it I get a out of memory error. I made the LimitedSharpenFaster.AVSI and placed it in my AVIsynth plugin folder. So yea, I'm not comfortable with avisynth as you can see =P. Odd thing, just found it, the memory error only happens when this AVSI file is in the plugins folder...::sighs::.
P.S....I know I could just pop the dll's I've loaded into my plugins folder, but I got use to it this way...lol...I'll do it later. =P
Adub
21st February 2008, 08:13
Mpg's should always be handled with DGindex and d2v with DGDecode.
Also, you may be receiving an out of memory because...you could be out of memory. dfttest and fft3dgpu both take a significant chunk of memory. It varies depending on the resolution size of your video.
You said you receive the error when limitedsharpenfaster.avsi is in your plugins folder. Well, since you are not calling it, it sounds like it has to do with something in that script. (Avisynth parses all avsi scripts before loading) Try getting the most up to date version from the avisynth wiki.
Ikasu
21st February 2008, 09:00
Merlin: Yea..I fixed it. Accidentally pasted a section right before the *'s started..So it case all AVS filed to error on memory. Working now, but I'm getting a dffttest error now on the AVS code. =(
Adub
21st February 2008, 09:08
What's the error? You did install the fftw library in you system32 folder, right?
Ikasu
21st February 2008, 09:20
Indeed. I just fixed it, dropped it in the wrong system directory >_<.
But now, fastlinedarken, and I can't find the download If I need one...Google search just brings up a deadline from a post in 2004.
mikeytown2
21st February 2008, 09:23
FastLineDarken
http://forum.doom9.org/showthread.php?p=616362#post616362
MaskTools
http://manao4.free.fr/MaskTools.htm
Ikasu
21st February 2008, 09:25
I've got masktools dl'ed, but fastlinedarken is a dead link in the main thread. Which is my dilemma =(.
mikeytown2
21st February 2008, 09:27
Make a new file called FastLineDarken.avsi
Copy pase from post into new file.
Ikasu
21st February 2008, 09:32
That though never crossed my mind, didn't even pay attention to the actual code posted. Now I've hit a snag with dehalo_alpha...lol
mikeytown2
21st February 2008, 09:35
Here is the code
http://forum.doom9.org/showthread.php?p=777956#post777956
A lot of the plugins that are used come from this post
http://forum.doom9.org/showthread.php?t=132240
By looking for the links you should be able to find anything your missing, if not, try a search, then ask.
Ikasu
21st February 2008, 09:40
I found it just as you posted, got it running..w00t
This is truly amazing...I never expected such a old crappily encoded file of mine could turn out to look this good...lol..
Hard Core Rikki
21st February 2008, 10:56
hmm hmm!! now that's some spiffy cleaning scripts we're seeing ;P
:thanks: for sharing
Mounir
6th May 2009, 16:39
I'm trying this script now
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\deblock.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dfttest\dfttest.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Deen.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\aWarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\FFT3dGPU.dll")
source=AviSource("C:\final.avi")
ConverttoYV12()
Deblock()
dfttest()
FastLineDarken()
deen("a3d",4,8,9)
Spline36Resize(last.width*2,last.height*2)
AddBorders(4, 0, 4, 0)
aWarpSharp(depth=12,blurlevel=4,thresh=0.2,cm=1)
FastLineDarken()
aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
Crop(4,0,-4,0)
FastLineDarken()
DeHalo_Alpha()
fft3dgpu(bt=3,sigma=8,sharpen=1.3)
Spline36Resize(last.width/2,last.height/2)
I got errors with a couples of filters:
FastLineDarken() => "there is no function named fast line darken"
DeHalo_Alpha() => "there is no function named expand"
dfttest() => "unable to load libfftw3f-3.dll!" (i know there is something to do to install this .dll in windows but i didn't quite understand how do it)
Well if someone could help me solve one by one the errors that would be nice
ash925
6th May 2009, 18:57
FastLineDarken,DeHalo_Alpha these are avs scripts try searching for them and import them into your script as Import("DeHalo_alpha.avs") ,put the DeHalo_Alpha.avs into the same folder as your script.
AFAIK libfftw3f-3.dll is to be put in your Windows\system32 folder.
Mounir
6th May 2009, 19:30
well i solved one error (the libfftw3f-3.dll) ; Two remain: dehalo & fastlinedarken
I put everything in the same folder ("plugins folder" to avoid errors) but no luck thus far
Should i import the .avs (dehalo & fastlinedarken) before loading the plugins or after ?
ash925
6th May 2009, 19:48
If you have put the scripts in the avisynth plugins folder then you need to specify the path to the script when importing(as follows Import("C:\Program Files\AviSynth 2.5\plugins\DeHalo_Alpha.avs") )or just rename the scripts like DeHalo_Alpha.avsi .AFAIK it doesn't matter when you import the script as long as it is before function call.
Mounir
6th May 2009, 22:05
well the script finally work
It appears the filter (script) fastlinedarken.avs was an html file in fact yet i have downloaded from a referenced link in this forum
BigDid
10th May 2009, 05:55
Hi,
Thanks to all for the great work. It does a wonderful job but it is so slowww :o
For anims, once I got the logic, I have tried to keep the main steps and see if I could get some speed improvements without sacrifying too much quality. I am not an avisynth expert so I am sure this chain could be improved.
1/First step is to darken the lines to keep them as good as possible with
fastlinedarkenMOD(thinning=0) # main filter
fluxsmoothST(5,5) soft smoother/stabilizer #main filter
use deblock() if needed #optional
use maa() from animeivtc if lines are too degraded or with jaggies, slower, use if needed #optional
* Above can be MTed
2/ Apply denoise filters; dfttest is wonderful but so slow, alternative:
fft3dgpu(plane=4, precision=1, sigma=2.4) sigma goes from 2 to 5 depending on the noise #main filter
* All below can be MTed
* use fft3dfilter if no 3d graphic card added or onboard: fft3dfilter(plane=4, bt=4, sigma=2.4)
use cnr2() for derainbow and additional denoise #optional
tbilateral() for specific anime noise: mosquito, ringing etc.., got the idea from the MSU cartoon restore Vdub filter #main filter
3/ Some post-denoising
* All below can be MTed
limitedsharpenfaster(smode=4, strength=40) basic lsf sharpening #main filter
use fastlinedarkenMOD(thinning=0, strength=24) another line darkening instance but half strength to minimize the sharpening effects #optional
use dehalo_alpha() if needed #optional
Some tips to re-use:
Use yadif() as deinterlacer to get rid of jaggies !
Use spline36resize() to minimize ringing
With this filterchain I improve the processing speed; it is not perfect but if the source is not too degraded it gives a good tradeoff quality/speed.
Did
JohannesL
10th May 2009, 13:28
Whoa, this looks great even on horrible 3D video game sources.
Thanks a bunch.
Ku2_BiO_X
2nd June 2009, 02:11
hello..
i tried the script but unsuccessful..
#LoadPlugin("C:\Documents and Settings\Ronaldo\Desktop\Remation\deblock.dll")
LoadPlugin("C:\Documents and Settings\Ronaldo\Desktop\Remation\dfttest.dll")
LoadPlugin("C:\Documents and Settings\Ronaldo\Desktop\Remation\Deen.dll")
LoadPlugin("C:\Documents and Settings\Ronaldo\Desktop\Remation\aWarpSharp.dll")
LoadPlugin("C:\Documents and Settings\Ronaldo\Desktop\Remation\Toon.dll")
LoadPlugin("C:\Documents and Settings\Ronaldo\Desktop\Remation\RemoveGrain.dll")
#LoadPlugin("C:\Documents and Settings\Ronaldo\Desktop\Remation\UnFilter.dll")
LoadPlugin("C:\Documents and Settings\Ronaldo\Desktop\Remation\Mt_MaskTools.dll")
LoadPlugin("C:\Documents and Settings\Ronaldo\Desktop\Remation\MaskTools.dll")
#LoadPlugin("C:\Documents and Settings\Ronaldo\Desktop\Remation\SangNom.dll")
LoadPlugin("C:\Documents and Settings\Ronaldo\Desktop\Remation\FFT3dGPU.dll")
Import("DeHalo_Alpha.avsi")
#Import("LimitedSharpenFaster.avs")
#Import("AAA.avsi")
#Import("Remation.avsi")
Import("FastLineDarken.avs")
DirectShowSource("test.flv")
Converttoyv12()
Deblock()
dfttest()
FastLineDarken()
deen("a3d",4,8,9)
Spline36Resize(last.width*2,last.height*2)
AddBorders(4, 0, 4, 0)
aWarpSharp(depth=12,blurlevel=4,thresh=0.2,cm=1)
FastLineDarken()
aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
Crop(4,0,-4,0)
FastLineDarken()
DeHalo_Alpha()
fft3dgpu(bt=3,sigma=8,sharpen=1.3)
Spline36Resize(last.width/2,last.height/2)
i keep getting error D3DERR_INVALIDCALL.. any suggestion?
edit: it's working now when i change fft3dgpu and use fft3dfilter using the same parameters..
i don't know whether this will give the same result, maybe slightly different..
Sagekilla
3rd June 2009, 00:47
Do you have fft3w.dll in your avisynth directory or in your system32 directory? Also, it's possible the GPU you have in your system isn't support by FFT3DGPU.
owais
3rd June 2009, 12:34
omg the first script in first post for me is very slow. is it a slow script?
sry for acting like baby
kemuri-_9
3rd June 2009, 16:00
omg the first script in first post for me is very slow. is it a slow script?
didn't you just answer your own question?
owais
3rd June 2009, 18:57
i dont understand how i will fix this green problem (had read sagekilla and Ranguvar post)
ok i sloved it
owais
3rd June 2009, 18:58
didn't you just answer your own question?
i was confirming whether it is really slow script or only on my computer it is slow
Dogway
5th January 2010, 20:38
Wow I really like this thread. The script works very nice but on really shitty crappy sources. It removed a lot of details on my source. So I dont know if this is only aimed to cartoons?
I made my own script to these kind of youtube videos. I realized that denoisers remove most of my blocking (if it's not too heavy), so I decided to not use deblock, because it just smooths away too much everything.
Well, I post my tests and script, so maybe I can improve it or you can take it for your own sources.
source (resized for comparison)
http://img691.imageshack.us/img691/729/sourceresized.th.png (http://img691.imageshack.us/img691/729/sourceresized.png)
dftest
http://img691.imageshack.us/img691/2519/dftest.th.png (http://img691.imageshack.us/img691/2519/dftest.png)
my script (encoded version, x264 removed banding further)
http://img685.imageshack.us/img685/1362/code.th.png (http://img685.imageshack.us/img685/1362/code.png)
ConvertToRGB.ChannelMixer(100, 0, 0,0, 100, 0, 0, 5, 100).ConvertToYV12
Tweak(sat=2,coring=false)
Levels(0, 1.2, 245, 0, 255, coring=false)
colorYUV(cont_y=40, cont_u=0, cont_v=0,gamma_y=0,gain_y=0)
Crop(6, 68, -4, -70)
tnlmeans(ax=4,ay=4,az=10,sx=2,sy=2,bx=1,by=1,a=2.0,sse=true) # very slow & best 4 anime
#ttempsmooth(maxr=7)
EEDI2() # for antialiasing
Lanczos4Resize(854, 480)
AddBorders(3,2,3,2,color=$000000)
mfToon(strength=10, sharpen=true, cwarp=false, wdepth=20, wblur=2, wthresh=0.5)
Crop(4, 2, -4, -2)
LimitedSharpenFaster(Smode=4, strength=20, edgemode=1, soft=-1)
GradFun2DBmod(thr=1.2,thrC=1.2,str=0.8,strC=0.4,radius=3,range=3,mode=3,temp=-1,mask=true,adapt=64)
farhanimator
4th February 2011, 19:52
Help me i m getting errors!! :(
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\deblock.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dfttest.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Deen.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\aWarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\FFT3dGPU.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\DeHalo_alpha.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\FastLineDarken.avs")
DirectShowSource("D:\test.mp4", fps=23.976, audio=true, convertfps=true)
Converttoyv12()
Deblock()
dfttest()
FastLineDarken()
deen("a3d",4,8,9)
Spline36Resize(last.width*2,last.height*2)
AddBorders(4, 0, 4, 0)
aWarpSharp(depth=12,blurlevel=4,thresh=0.2,cm=1)
FastLineDarken()
aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
Crop(4,0,-4,0)
FastLineDarken()
DeHalo_Alpha()
fft3dgpu(bt=3,sigma=8,sharpen=1.3)
Spline36Resize(last.width/2,last.height/2)
xekon
16th October 2011, 01:32
Plugins have evolved a little a bit since 2008, Dark Shikari, have you updated or changed anything since then?
I have been commenting out lines 1 at a time to see what effect each of them has on the outcome, also have been adjusting values and swapping out filters here and there for alternatives.
having a hard time choosing between deen("a3d",4,8,9) and hqdn3d(13,13,2,3)
also swapped out some stuff
deblock() for DeBlock_QED()
aWarpSharp(depth=12,blurlevel=4,thresh=0.2,cm=1) for AWarpSharp2(128,4,0,44)
DeHalo_Alpha() for DeHalo_alpha(brightstr=2, ss=2.0)
FastLineDarken() is behaving strangely for me, so I left that out, I wonder if somebody has an alternative for it or a revised version.
Also I could not figure out the reason for using Spline36Resize
it doubles the size and then halves it toward the end... does this make the filters work more efficiently or something?
I can only assume that the AddBorders(4, 0, 4, 0) was only so that deblock had a mod 8 source.... DeBlock_QED() seems to work without worrying about that.
also is there any reason to use fft3dgpu() over FFT3DFilter()
Also DeBlock_QED uses masktools2 but DeHalo_alpha uses masktools 1.5.8, the dlls are named differently so I have them both in the plugins folder but it kinda worries me. Would be nice to have a DeHalo_alpha that works with masktools2, but if you try it will complain about an expand function missing.
I was looking at this (http://forum.doom9.org/showthread.php?t=132240) older thread and decided to try a slight modification of his script on some low quality Youtube and Nicovideo sources that I wanted to restore.
After and Before, respectively:
http://i29.tinypic.com/2ug1b11.png
Script:
Deblock()
dfttest()
FastLineDarken()
deen("a3d",4,8,9)
Spline36Resize(last.width*2,last.height*2)
AddBorders(4, 0, 4, 0)
aWarpSharp(depth=12,blurlevel=4,thresh=0.2,cm=1)
FastLineDarken()
aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
Crop(4,0,-4,0)
FastLineDarken()
DeHalo_Alpha()
fft3dgpu(bt=3,sigma=8,sharpen=1.3)
Spline36Resize(last.width/2,last.height/2)
This script is surprisingly effective :eek: It even works on blocky gradients, strangely enough, even though the original author designed it for cartoons.
Bloax
16th October 2011, 09:37
It should be easy enough to switch the MaskTools (1) functions with their MaskTools2 counterparts, but I'll just go ahead and do it for you.
Switching to MaskTools2 also provides a nice speed boost. So yeah, please confirm if I did break (or miss) something. :)
function DeHalo_alpha(clip clp, float "rx", float "ry", float "darkstr", float "brightstr", float "lowsens", float "highsens", float "ss")
{
# Now in MaskTools2 flavour!
rx = default( rx, 2.0 )
ry = default( ry, 2.0 )
darkstr = default( darkstr, 1.0 )
brightstr = default( brightstr, 1.0 )
lowsens = default( lowsens, 50 )
highsens = default( highsens, 50 )
ss = default( ss, 1.5 )
LOS = string(lowsens)
HIS = string(highsens/100.0)
DRK = string(darkstr)
BRT = string(brightstr)
ox = clp.width()
oy = clp.height()
uv = 1
uv2 = (uv==3) ? 3 : 2
halos = clp.bicubicresize(m4(ox/rx),m4(oy/ry)).bicubicresize(ox,oy,1,0)
are = mt_lutxy(clp.mt_expand(U=uv,V=uv),clp.mt_inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
ugly = mt_lutxy(halos.mt_expand(U=uv,V=uv),halos.mt_inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
so = mt_lutxy( ugly, are, "y x - y 0.001 + / 255 * "+LOS+" - y 256 + 512 / "+HIS+" + *" )
lets = mt_merge(halos,clp,so,U=uv,V=uv)
remove = (ss==1.0) ? clp.repair(lets,1,0)
\ : clp.lanczosresize(m4(ox*ss),m4(oy*ss))
\ .mt_logic(lets.mt_expand(U=uv,V=uv).bicubicresize(m4(ox*ss),m4(oy*ss)),"min",U=uv2,V=uv2)
\ .mt_logic(lets.mt_inpand(U=uv,V=uv).bicubicresize(m4(ox*ss),m4(oy*ss)),"max",U=uv2,V=uv2)
\ .lanczosresize(ox,oy)
them = mt_lutxy(clp,remove,"x y < x x y - "+DRK+" * - x x y - "+BRT+" * - ?",U=2,V=2)
return( them )
}
function m4(float x) {return(x<16?16:int(round(x/4.0)*4))}
Edit: Seems to work for me, even without MaskTools.dll. So yeah, success?
xekon
18th October 2011, 05:27
Yes, Thank you for the update, working great here!
gyth
18th October 2011, 15:33
FastLineDarken() is behaving strangely for me, so I left that out, I wonder if somebody has an alternative for it or a revised version.
http://forum.doom9.org/showthread.php?p=1060081#post1060081
it doubles the size and then halves it toward the end... does this make the filters work more efficiently or something?
Supersampling, probably to reduce aliasing.
I can only assume that the AddBorders(4, 0, 4, 0) was only so that deblock had a mod 8 source.... DeBlock_QED() seems to work without worrying about that.
Maybe to give warpsharp something to pull in at the edges?
mzso
8th October 2016, 20:20
Deblock()
dfttest()
FastLineDarken()
deen("a3d",4,8,9)
Spline36Resize(last.width*2,last.height*2)
AddBorders(4, 0, 4, 0)
aWarpSharp(depth=12,blurlevel=4,thresh=0.2,cm=1)
FastLineDarken()
aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
Crop(4,0,-4,0)
FastLineDarken()
DeHalo_Alpha()
fft3dgpu(bt=3,sigma=8,sharpen=1.3)
Spline36Resize(last.width/2,last.height/2)
Hi!
Can anyone tell me which is the least painful way to get this working? Is there a a pack which includes all the filters?
Or, alternatively does anyone know of an alternative? Something else with the same goals? Be it for avisynth or not.
StainlessS
8th October 2016, 21:30
You should find these
Deblock
dfttest
FastLineDarken
deen
aWarpSharp
DeHalo_Alpha
fft3dgpu # From FFT3DFilter
here:- http://avisynth.nl/index.php/External_filters
FFT3dFilter requires same dll as dfttest, in system32 or SysWow64(64bit OS, 32Bit AVS) but named differently
FFT3D requires named as fftw3.dll and dfttest as libfftw3f-3.dll (one of them at least should include it).
EDIT: The rest are built-in.
mzso
8th October 2016, 22:14
You should find these
Deblock
dfttest
FastLineDarken
deen
aWarpSharp
DeHalo_Alpha
fft3dgpu # From FFT3DFilter
here:- http://avisynth.nl/index.php/External_filters
FFT3dFilter requires same dll as dfttest, in system32 or SysWow64(64bit OS, 32Bit AVS) but named differently
FFT3D requires named as fftw3.dll and dfttest as libfftw3f-3.dll (one of them at least should include it).
EDIT: The rest are built-in.
Thanks. Do I need to use 64 bit avisynth for a 64 bit player? Does it make sense to use the MT variant?
StainlessS
8th October 2016, 22:22
Do I need to use 64 bit avisynth for a 64 bit player?
No idea (expect so), but probably optimistic to expect the required plugins to all have 64 bit versions.
EDIT:
MT variant?
Again, no idea.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.