View Full Version : The power of Avisynth: restoring old 8mm films.
tedkunich
22nd January 2009, 18:08
Ah yes.. I see.. This depends on the source of cource. A blocksize of 16 is better with my 1024 x 768 originals.
The script runs 3-4 fps on my Dell Inspiron.. Nothing special, just a standard and cheap Dell machine.
Fred.
Oh... that was something I had not considered... I believe that my source is 1040 x 1040 (1440x1080 cropped). I'll play with my cropping and see if that fixes the problem.
Thank,
Ted
Blue_MiSfit
22nd January 2009, 21:02
AMD Phenom II processors aren't too bad, especially if you already have an AM2+ motherboard that can take a drop-in replacement.
But, from the sounds of it, you have an older system. In this case, you're probably better off buying an Intel setup, as their chips tend to be faster, and have similar entry costs
~MiSfit
EuropeanMan
4th February 2009, 01:48
@ VideoFred & others...I'm just now testing your script on page 1 (but using a replacement script for 2 lines vis a vis MVTools2 optimisation found on page 2 of this thread). I am trying to understand what is going on...but obviously there are things that I just don't understand. Would it be okay guys if I went line by line and asked what is going on and hopefully get answers that are simple enough to understand? Thanks again in advance as I'd really like to understand the thought process behind this.
I was scrolling through the video in VDM and wondered why I got blocking when there wasn't any in the video to begin with? :(
http://i44.tinypic.com/2hicgsk.jpg
source (Lagaan, R5, DVD9 PAL Disc 1/3)
settings used were exactly from script (except for output rez)
kopmjj
7th February 2009, 05:46
Here is the script:
# film restoring script by videoFred.
# denoising, resizing, stabilising, sharpening, auto-levels and auto-white balance.
film="F:\002_dodcaps_tebewaren\privé 64\privé_64T_0014.avi" # source clip, you must specify the full path here
short="L" # L=long clip S=short clip try it!
result="resultS3" # specify the wanted output here
trim_begin=6 trim_end=6 play_speed=18.75 #trim frames and play speed (PAL: 16.6666 or 18.75)
saturation=1.0 #saturation
X=4 gamma=0.7 # X is a special parameter for reducing the autolevels effect
black_level=0 white_level=255 output_black=0 output_white=255 # manual levels, when returning result4
AGC_max_sat=2 AGC_max_gain=1.0 #parameters of HDRAGC filter, improves colors and shadows
blue=-4 red=2 #manual color adjustment, when returning result2. Values can be positive or negative
denoising_strenght=800 #denoising level of first denoiser: MVDegrainMulti()
denoising_frames= 4 #number of frames for averaging (forwards and backwards) 3 is a good start value
block_size= 16 #block size of MVDegrainMulti()
block_over= 4 #block overlapping of MVDegrainMulti()
temp_radius=20 temp_luma=6 temp_chroma=6 #second denoiser: TemporalSoften
grain_luma=10 grain_chroma=10
# this will add some digital grain to the final result, set it to zero if you do not want it.
LSF_sharp_ness=250 LSF_radi_us=3 LSF_sub=1.5 #first sharpening parameters (LimitedSharpenFaster) sub=subsampling
USM_sharp_ness=40 USM_radi_us=2 USM_thres_hold=0 #second sharpening parameters (UnsharpMask)
USM_sharp_ness2=20 USM_radi_us2=1 USM_thres_hold2=0 #third sharpening parameters (UnsharpMask)
maxstab=60 #maximum values for the stabiliser (in pixels) 20 is a good start value
est_left=20 est_top=20 est_right=20 est_bottom=20 est_cont=0.8 #crop values for special Estimate clip
CLeft=30 CTop=30 CRight=30 CBottom=30 #crop values after Depan and before final resizing (40,30,40,30)
W=720 H=576 #final size from the returned clip
bord_left=0 bord_top=0 bord_right=0 bord_bot=0
#you can add black borders after resizing, final size is then size + borders!!
# End variables, begin script
#====================================================================================================
SetMemoryMax(1024) #set this to 1/3 of the available memory
Loadplugin("Depan.dll")
LoadPlugin("DepanEstimate.dll")
Loadplugin("removegrain.dll")
LoadPlugin("AGC.dll")
LoadPlugin("MVTools.dll")
Loadplugin("mt_masktools.dll")
LoadPlugin("MaskTools.dll")
Loadplugin("warpsharp.dll")
LoadPlugIn("LimitedSupport_09Jan06B.dll")
LoadPlugin("MT.dll")
LoadPlugin("autolevels.dll")
LoadPlugin("AddGrainC.dll")
Import("LimitedSharpenFaster.avs")
SetMTMode(5)
source1= Avisource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
end= source1.framecount()
end2= end-trim_end
frames=end+trim_begin
skip= end2/5
skip0=skip+3
skipend= 3
skipend1= skip0+3
skip2= skipend1+skip
skipend2= skip2+3
skip3= skipend2+skip
skipend3= skip3+3
skip4= skipend3+skip
skipend4= skip4+3
skip5= end2-3
L= trim(source1,0,end2)
LS= trim(source1,0,end2).scriptclip("""subtitle("frame "+string(trim_begin+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"\
+string(trim_end),x=100,y=60,size=32)""")
sourceT1= trim(source1,0,skipend).scriptclip("""subtitle("frame "+string(trim_begin+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)\
+" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT2= trim(source1,skip0,skipend1).scriptclip("""subtitle("frame "+string(trim_begin+skip0+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+" steps: "\
+string(skip),x=100,y=60,size=32)""")
sourceT3= trim(source1,skip2,skipend2).scriptclip("""subtitle("frame "+string(trim_begin+skip2+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+" steps:\
"+string(skip),x=100,y=60,size=32)""")
sourceT4= trim(source1,skip3,skipend3).scriptclip("""subtitle("frame "+string(trim_begin+skip3+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT5= trim(source1,skip4,skipend4).scriptclip("""subtitle("frame "+string(trim_begin+skip4+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT6= trim(source1,skip5,end2).scriptclip("""subtitle("frame "+string(trim_begin+skip5+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
SS= sourceT1+sourceT2+sourceT3+sourceT4+sourceT5+sourceT6
sourceT10= trim(source1,0,skipend)
sourceT20= trim(source1,skip0,skipend1)
sourceT30= trim(source1,skip2,skipend2)
sourceT40= trim(source1,skip3,skipend3)
sourceT50= trim(source1,skip4,skipend4)
sourceT60= trim(source1,skip5,end2)
S= sourceT10+sourceT20+sourceT30+sourceT40+sourceT50+sourceT60
stab_reference= eval(short).crop(est_left,est_top,-est_right,-est_bottom)\
.tweak(cont=est_cont).binarize(threshold=80).greyscale().invert()
mdata=DePanEstimate(stab_reference,trust=1.0,dxmax=maxstab,dymax=maxstab)
stab=DePanStabilize(eval(short),data=mdata,cutoff=0.5,dxmax=maxstab,dymax=maxstab,method=1,mirror=15)
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom).tweak(sat=saturation)
stab3=DePanStabilize(eval(short),data=mdata,cutoff=0.5,dxmax=maxstab,dymax=maxstab,method=1,info=true)
WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
vectors= stab2.MVAnalyseMulti(refframes=denoising_frames, pel=2, blksize=block_size, overlap=block_over, idx=1)
denoised= stab2.MVDegrainMulti(vectors, thSAD=denoising_strenght, SadMode=1, idx=1).tweak(sat=saturation)
leveled= denoised.HDRAGC(coef_gain=2.0,max_gain=AGC_max_gain,min_gain=0.5,max_sat=AGC_max_sat,shadows=true)
sharp1=limitedSharpenFaster(leveled,smode=1,strength=LSF_sharp_ness,overshoot=50,\
radius=LSF_radi_us, ss_X=LSF_sub, SS_Y=LSF_sub, dest_x=W,dest_y=H)
sharp2= unsharpmask(sharp1,USM_sharp_ness,USM_radi_us,USM_thres_hold)
sharpX= unsharpmask(sharp2,USM_sharp_ness2,USM_radi_us2,USM_thres_hold2)
sharp3= sharpX.TemporalSoften(temp_radius,temp_luma,temp_chroma,15,2).addgrainC(grain_luma,grain_chroma,0.2,0.2,5)
#backward_vectors = sharp3.MVAnalyse(isb = true,truemotion=true,idx=2)
#forward_vectors = sharp3.MVAnalyse(isb = false,truemotion=true,idx=2)
#frameclip=MVFlowFps(sharp3,backward_vectors, forward_vectors, num=25, den=1, ml=100, idx=2)
result1= sharp3.addborders(X,0,0,0,$FFFFFF).levels(0,gamma,255,0,255).autolevels().coloryuv(autowhite=true)\
.crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result2= sharp3.levels(black_level,gamma,white_level,0,255).coloryuv(autowhite=true)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result3= sharp3.coloryuv(off_U=blue,off_V=red).levels(0,gamma,255,0,255).addborders(X,0,0,0,$FFFFFF)\
.autolevels().crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result4= sharp3.coloryuv(off_U=blue,off_V=red).levels(black_level,gamma,white_level,0,255)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result5= overlay(eval(short),stab_reference,x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot
short2=short+"S"
source2=Lanczos4Resize(eval(short2),W2,H2)
source3=Lanczos4Resize(eval(short2),W,H)
resultS1= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result1,"autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result3,"autolevels + manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result4,"manual colors and levels correction",size=28,align=2))
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)
,subtitle(result2,"autowhite, manual levels\
correction",size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),subtitle(result3,"autolevels + manual color\
correction",size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),subtitle(result4,"manual colors and levels\
correction",size=28,align=2).histogram(mode="levels"))
result6= stackhorizontal(subtitle(result5,"baseclip for stabiliser -only the B/W clip is used",size=32,align=2)\
,subtitle(stab4,"test stabiliser: dx=horizontal, dy=vertical",size=32,align=5))
Eval(result)
All suggestions to improve it are welcome.
Fred.
hi WOW!!! FANTASTIC WORK!!! REALLY AMAZING. now i can work on some of my footage to restore some videos.
but im still new to avisynth so im confused on your script,it doesnt show what plugins to load etc, please can you show me an exact script exactly how it is like for example load video eg: avi, and the load plugins and adjust filters. or upload your editing script.
so a sample full script please just to give me an idea thanks.
then i can then adjust settings how i like but i just need the base.
if anyone is king enough please show the script thanks again.
videoFred
7th February 2009, 10:49
I was scrolling through the video in VDM and wondered why I got blocking when there wasn't any in the video to begin with? :(
EuropeanMan,
This script was special made for restoring old and very grainy 8mm film capturings. Settings are way to heavy for your source. Please reduce degraining and sharpening to begin with.
What do you want to improve anyhow? ;)
Fred.
videoFred
7th February 2009, 10:53
now i can work on some of my footage to restore some videos.
It will not work the same on old videos.... :scared:
It is made for film.
it doesnt show what plugins to load
Please read the script careful.. You will see what plugins are needed. ;)
Fred.
mikkop
8th February 2009, 01:50
Hi When i trie to load the script i get serveral errors like:
depanstabilize There's no function named "methode"
There's no function named "vector"
There's no function named "mvdegrainmulti"
And a few more.Al the dll files are in the map.
Can someone help me please:(
kopmjj
8th February 2009, 11:32
ok i had a go at this but now it says error in line 154 heres my scipt can you tell me what i have done wrong?
or show me a fixed script thanks.
SetMemoryMax(1024)
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DePan.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DePanEstimate.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\HDRAGC.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\WarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LimitedSupport_09Jan06B.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MT.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\autolevels.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\AddGrainC.dll")
Import("C:\Program Files\AviSynth 2.5\Plugins\LimitedSharpenFaster.avs")
SetMTMode(5)
AVISource("C:\Documents and Settings\king\Desktop\New Folder\mymovie.avi.avi")
converttoYV12
end= source1.framecount()
end2= end-trim_end
frames=end+trim_begin
skip= end2/5
skip0=skip+3
skipend= 3
skipend1= skip0+3
skip2= skipend1+skip
skipend2= skip2+3
skip3= skipend2+skip
skipend3= skip3+3
skip4= skipend3+skip
skipend4= skip4+3
skip5= end2-3
L= trim(source1,0,end2)
LS= trim(source1,0,end2).scriptclip("""subtitle("frame "+string(trim_begin+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"\
+string(trim_end),x=100,y=60,size=32)""")
sourceT1= trim(source1,0,skipend).scriptclip("""subtitle("frame "+string(trim_begin+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)\
+" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT2= trim(source1,skip0,skipend1).scriptclip("""subtitle("frame "+string(trim_begin+skip0+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+" steps: "\
+string(skip),x=100,y=60,size=32)""")
sourceT3= trim(source1,skip2,skipend2).scriptclip("""subtitle("frame "+string(trim_begin+skip2+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+" steps:\
"+string(skip),x=100,y=60,size=32)""")
sourceT4= trim(source1,skip3,skipend3).scriptclip("""subtitle("frame "+string(trim_begin+skip3+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT5= trim(source1,skip4,skipend4).scriptclip("""subtitle("frame "+string(trim_begin+skip4+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT6= trim(source1,skip5,end2).scriptclip("""subtitle("frame "+string(trim_begin+skip5+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
SS= sourceT1+sourceT2+sourceT3+sourceT4+sourceT5+sourceT6
sourceT10= trim(source1,0,skipend)
sourceT20= trim(source1,skip0,skipend1)
sourceT30= trim(source1,skip2,skipend2)
sourceT40= trim(source1,skip3,skipend3)
sourceT50= trim(source1,skip4,skipend4)
sourceT60= trim(source1,skip5,end2)
S= sourceT10+sourceT20+sourceT30+sourceT40+sourceT50+sourceT60
stab_reference= eval(short).crop(est_left,est_top,-est_right,-est_bottom)\
.tweak(cont=est_cont).binarize(threshold=80).greyscale().invert()
mdata=DePanEstimate(stab_reference,trust=1.0,dxmax=maxstab,dymax=maxstab)
stab=DePanStabilize(eval(short),data=mdata,cutoff=0.5,dxmax=maxstab,dymax=maxstab,method=1,mirror=15)
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom).tweak(sat=saturation)
stab3=DePanStabilize(eval(short),data=mdata,cutoff=0.5,dxmax=maxstab,dymax=maxstab,method=1,info=true)
WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
vectors= stab2.MVAnalyseMulti(refframes=denoising_frames, pel=2, blksize=block_size, overlap=block_over, idx=1)
denoised= stab2.MVDegrainMulti(vectors, thSAD=denoising_strenght, SadMode=1, idx=1).tweak(sat=saturation)
leveled= denoised.HDRAGC(coef_gain=2.0,max_gain=AGC_max_gain,min_gain=0.5,max_sat=AGC_max_sat,shadows=true)
sharp1=limitedSharpenFaster(leveled,smode=1,strength=LSF_sharp_ness,overshoot=50,\
radius=LSF_radi_us, ss_X=LSF_sub, SS_Y=LSF_sub, dest_x=W,dest_y=H)
sharp2= unsharpmask(sharp1,USM_sharp_ness,USM_radi_us,USM_thres_hold)
sharpX= unsharpmask(sharp2,USM_sharp_ness2,USM_radi_us2,USM_thres_hold2)
sharp3= sharpX.TemporalSoften(temp_radius,temp_luma,temp_chroma,15,2).addgrainC(grain_luma,grain_chroma,0.2,0.2,5)
#backward_vectors = sharp3.MVAnalyse(isb = true,truemotion=true,idx=2)
#forward_vectors = sharp3.MVAnalyse(isb = false,truemotion=true,idx=2)
#frameclip=MVFlowFps(sharp3,backward_vectors, forward_vectors, num=25, den=1, ml=100, idx=2)
result1= sharp3.addborders(X,0,0,0,$FFFFFF).levels(0,gamma,255,0,255).autolevels().coloryuv(autowhite=true)\
.crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result2= sharp3.levels(black_level,gamma,white_level,0,255).coloryuv(autowhite=true)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result3= sharp3.coloryuv(off_U=blue,off_V=red).levels(0,gamma,255,0,255).addborders(X,0,0,0,$FFFFFF)\
.autolevels().crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result4= sharp3.coloryuv(off_U=blue,off_V=red).levels(black_level,gamma,white_level,0,255)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result5= overlay(eval(short),stab_reference,x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot
short2=short+"S"
source2=Lanczos4Resize(eval(short2),W2,H2)
source3=Lanczos4Resize(eval(short2),W,H)
resultS1= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result1,"autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result3,"autolevels + manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result4,"manual colors and levels correction",size=28,align=2))
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)
,subtitle(result2,"autowhite, manual levels\
correction",size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),subtitle(result3,"autolevels + manual color\
correction",size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),subtitle(result4,"manual colors and levels\
correction",size=28,align=2).histogram(mode="levels"))
result6= stackhorizontal(subtitle(result5,"baseclip for stabiliser -only the B/W clip is used",size=32,align=2)\
,subtitle(stab4,"test stabiliser: dx=horizontal, dy=vertical",size=32,align=5))
jmartinr
8th February 2009, 12:43
You forgot a \ in line 154. ;)
Gavino
8th February 2009, 13:32
You forgot a \ in line 154. ;)
It's missing in the original script posted by videoFred, probably because he reformatted it for posting. It also contains wrongly split string literals. So the lines
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)
,subtitle(result2,"autowhite, manual levels\
correction",size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),subtitle(result3,"autolevels + manual color\
correction",size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),subtitle(result4,"manual colors and levels\
correction",size=28,align=2).histogram(mode="levels"))
should be
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",\
size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result3,"autolevels + manual color correction",\
size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result4,"manual colors and levels correction",\
size=28,align=2).histogram(mode="levels"))
kopmjj
8th February 2009, 14:01
It's missing in the original script posted by videoFred, probably because he reformatted it for posting. It also contains wrongly split string literals. So the lines
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)
,subtitle(result2,"autowhite, manual levels\
correction",size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),subtitle(result3,"autolevels + manual color\
correction",size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),subtitle(result4,"manual colors and levels\
correction",size=28,align=2).histogram(mode="levels"))
should be
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",\
size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result3,"autolevels + manual color correction",\
size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result4,"manual colors and levels correction",\
size=28,align=2).histogram(mode="levels"))
o thanks ill give it a try but what about the rest of the script is it right? i mean have i loaded the movie right etc?
kopmjj
8th February 2009, 14:29
ok i tried this...
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",\
size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result3,"autolevels + manual color correction",\
size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result4,"manual colors and levels correction",\
size=28,align=2).histogram(mode="levels"))
but now it says error in colum 157?
can you just post your script please so the only thing i have to edit is load my movie .thanks
Gavino
8th February 2009, 14:41
now it says error in colum 157?
can you just post your script please so the only thing i have to edit is load my movie .thanks
Apart from the correction I just posted, the only thing you have to change from videoFred's script is the line "film = ..." at the start, which defines your movie file.
Is the script you posted earlier your complete script? It is missing lines from the start and end of the original script.
kopmjj
8th February 2009, 15:22
Apart from the correction I just posted, the only thing you have to change from videoFred's script is the line "film = ..." at the start, which defines your movie file.
Is the script you posted earlier your complete script? It is missing lines from the start and end of the original script.
yeh thats my complete script so can you please edit my complete script please and show me here thanks again for your help.
Gavino
8th February 2009, 16:18
yeh thats my complete script so can you please edit my complete script please and show me here thanks again for your help.
All you need to do is:
1) Copy videoFred's script from post #14. Be sure to copy all of it, you will have to scroll down a few times.
2) Change the line at the start ["film = ..."] to put your movie filename in place of the original.
3) Make the changes I posted to correct line continuations (post #60).
That's it!
kopmjj
8th February 2009, 16:31
All you need to do is:
1) Copy videoFred's script from post #14. Be sure to copy all of it, you will have to scroll down a few times.
2) Change the line at the start ["film = ..."] to put your movie filename in place of the original.
3) Make the changes I posted to correct line continuations (post #60).
That's it!
hi i copied it and fixed what you said but still it says syntax error line 1.
please just save us some time and show me the complete script for me thanks. please heres my script of what you said......
film="C:\Documents and Settings\king\Desktop\New Folder\mymovie.avi.avi")
short="L" # L=long clip S=short clip try it!
result="resultS3" # specify the wanted output here
trim_begin=6 trim_end=6 play_speed=18.75 #trim frames and play speed (PAL: 16.6666 or 18.75)
saturation=1.0 #saturation
X=4 gamma=0.7 # X is a special parameter for reducing the autolevels effect
black_level=0 white_level=255 output_black=0 output_white=255 # manual levels, when returning result4
AGC_max_sat=2 AGC_max_gain=1.0 #parameters of HDRAGC filter, improves colors and shadows
blue=-4 red=2 #manual color adjustment, when returning result2. Values can be positive or negative
denoising_strenght=800 #denoising level of first denoiser: MVDegrainMulti()
denoising_frames= 4 #number of frames for averaging (forwards and backwards) 3 is a good start value
block_size= 16 #block size of MVDegrainMulti()
block_over= 4 #block overlapping of MVDegrainMulti()
temp_radius=20 temp_luma=6 temp_chroma=6 #second denoiser: TemporalSoften
grain_luma=10 grain_chroma=10
# this will add some digital grain to the final result, set it to zero if you do not want it.
LSF_sharp_ness=250 LSF_radi_us=3 LSF_sub=1.5 #first sharpening parameters (LimitedSharpenFaster) sub=subsampling
USM_sharp_ness=40 USM_radi_us=2 USM_thres_hold=0 #second sharpening parameters (UnsharpMask)
USM_sharp_ness2=20 USM_radi_us2=1 USM_thres_hold2=0 #third sharpening parameters (UnsharpMask)
maxstab=60 #maximum values for the stabiliser (in pixels) 20 is a good start value
est_left=20 est_top=20 est_right=20 est_bottom=20 est_cont=0.8 #crop values for special Estimate clip
CLeft=30 CTop=30 CRight=30 CBottom=30 #crop values after Depan and before final resizing (40,30,40,30)
W=720 H=576 #final size from the returned clip
bord_left=0 bord_top=0 bord_right=0 bord_bot=0
SetMemoryMax(1024)
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DePan.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DePanEstimate.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\HDRAGC.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\WarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LimitedSupport_09Jan06B.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MT.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\autolevels.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\AddGrainC.dll")
Import("C:\Program Files\AviSynth 2.5\Plugins\LimitedSharpenFaster.avs")
SetMTMode(5)
AVISource("C:\Documents and Settings\king\Desktop\New Folder\mymovie.avi.avi")
converttoYV12
end= source1.framecount()
end2= end-trim_end
frames=end+trim_begin
skip= end2/5
skip0=skip+3
skipend= 3
skipend1= skip0+3
skip2= skipend1+skip
skipend2= skip2+3
skip3= skipend2+skip
skipend3= skip3+3
skip4= skipend3+skip
skipend4= skip4+3
skip5= end2-3
L= trim(source1,0,end2)
LS= trim(source1,0,end2).scriptclip("""subtitle("frame "+string(trim_begin+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"\
+string(trim_end),x=100,y=60,size=32)""")
sourceT1= trim(source1,0,skipend).scriptclip("""subtitle("frame "+string(trim_begin+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)\
+" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT2= trim(source1,skip0,skipend1).scriptclip("""subtitle("frame "+string(trim_begin+skip0+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+" steps: "\
+string(skip),x=100,y=60,size=32)""")
sourceT3= trim(source1,skip2,skipend2).scriptclip("""subtitle("frame "+string(trim_begin+skip2+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+" steps:\
"+string(skip),x=100,y=60,size=32)""")
sourceT4= trim(source1,skip3,skipend3).scriptclip("""subtitle("frame "+string(trim_begin+skip3+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT5= trim(source1,skip4,skipend4).scriptclip("""subtitle("frame "+string(trim_begin+skip4+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT6= trim(source1,skip5,end2).scriptclip("""subtitle("frame "+string(trim_begin+skip5+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
SS= sourceT1+sourceT2+sourceT3+sourceT4+sourceT5+sourceT6
sourceT10= trim(source1,0,skipend)
sourceT20= trim(source1,skip0,skipend1)
sourceT30= trim(source1,skip2,skipend2)
sourceT40= trim(source1,skip3,skipend3)
sourceT50= trim(source1,skip4,skipend4)
sourceT60= trim(source1,skip5,end2)
S= sourceT10+sourceT20+sourceT30+sourceT40+sourceT50+sourceT60
stab_reference= eval(short).crop(est_left,est_top,-est_right,-est_bottom)\
.tweak(cont=est_cont).binarize(threshold=80).greyscale().invert()
mdata=DePanEstimate(stab_reference,trust=1.0,dxmax=maxstab,dymax=maxstab)
stab=DePanStabilize(eval(short),data=mdata,cutoff=0.5,dxmax=maxstab,dymax=maxstab,method=1,mirror=15)
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom).tweak(sat=saturation)
stab3=DePanStabilize(eval(short),data=mdata,cutoff=0.5,dxmax=maxstab,dymax=maxstab,method=1,info=true)
WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
vectors= stab2.MVAnalyseMulti(refframes=denoising_frames, pel=2, blksize=block_size, overlap=block_over, idx=1)
denoised= stab2.MVDegrainMulti(vectors, thSAD=denoising_strenght, SadMode=1, idx=1).tweak(sat=saturation)
leveled= denoised.HDRAGC(coef_gain=2.0,max_gain=AGC_max_gain,min_gain=0.5,max_sat=AGC_max_sat,shadows=true)
sharp1=limitedSharpenFaster(leveled,smode=1,strength=LSF_sharp_ness,overshoot=50,\
radius=LSF_radi_us, ss_X=LSF_sub, SS_Y=LSF_sub, dest_x=W,dest_y=H)
sharp2= unsharpmask(sharp1,USM_sharp_ness,USM_radi_us,USM_thres_hold)
sharpX= unsharpmask(sharp2,USM_sharp_ness2,USM_radi_us2,USM_thres_hold2)
sharp3= sharpX.TemporalSoften(temp_radius,temp_luma,temp_chroma,15,2).addgrainC(grain_luma,grain_chroma,0.2,0.2,5)
#backward_vectors = sharp3.MVAnalyse(isb = true,truemotion=true,idx=2)
#forward_vectors = sharp3.MVAnalyse(isb = false,truemotion=true,idx=2)
#frameclip=MVFlowFps(sharp3,backward_vectors, forward_vectors, num=25, den=1, ml=100, idx=2)
result1= sharp3.addborders(X,0,0,0,$FFFFFF).levels(0,gamma,255,0,255).autolevels().coloryuv(autowhite=true)\
.crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result2= sharp3.levels(black_level,gamma,white_level,0,255).coloryuv(autowhite=true)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result3= sharp3.coloryuv(off_U=blue,off_V=red).levels(0,gamma,255,0,255).addborders(X,0,0,0,$FFFFFF)\
.autolevels().crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result4= sharp3.coloryuv(off_U=blue,off_V=red).levels(black_level,gamma,white_level,0,255)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result5= overlay(eval(short),stab_reference,x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot
short2=short+"S"
source2=Lanczos4Resize(eval(short2),W2,H2)
source3=Lanczos4Resize(eval(short2),W,H)
resultS1= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result1,"autolevels, autowhite",size=28,align=2))
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",\
size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result3,"autolevels + manual color correction",\
size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result4,"manual colors and levels correction",\
size=28,align=2).histogram(mode="levels"))
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)
,subtitle(result2,"autowhite, manual levels\
correction",size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),subtitle(result3,"autolevels + manual color\
correction",size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),subtitle(result4,"manual colors and levels\
correction",size=28,align=2).histogram(mode="levels"))
result6= stackhorizontal(subtitle(result5,"baseclip for stabiliser -only the B/W clip is used",size=32,align=2)\
,subtitle(stab4,"test stabiliser: dx=horizontal, dy=vertical",size=32,align=5))
Gavino
8th February 2009, 16:39
hi i copied it and fixed what you said but still it says syntax error line 1.
...
film="C:\Documents and Settings\king\Desktop\New Folder\mymovie.avi.avi")
Why did you add a ')'?
It should not be there, that is your syntax error.
You are also missing the last line of the script:
Eval(result)
kopmjj
8th February 2009, 16:50
Why did you add a ')'?
It should not be there, that is your syntax error.
You are also missing the last line of the script:
Eval(result)
ok now it says there is no function setmtmode
again heres my script......
film="C:\Documents and Settings\king\Desktop\New Folder\mymovie.avi.avi"
short="L" # L=long clip S=short clip try it!
result="resultS3" # specify the wanted output here
trim_begin=6 trim_end=6 play_speed=18.75 #trim frames and play speed (PAL: 16.6666 or 18.75)
saturation=1.0 #saturation
X=4 gamma=0.7 # X is a special parameter for reducing the autolevels effect
black_level=0 white_level=255 output_black=0 output_white=255 # manual levels, when returning result4
AGC_max_sat=2 AGC_max_gain=1.0 #parameters of HDRAGC filter, improves colors and shadows
blue=-4 red=2 #manual color adjustment, when returning result2. Values can be positive or negative
denoising_strenght=800 #denoising level of first denoiser: MVDegrainMulti()
denoising_frames= 4 #number of frames for averaging (forwards and backwards) 3 is a good start value
block_size= 16 #block size of MVDegrainMulti()
block_over= 4 #block overlapping of MVDegrainMulti()
temp_radius=20 temp_luma=6 temp_chroma=6 #second denoiser: TemporalSoften
grain_luma=10 grain_chroma=10
# this will add some digital grain to the final result, set it to zero if you do not want it.
LSF_sharp_ness=250 LSF_radi_us=3 LSF_sub=1.5 #first sharpening parameters (LimitedSharpenFaster) sub=subsampling
USM_sharp_ness=40 USM_radi_us=2 USM_thres_hold=0 #second sharpening parameters (UnsharpMask)
USM_sharp_ness2=20 USM_radi_us2=1 USM_thres_hold2=0 #third sharpening parameters (UnsharpMask)
maxstab=60 #maximum values for the stabiliser (in pixels) 20 is a good start value
est_left=20 est_top=20 est_right=20 est_bottom=20 est_cont=0.8 #crop values for special Estimate clip
CLeft=30 CTop=30 CRight=30 CBottom=30 #crop values after Depan and before final resizing (40,30,40,30)
W=720 H=576 #final size from the returned clip
bord_left=0 bord_top=0 bord_right=0 bord_bot=0
SetMemoryMax(1024)
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DePan.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DePanEstimate.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\HDRAGC.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\WarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LimitedSupport_09Jan06B.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MT.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\autolevels.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\AddGrainC.dll")
Import("C:\Program Files\AviSynth 2.5\Plugins\LimitedSharpenFaster.avs")
SetMTMode(5)
AVISource("C:\Documents and Settings\king\Desktop\New Folder\mymovie.avi.avi")
converttoYV12
end= source1.framecount()
end2= end-trim_end
frames=end+trim_begin
skip= end2/5
skip0=skip+3
skipend= 3
skipend1= skip0+3
skip2= skipend1+skip
skipend2= skip2+3
skip3= skipend2+skip
skipend3= skip3+3
skip4= skipend3+skip
skipend4= skip4+3
skip5= end2-3
L= trim(source1,0,end2)
LS= trim(source1,0,end2).scriptclip("""subtitle("frame "+string(trim_begin+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"\
+string(trim_end),x=100,y=60,size=32)""")
sourceT1= trim(source1,0,skipend).scriptclip("""subtitle("frame "+string(trim_begin+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)\
+" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT2= trim(source1,skip0,skipend1).scriptclip("""subtitle("frame "+string(trim_begin+skip0+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+" steps: "\
+string(skip),x=100,y=60,size=32)""")
sourceT3= trim(source1,skip2,skipend2).scriptclip("""subtitle("frame "+string(trim_begin+skip2+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+" steps:\
"+string(skip),x=100,y=60,size=32)""")
sourceT4= trim(source1,skip3,skipend3).scriptclip("""subtitle("frame "+string(trim_begin+skip3+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT5= trim(source1,skip4,skipend4).scriptclip("""subtitle("frame "+string(trim_begin+skip4+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT6= trim(source1,skip5,end2).scriptclip("""subtitle("frame "+string(trim_begin+skip5+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
SS= sourceT1+sourceT2+sourceT3+sourceT4+sourceT5+sourceT6
sourceT10= trim(source1,0,skipend)
sourceT20= trim(source1,skip0,skipend1)
sourceT30= trim(source1,skip2,skipend2)
sourceT40= trim(source1,skip3,skipend3)
sourceT50= trim(source1,skip4,skipend4)
sourceT60= trim(source1,skip5,end2)
S= sourceT10+sourceT20+sourceT30+sourceT40+sourceT50+sourceT60
stab_reference= eval(short).crop(est_left,est_top,-est_right,-est_bottom)\
.tweak(cont=est_cont).binarize(threshold=80).greyscale().invert()
mdata=DePanEstimate(stab_reference,trust=1.0,dxmax=maxstab,dymax=maxstab)
stab=DePanStabilize(eval(short),data=mdata,cutoff=0.5,dxmax=maxstab,dymax=maxstab,method=1,mirror=15)
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom).tweak(sat=saturation)
stab3=DePanStabilize(eval(short),data=mdata,cutoff=0.5,dxmax=maxstab,dymax=maxstab,method=1,info=true)
WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
vectors= stab2.MVAnalyseMulti(refframes=denoising_frames, pel=2, blksize=block_size, overlap=block_over, idx=1)
denoised= stab2.MVDegrainMulti(vectors, thSAD=denoising_strenght, SadMode=1, idx=1).tweak(sat=saturation)
leveled= denoised.HDRAGC(coef_gain=2.0,max_gain=AGC_max_gain,min_gain=0.5,max_sat=AGC_max_sat,shadows=true)
sharp1=limitedSharpenFaster(leveled,smode=1,strength=LSF_sharp_ness,overshoot=50,\
radius=LSF_radi_us, ss_X=LSF_sub, SS_Y=LSF_sub, dest_x=W,dest_y=H)
sharp2= unsharpmask(sharp1,USM_sharp_ness,USM_radi_us,USM_thres_hold)
sharpX= unsharpmask(sharp2,USM_sharp_ness2,USM_radi_us2,USM_thres_hold2)
sharp3= sharpX.TemporalSoften(temp_radius,temp_luma,temp_chroma,15,2).addgrainC(grain_luma,grain_chroma,0.2,0.2,5)
#backward_vectors = sharp3.MVAnalyse(isb = true,truemotion=true,idx=2)
#forward_vectors = sharp3.MVAnalyse(isb = false,truemotion=true,idx=2)
#frameclip=MVFlowFps(sharp3,backward_vectors, forward_vectors, num=25, den=1, ml=100, idx=2)
result1= sharp3.addborders(X,0,0,0,$FFFFFF).levels(0,gamma,255,0,255).autolevels().coloryuv(autowhite=true)\
.crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result2= sharp3.levels(black_level,gamma,white_level,0,255).coloryuv(autowhite=true)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result3= sharp3.coloryuv(off_U=blue,off_V=red).levels(0,gamma,255,0,255).addborders(X,0,0,0,$FFFFFF)\
.autolevels().crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result4= sharp3.coloryuv(off_U=blue,off_V=red).levels(black_level,gamma,white_level,0,255)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result5= overlay(eval(short),stab_reference,x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot
short2=short+"S"
source2=Lanczos4Resize(eval(short2),W2,H2)
source3=Lanczos4Resize(eval(short2),W,H)
resultS1= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result1,"autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result3,"autolevels + manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result4,"manual colors and levels correction",size=28,align=2))
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",\
size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result3,"autolevels + manual color correction",\
size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result4,"manual colors and levels correction",\
size=28,align=2).histogram(mode="levels"))
result6= stackhorizontal(subtitle(result5,"baseclip for stabiliser -only the B/W clip is used",size=32,align=2)\
,subtitle(stab4,"test stabiliser: dx=horizontal, dy=vertical",size=32,align=5))
Eval(result)
Gavino
8th February 2009, 17:09
ok now it says there is no function setmtmode
For that, you need to install the amended avisynth.dll (see the MT (http://avisynth.org/mediawiki/MT)docs).
However, a quick fix for now would be just to remove the SetMTMode line.
The script should then work, though it may be slower.
kopmjj
8th February 2009, 17:34
For that, you need to install the amended avisynth.dll (see the MT (http://avisynth.org/mediawiki/MT)docs).
However, a quick fix for now would be just to remove the SetMTMode line.
The script should then work, though it may be slower.
nah still not working 1st it said ffwt3.dll was missing so then i fixed that now it says it doesnt know what method means on line 128.
so please please show me a complete script rather than telling me what to fix cause one thing is fixed then other is not , it will be so much easy if you show the full script. thanks.
kopmjj
8th February 2009, 18:03
please someone upload a full working script please thanks.
Gavino
8th February 2009, 18:08
it doesnt know what method means on line 128.
so please please show me a complete script rather than telling me what to fix..
You have the full script now, but perhaps you do not have the right version of all the plugins. The line giving you problems is a call to DepanStabilize.
Can videoFred (or anyone else who has actually run his script) help out here with a list of plugin versions required?
kopmjj
8th February 2009, 18:56
fred can you please upload your plugins folder and your script or edit my script thanks
Fizick
8th February 2009, 19:15
kopmjj,
1. please use CODE tag for scripts (like videofred did).
2. please learn avisynth scripting (start with simple scripts), read docs and this forum.
3. It is complex script, and it may have many variants and modifications.
kopmjj
8th February 2009, 19:24
kopmjj,
3. It is complex script, and it may have many variants and modifications.
ok thanks im trying to learn but its hard, but this is the main function or script i need cause this is awesome the way the video has been transformed.
i know it may have variants and modifications i should be able to deal with that, i just want a working script that someone has managed to do.
if anyone has worked on a video can you show me your script so i can understand.
thats all im asking please thanks.
tekNerd
8th February 2009, 20:11
I would love me some of this avisynth power for some of my dv footage. I tried some other scripts that I found, but there are too simple, stuff that I could do with Virtualdub or Avidemux.
mikkop
8th February 2009, 23:57
Hi,
After i made some adjusments i now get this message:
Avisynth open failure: The script's return value was not a video clip
Can someone tell me what this means and how to solve it?
Thnx, Michael
Gavino
9th February 2009, 00:29
Avisynth open failure: The script's return value was not a video clip
Can someone tell me what this means and how to solve it?
Either you have left out the last line in the script: Eval(result)
or you have deleted or changed the value of result or resultS3.
videoFred
9th February 2009, 07:36
Can videoFred (or anyone else who has actually run his script) help out here with a list of plugin versions required?
Hi Gavino,
Thanks a lot for all the good support here while I was not here. ;)
@Everybody:
This is not a simple beginners script. Gavino was right: I have reorganized it for posting here and I have made some "\" mistakes.. sorry for that. :scared:
I will make a list from the required plugins as soon as possible.
Fred.
videoFred
9th February 2009, 07:45
so please please show me a complete script rather than telling me what to fix cause one thing is fixed then other is not , it will be so much easy if you show the full script. thanks.
Take it easy man. There *is* a complete script, I have posted it, have I not? Just fix the "\" errors like Gavino has told you.
The rest is just a matter of having the right plugin versions.
Fred.
kopmjj
9th February 2009, 12:13
Take it easy man. There *is* a complete script, I have posted it, have I not? Just fix the "\" errors like Gavino has told you.
The rest is just a matter of having the right plugin versions.
Fred.
can you please upload your plugins then thanks
videoFred
9th February 2009, 12:28
can you please upload your plugins then thanks
No, plugins can not be uploaded. It's against the rules.
You will have to download them from the original source :D
What errors do you get, Kopmjj?
Fred.
kopmjj
9th February 2009, 12:33
No, plugins can not be uploaded. It's against the rules.
You will have to download them from the original source :D
What errors do you get, Kopmjj?
Fred.
depanstablise does not have a name method line 128 something like that
kopmjj
9th February 2009, 12:38
here my entire script...
film="C:\Documents and Settings\king\Desktop\New Folder\mymovie.avi.avi"
short="L" # L=long clip S=short clip try it!
result="resultS3" # specify the wanted output here
trim_begin=6 trim_end=6 play_speed=18.75 #trim frames and play speed (PAL: 16.6666 or 18.75)
saturation=1.0 #saturation
X=4 gamma=0.7 # X is a special parameter for reducing the autolevels effect
black_level=0 white_level=255 output_black=0 output_white=255 # manual levels, when returning result4
AGC_max_sat=2 AGC_max_gain=1.0 #parameters of HDRAGC filter, improves colors and shadows
blue=-4 red=2 #manual color adjustment, when returning result2. Values can be positive or negative
denoising_strenght=800 #denoising level of first denoiser: MVDegrainMulti()
denoising_frames= 4 #number of frames for averaging (forwards and backwards) 3 is a good start value
block_size= 16 #block size of MVDegrainMulti()
block_over= 4 #block overlapping of MVDegrainMulti()
temp_radius=20 temp_luma=6 temp_chroma=6 #second denoiser: TemporalSoften
grain_luma=10 grain_chroma=10
# this will add some digital grain to the final result, set it to zero if you do not want it.
LSF_sharp_ness=250 LSF_radi_us=3 LSF_sub=1.5 #first sharpening parameters (LimitedSharpenFaster) sub=subsampling
USM_sharp_ness=40 USM_radi_us=2 USM_thres_hold=0 #second sharpening parameters (UnsharpMask)
USM_sharp_ness2=20 USM_radi_us2=1 USM_thres_hold2=0 #third sharpening parameters (UnsharpMask)
maxstab=60 #maximum values for the stabiliser (in pixels) 20 is a good start value
est_left=20 est_top=20 est_right=20 est_bottom=20 est_cont=0.8 #crop values for special Estimate clip
CLeft=30 CTop=30 CRight=30 CBottom=30 #crop values after Depan and before final resizing (40,30,40,30)
W=720 H=576 #final size from the returned clip
bord_left=0 bord_top=0 bord_right=0 bord_bot=0
SetMemoryMax(1024)
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DePan.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DePanEstimate.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\HDRAGC.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\WarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LimitedSupport_09Jan06B.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MT.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\autolevels.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\AddGrainC.dll")
Import("C:\Program Files\AviSynth 2.5\Plugins\LimitedSharpenFaster.avs")
source1= Avisource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
end= source1.framecount()
end2= end-trim_end
frames=end+trim_begin
skip= end2/5
skip0=skip+3
skipend= 3
skipend1= skip0+3
skip2= skipend1+skip
skipend2= skip2+3
skip3= skipend2+skip
skipend3= skip3+3
skip4= skipend3+skip
skipend4= skip4+3
skip5= end2-3
L= trim(source1,0,end2)
LS= trim(source1,0,end2).scriptclip("""subtitle("frame "+string(trim_begin+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"\
+string(trim_end),x=100,y=60,size=32)""")
sourceT1= trim(source1,0,skipend).scriptclip("""subtitle("frame "+string(trim_begin+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)\
+" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT2= trim(source1,skip0,skipend1).scriptclip("""subtitle("frame "+string(trim_begin+skip0+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+" steps: "\
+string(skip),x=100,y=60,size=32)""")
sourceT3= trim(source1,skip2,skipend2).scriptclip("""subtitle("frame "+string(trim_begin+skip2+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+" steps:\
"+string(skip),x=100,y=60,size=32)""")
sourceT4= trim(source1,skip3,skipend3).scriptclip("""subtitle("frame "+string(trim_begin+skip3+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT5= trim(source1,skip4,skipend4).scriptclip("""subtitle("frame "+string(trim_begin+skip4+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT6= trim(source1,skip5,end2).scriptclip("""subtitle("frame "+string(trim_begin+skip5+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
SS= sourceT1+sourceT2+sourceT3+sourceT4+sourceT5+sourceT6
sourceT10= trim(source1,0,skipend)
sourceT20= trim(source1,skip0,skipend1)
sourceT30= trim(source1,skip2,skipend2)
sourceT40= trim(source1,skip3,skipend3)
sourceT50= trim(source1,skip4,skipend4)
sourceT60= trim(source1,skip5,end2)
S= sourceT10+sourceT20+sourceT30+sourceT40+sourceT50+sourceT60
stab_reference= eval(short).crop(est_left,est_top,-est_right,-est_bottom)\
.tweak(cont=est_cont).binarize(threshold=80).greyscale().invert()
mdata=DePanEstimate(stab_reference,trust=1.0,dxmax=maxstab,dymax=maxstab)
stab=DePanStabilize(eval(short),data=mdata,cutoff=0.5,dxmax=maxstab,dymax=maxstab,method=1,mirror=15)
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom).tweak(sat=saturation)
stab3=DePanStabilize(eval(short),data=mdata,cutoff=0.5,dxmax=maxstab,dymax=maxstab,method=1,info=true)
WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
vectors= stab2.MVAnalyseMulti(refframes=denoising_frames, pel=2, blksize=block_size, overlap=block_over, idx=1)
denoised= stab2.MVDegrainMulti(vectors, thSAD=denoising_strenght, SadMode=1, idx=1).tweak(sat=saturation)
leveled= denoised.HDRAGC(coef_gain=2.0,max_gain=AGC_max_gain,min_gain=0.5,max_sat=AGC_max_sat,shadows=true)
sharp1=limitedSharpenFaster(leveled,smode=1,strength=LSF_sharp_ness,overshoot=50,\
radius=LSF_radi_us, ss_X=LSF_sub, SS_Y=LSF_sub, dest_x=W,dest_y=H)
sharp2= unsharpmask(sharp1,USM_sharp_ness,USM_radi_us,USM_thres_hold)
sharpX= unsharpmask(sharp2,USM_sharp_ness2,USM_radi_us2,USM_thres_hold2)
sharp3= sharpX.TemporalSoften(temp_radius,temp_luma,temp_chroma,15,2).addgrainC(grain_luma,grain_chroma,0.2,0.2,5)
#backward_vectors = sharp3.MVAnalyse(isb = true,truemotion=true,idx=2)
#forward_vectors = sharp3.MVAnalyse(isb = false,truemotion=true,idx=2)
#frameclip=MVFlowFps(sharp3,backward_vectors, forward_vectors, num=25, den=1, ml=100, idx=2)
result1= sharp3.addborders(X,0,0,0,$FFFFFF).levels(0,gamma,255,0,255).autolevels().coloryuv(autowhite=true)\
.crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result2= sharp3.levels(black_level,gamma,white_level,0,255).coloryuv(autowhite=true)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result3= sharp3.coloryuv(off_U=blue,off_V=red).levels(0,gamma,255,0,255).addborders(X,0,0,0,$FFFFFF)\
.autolevels().crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result4= sharp3.coloryuv(off_U=blue,off_V=red).levels(black_level,gamma,white_level,0,255)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result5= overlay(eval(short),stab_reference,x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot
short2=short+"S"
source2=Lanczos4Resize(eval(short2),W2,H2)
source3=Lanczos4Resize(eval(short2),W,H)
resultS1= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result1,"autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result3,"autolevels + manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result4,"manual colors and levels correction",size=28,align=2))
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",\
size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result3,"autolevels + manual color correction",\
size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result4,"manual colors and levels correction",\
size=28,align=2).histogram(mode="levels"))
result6= stackhorizontal(subtitle(result5,"baseclip for stabiliser -only the B/W clip is used",size=32,align=2)\
,subtitle(stab4,"test stabiliser: dx=horizontal, dy=vertical",size=32,align=5))
Eval(result)[/PHP]
videoFred
9th February 2009, 12:50
depanstablise does not have a name method line 128 something like that
Simple, I assume you are using an older version from Depan(). Just remove this (twice) "method=1".
Or better, download the newest Depan() version. But I see Fizicks website is nor working for now??
Fred.
raeltheimperialaerosolkid
9th February 2009, 13:31
Hi videofred!
Thanks for this incredible script! I have a lot of 8mm film left from my dad that I would like to manage in my PC. After losing a bit of time in trying to make your script working (well, I could make it work with the patch suggested before for MVtools2 and not your original), now I'm facing a different kind of problem that is probably OT here: the quality of my source. The 8mm footage that I have spans form a long period (1965-1987... wow...22 years...) but they are in a poor condition. I made a first try in converting them paying a guy that, IMO, made a very bad job. With that conversion in my hands I could give a little better look to the film thorugh your script but, hey... still is very poor. Now I would like to make a new "conversion" Analog-->digital but I'm very confused on all the procedures and machines involved in the process. Is there a guide or something like that where I could look to? The restoration that you showed in your site is incredible but your source material is in waaaaay better condition than mine.
videoFred
9th February 2009, 13:46
After losing a bit of time in trying to make your script working (well, I could make it work with the patch suggested before for MVtools2 and not your original),
Hello Rael, (no, I am not going to repeat your full name :p )
To use my original script, you need the special modified MVTools with the 'multi' support. It can be found here on the forum.
the quality of my source. The 8mm footage that I have spans form a long period (1965-1987... wow...22 years...) but they are in a poor condition.
It could be the original but it could also be a bad transfer. I can only judge this if you would send me a sample piece of film.
You can always send me a PM...
Fred.
Fizick
9th February 2009, 18:14
videoFred,
may it is better to add some word about "8mm film" to the title of this thead?
to decrease mess with usual video. :)
videoFred
9th February 2009, 18:24
Fizick: title is fixed ;)
PS: what's wrong with your webspace??
Fred.
mikkop
19th February 2009, 22:14
hello,
I finaly have the script working but can't figur out how to get just the final video without the split screen and text can someone please help me.
thnx for the great script fred,
Michael
tedkunich
19th February 2009, 22:21
hello,
I finaly have the script working but can't figur out how to get just the final video without the split screen and text can someone please help me.
thnx for the great script fred,
Michael
Look at the end of the script:
result1 = "autolevels, autowhite"
result2 = "autowhite, manual levels correction"
result3 = "autolevels + manual color correction"
result4 = "manual colors and levels correction"
MadRat
22nd February 2009, 10:49
Wow, that's really impressive color adjustment! I was kind of surprised no one mentioned RemoveDirtMC() which removes dirt and dust specks that are only found on one frame of the video. I noticed some specks while watching your video. The link is http://forum.doom9.org/showthread.php?t=110078 There's also a scratch removal script that is supposed to remove dark vertical lines caused by scratches in the film but I've never tried it. I'm going to go watch your video again. :D :goodpost:
mikkop
22nd February 2009, 15:01
[CODE]Look at the end of the script:
Code:
result1 = "autolevels, autowhite"
result2 = "autowhite, manual levels correction"
result3 = "autolevels + manual color correction"
result4 = "manual colors and levels correction"/CODE]
Thanks for the answer,
I stil have a question. I wan't the same result as the outcome of the oiginal scrip (clip on the right). When i chane the script line at end into "return (result1)" or 2,3,4 the results are not so good as the original. the clip is shaking and in the original it is realy steady. Can you please tell me what i am doing wrong or what i shoot do to get the same result.
Thx, Michael
videoFred
23rd February 2009, 07:34
the clip is shaking and in the original it is realy steady. Can you please tell me what i am doing wrong or what i shoot do to get the same result.
Thx, Michael
Hello Michael,
You are not doing anything wrong. If your original clip is steady, then there is no need to stabilize it. Please set "maxstab" to zero. Probably the stabilizer tries to follow a moving object in your clip.
I have made an option "result6" to check this.
Fred.
mikkop
23rd February 2009, 13:04
Hi fred,
With original i ment the clip on the right in your script. My Original footage (on the left in the splitscreen) is shaking but whith your filters (on the right in the splitscreen) it became realy steady. When i adjust the script (see code) the result is still shaking and not so good as the clip on the right in your script.
Sorry for bothering you.
Michael
result1= sharp3.addborders(X,0,0,0,$FFFFFF).levels(0,gamma,255,0,255).autolevels().coloryuv(autowhite=true)\
.crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result2= sharp3.levels(black_level,gamma,white_level,0,255).coloryuv(autowhite=true)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result3= sharp3.coloryuv(off_U=blue,off_V=red).levels(0,gamma,255,0,255).addborders(X,0,0,0,$FFFFFF)\
.autolevels().crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result4= sharp3.coloryuv(off_U=blue,off_V=red).levels(black_level,gamma,white_level,0,255)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result5= overlay(eval(short),stab_reference,x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot
short2=short+"S"
source2=Lanczos4Resize(eval(short2),W2,H2)
source3=Lanczos4Resize(eval(short2),W,H)
resultS1= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result1,"autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result3,"autolevels + manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result4,"manual colors and levels correction",size=28,align=2))
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",\
size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result3,"autolevels + manual color correction",\
size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result4,"manual colors and levels correction",\
size=28,align=2).histogram(mode="levels"))
result6= stackhorizontal(subtitle(result5,"baseclip for stabiliser -only the B/W clip is used",size=32,align=2)\
,subtitle(stab4,"test stabiliser: dx=horizontal, dy=vertical",size=32,align=5))
return (result1)
videoFred
23rd February 2009, 13:22
Sorry for bothering you.
Michael, you are not bothering me at all but please stop posting half scripts. Where is the other half? :)
Why have you changed my script anyhow? The only things you must change are the parameters on top of the script.
What you say is impossible anyhow. If the right window on the spitscreen is OK then the output must be ok to. It is the very same clip...
Fred.
mikkop
23rd February 2009, 14:16
Here's the full script
film="C:\Documents and Settings\Michael\Mijn documenten\Downloads\filmdenoise\filmtest nieuw\alldepp2_15_16_fps.avi" # source clip, you must specify the full path here
short="L" # L=long clip S=short clip try it!
result="resultS3" # specify the wanted output here
trim_begin=6 trim_end=6 play_speed=18.75 #trim frames and play speed (PAL: 16.6666 or 18.75)
saturation=1.0 #saturation
X=4 gamma=0.7 # X is a special parameter for reducing the autolevels effect
black_level=0 white_level=255 output_black=0 output_white=255 # manual levels, when returning result4
AGC_max_sat=2 AGC_max_gain=1.0 #parameters of HDRAGC filter, improves colors and shadows
blue=-4 red=2 #manual color adjustment, when returning result2. Values can be positive or negative
denoising_strenght=800 #denoising level of first denoiser: MVDegrainMulti()
denoising_frames= 4 #number of frames for averaging (forwards and backwards) 3 is a good start value
block_size= 16 #block size of MVDegrainMulti()
block_over= 4 #block overlapping of MVDegrainMulti()
temp_radius=20 temp_luma=6 temp_chroma=6 #second denoiser: TemporalSoften
grain_luma=10 grain_chroma=10
# this will add some digital grain to the final result, set it to zero if you do not want it.
LSF_sharp_ness=250 LSF_radi_us=3 LSF_sub=1.5 #first sharpening parameters (LimitedSharpenFaster) sub=subsampling
USM_sharp_ness=40 USM_radi_us=2 USM_thres_hold=0 #second sharpening parameters (UnsharpMask)
USM_sharp_ness2=20 USM_radi_us2=1 USM_thres_hold2=0 #third sharpening parameters (UnsharpMask)
maxstab=60 #maximum values for the stabiliser (in pixels) 20 is a good start value
est_left=20 est_top=20 est_right=20 est_bottom=20 est_cont=0.8 #crop values for special Estimate clip
CLeft=30 CTop=30 CRight=30 CBottom=30 #crop values after Depan and before final resizing (40,30,40,30)
W=720 H=576 #final size from the returned clip
bord_left=0 bord_top=0 bord_right=0 bord_bot=0
#you can add black borders after resizing, final size is then size + borders!!
# End variables, begin script
#====================================================================================================
SetMemoryMax(1024) #set this to 1/3 of the available memory
Loadplugin("Depan.dll")
LoadPlugin("DepanEstimate.dll")
Loadplugin("removegrain.dll")
LoadPlugin("AGC.dll")
LoadPlugin("MVTools.dll")
Loadplugin("mt_masktools.dll")
LoadPlugin("MaskTools.dll")
Loadplugin("warpsharp.dll")
LoadPlugIn("LimitedSupport_09Jan06B.dll")
LoadPlugin("MT.dll")
LoadPlugin("autolevels.dll")
LoadPlugin("AddGrainC.dll")
Import("LimitedSharpenFaster.avs")
source1= Avisource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
end= source1.framecount()
end2= end-trim_end
frames=end+trim_begin
skip= end2/5
skip0=skip+3
skipend= 3
skipend1= skip0+3
skip2= skipend1+skip
skipend2= skip2+3
skip3= skipend2+skip
skipend3= skip3+3
skip4= skipend3+skip
skipend4= skip4+3
skip5= end2-3
L= trim(source1,0,end2)
LS= trim(source1,0,end2).scriptclip("""subtitle("frame "+string(trim_begin+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"\
+string(trim_end),x=100,y=60,size=32)""")
sourceT1= trim(source1,0,skipend).scriptclip("""subtitle("frame "+string(trim_begin+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)\
+" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT2= trim(source1,skip0,skipend1).scriptclip("""subtitle("frame "+string(trim_begin+skip0+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+" steps: "\
+string(skip),x=100,y=60,size=32)""")
sourceT3= trim(source1,skip2,skipend2).scriptclip("""subtitle("frame "+string(trim_begin+skip2+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+" steps:\
"+string(skip),x=100,y=60,size=32)""")
sourceT4= trim(source1,skip3,skipend3).scriptclip("""subtitle("frame "+string(trim_begin+skip3+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT5= trim(source1,skip4,skipend4).scriptclip("""subtitle("frame "+string(trim_begin+skip4+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
sourceT6= trim(source1,skip5,end2).scriptclip("""subtitle("frame "+string(trim_begin+skip5+current_frame)\
+" from "+string(frames)+" trim_begin-"+string(trim_begin)+" trim_end-"+string(trim_end)+\
" steps: "+string(skip),x=100,y=60,size=32)""")
SS= sourceT1+sourceT2+sourceT3+sourceT4+sourceT5+sourceT6
sourceT10= trim(source1,0,skipend)
sourceT20= trim(source1,skip0,skipend1)
sourceT30= trim(source1,skip2,skipend2)
sourceT40= trim(source1,skip3,skipend3)
sourceT50= trim(source1,skip4,skipend4)
sourceT60= trim(source1,skip5,end2)
S= sourceT10+sourceT20+sourceT30+sourceT40+sourceT50+sourceT60
stab_reference= eval(short).crop(est_left,est_top,-est_right,-est_bottom)\
.tweak(cont=est_cont).binarize(threshold=80).greyscale().invert()
mdata=DePanEstimate(stab_reference,trust=1.0,dxmax=maxstab,dymax=maxstab)
stab=DePanStabilize(eval(short),data=mdata,cutoff=0.5,dxmax=maxstab,dymax=maxstab,method=1,mirror=15)
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom).tweak(sat=saturation)
stab3=DePanStabilize(eval(short),data=mdata,cutoff=0.5,dxmax=maxstab,dymax=maxstab,method=1,info=true)
WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
vectors= stab2.MVAnalyseMulti(refframes=denoising_frames, pel=2, blksize=block_size, overlap=block_over, idx=1)
denoised= stab2.MVDegrainMulti(vectors, thSAD=denoising_strenght, SadMode=1, idx=1).tweak(sat=saturation)
leveled= denoised.HDRAGC(coef_gain=2.0,max_gain=AGC_max_gain,min_gain=0.5,max_sat=AGC_max_sat,shadows=true)
sharp1=limitedSharpenFaster(leveled,smode=1,strength=LSF_sharp_ness,overshoot=50,\
radius=LSF_radi_us, ss_X=LSF_sub, SS_Y=LSF_sub, dest_x=W,dest_y=H)
sharp2= unsharpmask(sharp1,USM_sharp_ness,USM_radi_us,USM_thres_hold)
sharpX= unsharpmask(sharp2,USM_sharp_ness2,USM_radi_us2,USM_thres_hold2)
sharp3= sharpX.TemporalSoften(temp_radius,temp_luma,temp_chroma,15,2).addgrainC(grain_luma,grain_chroma,0.2,0.2,5)
#backward_vectors = sharp3.MVAnalyse(isb = true,truemotion=true,idx=2)
#forward_vectors = sharp3.MVAnalyse(isb = false,truemotion=true,idx=2)
#frameclip=MVFlowFps(sharp3,backward_vectors, forward_vectors, num=25, den=1, ml=100, idx=2)
result1= sharp3.addborders(X,0,0,0,$FFFFFF).levels(0,gamma,255,0,255).autolevels().coloryuv(autowhite=true)\
.crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result2= sharp3.levels(black_level,gamma,white_level,0,255).coloryuv(autowhite=true)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result3= sharp3.coloryuv(off_U=blue,off_V=red).levels(0,gamma,255,0,255).addborders(X,0,0,0,$FFFFFF)\
.autolevels().crop(X,0,-0,-0).addborders(bord_left, bord_top, bord_right, bord_bot)
result4= sharp3.coloryuv(off_U=blue,off_V=red).levels(black_level,gamma,white_level,0,255)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
result5= overlay(eval(short),stab_reference,x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot
short2=short+"S"
source2=Lanczos4Resize(eval(short2),W2,H2)
source3=Lanczos4Resize(eval(short2),W,H)
resultS1= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result1,"autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result3,"autolevels + manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result4,"manual colors and levels correction",size=28,align=2))
resultS2H= stackhorizontal(subtitle(source2,"original",size=32,align=2)\
,subtitle(result2,"autowhite, manual levels correction",\
size=28,align=2).histogram(mode="levels"))
resultS3H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result3,"autolevels + manual color correction",\
size=28,align=2).histogram(mode="levels"))
resultS4H= stackhorizontal(subtitle(source2,"original",size=32,align=2),\
subtitle(result4,"manual colors and levels correction",\
size=28,align=2).histogram(mode="levels"))
result6= stackhorizontal(subtitle(result5,"baseclip for stabiliser -only the B/W clip is used",size=32,align=2)\
,subtitle(stab4,"test stabiliser: dx=horizontal, dy=vertical",size=32,align=5))
return (result1)
Fred,
The only thing i changed is the 1 line (film) , setmode (removed) and the last line return instead of eval.
When i use return1 does it use al the filters then?
Thnx, Michael
videoFred
23rd February 2009, 16:06
.
When i use return1 does it use al the filters then?
Michael,
All returned clips should be stabilized. There is no difference in stabilizing between return1 , return2 etc...
The difference is in the levels and color corrections.
'resultS1' will return a double window with clip 'result1' on the right and the source on the left.
'result1' will return clip 'result1' only.
There is no difference, in both cases you will see clip 'result1'
I realy do not understand your problem, what difference do you see exactly?
Fred.
Gavino
23rd February 2009, 16:40
The only thing i changed is the 1 line (film) , setmode (removed) and the last line return instead of eval.
The way Fred has set up the script, the idea is that instead of changing the last line from eval, you instead change the value of 'result' to be the name of the result you want, eg
result = "result1"
(where it says "specify the wanted output here")
It comes to the same thing of course, but that way you only change the parameter section at the start, not the main body of the script.
videoFred
23rd February 2009, 17:02
Yes, this 'eval' was a hint from you, if I remember well Gavino :thanks:
Fred.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.