View Full Version : Need script help, grainy 10fps source
Die*wrek*show
19th February 2008, 08:03
I did a full quicktime encode, and actually it turned out ok but I want to do several encodes using the same video but different audio. However, I started changing the script, and now I'm kinda stuck. I can't remember how it was before I started messing with it. Here's the script:
SetMemoryMax(96)
a=Import("C:\dog project\video\3and1.avs")
b=Import("C:\dog project\video\2and7.avs")
c=Import("C:\dog project\video\4and5.avs")
d=Import("C:\dog project\video\6and8.avs")
video=StackVertical(StackHorizontal(a,b),StackHorizontal(c,d)).bilinearresize(1280,720)
Deblock(quant=33,boffset=15)
Undot()
DegrainMedian(limitY=7,limitUV=3,mode=1)
DegrainMedian(limitY=7,limitUV=3,mode=1)
#VagueDenoiser(threshold=7,auxclip=aux,wiener=true)
VagueDenoiser(threshold=.75,method=1,nsteps=6,chromat=1.00)
#msharpen(20,125)
audio=AviSource("C:\5thro636.avi")
audiodub(video,audio)
trim(0,629,false)
I wasn't being greedy, avisynth suddenly decided it didn't want to resize anymore so I had to fix that. I fixed that by moving the resize line from near the end to where it is now. any suggestions on how i could change the values or add a few filters to make the video cleaner? most of the pre-made scripts here seem to be geared towards anime. also, everything works in the script, it loads, it just doesn't clean up the video as much as i was hoping.
here is a "before" screenshot from "b", i chose a frame with some movement on purpose to show you the blur. the other frames don't look bad like this one, just a bit grainy.
http://i30.tinypic.com/2qs76g4.jpg
im using avisynth2.5, winxp, and transcoding with winFF.
Dark Shikari
19th February 2008, 08:08
Try using dfttest(sigma=1,tbsize=5) instead of your massive denoiser chain. Remove the deblocker, too.
Die*wrek*show
19th February 2008, 08:10
thanks, will do it.
Die*wrek*show
19th February 2008, 12:29
i finally figured out what was causing the problems with resize and all that. stackvertical/stackhorizonal gets pissy with you if you try to do some processing after the 4 quadrants are merged. or at least, on MY machine that is what cause me to spend half the night re-writing over and over. it simply refuses to apply the filters. as a last resort, i put my processing filters before the stackvertical/stackhorizontal, problem disappeared immediately. no problems since.
finally, now that everything is working correctly, here is dft as dfttest(sigma=1,tbsize=5)
http://i29.tinypic.com/qvm1.jpg
if i wasn't so exhausted i'd try a lower sigma and post more pics but it's time to sleep for me.
Didée
19th February 2008, 14:15
stackvertical/stackhorizonal gets pissy with you if you try to do some processing after the 4 quadrants are merged. or at least, on MY machine that is what cause me to spend half the night re-writing over and over. it simply refuses to apply the filters.
Nothing wrong with the Stack-filters. Your script is wrong.
Look:
SetMemoryMax(96)
a=Import("C:\dog project\video\3and1.avs")
b=Import("C:\dog project\video\2and7.avs")
c=Import("C:\dog project\video\4and5.avs")
d=Import("C:\dog project\video\6and8.avs")
video=StackVertical(StackHorizontal(a,b),StackHorizontal(c,d)).bilinearresize(1280,720)
Deblock(quant=33,boffset=15)
Undot()
DegrainMedian(limitY=7,limitUV=3,mode=1)
DegrainMedian(limitY=7,limitUV=3,mode=1)
#VagueDenoiser(threshold=7,auxclip=aux,wiener=true)
VagueDenoiser(threshold=.75,method=1,nsteps=6,chromat=1.00)
#msharpen(20,125)
audio=AviSource("C:\5thro636.avi")
audiodub(video,audio)
trim(0,629,false)
The red part is the reason why either you get no cleaning from the filters (because you don't apply them to the "video" clip), or - if you change the script slightly - why the stack commands don't work.
The solution is simple:
SetMemoryMax(96)
a=Import("C:\dog project\video\3and1.avs")
b=Import("C:\dog project\video\2and7.avs")
c=Import("C:\dog project\video\4and5.avs")
d=Import("C:\dog project\video\6and8.avs")
StackVertical(StackHorizontal(a,b),StackHorizontal(c,d)).bilinearresize(1280,720)
Deblock(quant=33,boffset=15)
Undot()
DegrainMedian(limitY=7,limitUV=3,mode=1)
DegrainMedian(limitY=7,limitUV=3,mode=1)
#VagueDenoiser(threshold=7,auxclip=aux,wiener=true)
VagueDenoiser(threshold=.75,method=1,nsteps=6,chromat=1.00)
#msharpen(20,125)
video = last
audio=AviSource("C:\5thro636.avi")
audiodub(video,audio)
trim(0,629,false)
Die*wrek*show
21st February 2008, 17:56
oh, thanks didee.
After reading this-
"With tbsize=3, dfttest uses 3 frames: current, current-1, current+1.
To use 2 backward and 2 forward compensations in the code Terranigma posted, set tbsize=5."
I'm guessing for low motion it would be ok to use "tbsize=3" instead of "tbsize=5". I could have it backwards though:)
but I was more impressed with trying the dfttest + emc combo, so i added depan and dropped tbsize. i couldn't find where to download mc_spuds, but i think depan is ok for testing so i added that. currently it's broken though, when i load it into virtualdub it says "can't load libfftw3f-3.dll". so i commented out depanestimate and depan. it loads in virtualdub. here is the script.
SetMemoryMax(96)
a=Import("C:\dog project\3and1.avs")
b=Import("C:\dog project\2and7.avs")
c=Import("C:\dog project\4and5.avs")
d=Import("C:\dog project\6and8.avs")
StackVertical(StackHorizontal(a,b),StackHorizontal(c,d))
dfttest(sigma=.75)
#depanestimate(zoommax=1,improve=false,pixaspect=1.094)
#depan()
#bilinearresize(448,336)
bilinearresize(1280,720)
video=last
audio=AviSource("C:\5thro636.avi")
audiodub(video,audio)
trim(0,629,false)
converttomono()
my source is progressive yv12 10.446 fps .mov files. the scripts being imported change the framerate there is no image processing there except crop or resize.
some screen shots and settings(all have the same (1280,720) bilinear resize line)
original frame, resized to 1280,720
link (http://i27.tinypic.com/2z8u3vc.jpg)
dfttest(sigma=.75,tbsize=5)
link (http://i27.tinypic.com/16kqafs.jpg)
dfttest(sigma=1.25,tbsize=5)
link (http://i30.tinypic.com/2qnpooi.jpg)
i did an encode using only dfttest for image processing as dfttest(sigma=1,tbsize=5) and it looks ok, a slight bit blurry but otherfise fine. how could i improve?
any comments welcome.
Adub
21st February 2008, 18:46
You need libfftw3f-3.dll to be in your system32 folder, thats why you were getting the error. Also here is a link to mc_spuds:
http://avisynth.org/mediawiki/MC_Spuds
Also, I think you are going about motion compensation the wrong way. If you want motion compensated denoising, then use dfttest + emc. Depan does just that, "de-pans". It is used in alot of camera footage to stabilize the differences between frames. It helps to remove camera shake.
Dfttest + emc is a denoiser, and a damn good one at that. It you want to try and even crazier/slower denoiser, then mc_spuds is a good start.
*.mp4 guy
21st February 2008, 19:56
There are denoisers that blur less, but none of them are going to outperform dfttest in this case, there isn't any detail to save, and the video is out of focus. In addition to that, the video has been compressed, and dfttest is the best filter I know of for removing 8x8 dct blocks (the compresion artifacts in your video).
Die*wrek*show
21st February 2008, 20:42
hi merlin.
i saw this line in the dfttest thread:
mc_spuds(frames=2, strength=1, anime=true, starfield=true, lsfstr=50, blocksize=8, overlap=8/2)
and assumed mc_spuds was a .dll, ugh. but it makes sense now. and this-
dfttest improves much with motion compensation, was originally made for that in fact.
is why i added depan. i read the help file for depan and it said that it is used for motion compensation. in this thead (http://forum.doom9.org/showthread.php?t=114582#post861869) i saw this-
http://i30.tinypic.com/294mj42.jpg
and didn't really think adding all that code would be a good idea leaving the numbers the same so i just shortened it to dfttest and depan. now i realize that doesn't work like that. so if i do add all that code, do i change the values? what plugins do i need? here is a picture, (http://i30.tinypic.com/r27ofr.jpg) that shows two things. what plugins i have, and that error i keep getting. the error only happens when i enable the depanestimate line. i had that FFTW3 file in my windows directory, and i moved it to sys32 and it still gives the error.
and by some wild coincidence, the video i shot DOES jerk around a fair amount so as it turns out i did something right by accident. so i guess i should leave depan in?
Adub
21st February 2008, 22:52
If it does jerk around a little bit, then yes, use the depan combo. However, I recommend that you look at the manual:
http://avisynth.org.ru/depan/depan.html
It sounds like your FFTW3.dll is not cooperating with your current versions. For one, your depan* plugins are slightly old, so update those. However, your plugins aren't that old, so this shouldn't be the problem. Try and get your hands on a new version of the FFTW3.dll.
I tried to find one for you, but it looks like the fftw website is having internet issues.
Anyone know where a working version of the dll can be located?
Also, you could copy and paste the script that you found concerning dfttest + emc. It may not work as well as if you tweaked by hand for your source, but it should work.
Or you could try this: (stolen from mahsah)
source=last
backward_vectors = source.MVAnalyse(isb = true, truemotion=true, delta = 1, idx = 1)
# we use explicit idx for more fast processing
forward_vectors = source.MVAnalyse(isb = false, truemotion=true, delta = 1, idx = 1)
forward_compensation = source.MVFlow(forward_vectors, idx=1, thSCD1=500) # or use MVCompensate
backward_compensation = source.MVFlow(backward_vectors, idx=1, thSCD1=500) # or use MVCompensate
# create interleaved 3 frames sequences
interleave(forward_compensation, source, backward_compensation)
dfttest(sigma=.5,tbsize=3) # place your preferred temporal (spatial-temporal) denoiser here
selectevery(3,1) # return filtered central (not-compensated) frames only
Or you could use the variety of other motion compensated denoisers that we have available, such as MC_spuds, Temporal Degrain, MVDegrain(1,2,3), etc.
Die*wrek*show
23rd February 2008, 20:18
ok it's working nicely guys, thanks for the input.
@.mp4guy- yeah, the video is definitely out of focus, im gonna fire the camera man:)
here's my script:
SetMemoryMax(96)
a=Import("C:\dog project\3and1.avs")
b=Import("C:\dog project\2and7.avs")
c=Import("C:\dog project\4and5.avs")
d=Import("C:\dog project\6and8.avs")
source=StackVertical(StackHorizontal(a,b),StackHorizontal(c,d))
#begin "masah" code
#source=last ignore this line and comment
backward_vectors = source.MVAnalyse(isb = true, truemotion=true, delta = 1, idx = 1)
# we use explicit idx for more fast processing
forward_vectors = source.MVAnalyse(isb = false, truemotion=true, delta = 1, idx = 1)
forward_compensation = source.MVFlow(forward_vectors, idx=1, thSCD1=500) # or use MVCompensate
backward_compensation = source.MVFlow(backward_vectors, idx=1, thSCD1=500) # or use MVCompensate
# create interleaved 3 frames sequences
interleave(forward_compensation, source, backward_compensation)
dfttest(sigma=.5,tbsize=3) # place your preferred temporal (spatial-temporal) denoiser here
selectevery(3,1) # return filtered central (not-compensated) frames only
#end "masah" code
#mdata=depanestimate
#depanstabilize(data=mdata)
lanczos4resize(448,336)
#lanczos4resize(1280,720) this is for vimeo hd videos
video=last
audio=AviSource("C:\5thro636.avi")
audiodub(video,audio)
trim(0,629,false)
converttomono()
masah's code worked, that previous dft+emc code didn't. it's because those parameters won't work with the newer version of dfttest. i switched to lancos4resize to get some sharpness back. i can't tell if it's helping my eyes are bad.
the final .flv video size was 2,424KB so that's still too large for youtube to accept without them re-encoding. i used sorenson h263 for video compression. of course after resizing down to 448 x 336 it looks really good. now, how to look good for my 1280 x 720 encode i'll need to get lucky.
unless you guys see anything else to improve, i'll take this as a good final script for my last encode (1280,720).
edit: oh, i forgot to say. i updated those fftw3 files, using the ones from their website homepage. i tried putting all three files in both windows and windows\system32 and i still get the error. so depanestimate and depan had to stay broken as i had no way to fix that.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.