View Full Version : The power of Avisynth: restoring old 8mm films.
videoFred
14th January 2009, 10:18
=================================================================
UPDATE 06/06/2011
--------------------
The script discussed in this thread only works good with high quality film transfers.
The digital source must be progressive and there should be no duplicate frames.
Many people, however, are having already a digital transfer of their old 8mm films on DVD.
My script is useless here. But you can use some parts of it.
For those people, FPP has made this exellent thread:
http://forum.doom9.org/showthread.php?t=161493
===================================================================
UPDATE 30/08/2010
----------------------
New version of the script with RemoveDirtMC() as suggested by John Meyer:
http://www.super-8.be/avisynth/Film_Restoring.zip
The script is available in two versions now: one with frame interpolation, one with frame blending.
The helpfiles are updated too.
Example:
http://www.vimeo.com/13173031
=================================================================
This is a full package with all needed plugins, source code included.
I have added a complete help file about how to use the parameters.
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.
==================================================================
ORIGINAL POSTING 14th january 2009:
-----------------------------------------
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 !
Floatingshed
3rd April 2010, 18:14
I've been meaning to give this a go for ages. Today I made the attempt only to be halted by "unable to load warpsharp.dll".
I'm using the filter collection included with the script and I've disabled all other plugins. Avisynth 257 on windows xp sp3.
Any ideas most welcome...
Thanks.
videoFred
5th April 2010, 13:42
I've been meaning to give this a go for ages. Today I made the attempt only to be halted by "unable to load warpsharp.dll".
This is a known problem with certain versions of warpsharp.dll.
Please try this one: (right click, save target as..)
http://www.super-8.be/avisynth/warpsharp.dll
Please let me know if it works now!
Fred.
Floatingshed
6th April 2010, 06:08
That fixed it. Many thanks.
kopmjj
16th April 2010, 19:20
hey i have to say even tho its n ot intended for video on pc it does brilliant! i have managed to find my best settings but i have 1 problem, how do i keep the same framerate as input video?
i tried messing with the framerate settings on the script but it doesnt work. my video is ntsc .
because when i save the video file it plays in slow motion. what can i do thanks.
kopmjj
17th April 2010, 03:53
just what part of the script do i change or delete to keep the same framerate or not to touch the freamerate? please thanks
videoFred
19th April 2010, 07:42
just what part of the script do i change or delete to keep the same framerate or not to touch the freamerate? please thanks
1) Remove the "assumefps(play_speed)" from this line:
source1= AviSource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
New code:
source1= AviSource(film).trim(trim_begin,0).converttoYV12()
2) Remove this:
super2= denoised2.MSuper()
backward_vec2= MAnalyse(super2, isb=true)
forward_vec2= MAnalyse(super2, isb= false)
interpolated= denoised2.MFlowFps(super2, backward_vec2, forward_vec2, num=numerator, den= denumerator, ml=100).TemporalSoften(temp_radius,temp_luma,temp_chroma,15,2)
3) This must be changed then, because it refers to 'interpolated' but we just have removed it:
super3= interpolated.MSuper()
backward_vec3= MAnalyse(super3, isb=true)
forward_vec3= MAnalyse(super3, isb= false)
sharp3= interpolated.MFlowBlur(super3, backward_vec3, forward_vec3, blur=mo_blur)
4) so it must refer to the last clip in the script and this is denoised2. So this code must be :
super3= denoised2.MSuper()
backward_vec3= MAnalyse(super3, isb=true)
forward_vec3= MAnalyse(super3, isb= false)
sharp3= denoised2.MFlowBlur(super3, backward_vec3, forward_vec3, blur=mo_blur)
Everything that changes the play speed and the final frame rate is removed now. I have not tested this, but it should be OK. Please let me know if it works for you.
The TemporalSoften() was applied just after the interpolation, but we have removed this... So if you still want some TemporalSoften(), you must add it here:
denoised2= sharp2.MDegrain1(super, backward_vec,forward_vec,thSAD= second_denoising_strenght).sharpen(last_sharp).TemporalSoften(temp_radius,temp_luma,temp_chroma,15,2)
Keep the original script safe and do the editing on a copy!
Fred.
videoFred
22nd April 2010, 13:21
I'm still playing around with the script, to get optimal results.
Newest clip:
http://www.vimeo.com/11133342
This time I have used less sharpening radius 3 and a bit more radius 2 sharpening and no frame interpolation.
Again I notice that the grain removing by averaging 6 frames actualy makes more detail visible.
Fred.
CruNcher
22nd April 2010, 13:57
Especially the Debluring stage (guess that's mainly Didée LSF work) looks very nice playing around currently with super resolution i guess it could also help here getting the original feel back, of course the lost details are lost :)
Original = http://img689.imageshack.us/img689/815/originalw.jpg
Before SR = http://img689.imageshack.us/img689/754/nosr.jpg
After SR = http://img689.imageshack.us/img689/139/14790490.jpg
actually i expected more from SR but it might be the implementation in this case MotionDSPs consumer one (GPU) :(
kopmjj
24th April 2010, 10:46
thank you video fred 1 more question sometime on a dark scene i get white scatches or white marks in lines, but when i adjust pref= stab2.blur(0.00).blur(1.58).tweak(sat=10.0)
the blur bit it goes away but appears in other parts of the video do you know how i can get rid of it completely?
videoFred
26th April 2010, 07:41
thank you video fred 1 more question sometime on a dark scene i get white scatches or white marks in lines, but when i adjust pref= stab2.blur(0.00).blur(1.58).tweak(sat=10.0)
I must see an example to know what this is.
But I do not use the prefiltered clip any more.
I am preparing an update.
In the mean time you could delete or disable the 'pref=...' code.
The next code line must then be: "vectors= stab2.MVAnalyseMulti..."
Fred.
videoFred
27th April 2010, 10:40
Newest script and helpfile can be found here:
http://www.super-8.be/avisynth/Film_Restoring.zip
Fred.
kopmjj
28th April 2010, 04:56
thank you for this ill have a go at this.
edit: i had a quick preview and 2 questions how do i get rid of original vs final output preview? what line do i edit i didnt get that in previous script.
also with the framerate i want to leave my original 29.970 do i do the above instructions u gave or do i have to do anything different?
thanks a lot for this.
ok i read your manual for this i have figured it out thanks, if i can sort the fps out ill reply back but thanks you for this great script.
kopmjj
28th April 2010, 07:56
ok videofred 1 last help please im trying to figure this out but am really stuck.
from your script all i want to do is add the following only....
#COLOR AND LEVELS PARAMATERS
#----------------------------------------------------------------------------------------------------------------------------
saturation=1.3 #for all outputs
gamma=0.8 # for all outputs
blue= -0 red=-0 #manual color adjustment, when returning result3. Values can be positive or negative
black_level=0 white_level=255 output_black=0 output_white=255 # manual levels, when returning result4
#DENOISING PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
denoising_strenght=400 #denoising level of first denoiser: MVDegrainMulti()
denoising_frames= 6 #number of frames for averaging (forwards and backwards) 3 is a good start value
block_size= 16 #block size of MVDegrainMulti()
block_size_v= 16
block_over= 8 #block overlapping of MVDegrainMulti()
second_denoising_strenght= 300 #denoising level of second denoiser: MDegrain1()
temp_radius=4 temp_luma=3 temp_chroma=3 #final smoother: TemporalSoften()
#FOUR STEP SHARPENING PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------
PRE_sharp_ness=5 PRE_radi_us= 3 #presharpening (UnsharpMask) just after first denoising
LSF_sharp_ness=5 LSF_radi_us=2 LSF_sub=1.5 #second sharpening parameters (LimitedSharpenFaster) sub=subsampling
USM_sharp_ness2=5 USM_radi_us2=1 USM_thres_hold2=0 #third sharpening parameters (UnsharpMask)
last_sharp= 0.5 # final sharpening step after interpolation
mo_blur= 5 #this will add some motion blur, can be useful in panning scenes etc..
#AUTO LEVELS PARAMETER
#--------------------------------------------------------------------------------------------------------------------------------
X=0 # X is a special parameter for reducing the autolevels effect on the whites
X2=0 # X2 is a special parameter for reducing the autolevels effect on the blacks
basically i want to keep all the color,levels,denoising,sharpening filters and remove the rest eg: stablizing,crop,framerate etc.
how do i do this? please show me a script thanks.
videoFred
28th April 2010, 08:08
how do i do this? please show me a script thanks.
I am sorry my friend but:
:readguid:
Fred.
kopmjj
28th April 2010, 10:12
I am sorry my friend but:
:readguid:
Fred.
i read the guide but it doesnt tell me how to remove those things, and if i could use those filters i would but i dont know how.
all i want is that sharpening and noise filter, i have never seen that sharpening script before when i try that on its own it dont work.
even though i loaded the plugins. maybe a different way to type the script? also how do i use your noise reduction script on its own?
please man this will be a lifesaver thanks.
videoFred
28th April 2010, 10:38
I have showed you how to remove the interpolation, have I not? It's only a few postings above here.
That's it. If you do not want any stabilisation, set those parameters to zero.
If you do not want to resize, remove dest_x and dest_y from the limitedsharpen() call.
I do not write custom scripts for others. You realy should learn this yourself. Keep the original, and modify a copy. If it won't work, try to figure out why not. I have learned it myself this way, a few years ago. I was a complete novice myself. This approach is very good to learn how Avisynth works.
But if you modified script realy won't work, you can always ask here :)
Fred.
2Bdecided
28th April 2010, 11:54
I do not write custom scripts for others.More than that, it was very generous of Fred to share his work here - he could charge a lot for the quality of work he's doing, but he's shared so much information for free.
It'll discourage this level of sharing from others in future if people see one act of generosity, and assume this means that the author has infinite time to debug other people's problems for free!
I can second Fred's advise that learning by experimenting is the way to do. It's fine to ask "stupid" questions (I make a habit of it), but probably not fine to ask someone else directly to do all the work for you (even though, sometimes, someone will do exactly that in response to a new challenge/question that's not been tackled before).
Cheers,
David.
videoFred
28th April 2010, 12:56
he could charge a lot for the quality of work he's doing, but he's shared so much information for free.
Thank you David.
I have worked 5 years on this project and it's not finished yet. Frank Vine is developing a very special RGB Led backlight source. It's almost ready and once I have this running, the project is finished.
http://www.cine2digits.co.uk/
But because for me this is a pure free time project, I have decided to throw everything on the internet. Lots of people have build a similar transfer unit like mine by now.
It'll discourage this level of sharing from others in future if people see one act of generosity, and assume this means that the author has infinite time to debug other people's problems for free!
Indeed, I can not do this. I own and run a company (nothing with film) and this takes most of my time.
Fred.
rfmmars
28th April 2010, 15:43
Many thanks for the information, it's the purest approch to the subject.
Richard
boqa
30th April 2010, 03:21
Hi,
First of all, a huge thanks to Fred for sharing this great work with us. It's truly inspiring!
Secondly, I am complete newbie in this field, so I hope for your understanding if my questions are to ignorant :)
Anyway; I have the 8mm film that has been transferred to dvd by a company. I think that the transfer could be been done better, but this dvd is all I have, unfortunately a re-transfer is not a possibility at the moment.
The dvd is PAL and interlaced. So, I used Fred's script and a deinterlace filer on my source and the result is quite nice, definitely better than my original material.
But I was wondering if result could be better. It has been stressed many times in this discussion that the input must be de-interlaced with progressive non-duplicate frames. So my question is this; is it possible for me to remove any duplicate frames from my source dvd, that is, besides deinterlacing, how can I get my input as close to the original as possible (for using it with Fred's script)? I mean, my DVD seem to be 25 fps (as PAL should be), but the original 8mm must have been 18 fps, so it seems to me that "something" has been done by the transferring company.
I know that you may need further details for answering my question (problem is, I don't know exactly how the company transferred the 8mm to dvd), but maybe you still have some advice for me on how to best prepare my dvd input for being processed through Fred's wonder-script :)
Any advice will be appreciated, thanks
Jakob
videoFred
5th May 2010, 07:30
I know that you may need further details for answering my question (problem is, I don't know exactly how the company transferred the 8mm to dvd), but maybe you still have some advice for me on how to best prepare my dvd input for being processed through Fred's wonder-script :)
Hello Jacob,
The best advice I can give you is: get yourself a new transfer, frame by frame this time and no duplicate frames :)
The second best advice: remove both the interlacing and the duplicate frames. There are filters available for this but I am not the expert on this.
To judge the quality of the transfer, I must see an example. I have seen very good transfers on dvd format and I have seen very bad transfers on dvd format.
Fred.
kenpachi
23rd May 2010, 19:50
Freddy, Your results are awesome! As many have said before, You are truly a 8mm-transfer Master. Comparing to You and many other guys I'm a total newbie on Avisynth, especially 8mm transfer. I decided to post because of a source that reminded me 8mm quality. It is a NTSC TV broadcast from '68 delivered on DVD. I guess it isn't anything like 8mm but I asked myself how it was recorded in TV studio? I don't know what type of video cameras the used those days but it couldn't be much different from 8mm, could it?
This is the video:
Video
ID : 224 (0xE0)
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, Matrix : Default
Duration : 18mn 49s
Bit rate mode : Variable
Bit rate : 6 854 Kbps
Nominal bit rate : 7 700 Kbps
Width : 720 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate : 29.970 fps
Standard : NTSC
Colorimetry : 4:2:0
Scan type : Interlaced
Scan order : Bottom Field First
Bits/(Pixel*Frame) : 0.662
And here is an example:
http://www.speedyshare.com/files/22586894/example.zip
@Freddy: What I wonder is if Your script would be any use on this source? I have just tried the default params but it seems it won't do the trick at all. Should I study the script and modify params to obtain results as awesome as in Your clips or just leave it and try standard [ColorYUV, sharpen, AddGrain, TemporalSoften]?
PS. I don't know if this is some good place to discuss such things or I should've posted outside the topic. If so, sorry.
videoFred
25th May 2010, 08:02
Freddy: What I wonder is if Your script would be any use on this source?
The original source might have been real film, I do not know. But this looks like old and low quality video tape to me. My script can not do anything with a source like this, I'm sorry.
PS. I don't know if this is some good place to discuss such things or I should've posted outside the topic. If so, sorry.
Here is the place to discuss this :)
Fred.
2Bdecided
25th May 2010, 12:18
If you want to attack this source properly, it needs a separate thread.
I think it's video > film > video (VHS?) > DVD, without a TBC.
There are VHS artefacts, film artefacts, wrong levels, etc - and even IVTCing it isn't completely straight forward. I think I'd try that experimental software TBC for a start, though don't expect miracles - might make things worse rather than better.
Cheers,
David.
johnmeyer
4th June 2010, 02:50
I posted about my film to video transfer system:
High Speed Film to Video Transfer Machine (http://forum.doom9.org/showthread.php?t=106837&highlight=film)
I finally got the software to work perfectly using my IVTC method. Also, I still use a Workprinter for 8mm and Super8.
The reason for posting here is that I want to do a better job cleaning and adjusting the video that results from these film transfers. There are some things I like about VideoFred's script, some things I don't like, and some things I don't understand.
Like:
The Autolevels function seems to work quite well. It is more subtle and reliable than the HDRAGC filter that both VideoFred and I used a long time ago.
I like the sharpening functions, but I have some significant issues with these, and have several questions (see below). The defaults seem way too strong for 8mm film.
Dislike:
I don't care for the dirt and grain removal techniques. I have gotten much better results with two scripts I developed. One is based on MDegrain, but using the version in MVTools2. It is faster and better. I use this in conjunction with a motion-compensated version of Despot. Another approach I use in a script I sometimes use instead often provides even better results. It uses RemoveDirt. It took me awhile to get the right settings for this because the documentation for RemoveDirt is bad, even by AVISynth standards, but I think I now have it working.
Questions:
My main reason for posting is to ask a few questions. It seems to me that for both levels and for sharpening that you have too many places where these are being done, and as a result, the script sometimes delivers unexpected results. For levels, you first adjust them here:
noise_baseclip= stab2.coloryuv(off_U=blue,off_V=red).levels(0,gamma,255,0,255).tweak(sat=saturation)
but you then adjust them when computing whichever result is going to be returned.
Sharpening is also done more than once (three times, in fact):
stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5)
denoised= noise_baseclip.MVDegrainMulti(vectors, thSAD=denoising_strenght, SadMode=1, idx=2).unsharpmask(PRE_sharp_ness,PRE_radi_us,0)
followed by the entire sharpening section. This seems like a lot of sharpening, and indeed it can produce artifacts, as you can see here:
http://i177.photobucket.com/albums/w208/johnmeyer/FilmRestoreClip03.jpg
This is fairly grainy film stock and the grain is being emphasized because of the underexposure. Also note that the highlights are being blown out (look at the trailing edges of the seagulls' wings), something I noticed in the clips posted by VideoFred on Vimeo. I think the double sharpening and double levels increase are partly the reason for this. Obviously I can reduce the sharpening and levels settings, but I'm not sure how they interact and whether there is some subtle reason to have them both.
I also mentioned being disappointed in the dirt removal. Here's a before/after for the default script settings:
http://i177.photobucket.com/albums/w208/johnmeyer/FilmRestoreClip01.jpg
and here is the same before and after using the RemoveDirt script I normally use:
http://i177.photobucket.com/albums/w208/johnmeyer/FilmRestoreClip02.jpg
Note that the dirt above the girl's head is not cleaned by this script, but is nicely cleaned by the RemoveDirt script (the second of the two photo pairs above). Also note that in my script, the blurred parts of the seagulls' wings still looks normal, whereas this script makes them look grainy and unnatural.
But, I'm not posting to bash this script. Quite the opposite. It works really well on some clips. In particular, it often does a remarkable job of extracting details. I am almost certain that this is more than just sharpening, and it is this aspect of the script that I'd really like to understand. Take a look at this clip. The script performs absolute magic:
http://i177.photobucket.com/albums/w208/johnmeyer/FilmRestoreClip04.jpg
Look at the vertical members of the railing on the porch. They are almost invisible in the original, but are quite clear in the corrected version. What's more, this isn't just a single-frame anamoly: they are clear and visible on every frame in the scene on the corrected version.
So, what I'd like to do is combine the vastly superior dirt and grain removal of my scripts with a little of the autolevel feature of this script. But most of all, I want to figure out what part of this script is making those railings suddenly appear. That is very good stuff indeed.
videoFred
4th June 2010, 08:21
Hello John,
Thank you for testing my script, here we go:
The Autolevels function seems to work quite well. It is more subtle and reliable than the HDRAGC filter that both VideoFred and I used a long time ago.
HDRAGC is very good for restoring details on clips made with low dynamic range digital cameras. But it is introducing artefacts at the same time. When using a decent quality digital camera for film transfering, there is no need for HDRAGC.
The Autolevels plugin works fine indeed. But I had to 'soften' it a bit by adding small pure white and black borders to the picture, then applied Autolevels, then remove the borders again.
I like the sharpening functions, but I have some significant issues with these, and have several questions (see below). The defaults seem way too strong for 8mm film.
Well, it depends on the source and the amount of grain removing. You can set all sharpening parameters to zero to start, and then increase with small steps.
It uses RemoveDirt. It took me awhile to get the right settings for this because the documentation for RemoveDirt is bad, even by AVISynth standards, but I think I now have it working.
RemoveDirt is very good and very fast. But sharpening afterwards is introducing artefacts.
My main reason for posting is to ask a few questions. It seems to me that for both levels and for sharpening that you have too many places where these are being done, and as a result, the script sometimes delivers unexpected results. For levels, you first adjust them here:
noise_baseclip= stab2.coloryuv(off_U=blue,off_V=red).levels(0,gamma,255,0,255).tweak(sat=saturation)
You have tracked a mistake, I will examine this further.
Sharpening is also done more than once (three times, in fact):
Four times actualy :p It will only produce artefacts when strenght is to strong.
I also mentioned being disappointed in the dirt removal.
It works quite well when averaging 4 or more frames. But I agree that RemoveDirt work better and faster. But difficult to sharpen afterwards.
In particular, it often does a remarkable job of extracting details. I am almost certain that this is more than just sharpening, and it is this aspect of the script that I'd really like to understand. Take a look at this clip. The script performs absolute magic:
It's the avaraging of multiple frames (MVDegrainMulti). Grain is random, never the same on different frames. A small detail, visible on frame 1, is hidden by the grain on frame 2. Averaging multiple frames makes this detail visible on all frames.
But most of all, I want to figure out what part of this script is making those railings suddenly appear.
Again, MVDegrainMulti() followed by small sharpening steps, big radius first. This approach needs a top quality digital transfer to begin with and I know you have this quality, John.
That is very good stuff indeed.
Thank you! I would like to see a small not modified original clip from you and see what I can do with it. It's realy a matter of setting the parameters right.
Fred.
videoFred
4th June 2010, 13:17
Like John has noticed, this line:
noise_baseclip= stab2.coloryuv(off_U=blue,off_V=red).levels(0,gamma,255,0,255).tweak(sat=saturation)
must be:
noise_baseclip= stab2.levels(0,gamma,255,0,255).tweak(sat=saturation)
The color correction should not be there at this point of the script. The gamma and saturation is OK. It is better to do this before the degraining.
The following must be corrected too:
result3= sharp3.addborders etc.....
this must be:
result3= sharp3.coloryuv(off_U=blue,off_V=red).addborders etc....
It was a test to see if color correction before denoising would change anything. And I have forgotten to change it back to the original script. :scared:
I will modify the script as soon as possible and update the download.
Fred.
johnmeyer
4th June 2010, 19:12
Freddy,
Thanks for the very complete, and very useful reply. I have spent the past fifteen minutes trying to get information on MVDegrainMulti. That function appears to have been quietly added to MVTools and then quietly removed. I think it was developed by someone else (Josey?). As a result, I can't find much documentation. This is both the fun and the frustration of working with AVISynth plugins: the technology is sometimes amazing, but the documentation is sometimes really, really bad. I have a suspicion that this function, because of its multi-frame averaging, is one of the things that makes this script so slow. Also, it probably is never going to work using the multi-CPU AVISynth hack. I just tested, and my script operates at 78 fps, and yours at 5 fps. Obviously I'd like to improve the performance of your script somewhat. I just transferred another eight hours of film for a client for whom I previously transferred sixteen hours of film. The difference in performance becomes a major issue when trying to do this amount of material, against a deadline, for a client.
I just tried substituting the MVTools2 "equivalent" to MVDegrainMulti that was suggested earlier in this thread by "tedkunich:"
http://forum.doom9.org/showthread.php?p=1240377#post1240377
I had to make a few modifications to what he suggested in order to add back the levels and sharpening commands (even though I'm going to take them back out because, as noted above, some of them are redundant). After making those changes, I was unable to detect any difference between your original script, and your script with the MVTools2 code substituted for MVDegrainMulti. Most important to me, the "magic" appearance of the railings on the porch still happened, and looked identical.
So, when I get time tomorrow, I will go through the script and eliminate any other use of the code from the original MVTools (substituting instead the code from MVTools2) and then see if I can get the whole thing to work with a SetMTMode(2,0) command. My goal is to get my variations to your script to work at something approaching 30 fps on my 3.3 GHz i7 computer. I think that with a few tweaks to the sharpening, and with this change, the quality and speed of this already amazing script can be significantly improved. Once I achieve that, I will see if I can further improve the dirt and dust removal without diminishing the other excellent aspects of this script.
videoFred
7th June 2010, 07:21
My goal is to get my variations to your script to work at something approaching 30 fps on my 3.3 GHz i7 computer.
Be my guest to do this, John! It would be very nice if you would post the modified script here. The speed is the bottleneck indeed.
Fred.
Boulder
7th June 2010, 13:40
Be my guest to do this, John! It would be very nice if you would post the modified script here. The speed is the bottleneck indeed.
Fred.Would you also mind wrapping the whole script together as a function? It would be very useful if certain parts (such as stabilizing or sharpening) could be disabled with a single boolean. It would also be easier to create batch operations.
johnmeyer
7th June 2010, 19:14
Originally Posted by videoFred
Be my guest to do this, John! It would be very nice if you would post the modified script here. The speed is the bottleneck indeed.
I'll definitely post the result. My son graduated this weekend (from high school) so I didn't get a chance to work on this as planned. I should get to it today or tomorrow.
Would you also mind wrapping the whole script together as a function? It would be very useful if certain parts (such as stabilizing or sharpening) could be disabled with a single boolean. It would also be easier to create batch operations.
As for making it a function, that is a good idea, but I'm not sure it will add much value. Freddy has done an excellent job putting all the variables in the header, so the difference in adjusting those versus changing the settings via a function call is not that great. However, I'll look into it when I am working on things. The script is really clean and understandable, and I don't want to wreck a good thing.
johnmeyer
9th June 2010, 10:01
Well, after about twenty hours and hundreds of trials, I have created a heavily modified version of videoFred's excellent script. Here are the reasons I made these modifications:
1. I wanted better dirt removal. Much of the film I deal with is old home movies which have been badly stored. Even after cleaning, they still have lots of mold and dirt.
2. I wanted a much faster script.
3. I felt the original script used too much sharpening, leading to a result that sometimes didn't feel like film.
The complete changelog is incorporated into the script below.
The original script runs at about 5 fps on my computer. This one runs at 15 fps. I was able to get several versions to run at close to 50 fps, but they were not stable.
I did eliminate the ability to interpolate frames. I have done extensive work with frame synthesis in my Kinescope to video scripts (which turn Kinescopes into something that feels like the original video) so I am well aware of what can be done. However, once you start down this path, you end up with something that definitely no longer "feels" like film. When converting Kinescopes back to video, this is exactly what I want, but in this case, I still want the film to feel like film. Of course everyone gets to do what they want, but since one of my main objectives was a script that ran faster, I took this out in the name of performance.
Many, many thanks to VideoFred for this amazing script. Hopefully I have not done too much violence to his original vision, and perhaps others will find a use for this somewhat less capable, but definitely faster script. I think you will find the dirt removal rather amazing. You'll need to download the RemoveDirt plugin:
http://www.removedirt.de.tf/
To get full performance from this script, you must use the MT version AVISynth. I used the 2.5.8 MT version 5 (August 16, 2009) build.
The script is contained in the next post (too long to fit here).
johnmeyer
9th June 2010, 10:07
Here is the modified script:
# film restoration script by videoFred.
# denoising, resizing, stabilising, sharpening, auto-levels and auto-white balance.
#
# Modified by John Meyer, June 8, 2010
#
# Changes made by Meyer:
# 1. Replaced the MVDegrainMulti function, which was part of the original MVTools
# with the equivalent function using the newer and faster MVTools2.
# 2. Added RemoveDirt function prior to Degrain in order to eliminate large dust spots. This
# substantially improves the dirt removal capabilities of this script. The user will need to
# download this plugin at:
# http://www.removedirt.de.tf/
# 3. Eliminated a great deal of sharpening. The original script did sharpening in at least four places.
# With grainy film stock, this sometimes created objectionable grain. Also, the limitedSharpenFaster
# function, while excellent for video, is uncessarily slow, and isn't really needed for this low
# resolution source. Too much sharpening can make the film look too much like video.
# 4. Added multithreading. I was able to roughly triple the script performance. It may be possible to
# substantially increase this, perhaps as much as 12x instead of 3x. However, the autolevels function
# would have to be replaced.
# 5. Fixed several small errors I found. The result3 option didn't have the manual color correction code, so I
# added that back in. All the numbered "stab" variables (stab1, stab2, etc.) aren't needed except
# for providing a test function for stabilization. I eliminated all of this to streamline the script.
# 6. Deflicker seemed redundant, given all the averaging that takes place with MDegrain, and also the averaging
# that is done when the autolevels outputs are selected, so I took it out.
# 7. I reduced the number of frames used for averaging autolevels from the default (which is 5) to 2.
# I probably should add a variable in the header so the user can change this. Something else to do
# in the future ...
# 8. I added yet another set of crop parameters. I did this because both my capture and my output are
# done using NTSC DV AVI which is 720x480. However, 8mm film is almost exactly square, so the captured
# 720x480 video has black bars on the side. These need to be cropped off prior to doing motion
# stabilization, but then added back prior to the final output, which must still be 720x480 with the
# black bars on the side.
# 9. I reduced the default depan settings to 20, which is what was recommended in the original script. I
# also reduced the post-depan cropping. I did this so I could keep as much of the original frame
# as possible.
# 10. I removed the second denoising and sharpening function. It just seemed to be too much, and made the
# result too artificial
# 11. I removed the MVFLowFPS interpolation. I did this during one of dozens and dozens of attempts
# to improve the speed of the script. I should probably add this back, but if I do so, I also
# need to make it work correctly for interlaced output. If the goal is to show this on an NTSC or PAL
# television set, then it is not correct to convert from the film fps to 25 fps progressive (PAL) or
# 29.97 fps progressive (NTSC). Instead, this should be done as follows (example given is NTSC):
#
# MFlowFPS(source,super,backward_vec, forward_vec, num=60000, den=1001,ml=200)
# SeparateFields()
# SelectEvery(4, 0, 3)
# Weave()
#
# This yields interlaced 29.97, which has twice the temporal resolution as 29.97 progressive, and will
# therefore look correct on a TV set. I have done a lot of this as part of my Kinescope to video
# conversion scripts. For those scripts, the goal is to make the filmed version of a TV show look
# like it was actually videotaped. However, for something that originated on film, this "does violence"
# to the original feel of the media. It is true that it can make horizontal pans less "juddery," but
# it won't feel like film anymore. Also, this technique does break down, espcially with fast motion
# in the foreground.
# 12. Removed the unecessary "coloryuv(off_U=blue,off_V=red)" statement from the denoising section.
# 13. Added killaudio() statement to prevent lockups when using SetMTMode().
#====================================================================================
#Change the following line to point to your video file
film="e:\frameserver.avi"
#====================================================================================
#GENERAL PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
result="result3" #specify the wanted output here
trim_begin=0 play_speed=15 #trim frames and play speed (PAL: 16.6666 or 18.75)
#COLOR AND LEVELS PARAMATERS
#----------------------------------------------------------------------------------------------------------------------------
saturation=1.2 #for all outputs
gamma=1.2 #for all outputs
blue= -0 red=-0 #manual color adjustment, when returning result3 & result4. Values can be positive or negative
black_level=0 white_level=255 output_black=0 output_white=255 #manual levels, when returning result2 & result4
#SIZE, CROP AND BORDERS PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
CLeft=16 CTop=16 CRight=16 CBottom=16 #crop values after Depan and before final resizing
W=720 H=480 #final size after cropping
bord_left=0 bord_top=0 bord_right=0 bord_bot=0 #720p= borders 150
in_bord_left=68 in_bord_top=0 in_bord_right=68 in_bord_bot=0 #Borders around input that must be removed
#STABILISING PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
maxstabH=20 #maximum values for the stabiliser (in pixels) 20 is a good start value
maxstabV=20
est_left=40 est_top=40 est_right=40 est_bottom=40 est_cont=1.6 #crop and contast values for special Estimate clip
#DENOISING PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
denoising_strength=600 #denoising level of first denoiser: MVDegrain()
block_size= 16 #block size of MVDegrain
block_size_v= 16
block_over= 8 #block overlapping of MVDegrainMulti()
dirt_strength=23 #sets amount of dirt removal (big spots)
#FOUR STEP SHARPENING PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------
PRE_sharp_ness= 120 PRE_radi_us= 3 #presharpening (UnsharpMask) just after first denoising
#AUTO LEVELS PARAMETER
#--------------------------------------------------------------------------------------------------------------------------------
X=4 #X is a special parameter for reducing the autolevels effect on the whites
X2=2 #X2 is a special parameter for reducing the autolevels effect on the blacks
# END VARIABLES, BEGIN SCRIPT
#=================================================================================================================================
SetMemoryMax(800) #set this to 1/3 of the available memory
Loadplugin("Depan.dll")
LoadPlugin("DepanEstimate.dll")
Loadplugin("removegrain.dll")
LoadPlugin("MVTools2.dll")
Loadplugin("mt_masktools.dll")
Loadplugin("warpsharp.dll")
LoadPlugIn("LimitedSupport_09Jan06B.dll")
LoadPlugin("autolevels.dll")
loadplugin("C:\Program Files\AviSynth 2.5\plugins\RemoveDirtSSE2.dll")
#Remove all setmtmode statements (there are three in this script) if not using multi-threaded (MT) AVISynth
setmtmode(5)
source1= Avisource(film).killaudio().assumefps(play_speed).trim(trim_begin,0).converttoYV12()
cropped_source=source1.crop(in_bord_left,in_bord_top,-in_bord_right,-in_bord_bot) #remove any black borders on input video
setmtmode(2,0)
#STABILIZING
#....................................................................................................................................................................
stab_reference= cropped_source.crop(est_left,est_top,-est_right,-est_bottom).tweak(cont=est_cont).MT_binarize(threshold=80).greyscale().invert()
mdata=DePanEstimate(stab_reference,trust=1.0,dxmax=maxstabH,dymax=maxstabV)
stab=DePanStabilize(cropped_source,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=1,mirror=15)
#DENOISING
#...................................................................................................................................................................
input_to_removedirt=stab.crop(CLeft,CTop,-CRight,-CBottom)
stabcrop=RemoveDirtMC(input_to_removedirt,dirt_strength,false)
super = stabcrop.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)
#Use the second line below, and un-comment two lines above if you want to average more frames. Doesn't seem necessary for most work IMHO.
denoised=stabcrop.MDegrain2(super, bvec1,fvec1,bvec2,fvec2,thSAD=denoising_strength).levels(0,gamma,255,0,255).tweak(sat=saturation).unsharpmask(PRE_sharp_ness,PRE_radi_us,0)
#denoised=stabcrop.MDegrain3(super, bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=denoising_strength).levels(0,gamma,255,0,255).tweak(sat=saturation).unsharpmask(PRE_sharp_ness,PRE_radi_us,0)
#SHARPENING
#...................................................................................................................................................................
sharp1=denoised.sharpen(0.9)
PreBorderFrame = sharp1.Lanczos4Resize(W - bord_left - in_bord_left - bord_right - in_bord_right, H - bord_top - in_bord_top - bord_bot - in_bord_bot)
#RESULT1: AUTOLEVELS,AUTOWHITE
#......................................................................................................................................................................
setmtmode(5)
result1= PreBorderFrame.coloryuv(autowhite=true).addborders(X,0,0,0,$FFFFFF).addborders(0,0,X2,0,$000000).autolevels(filterRadius=2).crop(X,0,-X2,-0).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)
#RESULT2: MANUAL LEVELS, AUTOWHITE
#......................................................................................................................................................................
result2= PreBorderFrame.levels(black_level,gamma,white_level,0,255).coloryuv(autowhite=true).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)
#RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
#.....................................................................................................................................................................
result3= PreBorderFrame.coloryuv(off_U=blue,off_V=red).addborders(X,0,0,0,$FFFFFF).addborders(0,0,X2,0,$000000).autolevels(filterRadius=2).crop(X,0,-X2,-0).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)
#RESULT4: MANUAL LEVELS, MANUAL COLOR CORRECTIONS
#.....................................................................................................................................................................
result4= PreBorderFrame.coloryuv(off_U=blue,off_V=red).levels(black_level,gamma,white_level,0,255).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)
#PARAMETERS FOR THE COMPARISONS
#.....................................................................................................................................................................
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot
source4=Lanczos4Resize(source1,W2,H2)
#COMPARISONS: ORIGINAL VS RESULTS
#......................................................................................................................................................................
resultS1= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result1,"autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result2,"autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result3,"autolevels, manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result4,"manual colors and levels correction",size=28,align=2))
Eval(result)
# END SCRIPT, BEGIN FUNCTIONS
#=================================================================================================================================
#REMOVE DIRT FUNCTION
#......................................................................................................................................................................
function RemoveDirt(clip input, int limit, bool _grey)
{
clensed=input.Clense(grey=_grey, cache=4)
alt=input.RemoveGrain(2)
return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3, dmode=2,debug=false,noise=limit,noisy=4, grey=_grey)
# Alternative settings
# return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=true)
# return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=false)
}
function RemoveDirtMC(clip,int limit, bool "_grey")
{
_grey=default(_grey, false)
limit = default(limit,6)
i=MSuper(clip,pel=2)
bvec = MAnalyse(i,isb=false, blksize=8, delta=1, truemotion=true)
fvec = MAnalyse(i,isb=true, blksize=8, delta=1, truemotion=true)
backw = MFlow(clip,i,bvec)
forw = MFlow(clip,i,fvec)
clp=interleave(backw,clip,forw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}
videoFred
9th June 2010, 17:01
Here is the modified script:
It looks great, John! The dirt removing is quite impressive. I will test it further on different sources.
Fred.
johnmeyer
9th June 2010, 18:59
I plan on doing more work today. Your script definitely does a better job of extracting small details in fine-grained film that contains pictures with a lot of "structure," meaning that they don't have huge areas of sky or water, but instead are filled with objects that have lots of varied details.
On the other hand, the performance of this script is key. I still believe that I can get this to operate at least 2x faster, and perhaps more, because I'm still only using about 20% of my CPUs, and many of my other scripts peg all eight cores on my machine at 100%.
I have run through clips from over eight hours of 8mm film through my modification of your script. The film I used for my tests was taken over a thirty year period on dozens of different film stocks, and contains a huge range of terrible exposures, camera shakes, subject matter, etc. Thus, this amateur film helps show off the advantages and disadvantages of every script approach. So far, I've had no bad surprises from my modified script. Since I want to be able to treat large amounts of film, and don't have the time to fine-tune each and every scene, the other goal I had was to create a script where the settings could be kept constant for an entire reel of film. I'm going to start on the eight hours of film today. We'll see how it goes.
P.S. I also have increased the X and X2 parameters since I posted the script. I kept having "flashes" from the autolevels locking on borders. This probably has to do with the fact that my 720x480 videos have some residual borders. I now crop these in the script, but I think some residual may be creeping through. As near as I can tell, these two parameters can be made quite large before the exposure would be adversely affected.
johnmeyer
9th June 2010, 20:12
Here's a short before/after clip using the revised script:
http://www.youtube.com/user/johnmeyer77#p/u/0/4Gy9ZG23TTk
(And yes, I did clean the film prior to transferring with my Workprinter ...)
Leinad4Mind
9th June 2010, 20:49
johnmeyer, can u please upload, the "LimitedSupport_09Jan06B.dll" plugin, I can just find the 2005 version of it.
best regards, and great work improving it. ;)
johnmeyer
9th June 2010, 22:14
johnmeyer, can u please upload, the "LimitedSupport_09Jan06B.dll" plugin, I can just find the 2005 version of it.
All the AVISynth DLLs needed for VideoFred's script are included in his download link posted at the beginning of this thread, including "LimitedSupport_09Jan06B.dll."
The only additional DLLs you will need to run my version of this script are the RemoveDirt DLL and also the multi-threaded version of AVISynth, if you want the extra speed that comes from multi-threading portions of this script, and if you have a multi-core CPU. Both those links are given in the changelog of my script in my post above.
BTW, I just noticed something in that before/after YouTube example I linked to in my previous post, and it is another testament to the brilliance of what VideoFred has done. Run the video full screen at 480p and then look at the side of the building in the lower left corner of the screen. In the before, you can't see anything, but in the after, you can see two murals on the side of the building the details of which remain steady and clear, despite the dirt and mold that comes and goes from frame to frame.
Leinad4Mind
9th June 2010, 22:29
Thks johnmeyer. ;)
btw if anyone want's more than an Mdegrain3, like an MDegrain5, here it is, (in many cases, it's not really necessary):
#DENOISING PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
denoising_strength=600 #denoising level of first denoiser: MVDegrain()
block_size= 16 #block size of MVDegrain
block_size_v= 16
block_over= 8 #block overlapping of MVDegrainMulti()
dirt_strength=23 #sets amount of dirt removal (big spots)
tm= true
pel_value= 2
shrp_value= 1
idx_value= 11
#DENOISING
#...................................................................................................................................................................
input_to_removedirt=stab.crop(CLeft,CTop,-CRight,-CBottom)
stabcrop=RemoveDirtMC(input_to_removedirt,dirt_strength,false)
super = stabcrop.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)
bvec4 = MAnalyse(super, isb = true, delta = 4, blksize=block_size, overlap=block_over)
fvec4 = MAnalyse(super, isb = false, delta = 4, blksize=block_size, overlap=block_over)
bvec5 = MAnalyse(super, isb = true, delta = 5, blksize=block_size, overlap=block_over)
fvec5 = MAnalyse(super, isb = false, delta = 5, blksize=block_size, overlap=block_over)
#Use the second line below, and un-comment two lines above if you want to average more frames. Doesn't seem necessary for most work IMHO.
#denoised=stabcrop.MDegrain2(super, bvec1,fvec1,bvec2,fvec2,thSAD=denoising_strength).levels(0,gamma,255,0,255).tweak(sat=saturation).unsharpmask(PRE_sharp_ness,PRE_radi_us,0)
#denoised=stabcrop.MDegrain3(super, bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=denoising_strength).levels(0,gamma,255,0,255).tweak(sat=saturation).unsharpmask(PRE_sharp_ness,PRE_radi_us,0)
#Use this lines for MDegrain5 and activate ALL bvec and fvec above.
superDenoised=stabcrop.MDegrain3(super, bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=denoising_strength).levels(0,gamma,255,0,255).tweak(sat=saturation).unsharpmask(PRE_sharp_ness,PRE_radi_us,0)
denoised=stabcrop.MDegrain2(super, bvec4,fvec4,bvec5,fvec5,thSAD=denoising_strength).levels(0,gamma,255,0,255).tweak(sat=saturation).unsharpmask(PRE_sharp_ness,PRE_radi_us,0)
\ .Merge(superDenoised, 0.436) # correct weightings (hopefully)
Best Regards
johnmeyer
9th June 2010, 23:55
btw if anyone want's more than an Mdegrain3, like an MDegrain5, here it is, (in many cases, it's not really necessary):
In my quest for a faster script, I did a lot of testing using just two "before" and two "after" MAnalyze vectors. I couldn't tell any difference. However, this isn't to say that there might be. Have you found any substantial improvement in using the extra vectors, and if so, what did they look like, and in what circumstances did they occur?
johnmeyer
10th June 2010, 00:24
Just a quick update.
As I work my way through 100 reels of film, I keep experimenting. I have found that the main reason that VideoFred's script does a better job bringing out details in scenes containing lots of "structure" is due mostly to the LimitedSharpenFaster function. I removed this because it takes my script from 15 fps to about 9 fps. However, I have added it back in as an option and am occasionally using it on certain reels. As time permits I will see if I can get the LimitedSharpen MOD version to run faster under MT. I did spend some time with this yesterday, but wasn't able to get it to run any faster. There is also a similar sharpening script that I think is called "SeeSaw" or something like that. I may experiment with that.
Gavino
10th June 2010, 00:37
superDenoised=stabcrop.MDegrain3(super, bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=denoising_strength).levels(0,gamma,255,0,255).tweak(sat=saturation).unsharpmask(PRE_sharp_ness,PRE_radi_us,0)
denoised=stabcrop.MDegrain2(super, bvec4,fvec4,bvec5,fvec5,thSAD=denoising_strength).levels(0,gamma,255,0,255).tweak(sat=saturation).unsharpmask(PRE_sharp_ness,PRE_radi_us,0)
\ .Merge(superDenoised, 0.436) # correct weightings (hopefully)
Is it valid to use vectors of delta=4 or 5 with MDegrain2?
Even if it is, how did you derive the merge weight?
I don't think it's possible to get the right final weighting for both the centre frame and the outermost ones at the same time.
Leinad4Mind
10th June 2010, 03:19
Is it valid to use vectors of delta=4 or 5 with MDegrain2?
Even if it is, how did you derive the merge weight?
I don't think it's possible to get the right final weighting for both the centre frame and the outermost ones at the same time.
Yes it is. How did I ? I didn't. Didée did. :)
Check this: http://forum.doom9.org/showthread.php?p=1138514 ;)
Btw, I have been working around with the script, but for restore very old dvd animation. Soon I will post the "new" script and my results. :rolleyes:
best regards
Didée
10th June 2010, 05:03
@Gavino: yes, mdegrainX allows to use vectors with such deltas. And, yes, there is no "fully correct" way to make that particular averaging.
@ Leinad4Mind - you're linking to the wrong thread/post/script. That one is TGMC, and the averaging used in there is quite a bit different.
What you would have wanted to link is this here (http://forum.doom9.org/showthread.php?p=1141506#post1141506), most probably.;)
But again - that averaging is a reasonable approximation, but not-at-all mathematically exact (since that's impossible.).
In any case, you seem to have reversed the weighting: you've small weight for the 3-frame-clip, and bigger weight for the 2-frame-clip. It should be exactly the other way round.
Leinad4Mind
10th June 2010, 08:14
I mean here: http://forum.doom9.org/showthread.php?p=1138690 ^^'
And I think I've fixed the weighting ^^'
#Use this lines for MDegrain5 and activate ALL bvec and fvec above.
superDenoised=stabcrop.MDegrain3(super, bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=denoising_strength).levels(0,gamma,255,0,255).tweak(sat=saturation)#.unsharpmask(PRE_sharp_ness,PRE_radi_us,0)
denoised=superDenoised.MDegrain2(super, bvec4,fvec4,bvec5,fvec5,thSAD=denoising_strength)
\ .Merge(superDenoised, 0.436) # correct weightings (hopefully)
Right Didée?
I have made my own modded version, aim for old and ugly animation xD
Here it is the result:Anime-Restoration (http://manganime.biz/Anime_Restoring.mp4)
Gavino
10th June 2010, 10:18
I mean here: http://forum.doom9.org/showthread.php?p=1138690 ^^'
And I think I've fixed the weighting ^^'
Right - I see how that can work, as MDegrain2 is applied to the result of MDegrain3, giving the central frame the same weight as its neighbours. But I think the merge weight should be 5/11 = 0.455.
Leinad4Mind
10th June 2010, 13:03
Right - I see how that can work, as MDegrain2 is applied to the result of MDegrain3, giving the central frame the same weight as its neighbours. But I think the merge weight should be 5/11 = 0.455.
yeah, u're right I will put then "0.4545". thks in advance :cool:
Gavino
10th June 2010, 18:58
John, firstly well done for your work on the script.# 13. Added killaudio() statement to prevent lockups when using SetMTMode().
Have you experienced these lockups yourself, or can you provide links to evidence?
This sounds like an urban myth to me since as far as I know SetMTMode does not touch the audio in any way and it continues to run single-threaded.
johnmeyer
10th June 2010, 20:38
Have you experienced these lockups yourself, or can you provide links to evidence?
This sounds like an urban myth to me since as far as I know SetMTMode does not touch the audio in any way and it continues to run single-threaded.
Yes, I experienced myself:
http://forum.doom9.org/showthread.php?p=1345342#post1345342
You'll have to read several posts down from this one to see where the killaudio() command was suggested as a way to stop crashes when using setmtmode() with MVTools2. Not only did it work, but when I have forgotten to include it in other scripts, I have experienced crashes until I remember to add it.
Didée
10th June 2010, 22:31
I can't confirm that urban myth. It seems that SetMTmode + MVTools really has a nasty tendency to crash. From what I experienced so far, it seems related to SetMemoryMax. Rule of thumb: when SMM is <1GB (32bit Avisynth) resp. <2GB (64bit Avisynth), then usually all is good. When going beyond 1GB (32) / 2GB (64bit), I can literally sit there and wait for the crash, it won't take long.
I tried the KillAudio() thingy, but it doesn't change anything for me. (Well, how should it? With Mpeg2source, there is no audio to start with...)
Gavino
10th June 2010, 23:00
I tried the KillAudio() thingy, but it doesn't change anything for me. (Well, how should it? With Mpeg2source, there is no audio to start with...)
LOL - a good one! :):):):)
Your experience shows there is definitely some memory-related problem with SetMTMode+MVTools, even when there is no audio in sight (or in earshot). I suspect adding KillAudio simply changes the memory location of other filters and the real problem lies elsewhere.
In the script johnmeyer referenced that originally had a problem, killaudio was already present and simply moving it made the problem (appear to) go away. So it is not related to the presence or absence of an audio-processing execution path. Problems that come and go with random script changes are nearly always due to memory corruption of some kind.
Still, if KillAudio makes a particular script work (and you don't want the audio anyway), then you might as well keep it in...
Boulder
17th June 2010, 17:44
# based on videoFred's script and johnmeyer's modification of it
# PLEASE NOTE THAT THIS FUNCTION IS NOT SMART, IT IS JUST SOME THINGS POURED TOGETHER!
# THE THREAD http://forum.doom9.org/showthread.php?t=144271 CONTAINS THE ORIGINAL SCRIPT
function RestoreOldFilm (clip film, string "result", int "trim_begin", float "play_speed", float "saturation", float "gamma",
\ int "blue", int "red", int "black_level", int "white_level", int "output_black", int "output_white",
\ int "CLeft", int "CTop", int "CRight", int "CBottom", int "W", int "H", int "bord_left", int "bord_top",
\ int "bord_right", int "bord_bot", int "in_bord_left", int "in_bord_top", int "in_bord_right", int "in_bord_bot",
\ int "maxstabH", int "maxstabV", int "range", float "trust", int "est_left", int "est_top", int "est_right", int "est_bottom",
\ float "est_cont", int "mirror", int "denoising_strength", int "block_size", int "block_size_v", int "block_over",
\ int "thscd1", int "thscd2", int "rfilter", int "search", int "searchparam", int "lambda", int "pnew", int "plevel",
\ int "lsad", int "badsad", int "dirt_strength", int "smode", int "lsfstrength", int "X", int "X2",
\ bool "stabilize", bool "denoise", bool "sharpen", bool "despot")
{
result=default(result, "resultS3")
trim_begin=default(trim_begin, 0)
play_speed=default(play_speed, 18)
saturation=default(saturation, 1.2)
gamma=default(gamma, 1.2)
blue=default(blue, -0)
red=default(red, -0)
black_level=default(black_level, 0)
white_level=default(white_level, 255)
output_black=default(output_black, 0)
output_white=default(output_white, 255)
CLeft=default(CLeft, 0)
CTop=default(CTop, 0)
CRight=default(CRight, 0)
CBottom=default(CBottom, 0)
W=default(W, 720)
H=default(H, 576)
bord_left=default(bord_left, 0)
bord_right=default(bord_right, 0)
bord_top=default(bord_top, 0)
bord_bot=default(bord_bot, 0)
range=default(range, 3)
trust=default(trust, 4.0)
in_bord_left=default(in_bord_left, 0)
in_bord_right=default(in_bord_right, 0)
in_bord_top=default(in_bord_top, 0)
in_bord_bot=default(in_bord_bot, 0)
maxstabH=default(maxstabH, 20)
maxstabV=default(maxstabV, 20)
est_left=default(est_left, 0)
est_right=default(est_right, 0)
est_top=default(est_top, 0)
est_bottom=default(est_bottom, 0)
est_cont=default(est_cont, 1.3)
mirror=default(mirror, 0)
denoising_strength=default(denoising_strength, 600)
block_size=default(block_size, 16)
block_size_v=default(block_size_v, block_size)
block_over=default(block_over, block_size/2)
thscd1=default(thscd1, 400)
thscd2=default(thscd2, 130)
rfilter=default(rfilter, 4)
search=default(search, 5)
searchparam=default(searchparam, 8)
lambda= default(lambda, 100*block_size*block_size/64)
pnew= default(pnew, 25)
plevel= default(plevel, 0)
lsad= default(lsad, 400*block_size*block_size/64)
badsad=default(badsad, 10000)
dirt_strength=default(dirt_strength, 23)
smode=default(smode, 5)
lsfstrength=default(lsfstrength, 100)
X=default(X, 4)
X2=default(X2, 2)
stabilize=default(stabilize, true)
sharpen=default(sharpen, true)
denoise=default(denoise, true)
despot=default(despot, true)
source1= film.killaudio().assumefps(play_speed).trim(trim_begin,0).converttoYV12()
cropped_source=source1.crop(in_bord_left,in_bord_top,-in_bord_right,-in_bord_bot)
stab_reference = (stabilize == true) ? cropped_source.crop(est_left,est_top,-est_right,-est_bottom).mt_binarize(threshold=round(80/est_cont),upper=true,U=-128,V=-128) : cropped_source
mdata = (stabilize == true) ? DePanEstimate(stab_reference,trust=trust,dxmax=maxstabH,dymax=maxstabV,range=range) : NOP()
stab = (stabilize == true) ? DePanStabilize(cropped_source,data=mdata,info=false,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=1,mirror=mirror) : cropped_source
WS = width(stab)
HS = height(stab)
stab4 = (stabilize == true) ? stab.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS) : cropped_source.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
spot = (despot == true) ? RemoveSpots(stab) : stab
input_to_removedirt = (denoise == true) ? spot.crop(CLeft,CTop,-CRight,-CBottom) : NOP()
stabcrop = (denoise == true) ? RemoveDirtMC(input_to_removedirt,dirt_strength,false) : NOP()
super = (denoise == true) ? stabcrop.MSuper(pel=2,rfilter=rfilter) : NOP()
bvec1 = (denoise == true) ? MAnalyse(super, isb = true, delta = 1, blksize=block_size, overlap=block_over, search=search, searchparam=searchparam, truemotion=false, global=true, lambda=lambda, pnew=pnew, plevel=plevel, lsad=lsad, badsad=badsad) : NOP()
fvec1 = (denoise == true) ? MAnalyse(super, isb = false, delta = 1, blksize=block_size, overlap=block_over, search=search, searchparam=searchparam, truemotion=false, global=true, lambda=lambda, pnew=pnew, plevel=plevel, lsad=lsad, badsad=badsad) : NOP()
bvec2 = (denoise == true) ? MAnalyse(super, isb = true, delta = 2, blksize=block_size, overlap=block_over, search=search, searchparam=searchparam, truemotion=false, global=true, lambda=lambda, pnew=pnew, plevel=plevel, lsad=lsad, badsad=badsad) : NOP()
fvec2 = (denoise == true) ? MAnalyse(super, isb = false, delta = 2, blksize=block_size, overlap=block_over, search=search, searchparam=searchparam, truemotion=false, global=true, lambda=lambda, pnew=pnew, plevel=plevel, lsad=lsad, badsad=badsad) : NOP()
#bvec3 = (denoise == true) ? MAnalyse(super, isb = true, delta = 3, blksize=block_size, overlap=block_over, search=search, searchparam=searchparam, truemotion=false, global=true, lambda=lambda, pnew=pnew, plevel=plevel, lsad=lsad, badsad=badsad) : NOP()
#fvec3 = (denoise == true) ? MAnalyse(super, isb = false, delta = 3, blksize=block_size, overlap=block_over, search=search, searchparam=searchparam, truemotion=false, global=true, lambda=lambda, pnew=pnew, plevel=plevel, lsad=lsad, badsad=badsad) : NOP()
denoised = (denoise == true) ? stabcrop.MDegrain2(super,bvec1,fvec1,bvec2,fvec2,thSAD=denoising_strength,thscd1=thscd1,thscd2=thscd2).levels(0,gamma,255,0,255).tweak(sat=saturation) : spot
sharp1 = (sharpen == true) ? denoised.LSFMod(defaults="slow",smode=smode,strength=lsfstrength) : NOP()
PreBorderFrame = (sharpen == true) ? sharp1.Lanczos4Resize(W - bord_left - in_bord_left - bord_right - in_bord_right, H - bord_top - in_bord_top - bord_bot - in_bord_bot) : denoised
#RESULT1: AUTOLEVELS,AUTOWHITE
#......................................................................................................................................................................
result1= PreBorderFrame.coloryuv(autowhite=true).addborders(X,0,0,0,$FFFFFF).addborders(0,0,X2,0,$000000).autolevels(filterRadius=2).crop(X,0,-X2,-0).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)
#RESULT2: MANUAL LEVELS, AUTOWHITE
#......................................................................................................................................................................
result2= PreBorderFrame.levels(black_level,gamma,white_level,0,255).coloryuv(autowhite=true).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)
#RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
#.....................................................................................................................................................................
result3= PreBorderFrame.coloryuv(off_U=blue,off_V=red).addborders(X,0,0,0,$FFFFFF).addborders(0,0,X2,0,$000000).autolevels(filterRadius=2).crop(X,0,-X2,-0).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)
#RESULT4: MANUAL LEVELS, MANUAL COLOR CORRECTIONS
#.....................................................................................................................................................................
result4= PreBorderFrame.coloryuv(off_U=blue,off_V=red).levels(black_level,gamma,white_level,0,255).addborders(bord_left+in_bord_left, bord_top+in_bord_top, bord_right+in_bord_right, bord_bot+in_bord_bot)
result5= overlay(source1,stab_reference,x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)
#PARAMETERS FOR THE COMPARISONS
#.....................................................................................................................................................................
W2= W+bord_left+bord_right
H2= H+bord_top+bord_bot
source4=Lanczos4Resize(source1,W2,H2)
#COMPARISONS: ORIGINAL VS RESULTS
#......................................................................................................................................................................
resultS1= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result1,"autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result2,"autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result3,"autolevels, manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result4,"manual colors and levels correction",size=28,align=2))
resultS5= 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)
}
# END SCRIPT, BEGIN FUNCTIONS
#=================================================================================================================================
#REMOVE DIRT FUNCTION
#......................................................................................................................................................................
function RemoveDirt(clip input, int limit, bool _grey)
{
clensed=input.Clense(grey=_grey, cache=4)
alt=input.RemoveGrain(2)
return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,dmode=2,debug=false,noise=limit,noisy=4, grey=_grey)
# Alternative settings
# return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=true)
# return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=false)
}
function RemoveDirtMC(clip,int limit, bool "_grey", int "block_size", int "block_over", int "thscd1", int "rfilter", int "search", int "searchparam", int "lambda", int "pnew", int "plevel", int "lsad")
{
_grey=default(_grey, false)
limit = default(limit,6)
i=MSuper(clip,pel=2,rfilter=rfilter)
bvec = MAnalyse(i,isb=false, blksize=block_size, overlap=block_over, delta=1, search=search, searchparam=searchparam, truemotion=false, global=true, lambda=lambda, pnew=pnew, plevel=plevel, lsad=lsad, badsad=500)
fvec = MAnalyse(i,isb=true, blksize=block_size, overlap=block_over, delta=1, search=search, searchparam=searchparam, truemotion=false, global=true, lambda=lambda, pnew=pnew, plevel=plevel, lsad=lsad, badsad=500)
backw = MFlow(clip,i,bvec,thscd1=thscd1)
forw = MFlow(clip,i,fvec,thscd1=thscd1)
clp=interleave(backw,clip,forw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}
function Removespots (clip i, int "ml", int "thscd1", int "rfilter", int "block_size", int "block_over", int "search", int "searchparam", int "lambda", int "pnew", int "plevel", int "lsad", int "badsad")
{
prefilt=i.DeGrainMedian(mode=3) # prefiltered for better motion analysis
#analyse and compensate motion forward and backward (to current frame)
ml=default(ml, 100) # mask scale
thscd1=default(thscd1, 400) # scene change
super=i.MSuper(pel=2,rfilter=rfilter) # super clip
superprefilt=prefilt.MSuper(pel=2,rfilter=rfilter) # super filtered clip
vf = superprefilt.MAnalyse(isb=false,blksize=block_size,overlap=block_over,search=search, searchparam=searchparam, truemotion=false, global=true, lambda=lambda, pnew=pnew, plevel=plevel, lsad=lsad, badsad=badsad) # forward vectors
cf = i.MFlow(super, vf, thscd1 = thscd1) # previous compensated forward
sadf = i.MMask(vf, ml=ml,kind=1,gamma=1, thscd1 = thscd1) # forward SAD mask
msadf=sadf.MT_Binarize() # binary inverted forward SAD mask
vb = superprefilt.MAnalyse(isb=true,blksize=block_size,overlap=block_over,search=search, searchparam=searchparam, truemotion=false, global=true, lambda=lambda, pnew=pnew, plevel=plevel, lsad=lsad, badsad=badsad) # backward vectors
cb = i.MFlow(super, vb, thscd1 = thscd1) # next compensated backward
sadb = i.MMask(vb, ml=ml, gamma=1, kind=1, thscd1 = thscd1) # backward SAD mask
msadb = sadb.MT_Binarize() # binary inverted backward SAD mask
msad = MT_Logic(msadf,msadb,"or") # combined inverted SAD mask
msad = msad.MT_Expand() # expanded inverted SAD mask
msadi = Interleave(msad, msad, msad) # interleaved 3-frame inverted SAD mask
#This mask is high (255) where at least one motion estimation is good,
#so these areas will be protected
Interleave(cf,i,cb) # interleave forward compensated, source, and backward compensated
DeSpot(p1=30,p2=12,pwidth=800,pheight=600,mthres=20,merode=33,\
sign=0,show=0,seg=0,color=true,motpn=true, extmask=msadi)
Eval("SelectEvery(3,1)")
}
Here's my hack which I promised to post. The structure of the function is very stupid, no checks whatsoever. Things borrowed, stolen and pulled out of a hat :) No warranty, that is..hope someone will tweak and enhance it to be actually useful to anyone else but me. Gavino's GScript could do it some good, at least.
videoFred
30th June 2010, 11:21
I am working on an improved script. :)
It looks like RemoveDirtMC() followed by MVDegrainMulti() gives realy spectacular results.
With special thanks to JohnMeyer for pionting me to RemoveDirtMC.
I have a few questions:
1) Who has made RemoveDirtMC() and what is the difference with the original RemoveDirt()?
2) Several step sharpening (big radius first) is absolutely the way to go for maximum quality.
But, from a pure technical view, should I apply sharpening before or after dirt removing and degraining?
3) The use of MT. I must place SetMTMode(5) on top of the script, if I understand it good. But then, where to place SetMTMode(2)?
Will RemoveDirtMC() has benefit of this? But MVDegrainMulti() comes after RemovedirtMC(). And as far as I know MVDegrainMulti() is multi core allready.
Sunny greetings from Belgium, (it's hot here now :cool: )
Fred.
Didée
30th June 2010, 13:12
1) Who has made RemoveDirtMC()
That's easy. (But I didn't remember, either.)
Search forum
-> search term "RemoveDirtMC"
--> show results as posts
---> sort results ascending
This will (should) find the first-ever mentioning of the search term on this board.
Here it is. (http://forum.doom9.org/showthread.php?p=791217&highlight=RemoveDirtMC#post791217) ;)
and what is the difference with the original RemoveDirt()?
Obviously, the usage of motion compensation.
But, from a pure technical view, should I apply sharpening before or after dirt removing and degraining?
From a technical view, it should be done either before, or after, or both. :D
(One can argue like this or like that, but there's not really any technical imperative.)
But then, where to place SetMTMode(2)?
I say nothing. Whenever I "assume" something about Avisynth multithreading, I'm told that i got it all wrong. :D
videoFred
30th June 2010, 14:17
Here it is. (http://forum.doom9.org/showthread.php?p=791217&highlight=RemoveDirtMC#post791217) ;)
Thank you!
Obviously, the usage of motion compensation.
But of cource. Next time I will read a script before asking anything . :scared: :p
From a technical view, it should be done either before, or after, or both. :D
Then it will be the videoFred approach: by eye :)
I say nothing. Whenever I "assume" something about Avisynth multithreading, I'm told that i got it all wrong. :D
The same approach then. :p
Fred.
Undead Sega
30th June 2010, 16:08
Dont mind me intruding (hahaha) but I would like to ask, how are you guys transfering your 8mm films to a digital format?
videoFred
30th June 2010, 16:11
how are you guys transfering your 8mm films to a digital format?
My signature :D
Fred.
johnmeyer
30th June 2010, 23:45
Who has made RemoveDirtMC() and what is the difference with the original RemoveDirt()?RemoveDirt was created by Rainer Wittmann:
Remove Dirt (http://www.removedirt.de.tf/)
RemoveDirtMC is, as you can see from the modification to your script that I posted earlier in this thread, simply a function that calls RemoveDirt after motion compensating the clip. So, it is not a different DLL, but simply a function that uses the RemoveDirt DLL.
BTW, I have some alternative documentation for RemoveDirt that was published a long time ago. It refers to an earlier version, so not all the settings are the same. However, it explains far better what the heck is going on, and may help you if you want to tweak some settings. Send me a PM and I'll be happy to send it to you.
The use of MT. I must place SetMTMode(5) on top of the script, if I understand it good. But then, where to place SetMTMode(2)?Don't use the MT calls anywhere in the script. Instead use the SetMTMode statements. I think this is what you are doing, but your question made it sound like you might be using the MT function. This won't work in this script.
The general usage is to put SetMTMode(5) before you open the clip, and then immediately following the call to get the clip, you put the SetMTMode(2,0) statement. I have found several things to look out for when trying to make a script work with multi-threading:
Perfect the script without it, and make sure it works as you expect.
Process and save a clip without the multi-threading
Add multi-threading and then process and save the same clip. Carefully compare the result to what you did without multi-threading. I have seen some cases where the results are not identical because of how things are done in parallel.
Some imported functions (such as the LimitedSharpen function in your script) may not work reliably (they crash when multi-threaded). You may have to incorporate the function into the main script (although I am not sure whether the "Import" function is the cause of the problem) or possibly re-write the LimitedSharpen function to eliminate whatever is causing the problem. Alternatively, you can use a SetMTMode(5) call before the bothersome function, and then put SetMTMode(2,0) after it. Doing this, however, will probably significantly compromise the speed.
I had intended to try to use one of the replacement functions for LimitedSharpenFaster, perhaps the "mod" version, but ran out of time.
I would like to ask, how are you guys transfering your 8mm films to a digital format?Two ways:
Workprinter (http://www.moviestuff.tv/wp_xp.html)
My own invention: High Speed Film to Video Transfer Machine (http://forum.doom9.org/showthread.php?t=106837&highlight=film)
VideoFred has his own invention, and you should definitely go to his page and have a look. It is an absolutely beautiful piece of design, and the craftsmanship is spectacular.
My own invention only requires that you remove the shutter from the projector. After that, you simply capture the film using 1/500 or faster shutter speed on your video camera. The software does everything else and now works flawlessly. I can even capture sound film, in real time, using this technique.
Undead Sega
1st July 2010, 01:59
Wow, your machines are pretty nice :) at what resolution are you capturing in?
tormento
1st July 2010, 07:55
It looks like RemoveDirtMC() followed by MVDegrainMulti() gives realy spectacular results.
Are they scripts or functions? I searched almost anywhere but couldn't find them. :mad:
Nightshiver
2nd July 2010, 02:19
Obviously you haven't searched hard enough. They are functions. MVDegrainMulti is from, what else, MVTools.
johnmeyer
2nd July 2010, 07:35
Wow, your machines are pretty nice at what resolution are you capturing in? 720x480.
I know that Roger Evans (Workprinter's inventor) says you can get better results by capturing at full HD resolution (1920x1080). While I can capture in HDV (1440x1080 1.33 PAR), with my technique this doesn't produce very good results because the inter-frame compression gets hosed by the pulldown fields. The solution would be to capture the component output from my FX1, but the capture card and software needed would be over $500, even on eBay.
In theory, 720x480 should be enough to capture most detail from 8mm and Super8, but again, since I haven't tried true HD capture, I don't know. I'm quite certain that 16mm would benefit from HD capture.
Of course none of these consumer film formats are 16:9, so some of the resolution in an HD capture isn't used (black bars on the side). With 8mm, which is almost perfectly square, almost half the area of the capture isn't used. I haven't run the math, but my guess is that instead of getting 1920, you'd probably only get about 1200 horizontal pixels when capturing most of these formats. So, the real increase in resolution would be something more like going from 720x480 (345,600 pixels) to 1200x1080 (1,296,000 pixels) an increase of 3.75.
And, just to anticipate, no the whole progressive vs. interlaced doesn't mean anything because we are capturing the film while it is at rest in the projector gate, and the results obtained with interlaced video when filming a stationary object are exactly identical to progressive video. So, a 60p camera won't improve the quality. The only way to get better results would be to slow down the projector and use a still camera with megapixel resoltuion. It's been a long time since I looked into this, but most still cameras can't sustain multiple frame capture for more than a few seconds, and I'm not sure if they would breakdown from either heat or shutter wear (I think most still cameras use a physical shutter).
I guess I could take a dozen photos with my Nikon SLR and compare the results to what I get with my FX1.
Quite frankly, once you do this for awhile, you realize that resolution is the least important issue for getting a good result. The whole point of VideoFred's script is to overcome these serious issues.
The toughest thing to get right when transferring film to video: gamma. I kick myself every day for buying the FX1 instead of the Z1. These two cameras were supposed to be identical except for the XLR audio on the Z1. Wrong. The Z1 has the ability to create custom gamma curves so you can create your own look. This would let me flatten the highlights and gain the shadows.
Oh well ... next lifetime I'll do everything right.
videoFred
6th July 2010, 07:15
RemoveDirt was created by Rainer Wittmann:
Remove Dirt (http://www.removedirt.de.tf/)
Thank you!
BTW, I have some alternative documentation for RemoveDirt that was published a long time ago. It refers to an earlier version, so not all the settings are the same. However, it explains far better what the heck is going on, and may help you if you want to tweak some settings. Send me a PM and I'll be happy to send it to you.
OK.
The general usage is to put SetMTMode(5) before you open the clip, and then immediately following the call to get the clip, you put the SetMTMode(2,0) statement.
I'm experimenting with the SetMTMode() calls in the script right now.
Fred.
videoFred
6th July 2010, 07:21
The toughest thing to get right when transferring film to video: gamma.
That's one of the reasons why I use a machine vision camera. All settings can be done manual, with the capture software. Another very useful feature is the ROI (region of interest). With the ROI you can set any aspect ratio and any resolution you want, within the limits of the max. resolution of the sensor of cource.
Fred.
videoFred
8th July 2010, 09:35
I have made a new script with RemoveGrainMC() followed by MDegrainMulti() and some more subtile 3-step sharpening.
Example clip:
http://www.vimeo.com/13173031
Fred.
johnmeyer
8th July 2010, 16:30
Wow, the newest test clip example looks absolutely stunning! The improvements to the sharpening are much better.
I tried downloading the script from the first post in this thread, but the site is down, and it doesn't look like you updated the link. I hope you will be willing to share the results of your efforts.
John
videoFred
9th July 2010, 08:07
I tried downloading the script from the first post in this thread, but the site is down
?? This site should not be down.. never. Please try again by right click on the links and then 'save target'.
I have updated the first page of this thread and the new script is available for download now. If you can not download it, I will send it to you by mail. I have made a separate *avs file from RemoveDirtMC() and I load it in the script now.
Please lower all sharpening settings if the sharpening should be to heavy. Or increase the degraining...
It looks like all filters are working fine with SetMTMode(1,0) but you can change this of cource. At the end of the script, I had to place SetMTMode(5) otherwise it crashes.... I run it on a dual core Dell, in Vista. It's still slow... 3fps.
Fred.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.