cogman
7th January 2008, 17:50
Ok, after quite a while of playing around with Avi-synth scripts, I have come up with one that removes a lot of noise from a fairly noisy source (M*A*S*H). So for you're pleasure and critiquing, here it is :). I would really appreciate any helpful suggestions. (I do tweak some of the values for individual videos, so I should be good there)
# Set DAR in encoder to 133 : 100. The following line is for automatic signalling
SetMTMode(2)
global MeGUI_darx = 133
global MeGUI_dary = 100
DGDecode_mpeg2source("C:\Mash\VTS_03_PGC_08_1.d2v")
#crop
crop(0,0,-2,0)
bob()
Spline36Resize(720,480) # Spline36 (Neutral)
#denoise
fluxsmootht(5)
undot()
dfttest(sigma=0.25)
BryanDenoise(iSearch=2)
tweak(hue=0.6, sat=1.3, bright=-1, cont=0.9)
sharpen(0.68)
function BryanDenoise(clip c, int "iTHSAD", int "iBlksize", int "iOverlap", int "iPel", bool "bChroma", bool "bTrueMotion", int "iSearch", int "iSharp", int "iDct", int "iIdx")
{
iBlksize =default(iBlksize, 8) #default block size
iOverlap =default(iOverlap, iBlksize/2) #default 1/2 block size
iTHSAD =default(iTHSAD, 400) #default
iPel =default(iPel, 4) #quarter pixel
bChroma =default(bChroma, true) #use chroma
bTrueMotion=default(bTrueMotion, true) #use true motion
iSearch =default(iSearch, 3) #exhaustive search
iSharp =default(iSharp, 2) #6 tap sharp filter
iDct =default(iDct, 1) #use DCT for SAD
iIdx =default(iIdx, 1) #index
backward_vec2=c.MVAnalyse(isb=true, delta=2, pel=iPel, blksize=iBlksize, overlap=iOverlap, chroma=bChroma, truemotion=bTrueMotion, search=iSearch, sharp=iSharp, dct=iDct, idx=iIdx)
backward_vec1=c.MVAnalyse(isb=true, delta=1, pel=iPel, blksize=iBlksize, overlap=iOverlap, chroma=bChroma, truemotion=bTrueMotion, search=iSearch, sharp=iSharp, dct=iDct, idx=iIdx)
forward_vec1 =c.MVAnalyse(isb=false, delta=1, pel=iPel, blksize=iBlksize, overlap=iOverlap, chroma=bChroma, truemotion=bTrueMotion, search=iSearch, sharp=iSharp, dct=iDct, idx=iIdx)
forward_vec2 =c.MVAnalyse(isb=false, delta=2, pel=iPel, blksize=iBlksize, overlap=iOverlap, chroma=bChroma, truemotion=bTrueMotion, search=iSearch, sharp=iSharp, dct=iDct, idx=iIdx)
return c.MVDegrain2(backward_vec1, forward_vec1, backward_vec2, forward_vec2, thSAD=iTHSAD, idx=iIdx)
}
changefps(29.970)
Some notes on the script, One of the videos was interlaced, 99% of them that I have encoded are progressive, whatever reason they decided to do that, I'm not quite sure. What I am not sure about is changing the FPS back to its original forum. Bob works well to remove all interlacing and produces something along the lines of a 59.something fps video. So I filtered, then converted to half the fps, then used change fps to basically delete every other frame. I'm not quite sure if this will result in the audio becoming unsynchronized (the task is still in que) but it looks good from AVSP.
I'm not quite sure about including Fluxsmooth and dfttest, like I said, the result looks pretty good without them, but I like the way it looks with them as well (it also provides somewhat of a failsafe for me)
The last thing is SetMTMode, I have never had problems with dfttest and SetMTMode, so it should be fine, but maybe someone else has had some different experience with it.
I am open to any suggestions on filter order or different filters, I do prefer dfttest over fft3dfilter, I like the results better. If anyone would like to see a before and after screen shot Ill be happy to provide one.
*edit* just after posting this script, I noticed a problem with the fps I was going to and from, I corrected it (and removed the convertfps stage) Now I know where the odd 59.ect number came from :)
http://i253.photobucket.com/albums/hh50/cogman10/before.png
http://i253.photobucket.com/albums/hh50/cogman10/after.png
# Set DAR in encoder to 133 : 100. The following line is for automatic signalling
SetMTMode(2)
global MeGUI_darx = 133
global MeGUI_dary = 100
DGDecode_mpeg2source("C:\Mash\VTS_03_PGC_08_1.d2v")
#crop
crop(0,0,-2,0)
bob()
Spline36Resize(720,480) # Spline36 (Neutral)
#denoise
fluxsmootht(5)
undot()
dfttest(sigma=0.25)
BryanDenoise(iSearch=2)
tweak(hue=0.6, sat=1.3, bright=-1, cont=0.9)
sharpen(0.68)
function BryanDenoise(clip c, int "iTHSAD", int "iBlksize", int "iOverlap", int "iPel", bool "bChroma", bool "bTrueMotion", int "iSearch", int "iSharp", int "iDct", int "iIdx")
{
iBlksize =default(iBlksize, 8) #default block size
iOverlap =default(iOverlap, iBlksize/2) #default 1/2 block size
iTHSAD =default(iTHSAD, 400) #default
iPel =default(iPel, 4) #quarter pixel
bChroma =default(bChroma, true) #use chroma
bTrueMotion=default(bTrueMotion, true) #use true motion
iSearch =default(iSearch, 3) #exhaustive search
iSharp =default(iSharp, 2) #6 tap sharp filter
iDct =default(iDct, 1) #use DCT for SAD
iIdx =default(iIdx, 1) #index
backward_vec2=c.MVAnalyse(isb=true, delta=2, pel=iPel, blksize=iBlksize, overlap=iOverlap, chroma=bChroma, truemotion=bTrueMotion, search=iSearch, sharp=iSharp, dct=iDct, idx=iIdx)
backward_vec1=c.MVAnalyse(isb=true, delta=1, pel=iPel, blksize=iBlksize, overlap=iOverlap, chroma=bChroma, truemotion=bTrueMotion, search=iSearch, sharp=iSharp, dct=iDct, idx=iIdx)
forward_vec1 =c.MVAnalyse(isb=false, delta=1, pel=iPel, blksize=iBlksize, overlap=iOverlap, chroma=bChroma, truemotion=bTrueMotion, search=iSearch, sharp=iSharp, dct=iDct, idx=iIdx)
forward_vec2 =c.MVAnalyse(isb=false, delta=2, pel=iPel, blksize=iBlksize, overlap=iOverlap, chroma=bChroma, truemotion=bTrueMotion, search=iSearch, sharp=iSharp, dct=iDct, idx=iIdx)
return c.MVDegrain2(backward_vec1, forward_vec1, backward_vec2, forward_vec2, thSAD=iTHSAD, idx=iIdx)
}
changefps(29.970)
Some notes on the script, One of the videos was interlaced, 99% of them that I have encoded are progressive, whatever reason they decided to do that, I'm not quite sure. What I am not sure about is changing the FPS back to its original forum. Bob works well to remove all interlacing and produces something along the lines of a 59.something fps video. So I filtered, then converted to half the fps, then used change fps to basically delete every other frame. I'm not quite sure if this will result in the audio becoming unsynchronized (the task is still in que) but it looks good from AVSP.
I'm not quite sure about including Fluxsmooth and dfttest, like I said, the result looks pretty good without them, but I like the way it looks with them as well (it also provides somewhat of a failsafe for me)
The last thing is SetMTMode, I have never had problems with dfttest and SetMTMode, so it should be fine, but maybe someone else has had some different experience with it.
I am open to any suggestions on filter order or different filters, I do prefer dfttest over fft3dfilter, I like the results better. If anyone would like to see a before and after screen shot Ill be happy to provide one.
*edit* just after posting this script, I noticed a problem with the fps I was going to and from, I corrected it (and removed the convertfps stage) Now I know where the odd 59.ect number came from :)
http://i253.photobucket.com/albums/hh50/cogman10/before.png
http://i253.photobucket.com/albums/hh50/cogman10/after.png