PDA

View Full Version : The power of Avisynth: restoring old 8mm films.


videoFred
14th January 2009, 10:18
==================================================================
*EDIT*
Update 17/09/2009:
New improved version version of the script, it can be downloaded from here:
http://www.64k.it/andres/data/f/film_restoration_v03.rar


This is a full package with all needed plugins, source code included.
With special thanks to buzzqw for helping me with this.

I have also added a small helpfile (not finished yet)
The code is cleaned up, and the script needs less plugins now.
Both sharpening and denoising are improved, too.

Lots of frames, generated with the improved script, can be found on my website.
Please keep always in mind: this is real 8mm film, no video, no digital tape.
==================================================================




I have posted an example clip on Vimeo to show the people the incredible power of Avisynth.

http://www.vimeo.com/2823934

With special thanks to Fizick, Didée, Manao for making these exellent plugins available for all of us. :thanks:

Special thanks to Josey_Wells too for the multithreaded version.
Averaging more then 4 frames in MVDegrainMulti() works very well for removing film dirt spots.

The example clip is showing the result of a special film restoring script I have made.

The filmtransfer itself was done by me, but that film needs a second wetgate transfer.
There was a dirt spot on the CCD from my camera too. But that's easy enough to fix.

I just could not wait to show you all these first results. :p

Fred.

mikeytown2
14th January 2009, 13:51
Awesome vid, thats quite amazing! It really shows the power of AviSynth. What did you use to stabilize the image, Deshaker?

As a side note, I think AviSynth could use more promotion and how-to's.
http://forum.doom9.org/showthread.php?t=142451

videoFred
14th January 2009, 14:01
What did you use to stabilize the image, Deshaker?

DepanStabilize() of cource! The script does everything in one pass. But I use a special service clip for DepanEstimate().

Fred.

halsboss
14th January 2009, 14:03
Nice Job. Yes, what stabilisation ? Also, could you please post some of your scripts ? It'd be of use to the DV camcorder user base too :) Thanks.

ankurs
14th January 2009, 14:08
awesome work !

i'd love to see the script :P

Blue_MiSfit
14th January 2009, 17:38
Very nice!!

~Misfit

sumawo13
14th January 2009, 17:59
Excellent work.

videoFred
14th January 2009, 18:34
Thank you all for the kind words so far. :p

I will post the script here as soon as possible.

Fred.

NerdWithNoLife
14th January 2009, 19:31
It really is a fantastic demonstration. AviSynth is severely overlooked. I've seen other forums, where basically the advice goes like this: get a Mac. Get Final Cut Pro. Buy expensive stuff. But on the fundamentals of video and compression, the majority of people are clueless. I know a guy who works on video all the time (he's the video guy for a local institution) and he didn't know that film is 24fps and US TV is [approximately] 30. I don't say this to slam anyone, for we're all students at some level, it's just a shame they aren't getting more out of software/equipment that can cost thousands. Not every video should be processed with the same one-size-fits-all settings.

Wilbert
14th January 2009, 20:40
@videoFred,

I think it would be a great idea to write a guide about this subject on avisynth.org (ie about restoring old 8mm films)! I hope you are interested and i will help you if necessary.

EuropeanMan
14th January 2009, 21:32
wow - just saw the clip - AMAZING - specially the trains...what a difference

can't wait to see the script and the tools for your colour corrections.

videoFred
15th January 2009, 07:22
AviSynth is severely overlooked.

Yes it is! That's why I have uploaded this clip on Vimeo in the first place. :)
The second reason was to show the quality from the old double-8mm film system.

Fred.

videoFred
15th January 2009, 07:24
I think it would be a great idea to write a guide about this subject on avisynth.org

OK Wilbert, I will send you a PM.

Fred.

videoFred
15th January 2009, 14:20
*EDIT 16/09/2009*
The updated script is available for download now.
Please see top of this thread.

jollye
15th January 2009, 15:48
Hi,

That's really an amazing result. However I've noticed that when we pause the movie (for example on the cactus trees), there seem to be no details in the source. As it's impossible to get details that weren't present in the original, I suspect it's a compression side effect. It looks as if the original image is more compressed than the processed one.

Do you have an explanation?

Thanks

videoFred
15th January 2009, 17:23
Hello Jollye,

The old double-8mm film frame format is very tiny: 4.20x3.60mm. And because of the used anamorphic lens, that film was not so sharp to begin with. I have seen better. Second, I have captured the film with gamma set pretty high on my machine vision camera. It's a trick to be able to capture the dynamic range of real film.

So yes, the compression from my mpeg4 example clip is removing some detail from the original indeed.


Fred.

smok3
15th January 2009, 19:45
So yes, the compression from my mpeg4 example clip is removing some detail from the original indeed.
Fred.

And you were doing so well..., you do understand that this single fact actually breaks all the 'movie magic' ? :)

tedkunich
16th January 2009, 06:20
Here is the script:

# film restoring script by videoFred.

CLeft=30 CTop=30 CRight=30 CBottom=30 #crop values after Depan and before final resizing (40,30,40,30)



All suggestions to improve it are welcome.

Fred.

Fred,

One recommendation is to make the crop values multiples of 8 - LSF corrupts the output with the non-mod8 crop. (at least with my original 1008x1008 source (cropped HDV cam output))

I'm looking to replace the MVxxxMulti calls with Fizick's MVToolsV2 equivalents ;)

Thanks again.

Ted

videoFred
16th January 2009, 07:48
One recommendation is to make the crop values multiples of 8 - LSF corrupts the output with the non-mod8 crop.

Good hint! I did not realise this because it works without error messages. My machine camera source is 1024x768. When cropping 30 pixels on each side I get 964x708. But 960x704 would be better indeed. I will test this at once.


I'm looking to replace the MVxxxMulti calls with Fizick's MVToolsV2 equivalents ;)

I have several versions of the script here, including with MVToolsV2.. with the 'super' clip. Works very fine too.

Thank you Ted and more tips are very welcome.

Fred.

videoFred
16th January 2009, 07:56
And you were doing so well..., you do understand that this single fact actually breaks all the 'movie magic' ? :)

It's an internet upload! Easy to download for everybody.

It shows very well the effect from the script. :)

Fred.

Didée
16th January 2009, 09:00
LSF does not impose any modulo restrictions on its input. Even modulo 2 is enough for LSF. Just tried it, and there's no "image corruption" coming up.

tedkunich
16th January 2009, 16:17
LSF does not impose any modulo restrictions on its input. Even modulo 2 is enough for LSF. Just tried it, and there's no "image corruption" coming up.

Hmmm... For some reason it was causing diagonal lines of black across the image.

This is a test run of a sample cap I have (ignore the dirt and out of focus - need to clean the film and fine tune the focus once I get my telecine rig permanently mounted.)

With mod8 cropping
http://img82.imageshack.us/img82/8359/crop32bg7.th.png (http://img82.imageshack.us/my.php?image=crop32bg7.png)

With non-mod8 cropping (30)
http://img82.imageshack.us/img82/5522/crop30nb6.th.png (http://img82.imageshack.us/my.php?image=crop30nb6.png)

I definitely traced it back to LSF. (now whether I have the latest and greatest is to be determined - the copy I have has no rev or anything of the like.... )

tetsuo55
16th January 2009, 16:42
That result is REALLY amazing.

I cannot wait for the day that these kind of scripts can be build into a almost fully automatic(universal) one.

jollye
16th January 2009, 18:00
Hmmm... For some reason it was causing diagonal lines of black across the image.

Looks like some plugin is internally using GetRowSize instead of GetPitch somewhere.

tedkunich
16th January 2009, 18:13
Looks like some plugin is internally using GetRowSize instead of GetPitch somewhere.


That result happens with a simple call to limitedsharpenfaster(). Again, I'll have to dig into the versions of LFS and all the associated plugins.

EDIT: yep, seems I had some older version of LSF - downloaded the latest script and cropping by 30 causes no issues.

videoFred
19th January 2009, 16:48
Hey Ted!

It is nice to see someone playing around with my script. :)

I have added a new clip:
http://www.vimeo.com/2882371


This time I have used less sharpening and I have added some digital grain afterwards with AddGrainC(). I know this sounds strange, but the digital grain is way less 'heavy' then the original Ektachrome real film grain.

You realy must download the full version and watch it with a decent player (read: Mplayer Classic+ffdshow) to see the full effect.

PS: in the beginning you will see a blue layer at the bottom left. This is caused by the camera's build in filter. Next time I will use an external filter.

PS2: averaging many frames (10) in MVDegrainMulti() is also removing lots of dirt spots and artefacts!

Fred.

2Bdecided
19th January 2009, 18:48
Stunning (again).

Did you give up on the motion interpolation for frame-rate upconversion?

Cheers,
David.

tedkunich
19th January 2009, 19:03
Hey Ted!

It is nice to see someone playing around with my script. :)

I have added a new clip:
http://www.vimeo.com/2882371


This time I have used less sharpening and I have added some digital grain afterwards with AddGrainC(). I know this sounds strange, but the digital grain is way less 'heavy' then the original Ektachrome real film grain.

You realy must download the full version and watch it with a decent player (read: Mplayer Classic+ffdshow) to see the full effect.

PS: in the beginning you will see a blue layer at the bottom left. This is caused by the camera's build in filter. Next time I will use an external filter.

PS2: averaging many frames (10) in MVDegrainMulti() is also removing lots of dirt spots and artefacts!

Fred.


Yep, I am really impressed with the result of my own test captures with my new rig and your script (I still have some focus and "cleanliness" issues) - I did have one question... what version of MVtools has the MVDegrainMult functions? neither of the ones I have (1.3 and 2.x) have that function. Unless I am missing something, with the 2.x branch of MVtools, you can only look 3 frames forward and back.

Thanks,

Ted

jeffy
19th January 2009, 20:10
@tedkunich: josey_wells's version of MV Tools 1.7.7
http://forum.doom9.org/showthread.php?p=1188389#post1188389

If videoFred used some other version, please let us know.

Blue_MiSfit
19th January 2009, 21:37
VideoFred:

You might take a look at GrainFactory3. I always used AddGrainC until recently, and I'm HUGELY impressed with GrainFactory3. Basically, it adds grain in 3 distinct layers, with different sizes, amounts, and temporal characteristics according to luma in the source. It's very very cool!

~MiSfit

videoFred
20th January 2009, 09:14
Did you give up on the motion interpolation for frame-rate upconversion?

Sometimes I use it, sometimes not. It depends on the scene...... These example files are playing just like the original film: progressive 18fps. I have made that 18.75 because later the mpeg2 encoder will create a nice 2+1 pattern for standard PAL that is.

Of cource we can not create the projector shutter blade effect on digital (for now). For this, we need much higher frame rates. Perhaps in the future?

Fred.

videoFred
20th January 2009, 09:19
VideoFred:

You might take a look at GrainFactory3.

I can not run it on my system :mad: It starts good, but after a while I see strange color masking effects?

GrainFactory_MT1 runs fine on my system and I agree it is very cool indeed!

Fred.

morsa
20th January 2009, 21:01
Wouldn-t it be a good idea to merge some of the functionalities of Josey's into MVtools2 branch?

I mean like MVdegrainMulti....

Sagekilla
20th January 2009, 21:45
It would be nice, yes, but the problem is Josey changed how MVTools works internally, so it'd be a lot of work to port it over properly. It's not like he just added a few lines that enabled MT, he changed a lot of it so that the various filters work (internally, not externally) in a different way than vanilla MVTools 1.x.

San07
21st January 2009, 07:53
Awesome work........





Regards
San07

halsboss
21st January 2009, 16:18
I'm looking to replace the MVxxxMulti calls with Fizick's MVToolsV2 equivalents ;)


Did you achieve that and could you please post your equivalent script ?

tedkunich
21st January 2009, 22:29
Did you achieve that and could you please post your equivalent script ?

Fairly simple...

Replace the following of Fred's original script

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)


with this:

# Support for MVTools2 ######################
super = stab2.MSuper(pel=2)
bvec1 = MAnalyse(super, isb = true, delta = 1, blksize=block_size, overlap=block_over)
fvec1 = MAnalyse(super, isb = false, delta = 1, blksize=block_size, overlap=block_over)
bvec2 = MAnalyse(super, isb = true, delta = 2, blksize=block_size, overlap=block_over)
fvec2 = MAnalyse(super, isb = false, delta = 2, blksize=block_size, overlap=block_over)
bvec3 = MAnalyse(super, isb = true, delta = 3, blksize=block_size, overlap=block_over)
fvec3 = MAnalyse(super, isb = false, delta = 3, blksize=block_size, overlap=block_over)
#denoised=stab2.MDegrain2(super, bvec1,fvec1,bvec2,fvec2,thSAD=denoising_strenght).tweak(sat=saturation)
denoised=stab2.MDegrain3(super, bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=denoising_strenght)#.tweak(sat=saturation)


Select MDegrain2 or MDegrain3 depending on your application.

I could never get the MVDegrainMulti call to work properly on my system - colors were lost and really noisy.

halsboss
22nd January 2009, 00:52
Thanks tedkunich.

I have several versions of the script here, including with MVToolsV2.. with the 'super' clip. Works very fine too.
This time I have used less sharpening and I have added some digital grain afterwards with AddGrainC()
....
PS2: averaging many frames (10) in MVDegrainMulti() is also removing lots of dirt spots and artefacts!

videoFred, would it be possible to post your full mvtools2 version script, which contain lines like tedkunich's ? I guess that averaging up to 10 frames will look interesting. Also would it be possible to see where AddGrainC() fits into that ?

Just wondering... with setmtmode(mode=2,threads=4) which splits up consecutive frames and farms them off to separate threads - does that then muck up any mvanalyses and degrains which are suppose to compare frames in sequence ? MT() could be the workable alternative I guess ?

tedkunich
22nd January 2009, 02:44
Thanks tedkunich.


You are welcome

Also would it be possible to see where AddGrainC() fits into that ?

?

It is already in the script Fred posted...

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)

videoFred
22nd January 2009, 07:50
videoFred, would it be possible to post your full mvtools2 version script, which contain lines like tedkunich's ? I guess that averaging up to 10 frames will look interesting. Also would it be possible to see where AddGrainC() fits into that ?

Ted has answered these questions correct. :) The script I have posted *is* using MVDegrainMulti() so you can do the averaging. Of cource you will need the correct MVTools.dll version for this.

Fred.

videoFred
22nd January 2009, 07:58
I could never get the MVDegrainMulti call to work properly on my system - colors were lost and really noisy.

Strange... it works fine here on several computers. It even works on old single core computers, and it works both on XP and Vista.

There's a "SetMTMode=5" call in my script that can be removed when using MVMulti.. Perhaps MVMulti needs the special "Avisynth-MT" dll ?

I have done so many tests.. I do not remember some details any more.

Fred.

halsboss
22nd January 2009, 10:14
Ted has answered these questions correct. :) The script I have posted *is* using MVDegrainMulti() so you can do the averaging. Of cource you will need the correct MVTools.dll version for this.
Thankyou videoFred. I was hoping for the non-multi version, like Ted, and wondered how you went about averaging so many frames like you said.

videoFred
22nd January 2009, 10:23
Thankyou videoFred. I was hoping for the non-multi version, like Ted, and wondered how you went about averaging so many frames like you said.

To be very clear on this: averaging so many frames is only possible with MVDegrainMulti()
This also removes a lot of (small) dirt spots on the film :)

PS: the multi version works fine on old computers to. But insane slow of cource (1fps).


Fred.

halsboss
22nd January 2009, 10:49
Oh. Thanks anyway. I wanted to stick with Fizick's stuff rather than the "multi" side-branch. I wonder what that means for Ted :-

I'm looking to replace the MVxxxMulti calls with Fizick's MVToolsV2 equivalents ;)

I suppose he/I will use with the code he posted as changes to your amazing script, unless you have other suggestions ? I wonder if Fizick has a "generalised" MVdegrain by now.

I must see if I can find an appropriate thread to ask the question "Just wondering... with setmtmode(mode=2,threads=4) which splits up consecutive frames and farms them off to separate threads - does that then muck up any mvanalyses and degrains which are suppose to compare frames in sequence ? MT() could be the workable alternative I guess ?"

videoFred
22nd January 2009, 11:12
I wanted to stick with Fizick's stuff rather than the "multi" side-branch.

I understand. But of cource the multi stuff *is* modified Fizick stuff. :)
I bet the MVDegrain() engine is the same...


Just wondering... with setmtmode(mode=2,threads=4) which splits up consecutive frames and farms them off to separate threads - does that then muck up any mvanalyses and degrains which are suppose to compare frames in sequence ?

I'm an end user myself , I'm not an Avisynth guru!
I hope someone else can answer this.

Fred.

salehin
22nd January 2009, 12:10
@videoFred: This is simply amazing.. Thank you very much for sharing your script with us.

I'm going to try this magic of yours with my precious Louis Malle docus (http://forum.doom9.org/showthread.php?t=134496) that he made in 70's

Regards

Salehin

videoFred
22nd January 2009, 12:40
Thank you very much for sharing your script with us.

You are most welcome, Salehin. :)
Perhaps you can show us some of your results later?

Fred.

halsboss
22nd January 2009, 13:50
Yes please, I too would appreciate showing us the results of applying videoFred's script.

tedkunich
22nd January 2009, 16:09
Strange... it works fine here on several computers. It even works on old single core computers, and it works both on XP and Vista.

There's a "SetMTMode=5" call in my script that can be removed when using MVMulti.. Perhaps MVMulti needs the special "Avisynth-MT" dll ?

I have done so many tests.. I do not remember some details any more.

Fred.

Fred,

I played with it last night and found that reducing the blocksize to 8 (from 16) took care of losing the colors - color was lost in much of the image, just remaining in some locations around the perimeter.

I have not tried MVDegrainMulti with the non-MT version of avisynth.dll yet - I'll give that a try next. But based on some initial testing, the MDegrain3 in MVTools 2.x does a really nice job and is faster than MVDegrainMulti using 3 frames - it may be a wash.....

One thing I have found is that I NEED a new computer!!!! @ 1-2fps rendering rate and several hours of footage to process, this will take forever!!! Have been looking at the AMD Quad cores... specifically the AMD Phenom II 3Gig 940, anyone have any experience with these?





Ted

videoFred
22nd January 2009, 16:36
Fred,

I played with it last night and found that reducing the blocksize to 8 (from 16) took care of losing the colors

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.

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.

mikkop
23rd February 2009, 20:04
Thanks guys,
I give it a go. I'm triing to understand the scripting but it's a not so easy.
Thanks for the script fred i love your films.
Michael

bigdog660
28th February 2009, 11:21
Hey everyone,

I'm getting the following error: "Script error: there is no function named 'MVAnalyseMulti'".

And if I rename MVAnalyseMulti to MVAnalyse, I get this error instead: "MVAnalyse does not have a named argument "refframes".

Anyone have and idea what's wrong? I'm using AviSynth 2.58, and all DLL's are installed.

Thanks,
Ron

videoFred
2nd March 2009, 07:36
Hello Ron,

You need the special 'multi' MVTools version. It can be found here on the forum. But you can replace the denoising lines with the examples from Fizicks help files.

Fred.

bigdog660
3rd March 2009, 15:01
Thanks for your help Fred.

But now another error pops up:

Avisynth open failure:
Script error: there is no fuction named "Spline64Resize"
(C:\Program Files\AviSynth 2.5\Plugins\LimitedSharpenFaster.avs, line 66)
(D:\0534503\VIDEO_TS\test.avs, line 149)

Here is my test.avs script:

film="D:\0534503\VIDEO_TS\VTS_02_1.d2v"

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=16.00 #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=20 #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=704 H=480 #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\AGC.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)
source1= Mpeg2source(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)

And here is the LimitedSharpenFaster.avs script I am using:

# LimitedSharpen() ( modified for standard definition dvds and dual core cpus. by jeremy duncan november 11, 2008 )
#
# A multi-purpose sharpener by Didée
#
#
# Changes in this mod:
#
# - RemoveGrain >= v0.9 IS REQUIRED!!
# ==================================
#
# - Smode=4 / sometimes does the magic ;-)
# - a separate "undershoot" parameter, to allow for some line darkening in comic or Anime
# - Lmode=3 / on edges, limited sharpening with zero OS & US. On not-edges, limited sharpening with specified OS + LS
# - "soft" acts different now: no more boolean true/false, but instead integer 0 - 100 (or -1 -> automatic)
# instead of blurring before finding minima/maxima, it now softens the "effect-of-sharpening"
# - edgemode=-1 now shows the edgemask. (scaling still not implemented :p )
# - If you use a different resolution than standard definition dvd. Disable supersampling ss_x and ss_y by setting them to 1.0
# - for ntsc supersampling set ss_x to 1.2, set ss_y to 1.2
# - for pal supersampling set ss_x to 1.3 set ss_y to 1.1
#
## - MODIFIED version using MaskTools 2.0 and dedicated support plugin LimitedSupport

function LimitedSharpenFaster( clip clp,
\ float "ss_x", float "ss_y",
\ int "dest_x", int "dest_y",
\ int "Smode" , int "strength", int "radius",
\ int "Lmode", bool "wide", int "overshoot", int "undershoot",
\ int "soft", int "edgemode", bool "special",
\ int "exborder" )
{
ox = clp.width
oy = clp.height

Smode = default( Smode, 3 )
ss_x = (Smode==4)
\ ? default( ss_x, 1.2)
\ : default( ss_x, 1.2 )
ss_y = (Smode==4)
\ ? default( ss_y, 1.2)
\ : default( ss_y, 1.2 )
dest_x = default( dest_x, ox )
dest_y = default( dest_y, oy )
strength = (Smode==1)
\ ? default( strength, 127 )
\ : default( strength, 127 )
strength = (Smode==2&&strength>100) ? 100 : strength
radius = default( radius, 2 )
Lmode = default( Lmode, 1 )
wide = default( wide, false )
overshoot = default( overshoot, 0)
undershoot= default( undershoot, overshoot)
softdec = default( soft, 60 )
soft = softdec!=-1 ? softdec : sqrt( (((ss_x+ss_y)/2.0-1.0)*100.0) ) * 10
soft = soft>100 ? 100 : soft
edgemode = default( edgemode, 0 )
special = default( special, false )
exborder = default( exborder, 0)
#radius = round( radius*(ss_x+ss_y)/2) # If it's you, Mug Funky - feel free to activate it again
xxs=round(ox*ss_x/12)*10
yys=round(oy*ss_y/12)*10
smx=exborder==0?dest_x:round(dest_x/Exborder/4)*4
smy=exborder==0?dest_y:round(dest_y/Exborder/4)*4

clp.isYV12() ? clp : clp.converttoyv12()

ss_x != 1.0 || ss_y != 1.0 ? last.MT("Spline64Resize(xxs, last.height)",2).MT("Spline64Resize(last.width, yys)",3, splitvertical=true) : last
tmp = last

edge = mt_logic( tmp.mt_edge(thY1=0,thY2=255,"8 16 8 0 0 0 -8 -16 -8 4")
\ ,tmp.mt_edge(thY1=0,thY2=255,"8 0 -8 16 0 -16 8 0 -8 4")
\ ,"max") .mt_lut("x 128 / 0.86 ^ 255 *") #.levels(0,0.86,128,0,255,false)

tmpsoft = tmp.removegrain(1,-1)
dark_limit1 = tmp.mt_inpand()
bright_limit1 = tmp.mt_expand()
dark_limit = (wide==false) ? dark_limit1 : dark_limit1 .removegrain(1,-1).mt_inpand()
bright_limit = (wide==false) ? bright_limit1 : bright_limit1.removegrain(1,-1).mt_expand()
minmaxavg = special==false
\ ? SimpleAverage(dark_limit1, bright_limit1)
\ : mt_merge(dark_limit,bright_limit,tmp.removegrain(1,-1),Y=3,U=-128,V=-128)

Str=string(float(strength)/100.0)
normsharp = Smode==1 ? unsharpmask(strength,radius,0)
\ : Smode==2 ? sharpen(float(strength)/100.0)
\ : Smode==3 ? mt_lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
\ : mt_lutxy(tmp,tmpsoft,"x y == x x x y - abs 16 / 1 2 / ^ 16 * "+Str+
\ " * x y - 2 ^ x y - 2 ^ "+Str+" 100 * 25 / + / * x y - x y - abs / * + ?")

OS = string(overshoot)
US = string(undershoot)
mt_lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x y x - "+OS+" - 1 2 / ^ + "+OS+" + ?")
mt_lutxy( dark_limit, last, yexpr="y x "+US+" - > y x x y - "+US+" - 1 2 / ^ - "+US+" - ?")

Lmode==1 ? clamp(normsharp, bright_limit, dark_limit, overshoot, undershoot) : last

normal = last
zero = clamp(normsharp, bright_limit, dark_limit, 0,0)

Lmode==3 ? mt_merge(normal,zero,edge.mt_inflate()) : normal

edgemode==0 ? last
\ : edgemode==1 ? mt_merge(tmp,last,edge.mt_inflate().mt_inflate().removegrain(1,-1),Y=3,U=1,V=1)
\ : mt_merge(last,tmp,edge.mt_inflate().mt_inflate().removegrain(1,-1),Y=3,U=1,V=1)

AMNT = string(soft)
AMNT2 = string(100-soft)
sharpdiff=MakeDiff(tmp,last)
sharpdiff2=mt_lutxy(sharpdiff,sharpdiff.removegrain(1,-1),
\ "x 128 - abs y 128 - abs > y "+AMNT+" * x "+AMNT2+" * + 100 / x ?")

soft==0 ? last : SubtractDiff(tmp,sharpdiff2)

(ss_x != 1.0 || ss_y != 1.0)
\ || (dest_x != ox || dest_y != oy) ? MT("Spline64Resize(dest_x, last.height)",2).MT("Spline64Resize(last.width, dest_y)",3, splitvertical=true) : last

ex=blankclip(last,width=smx,height=smy,color=$FFFFFF).addborders(2,2,2,2).coloryuv(levels="TV->PC")
\.blur(1.3).mt_inpand().blur(1.3).MT("bicubicresize(dest_x, last.height)",2).MT("bicubicresize(last.width, dest_y,0.6,.0)",3, splitvertical=true)
tmp = clp.MT("Spline64Resize(dest_x, last.height)",2).MT("Spline64Resize(last.width, dest_y)",3, splitvertical=true)

clp.isYV12() ? ( exborder==0 ? tmp.mergeluma(last)
\ : mt_merge(tmp,last,ex,Y=3,U=1,V=1) )
\ : ( exborder==0 ? tmp.mergeluma(last.converttoyuy2())
\ : tmp.mergeluma( mt_merge(tmp.converttoyv12(),last,ex,Y=3,U=1,V=1)
\ .converttoyuy2()) )

(edgemode!= -1) ? last : edge.MT("Spline64Resize(dest_x, last.height)",2).MT("Spline64Resize(last.width, dest_y)",3, splitvertical=true).greyscale

return last
}

Hope you can help.

Thanks,
Ron

Didée
3rd March 2009, 15:18
Spline64resize was introduced Avisynth 2.5.8. Earlier versions don't have it.


And, unless I am missing something unique about MT, that version of LimitedSharpenFaster completely disables supersampling on the x-axis:

ss_x != 1.0 || ss_y != 1.0 ? last.MT("Spline64Resize(xxs, last.height)",2).MT("Spline64Resize(last.width, yys)",3, splitvertical=true) : last

That's wrong, since the 2nd resize will scale back to the original input resolution ...

Corrected:
ss_x != 1.0 || ss_y != 1.0 ? last.MT("Spline64Resize(xxs, last.height)",2).MT("Spline64Resize(xxs, yys)",3, splitvertical=true) : last



Edit:

In the same manner, the final resizing (towards the end of the script) is wrong.

Moreover, the "soft" option has been crippled ... removegrain(1) will not do the intended operation.


That's a very funny version of LimitedSharpenFaster. I definetly recommend to NOT USE it ... it's full of errors.

videoFred
3rd March 2009, 15:44
I'm still using an old version of LimitedSharpenFaster(): 29 oct 2005 :eek:

That specific line of code looks like this:
ss_x != 1.0 || ss_y != 1.0 ? last.lanczosresize(xxs,yys) : last tmp = last

The scaling works very fine in this version..
But I will look for a more recent -and good working- version.

Fred.

Didée
3rd March 2009, 16:28
I was referring to the version posted by bigdog660 above. Sorry if that was not clear...

Ah, just now I saw the very first line of that mod: "modified ... by jeremy duncan november 11, 2008" :)

Gavino
3rd March 2009, 16:36
That's a very funny version of LimitedSharpenFaster. I definetly recommend to NOT USE it ... it's full of errors.
It appears to be the special version produced by Jeremy Duncan in this thread. Various people suggested at the time to rename the function to avoid confusion...

Fizick
3rd March 2009, 21:15
Gavino, you (we) can request moderator to rename script(s) modified by "Jeremy Duncan" (automatically :))

His method is practical, experimental, "rule of thumb", often (sometimes) it works (and fast), but seems, he often do not fully understand what does he do exactly. ;)
Usually me too, but I do not write guides (almost) :)

Sorry for offtopic, Fred!
At last I download your example clip from vimeo. Good works!
Will look to your script :)

videoFred
4th March 2009, 07:35
Will look to your script :)

Thank you Fizick! :)

Please have a special look at result6. You will see I have used a special clip for DepanEstimate(). This works very good.

PS: this clip shows very well how good DepanStabilize() can be:
( the yellow flowers and the butterfly)
http://www.vimeo.com/2827387


Fred.

bigdog660
4th March 2009, 11:39
Spline64resize was introduced Avisynth 2.5.8. Earlier versions don't have it.

That is exactly what I was thinking base on what I've been reading.

I have replaced the LimitedSharpenFaster with the version from 2005 and it now loads without error. Thanks for bring that version info to my attention.

Now with that clip loaded in virtualdub, I have a split screen showing the following text:

In the left screen, there is text at the top that says "frame 5708 from 174255 trim_begin-6 trim_en". At the bottom of the left screen, it says "original".

Then in the bottom right screen it says "autolevels + manual color correction".

It looks like if I encoded the video, that text will be included. It also look like my video would be a split screen. Any comments how to fix this?

Here is a pix:

http://www.etnwx.com/images/splitscn.jpg

Thanks for your help,
Ron

Gavino
4th March 2009, 11:58
It looks like if I encoded the video, that text will be included. It also look like my video would be a split screen. Any comments how to fix this?
Simply change the line near the start of the script
result="resultS3" # specify the wanted output here
to
result = "result3"
The script is set up to produce a number of possible different results and this is where you say which one you want. The names with 'S' (eg resultS3) give you a split screen for comparison with the original.

videoFred
4th March 2009, 12:02
Hey Ron!

*EDIT*: cross posting with Gavino.. he was faster :)

I see there is a lot of confusion about this.
Let me explain:

I have made these split screen clips for comparison reasons and to be able to tweak the parameters when watching the original vs the tweaked version.

Now, at the top of the script you will see:
result="resultS3"

The "S" stands for split screen.

The following code:
result="result3"

Will return clip "result3" without the split screen and without the text.

The following options are possible:
result1: autolevels and autowhite (manual disabled)
result2: autowhite, manual levels correction
result3: autolevels, manual color correction
result4: everything manual
result6: special comparison clip to test stabilizing.

resultS1,S2,S3,S4: split screens for comparison.

PS: in your case, the text is to large, it does not fit in the screen. Easy to change: in the "subtitle' code you must change "size=32" "to size=24" for example.

PS2: denoising, sharpening and gamma is always enabled on all clips, unless you set the parameters to zero. Levels and color adjustment is only applied on certain clips, see above.

For example, if you set "blue=-10" this is only applied on clips 3 and 4, it will have no effect on clips 1 and 2.

Fred.

Didée
4th March 2009, 12:45
Addendum to the LimitedSharpenFaster issue posted above.
After playing a bit with MT(), I have to correct what I said. The supersampling in the Jeremy-Version of LSF does work. MT() can cause changes in a script's flow.

Normal code:
clip
filter1().filter2(x=last.width())
Here, "last" in filter2 refers to "clip" one line above. In a dotted chain "filter().filter().filter()", the intermediate states are not stored in "inherent last".

Code with separated(!) MT() :
clip
MT("filter1()").MT("filter2(x=last.width))")
Now, this works different. Here, "last" in filter2 does NOT refer to "clip" one line above. Instead, it refers to the result of "filter1()". Eventhough the calls are chained by dots, the 2nd MT() is interpreted as if it was placed in a new line.

For that reason, supersampling in Jeremy's version indeed works correct. It only seems wrong, if you don't know about this particularity of MT().

But that's no excuse for replacing all 11/20 modes of removegrain with mode 1. "soft" is broken, smode=4 is broken, "special" is broken (more than it was from the start).

Note: the different behaviour due to MT() is not trivial. It's a pitfall when multithreading a script with MT(), and in some cases it may be the cause for complete failures when trying to do so.

Gavino
4th March 2009, 16:37
clip
MT("filter1()").MT("filter2(x=last.width))")
Now, this works different. Here, "last" in filter2 does NOT refer to "clip" one line above. Instead, it refers to the result of "filter1()". Eventhough the calls are chained by dots, the 2nd MT() is interpreted as if it was placed in a new line.
Right. Specifically, the way it works is similar to the behaviour of ScriptClip - the inner 'last' (note that it's inside a string) is not evaluated until inside the second MT, in a context where 'last' has been temporarily set to the clip parameter of that MT (which here is the result of the first MT).
Just like ScriptClip(c, "filter2(x=last.width)"), where 'last' refers to 'c'.
Note: the different behaviour due to MT() is not trivial. It's a pitfall when multithreading a script with MT(), and in some cases it may be the cause for complete failures when trying to do so.
Yes, you're right. The documentation doesn't really make that clear.

bigdog660
5th March 2009, 10:58
videoFred, thanks for the explanation. I applied the filter, and it did help, but the second DVD I had made is even worse than the 1st. Even using your filter, the images are too grainy and dark. I'm afraid I'm going to have to find someone who knows what they are doing when transferring film to DVD. As it was said in another thread, there are people who specialize in this on this forum, and I believe you are one of them. If you (or you have someone you can recommend) wants to take a shot at this, please PM me.

Sorry for the OT.

I'll post a sample of the film untouched here tomorrow for anyone who's interested to look at. Comments on the transfer will be welcome.

videoFred
5th March 2009, 11:43
I'll post a sample of the film untouched here tomorrow for anyone who's interested to look at. Comments on the transfer will be welcome.

About transfering film: please see my signature.
You can mail me direct from there.

Fred.

rfmmars
5th March 2009, 16:52
videoFred, thanks for the explanation. I applied the filter, and it did help, but the second DVD I had made is even worse than the 1st. Even using your filter, the images are too grainy and dark. I'm afraid I'm going to have to find someone who knows what they are doing when transferring film to DVD. As it was said in another thread, there are people who specialize in this on this forum, and I believe you are one of them. If you (or you have someone you can recommend) wants to take a shot at this, please PM me.

Sorry for the OT.

I'll post a sample of the film untouched here tomorrow for anyone who's interested to look at. Comments on the transfer will be welcome.

I am the film transfer business too and have used VideoFred's script which is excellent. You got to keep in mind that each film is different in its need for correction. There is no automatic correction process avalible period. It is you or me doing a sence by sence correction, using Virtualdub, Avisynth, and the best Editor for film\tape is Magix's MEP-14 Plus, which allows you to use Virtualdub plugins on a frame to frame bases. This is not easy stuff, many hours are spent on each project. best of luck.
Take a look at my website too.

Richard
photorecall.net

bigdog660
7th March 2009, 14:01
Hey guys,

I finally had time to encode and up a sample. Here is a 10 minute segment of the DVD. No filters or adjustments were make. I encoded using 2 pass Xvid at 1400 ABR. Resolution is 704x480, same as the DVD. Please let me know what you think.

http://www.sendspace.com/file/zorcqx

File size is 100,422 KB.

rfmmars
8th March 2009, 00:10
Hey guys,

I finally had time to encode and up a sample. Here is a 10 minute segment of the DVD. No filters or adjustments were make. I encoded using 2 pass Xvid at 1400 ABR. Resolution is 704x480, same as the DVD. Please let me know what you think.

http://www.sendspace.com/file/zorcqx

File size is 100,422 KB.

Looking at your raw capture footage, the camera is the weak link. Very little resolution, less than 200 lines, my Sony DXC 750 has 750 lines, and that going to be the limiting factor. The color film balance reminds me of Agfachrome, very warm. I used Video Fred's script and RGBeq 2.11 and Color mill 2.11 for grayscale balance. Also the camera may have color drupp or apeature correction problems, see yellow squares.

Again you will need to do custom correctio for every scene change.

Richard
photorecall.net

http://img6.imageshack.us/img6/892/doomavi.th.jpg (http://img6.imageshack.us/my.php?image=doomavi.jpg)

2Bdecided
8th March 2009, 01:13
the camera is the weak linkOr else something in the setup is just not in focus?

Cheers,
David.

rfmmars
8th March 2009, 14:03
Or else something in the setup is just not in focus?

Cheers,
David.

It could be that the film camera lens is a fault but looking at the film grain in other sections of the film, that seems to be ruled out, the grain is large, pointing to the capture camera is at fault.

I capture Mjpeg using the last version of "Dscaler". A lot of people don't like Descaler but it is the most flexable for real time film capture.

Richard
photorecall.net

scharfis_brain
8th March 2009, 14:41
DScaler (without 'e')
is good for viewing analogue stuff, but it is NOT good for capturing cause it doesn't properly handle A/V offset as well as framedropping.

Better go for VirtualVCR as it is specially built for capturing stuff.

rfmmars
8th March 2009, 23:47
DScaler (without 'e')
is good for viewing analogue stuff, but it is NOT good for capturing cause it doesn't properly handle A/V offset as well as framedropping.

Better go for VirtualVCR as it is specially built for capturing stuff.

Offset is not a problem since the films have no audio. Using Leadlool's Mjpeg codec with a AMD 1.8 gig old style XP chip, no drop frames ever using highest quality setting. I made it clear that it was a Sony analog camera doing film capture work. Tried VirtualVCR but didn't like it.

Richard

rfmmars
9th March 2009, 02:11
DScaler (without 'e')
NOT good for capturing cause it doesn't properly handle A/V offset.



So I did a 2 hour capture with my configuation using Dscaler and indeed it has a -6ms linera audio offset, so I reset it in VideoDeluxe Video Pro X with a +6ms correction for perfect audio sync, so what the big deal........audio offset is part of the video industry, related to the choice of video card, audio card, and codec conbination used.

Richard

scharfis_brain
9th March 2009, 22:50
if you got poor tapes (VHS, Video8 etc.) the framerate will be slightly off 25.000 or 29.970 fps thus introducing a variable audio offset.
VirtualVCR compensates for that. I never was able to get decent A/V sync out of Dscaler for poor sources.
But if you don't need audio dscaler might be fine.

Also I am able to use ffdshows (AVISynth) filtering in realtime while capturing if I want to.

Tagert
23rd April 2009, 10:13
Amazing work !
It was a joy to watch it :)

BillB
4th June 2009, 22:25
For us newbies not quite familiar with this: http://en.wikipedia.org/wiki/Motion_picture_film_scanner

videoFred
5th June 2009, 12:33
Yes,

But I'm using a 'poor mans' home build version. It's not a scanner.. It's a machine vision camera with trigger. You could say I'm taking a digital photo from every film frame, and store this on the fly in a "growing" AVI file. The capture software comes with the camera.

But my friend Frank is developing more sophisticated software right now.
For those who are interested, there is a lot more on Franks website.
http://www.cine2digits.co.uk/

I am going to test it very soon. Franks software is based on ActiveDcam.
http://www.ab-soft.com/activedcam.php

My system works like this: the projector sends a pulse (optical switch) to the camera trigger input everytime the film frame stands still in the projectors gate. It only takes a few ms to capture one film frame.

Capture speed does not matter at all. In fact, my capture speed is variable from 1 to 20 fps. The result is always the same: one film frame = one AVI frame. Play speed can be easily changed in post with AssumeFPS() and final frame rate with ChangeFPS() or ConvertFPS(). Or by interpolation with MVFlowFPS().

Fred.

stenews
16th June 2009, 21:40
Hi videoFred,

can I use your script to restoring a standard VHS tape as well?
In case, which type of variables should I look after with respect to the one you use for 8mm films?
Mind that I'm a newbie and my questions can sound with no sense at all... so please be gentle with me.

Thanks,
Stefano

videoFred
17th June 2009, 07:10
Hi videoFred,

can I use your script to restoring a standard VHS tape as well?


Hello Stefano,

Sorry, but my script is not made for this. For VHS you will find much better solutions here.

Fred.

videoFred
17th June 2009, 09:18
It is time for an update.

I have made the script more readable and I have added comments to make it more understandable. I have removed the 'short clip- long clip' code, that was just a test to see how far I could go with displaying frame numbers etc.

Final frame rate conversion with interpolation is part of the script, now. When returning the "S" clips you will see the original at the left and the interpolated clip at the right. Very interesting to see how MVFlowFPS works!

About the dll's: 'MVTools' must be the modified Multithreaded version. 'MVTools2' is the latest Fizick version.
Be sure that the multi version is named 'MVTools.dll' and the other one 'MVTools2.dll'
The script is using both versions without any problem.

*EDIT 16/09/2009*
The updated script is available for download now.
Please see first page of this thread.

stenews
17th June 2009, 09:26
Hi videoFred and thanks for your reply.
You said that:
...For VHS you will find much better solutions here
where...? I mean, could you provide a link where to see code(s) more suitable for restoring VHS tape(s)?
or I'm just miss understanding something in your answer?

Thanks, :)
Stefano.

videoFred
17th June 2009, 09:29
Hello Stefano,

Please use search here on this forum.
VHS in not my thing, sorry.

Fred.

stenews
17th June 2009, 09:35
all right...now I see what you mean.
Thanks the same,

bye,
Stefano

videoFred
17th June 2009, 13:22
You are welcome!

It has just been posted today, Stefano:
http://forum.doom9.org/showthread.php?t=147796

Fred.

stenews
17th June 2009, 14:02
you're a gentlemen, mate.

Thanks a lot for your help, I really appreciate that! ;)

Bye,
Stefano

superpat999
8th July 2009, 20:59
Hi,

Hello everyone

This is my first post on this forum. Unfortunately it is an appeal for assistance.

I recently discovered Avisynth and your fantastic restoration script!

I have a number of avi files of standard 8mm film that have been digitised by a 'professional' company for me. I am a bit disappointed with the results and decided to use your script to improve the avi images I received back from the company.

I have struggled with the steep learning curve involved with starting out with avisynth and using a complex script!, but I think I have installed Avisynth (2.58) and the required filters and auxilary scripts correctly.

The example scripts provided with Avisynth run fine!

I have created a short clip from one of my files to experiment with.

I have downloaded your 17-June-2009 script, and the particular filters as listed on that post.

However when I run your script, suitably edited for my avi clip file name and paths, after some tens of seconds without the monitor showing the input/output boxes I get the following error:-

AVI: Opening file "C:\films\freds.avs"

[E] Error: Avisynth open failure:
Error in MFlowFps : mvbw's overlap size is incorrect
(C:\films\freds.avs, line 168)

Line 168 in your script is:-

164. super= sharp1.MSuper(pel=2)
165. backward_vec= MAnalyse(super, isb=true)
166. forward_vec= MVAnalyse(super, isb=false)
167.
168. interpolated= sharp1.MFlowFps(super, backward_vec, forward_vec, num=numerator,\
169. den=denumerator,ml=100)#.TemporalSoften(temp_radius,temp_luma,temp_chroma,15,2)
170.
171. sharp3= unsharpmask(interpolated,USM_sharp_ness2,USM_radi_us2,USM_thres_hold2)\
172. .addgrainC(grain_luma,grain_chroma,0.2,0.2,5)

avisynth reports my unmodified avi clip as:-

Video stream
Frame size fps (us per frame 720x576 25.000fps (40000)us
Length 18614 frames 12:24.56
Decompressor Panasonic DV CODEC (dvsd)
Number key frames 144000/144000/144000 [2617954k]
no delta frames
Data rate 28800fps (0.02% overhead)


Googling for this error and searching the forum does not find any other people with this error which is very worrying.

I have tried altering the "block number" and "block overlap" parameters to no avail.

I have tried de-interlacing my clip and running it as a de-interlaced clip, but the error remains constant.

I obviously must have done something stupid, but I do not know enough to work it out for myself!

Please would some kind people put me out of my misery!

thanks in advance

Patrick

videoFred
9th July 2009, 07:35
Hello Patrick,

It's a type error :scared:

Line 166: forward_vec= MVAnalyse(super, isb=false)
Must be: forward_vec= MAnalyse(super, isb=false)

Of cource I have corrected the script.
Thank you for the good documented feedback!

Please report back here if it works now.

Fred.

superpat999
9th July 2009, 14:05
Hi Fred,

Thanks for that correction.

I am now sitting here waiting fo my first test clip to process.

It is processing at around 1 fps.. It is going to take a very long time to process all 37 Gbytes of avi's I have here produced from my family's old std 8mm films.

Some of the film dates back to the early 1940's. My father-in-law was an aero engine engineer, and went to the states to set up US factories to build the big Bristol Centurus radial engines under lease-lend during the war. He brought back some rolls of Kodachrome 8mm stock, which he used back here in the UK. Unfortunately most of the colour has gone, only blues and greens left. This will be a challenge to improve!

I have a AMD 64 X2 6400 ( dual 3gHz about) system, doing nothing here. I don't see a working 64bit version of avisynth. Would it be worthwhile installing a 32 bit XP operating system on it, and avisynth etc, and using this as a system, with MT enabled?

What fps approx would I expect from this system?

Any advice on the way to process all these avi's will be much appreciated.

One last question. Avisynth has just finished processing the clip, and the output images are FAR better than the original. However It only appears to run at 1 fps..

Where is the modified clip stored? so I can run it at "normal" speed? I will try to understand the result part of the scripts a bit better.

Thank you again for your work with these scripts

Patrick

videoFred
9th July 2009, 14:25
Some of the film dates back to the early 1940's.

Sounds interesting! Can we see something?


Unfortunately most of the colour has gone, only blues and greens left. This will be a challenge to improve!

Yes it will.... An example maybe?


What fps approx would I expect from this system?

On all my system(s) the script runs at 4fps, with a 720x576 source that is. I do not know why it is slower on yours...


Where is the modified clip stored? so I can run it at "normal" speed? I will try to understand the result part of the scripts a bit better.

When you run a script (in VirtualDub I assume?) you must save the output somewhere, Patrick!
The output will be what you see in the right Vdub window.

The result part of my script is simple: for example 'result3' will return the clip with autolevels and manual color corrections. If you not have done any 'blue' or 'red' color corrections, then there will be no corrections. 'resultS3' will return the original (at the left) vs the corrected one (at the right).

Fred.

superpat999
9th July 2009, 15:39
Hi Fred,

I found the save "file as avi" tab in Virtual Dub, just before I read your last post.

I had worked out how to use resultx and resultSx already.

I am getting 1.36fps on the conversion. (found the drop menu in Virtual dual that shows the exact info).

I am using an AMD Sempron (sp?) system about 1.5 Ghz. A quick check of the processor load, shows that it is balls to the wall, pegged at 100% load. I think I am going to build up the AMD x2 system. The time spent doing this will be recouped in a much shorter processing time!

I will put some clips of the early films on a view site for you soon! Besides the faded colour films, there are several hundred feet of black and white. I think there are some scenes from 1945 VE day of my wife's elder brother, aged about 9, riding his tricycle up and down the road with a Union flag tied to a stick, tied to the trike. There are also scenes I think of the winter snows of 1947.

Give me a few days to play with my new toy!

cheers

Patrick

neuron2
9th July 2009, 15:41
I found the save "file as avi" tab in Virtual Dub, just before I read your last post. I hope you also found Video/Compression to set an output codec, otherwise your output file will be HUGE uncompressed RGB.

videoFred
9th July 2009, 15:54
I am getting 1.36fps on the conversion. (found the drop menu in Virtual dual that shows the exact info).

You mean.. while rendering?

But because your input is already film telecined to PAL, you should set play_speed=25 , numerator=25, denumerator=1. In other words, my script should not change this.


I will put some clips of the early films on a view site for you soon!

Yes, please do so. And if possible, the original transfered files. I think we will have to deal with interlacing and frame rate convertions too.


Give me a few days to play with my new toy!

Take your time... :)

Fred.

tedkunich
9th July 2009, 18:09
I think I am going to build up the AMD x2 system. The time spent doing this will be recouped in a much shorter processing time!

Don't expect a "huge" performance gain with a new CPU - for example, on my quad core AMD 940, I can only clock about 4-6 fps on my sources (granted they are 1440x1080 HDV AVI's).

There seems to be some interaction conflicts with some of the plugins used in the script - using Temporalsoften with Mdegrain seems to bring everything to a crawl with only ~30% CPU utilization. Call only one or the other, and you get 100% CPU utilization.


T

videoFred
10th July 2009, 08:01
Don't expect a "huge" performance gain with a new CPU - for example, on my quad core AMD 940, I can only clock about 4-6 fps on my sources (granted they are 1440x1080 HDV AVI's).

That's pretty fast, Ted!

I barely get 3 fps on my dual core Dell, with my 1024x768 source. Of cource, if the end target is standard DVD, we could win some speed by doing the resizing at the beginning of the script. But the quality is better when doing the resizing nearly at the end, with LimitedSharpenFaster().

Anyhow... I was thinking to spread the script over several computers in a network. But I have no experience with this at all. For example: how do you call a script like this? On the last computer in the chain? And how much speed would we win?

Fred.

superpat999
12th July 2009, 13:06
Hi,

I am struggling with the move to a faster system.

I have done a clean install of 32 bit XP + SP2 on a AMD 6400 X2.

Avsynth and Virtual dub works ok on the example scripts. (Only running as single thread at the moment)

However I am having problems with your restore script.

warpsharp and autolevels dlls will not load. These are the identical dlls and versions of Avisynth and Vdub that run ok on my old Sempron AMD 1.G machine.

Tried XP SP3 no improvement

Poking around on the forum, I found some cryptic posts about the need to install some extra dlls in the Windows XP System32 directory, when using an AMD64. Unfortunately I cannot find out what these dlls are.

Are there some extra dlls to fix his problem, or is there another way of going about it?

At this time I do not want to go to 64 bit O/S (it would have to be Windows 7 RC1! ), or even MT at this time, I just want to get Fred's script working on the faster AMD cpu.

regards

Patrick

superpat999
16th July 2009, 11:18
Hi,

As promised I have uploaded one minute of each of my two oldest Standard 8 avi's

They are exactly as I received them from the telecine company:-

10.1.avi. This dates from 1942/1943. My wife's elder brother is the focus character he was born in 1937. So you can guestimate the date of the film yourself. It is in B/W I think that when I last saw it many years ago, it was in colour that had almost faded to patchy blues and greens, but there is no colours in it at all now.

16.1.avi This dates from around 1945. It is in colour. The two babies are my wife and her twin brother born in March 1944, so you can guess the year quite accurately!

I would appreciate some advice on the best way to use your script to clean sharpen and get the colour balance correct in these images. There appears to be too much brightness, in the faces, washing details out.

I have tried running the clips through resultS3 and resultS1 in your script, but I am getting a bunch of short horizontal lines in the output where motion occurs in the frame.

I have noticed that the clips are interlaced. Does your script cope with this OK? Would it help to run a deinterlace script first and then run your script?

I am a complete novice in this subject and I am sinking fast.

I was going to upload to Vimeo, but they have a new policy and will only keep original files for a week unless you pay a $60 subscription.

I have used instead:-

http://www.filehosting.org/file/details/46110/10.1.avi

http://www.filehosting.org/file/details/46136/16.1.avi

regards

Patrick

videoFred
16th July 2009, 11:58
Hi Patrick,

This is footage with great historical value!

I am very sorry but my script is overkill for film transfers like this. For example there is almost no visible film grain, so why remove it? Blown out whites are lost.. forever. No way you can recover these.

I sure hope you still have the original films? Take my advice and get yourself a better transfer. If this is not possible then I would advice to use a much faster and simple script that only does some sharpening and perhaps some stabilising or you can even do this in VirtualDub.

I sure hope I have not dissapointed you, but the 'magic' of my script only works with better transfer quality files.

PS: where are you located? Perhaps I could point you to a decent transfer service (offline). You can send me a PM, I do not do this in public.

Fred.

m3mbran3
16th July 2009, 12:56
Since your files are so big superpat999 it is unlikely that most people will d/l them to have a look. I'm currently trying to restore some old family VHS tapes and some the filters could also be used on some of your footage. May I suggest you upload some smaller files as well (<50mb)

2Bdecided
16th July 2009, 16:30
Looking at 16.1.via...

Fred's being too polite - this transfer is terrible - it's not in focus - not even close! The levels are wrong, and it's not a frame-by-frame copy of the original - so it has frame blending throughout which makes it nearly impossible to use AVIsynth temporal denoisers properly.

It's just someone pointing a camcorder in full automode at a projector that's not set up properly. To be honest, it would be hard to do worse!

Find a proper frame-by-frame transfer service and have it done again.

...and please name and shame the cowboys who did this for you!

Cheers,
David.

superpat999
19th July 2009, 18:16
Hi David

I will not reveal the particular firm yet, I have to do a couple of things

Firstly I need to check the original film when projected, (I have to dig out the old Eumig, rescue it from the grave), and have a close look at the focus etc.

If it looks good, or even reasonable then, secondly, I need to complain about the quality of the avi's I got back!

It was supposed to be frame by frame transfer This is from the company I used, website's FAQ):-

How do you capture the image? I use frame by frame scanning which is by far the best way to capture the images from the film. This means they are flicker free and crystal clear and completely digital. Other company's use the useless method of an old projector with a camcorder at the side of it filming the projected image from the screen. Then there are others which use telecine machines from the 1980's which to be honest, is the same as the projector and camcorder method. It is still a projector but has a small camera built in which films the image in the gate rather than from on the screen. The problem here is that the cameras are from the eighties and not as good quality as todays camcorders, so you could say that you may even get a better image with the camcorder and projector method if it were not for the flicker problem.
Do you use analogue capturing methods? No. As stated above, because I use frame by frame scanning, the whole process is digital every step of the way. The quality of the transfer will be exactly as the film is, with no deterioration.



So there you go

regards

Patrick

rfmmars
19th July 2009, 20:07
First I can tell you that the film isn't that great. What you see projected is not always how the digitizing device sees it, different film brands have different color ranges. Can there be a better transfer, yes!!!

First things first, the camera I use is a Sony DXC 755 2/3" 3 chip camera with a Sony ANALOG video processor for color balance and B&W clamping, 760 lines 60db. s/n. I set for a medium gamma curve on capture so to have min. blocking in dark areas. I have a laser beam generator to put a red line on the capture anytime I stopped or reverse the projector for exposure adjustment correction, in post editing, that is taken out. No auto level/color ever. Then a custom avisynth / Vdub script is run on the entire assembled movie, average rendering time 2 days Then using Magix Edit Pro Plus 14, I do a manual scene by scene correction on the timeline using Vdub plugins.

Poor quality 2 hour movie will require my handywork for up to 8 hours, and a final render time of sometimes up to 1 day.

A company in the telecine business can not give you that kind of service, they would go broke.

There is simply not much good film out there to work with anymore. When it is good, the results are fantastic, better than video.

Not a simple business.

Richard
photorecall.net

henryperu77
20th July 2009, 23:40
Hello Fred

I was impress with your video restoration results. But could you upload some of your work in x264 or xvid in high resolutions, that online videos aren't really the proper way to watch them..

2Bdecided
22nd July 2009, 13:33
If you log in to vimeo (join - it's free) you can download the original files.

http://www.vimeo.com/2823934

Cheers,
David.

videoFred
23rd July 2009, 14:01
If you log in to vimeo (join - it's free) you can download the original files.

Thank you for explaining this while I was away David. :)

Those originals are in Microsofts Mpeg4 V3 codec, high bitrate. They will stay available for download because I have upgraded to Vimeo Pro.

Fred.

henryperu77
24th July 2009, 16:44
Ok thanks, just found the link on that page :P

bairradino
6th August 2009, 11:48
I'm trying to use the script but I have an 'Script error:there is no function named "SCSelect"'.
This error comes out when loading the Removedirt funtion.function RemoveDirt(clip input, bool "_grey", int "repmode")
{
_grey=default(_grey, false)
repmode=default(repmode, 16)
clmode=17
clensed=Clense(input, grey=_grey, cache=4)
sbegin = ForwardClense(input, grey=_grey, cache=-1)
send = BackwardClense(input, grey=_grey, cache=-1)
alt=Repair(SCSelect(input, sbegin, send, clensed, debug=true), input, mode=repmode, modeU = _grey ? -1 : repmode )
restore=Repair(clensed, input, mode=repmode, modeU = _grey ? -1 : repmode)
corrected=RestoreMotionBlocks(clensed, restore, neighbour=input, alternative=alt, gmthreshold=70, dist=1, dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode )
}
Any help?

kemuri-_9
6th August 2009, 12:14
I'm trying to use the script but I have an 'Script error:there is no function named "SCSelect"'.
This error comes out when loading the Removedirt funtion.
Any help?

SCSelect and RestoreMotionBlocks are provided by the RemoveDirt.dll (the actual RemoveDirt plugin),
just be sure to load the proper version for your CPU

newlife007
6th August 2009, 15:30
I am getting a similar error in that the RemoveDirt.avs is telling me function Clense is not found. I have RemoveGrain 1.0 and have tried RemoveGrain 0.9. The dlls and the scripts are set

pref= stab2.blur(1.0).blur(1.0).RemoveDirt().tweak(sat=2.5)
noise_baseclip= stab2.unsharpmask(PRE_sharp_ness,PRE_radi_us,0).coloryuv(off_U=blue,off_V=red).tweak(sat=saturation)
vectors= pref.MVAnalyseMulti(refframes=denoising_frames, pel=2, blksize=block_size, overlap=block_over, idx=1)
denoised= noise_baseclip.MVDegrainMulti(vectors, thSAD=denoising_strenght, SadMode=1, idx=1).TemporalSoften(temp_radius,temp_luma,temp_chroma,15,2)
leveled=denoised.addborders(X,0,0,0,$FFFFFF).crop(X,0,-0,-0).deblock()

RemoveDirt.avs looks exactly like above

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\RemoveDirt.dll")
LoadPlugin("c:\Program Files\AviSynth 2.5\plugins\Repair.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\mvtools2.dll")
Loadplugin("c:\Program Files\AviSynth 2.5\plugins\mt_masktools-26.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_28Nov05.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")
Import("c:\Program Files\AviSynth 2.5\plugins\RemoveDirt.avs")

newlife007
7th August 2009, 01:57
Nevermind I found my answer. I changed the RemoveDirt.avs to RemoveDirt.avsi, error went away

videoFred
2nd September 2009, 15:44
I have done some new 8mm real filmshooting with a Canon 1014E. The filmstock was Kodak Ektachrome 64T.

The old Canon needs some greasing etc, so the result was good, but sometimes there where dark frames in an irregular pattern. Some kind of flickering. Fizicks deflicker() plugin followed by strong denoising has solved this isssue completely. :cool:

I have downscaled the original 1024x768 filmtransfer files to 980x720, so with two 150 pixels black borders, we have HD. I have also converted the frame rate from 18fps to 50fps with MFlowFPS(). You will notice the interpolation artefacts but, in general, the result is pretty good.

Clip:
http://www.vimeo.com/6377661

As usual, your feedback is very welcome.
Please register (free) and download the full version.

Fred.

videoFred
16th September 2009, 09:42
My improved script is available for download now, please see the first page of this thread. I have also added some links to find the needed plugins.

I have also uploaded lots of new film frames, all generated with the script of cource. All these frames are from recent films I have shot myself this summer. On Super-8 mm real film of cource. :)

The pictures can be found on the 'film frames' pages from my website.

Fred.

buzzqw
16th September 2009, 10:20
thanks for your work!

a little note the
MVTools.dll - special version, allows averaging of multiple frames.
is linked to rapidshare, and this is evil (and the link is broken)

i can host freely the package of all filters/script on my site (with direct link allowed)
please PM me if you are interested

BHH

videoFred
16th September 2009, 10:36
MVTools.dll - special version, allows averaging of multiple frames.
is linked to rapidshare, and this is evil (and the link is broken)

Thank you for reporting this! Perhaps someone else knows where to find it?


i can host freely the package of all filters/script on my site (with direct link allowed)

Thank you for the kind offer, but we must be very careful with the GPL rules. I have asked this at the moderator and he says the source code must also be included then.

Fred.

buzzqw
16th September 2009, 10:48
Thank you for reporting this! Perhaps someone else knows where to find it?

i can suggest you to made a big zip file of varius zipped filters needed (with source, as original package)

send me a pm with link to download it and i will publish it

BHH

videoFred
18th September 2009, 09:55
i can suggest you to made a big zip file of varius zipped filters needed (with source, as original package)

send me a pm with link to download it and i will publish it

BHH

Done!

It can be found on page 1 of this thread.

Fred.

tengo6dedos
22nd September 2009, 01:29
Hello videFred, thanks for the update and uploaded needs. I noticed the MT part is gone, does the script stoped supporting it or you just removed for compiability for all users?


saluts

videoFred
22nd September 2009, 07:27
I noticed the MT part is gone, does the script stoped supporting it or you just removed for compiability for all users?


Yes, and also because the slowest filter in the chain, MVToolsMulti, already supports multi core computers.

But please feel free to experiment with MT for the other filters.
If someone can speed up my script, I will be happy to hear it.

Fred.

pirej
14th January 2010, 23:41
Hi all.
This is my first post here on the forum, i just want to say THANK YOU all for sharing you're knowledge , especially to videoFred for the restoration script.
As i remember.. somewhere videoFred said that this script is not for VHS restoring, but i just wanted to give it a try.. :)
So, i have this crapy Pal VHS source that was originally captured in 1973 (i guess)with 8mm film > NTSC VHS > PAL VHS somewhere around 1995.
I have done a test capture in mjepg (720x576), and among (lot of)other things.. the lower fields are extremely bad.
I separated the fields, and served the script as video-source to this.. Fred's script, i made some modifications in it, and it really surprised me... positively :)
Maybe i have to do some more tweaking but.. im already happy with the result.
I have this screenshot of the processed lower field, so... judge you're self.

davidhorman
15th January 2010, 03:13
videoFred, I had a look at some of your clips a week or two back - they're great examples of what AviSynth can do.

I was wondering if you have any clips that are - is there a word for this? - well exposed in some areas but too dark in areas? Like an indoor shot that includes a view outside to a bright day? I'm working on a filter and thought you might have something like that in your collection (like this (http://images.bit-tech.net/content_images/hl2_hdr_overview/hdr_archway_normalexposure.jpg)).

Thanks,

David

Blue_MiSfit
15th January 2010, 04:06
This thread continues to amaze me. You're doing fantastic stuff videoFred!

Cheers! Spread among my facebook friends!

FredThompson
15th January 2010, 19:03
What are the source of the agc and limitedsupport_20051128 dlls in the package?

The most recent limitedsupport from avisynth.org is version 20051221. Is there a reason to use verison 20051128?

Didée
15th January 2010, 20:13
LimitedSupport once was done by mg262 when MaskTools didn't have some of the needed filters, but actually they are included since many years. Versions of LSF that require LimitedSupport are stone old, and depreciated.
(I know there were reports that LimitedSupport versions were slightly faster - like 9.87 fps vs. 9.82 fps, you know ...)

FredThompson
16th January 2010, 16:14
LimitedSupport once was done by mg262 when MaskTools didn't have some of the needed filters, but actually they are included since many years. Versions of LSF that require LimitedSupport are stone old, and depreciated.
(I know there were reports that LimitedSupport versions were slightly faster - like 9.87 fps vs. 9.82 fps, you know ...)
So there's no reason to keep the LimitedSupport in the package, right?

knutinh
18th January 2010, 11:18
Thanks for this nice script. I have some questions that really are about "inverse telecine", but since my input is 8mm (most posts about IVTC seems to be about 24fps movie content) and I want to use it together with your script, I hope that it is ok for me to ask here.

I have been trying to process my 8mm films. I had them professionally transferred, and received 10GB of DV-PAL files.

The files appear to be 25/50 frames/fields interlaced, but the sequence seems to be somewhat irregular (tried stepping frame by frame in VirtualDub, and there appears to be no short pattern of combed/noncombed frames). I had hoped that each film-frame would be repeated in a regular pattern of 3 fields, meaning that the film would be slightly slowed down to 16.67fps.

I tried inserting Yadif in the script to get some kind of progressive input, but I guess there are some duplicate frames in the input. When looking at the output, it seems that I get very little denoising compared to your fantastic demo, no matter how many frames I use for averaging. So could it be that it is the duplicate frames that is fooling the denoising process?


BTW, there seems to be a slight error in your script (?). The trim_start parameter is used as expected, but trim_end is never used, and a hard-coded zero is used instead.

-k

videoFred
18th January 2010, 11:23
I was wondering if you have any clips that are - is there a word for this? - well exposed in some areas but too dark in areas?
David


Hi David,

In some cases, the HDR (AGC) filter does the trick.. But actualy I have changed my opinion about this kind of corrections. It often looks unnatural. A bit of gamma is often enough to brighten up the dark parts.

Anyhow, you can also do a search for Didee's 'Ylevels' filters. They are build in in MPlayer Classic.

Fred.

videoFred
18th January 2010, 11:29
Versions of LSF that require LimitedSupport are stone old, and depreciated.

It looks like I must update my plugins then :)

Fred.

videoFred
18th January 2010, 11:33
As i remember.. somewhere videoFred said that this script is not for VHS restoring, but i just wanted to give it a try.. :)

Sorry, but here are much better VHS restoring tools available here. Again, my script is made for improving real film transfers, straight to digital that is. The better the quality of the transfer, the better the script will work.

Fred.

videoFred
18th January 2010, 11:40
When looking at the output, it seems that I get very little denoising compared to your fantastic demo, no matter how many frames I use for averaging. So could it be that it is the duplicate frames that is fooling the denoising process?

Yes, of cource. You will have to remove the duplicate frames! Have you tried smoothdeinterlacer() for deinterlacing?


BTW, there seems to be a slight error in your script (?). The trim_start parameter is used as expected, but trim_end is never used, and a hard-coded zero is used instead.



I will have a look at this...

Fred.

Ovidiu
17th March 2010, 19:19
http://img697.imageshack.us/i/filmrestoration.jpg/Hi guys who want to help me with this scriptu not look good and I do not know what settings to look something like him


film="C:\Users\Ovidiu\Desktop\Passengers.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\ovidiu\DePan.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ovidiu\DePanEstimate.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ovidiu\RemoveGrain.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ovidiu\AGC.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ovidiu\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ovidiu\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ovidiu\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ovidiu\WarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ovidiu\LimitedSupport_09Jan06B.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ovidiu\autolevels.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ovidiu\AddGrainC.dll")
Import("C:\Program Files\AviSynth 2.5\Plugins\ovidiu\LimitedSharpenFaster.avs")


source1= AVISource("C:\Users\Ovidiu\Desktop\Passengers.avi").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)

Ovidiu
17th March 2010, 19:28
http://img697.imageshack.us/i/filmrestoration.jpg/

osgZach
18th March 2010, 16:27
Holy crap... Fred,

This work belongs in a museum !