View Full Version : The power of Avisynth: restoring old 8mm films.
videoFred
14th January 2009, 10:18
UPDATE 20/06/2012
-------------------------
Newest version of the script:
http://www.super-8.be/avisynth/Film_Restoring_vs_06_2012.zip
- improved autolevels
- improved stabilisation
- improved sharpening
- less plugins
- plugins are now in "plugins' folder.
- better helpfiles
=================================================================
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
===================================================================
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, 09:13
Amazing work !
It was a joy to watch it :)
BillB
4th June 2009, 21:25
For us newbies not quite familiar with this: http://en.wikipedia.org/wiki/Motion_picture_film_scanner
videoFred
5th June 2009, 11: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, 20: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, 06: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, 08: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, 08: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, 08:29
Hello Stefano,
Please use search here on this forum.
VHS in not my thing, sorry.
Fred.
stenews
17th June 2009, 08:35
all right...now I see what you mean.
Thanks the same,
bye,
Stefano
videoFred
17th June 2009, 12:22
You are welcome!
It has just been posted today, Stefano:
http://forum.doom9.org/showthread.php?t=147796
Fred.
stenews
17th June 2009, 13:02
you're a gentlemen, mate.
Thanks a lot for your help, I really appreciate that! ;)
Bye,
Stefano
superpat999
8th July 2009, 19: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, 06: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, 13: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, 13: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, 14: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
Guest
9th July 2009, 14: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, 14: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, 17: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, 07: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, 12: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, 10: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, 10: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, 11: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, 15: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, 17: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, 19: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, 22: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, 12: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, 13: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, 15:44
Ok thanks, just found the link on that page :P
bairradino
6th August 2009, 10: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, 11: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, 14: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, 00:57
Nevermind I found my answer. I changed the RemoveDirt.avs to RemoveDirt.avsi, error went away
videoFred
2nd September 2009, 14: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, 08: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, 09: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, 09: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, 09: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, 08: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, 00: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, 06: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.
wonkey_monkey
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, 17: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, 12: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, 05:08
That fixed it. Many thanks.
kopmjj
16th April 2010, 18: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, 02: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, 06: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, 12: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, 12: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, 09: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, 06: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, 09:40
Newest script and helpfile can be found here:
http://www.super-8.be/avisynth/Film_Restoring.zip
Fred.
kopmjj
28th April 2010, 03: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, 06: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, 07:08
how do i do this? please show me a script thanks.
I am sorry my friend but:
:readguid:
Fred.
kopmjj
28th April 2010, 09: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, 09: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, 10: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, 11: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, 14:43
Many thanks for the information, it's the purest approch to the subject.
Richard
boqa
30th April 2010, 02: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, 06: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, 18: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, 07: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, 11: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, 01: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:
https://i.imgur.com/hgspt18.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:
https://i.imgur.com/lZOzjzL.jpg
and here is the same before and after using the RemoveDirt script I normally use:
https://i.imgur.com/BrlXLba.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:
https://i.imgur.com/yhceYyZ.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, 07: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, 12: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, 18: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, 06: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, 12: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, 18: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, 09: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, 09: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(forw,clip,backw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}
videoFred
9th June 2010, 16: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, 17: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, 19: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, 19: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, 21: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, 21: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, 22: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
9th June 2010, 23: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
9th June 2010, 23: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, 02: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, 04: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, 07: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, 09: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, 12: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, 17: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, 19: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, 21: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, 22: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, 16: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, 10: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, 12: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, 13: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, 15: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, 15:11
how are you guys transfering your 8mm films to a digital format?
My signature :D
Fred.
johnmeyer
30th June 2010, 22: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, 00:59
Wow, your machines are pretty nice :) at what resolution are you capturing in?
tormento
1st July 2010, 06: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, 01:19
Obviously you haven't searched hard enough. They are functions. MVDegrainMulti is from, what else, MVTools.
johnmeyer
2nd July 2010, 06: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, 06: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, 06: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, 08: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, 15: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, 07: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.
Gerald1937
14th July 2010, 16:45
Johnmeyer
Capturing 8mm film at full HD resolution (1920x1080) is possible for modest expenditure but the problem to me is the cost of storage/distribution on Blueray or practical alternatives.
Capture method used.
Canon HV20 + 43mm to 49mm step-up ring + 49mm coupling ring + Pentax 50mm f1.7 lens reversed; provides the video camera with a high quality macro facility. The video camera HDMI sensor output is used to feed into a Blackmagic Intensity card to capture a series of sequentially numbered BMP images at full HD resolution. Each BMP image is 6MB so sustained capture rate is limited by HDD write speed. Typically my SATA II drives as measured using the Blackmagic disk test utility indicate 30 to 60 MB/s. There are other delays within the video camera and frame capture software due to the asynchronous relationship with the film transport. Typically my system provides an average capture rate of 2.7 fps measured over 500 frames using a 60MB/s partition on my SATA II drives.
The film transport system should ideally provide repeatable positional accuracy of the film frame to frame to within 1 pixel. The picture height of a Standard 8mm film is 3.68mm covered by 1080 pixels so 1 pixel = 0.0034mm. This level of accuracy is difficult to achieve and measure. Initially to check my own design of film transport mechanism I used Xnview's > View > display colour information of X and Y values as a measurement tool to accurately locate the sprocket hole edge i.e. the transition to full white RGB all 255. Fringing at the sprocket hole edge is a problem and detracts from the accuracy of this method of measurement. Subsequently I have written a program to automate the measurement over 50 or more frames. This indicates my overall film transport system is within +5 to -5 pixels. Elimination of vibration and film winder take-up during frame capture is also needed to get top quality images. I have no experience of testing modified film projector systems that VideoFred and your Workprinter use. The image taken should be of the emulsion side of the film to obtain the best quality. The resultant images taken are upside-down and 16:9 format so I crop the image to 1440x1080 to get 4:3 format and then flip it vertically before doing the fps change. Finally I add back the borders left and right to restore the 1920x1080 format. I think this order of processing reduces the number of pixels processed to a minimum.
The series of BMP frames are then assembled and processed for PAL using this Avisynthh script:
# /LOADING THE PLUGINS...
LoadPlugin("F:\AviSynth 2.5\plugins\mvtools2.dll")
#
# STARTING THE SCRIPT
# Load the sequence of 500 bmp images: the end number needs to be changed for more or less !!!!!
ImageSource("O:\frames\frame%06d.bmp", start = 0, end = 499, fps = 16, use_DevIL=false) converttoyv12
# Crop the image and flip before the speed change from 16 fps to 25 fps to reduce CPU load?
crop(240, 0, -240,0)
# FlipVertical to get the image right way up.
FlipVertical()
# Do fps change
super = MSuper(pel=2)
backward_vec = MAnalyse(super, isb = true)
forward_vec = MAnalyse(super, isb = false)
#
MFlowFps(super, backward_vec, forward_vec, num=25, den=1, ml=100)
# Add the borders left and right to restore the 1920 x 1080 format.
addborders(240, 0, 240, 0)
#
Open the AVS into Virtualdub then output a Huffyuv compressed avi file for subsequent editing with Premiere Pro 2. The edited version is then exported back to tape in the HV20 and a copy of the HDV2 file created by Premiere Pro as part of the export to tape is kept by renaming it before PPro deletes it. The export to tape process has converted the avi to a HDV (1440x1080 1.33 PAR) format so there will be some degradation in quality. The playback from HV20 HDMI output to Panasonic Viera TV HDMI input shows the capture to best advantage. The observed displayed quality is good and did not show significant signs of film grain from the Kodachrome II film used even from Standard 8mm film BUT is it that much better than a PAL 720x576 transfer from the same film to justify the cost, complexity and time to effect such a transfer to HD? The technical challenge for me was to investigate and know how I could make a successful HD transfer. I doubt if I will be making many more HD transfers, as my SD transfers suffice to bring back the memories of the people and places that others and I filmed. You can view an SD transfer made on this type of system at the www.vtoldboys.com on the LHS of the page click on Trips > Christchurch 1974 > Stan’s film and The Band buttons at the bottom of the page.
Gerald
Boulder
14th July 2010, 16:55
Have you guys (all of you doing these projects) given any thought to using DGPulldown? I got 18fps out of my source so it was easy to first encode to MPEG2 using HCEnc (the latest 024 beta from April 2010) with AssumeFPS(25) in the script and then running the result through DGPulldown doing a 18fps --> 25fps pulldown. Lots of bits saved and all those problem rising from framerate changes avoided :) I just had to restrict the max GOP length to 10 frames for DVD compliance.
johnmeyer
14th July 2010, 17:30
The observed displayed quality is good and did not show significant signs of film grain from the Kodachrome II film used even from Standard 8mm film BUT is it that much better than a PAL 720x576 transfer from the same film to justify the cost, complexity and time to effect such a transfer to HD?One of the first things I would do is capture one minute of film using your technique, and then capture the same one minute simply using the DV output of the HV20. Do the post production in the same way for both. I expect that the differences with 8mm and Super8 will be very, very slight, especially if you use any of the post-processing described in this long thread.
Capturing 8mm film at full HD resolution (1920x1080) is possible for modest expenditure but the problem to me is the cost of storage/distribution on Blueray or practical alternatives.I'm not sure what you mean by this. Aren't Blu-Ray blanks pretty cheap now?
The video camera HDMI sensor output is used to feed into a Blackmagic Intensity card to capture a series of sequentially numbered BMP images at full HD resolution. Each BMP image is 6MB so sustained capture rate is limited by HDD write speed.There are ways you can capture direct to Cineform or the the Blackmagic intermediate. This will require far less disk performance, and will avoid the step of assembling video from the individual BMP files. I asked about this in the Sony Vegas forum awhile back:
Intensity Pro Cineform FX1 Non-RAID (http://www.sonycreativesoftware.com/forums/ShowMessage.asp?ForumID=4&MessageID=682276)
The film transport system should ideally provide repeatable positional accuracy of the film frame to frame to within 1 pixel. Yes this is a desirable goal, but darn near impossible with anything other than a Rank Cintel. Gate weave (which results from the fact that no projector provides "repeatable positional accuracy") is part of the film experience. A much simpler way to deal with this is to do small motion compensated stabilization on the resulting capture. This is something VideoFred included in his script via the Depan plugin.
BTW, I note that you are setting the film playback speed using MFlowFPS, something that VideoFred does in his script as well. This is an interesting thing to do, and I am not entirely against it. However, everyone who uses it needs to understand that it WILL introduce artifacts, and these can sometimes be very strong and obnoxious. The more usual way to handle the speed conversion when showing film on a television set is to add pulldown. When starting with 24 fps and going to 25 fps PAL interlaced, many companies simply speed up the film (i.e., change the header flag in the video file). Thus, the frames themselves are not touched. When going from 15, 16, or 18 fps film, this is where pulldown is used. For instance, to show 18 fps film on a 29.97 NTSC television, I use this code to add pulldown:
separatefields()
selectEvery(6, 0,1, 0,3, 2,3, 2,5, 4,5)
weave()
AssumeFPS(29.97, true)
manono
14th July 2010, 23:41
For instance, to show 18 fps film on a 29.97 NTSC television, I use this code to add pulldown:
separatefields()
selectEvery(6, 0,1, 0,3, 2,3, 2,5, 4,5)
weave()
AssumeFPS(29.97, true)
I think much more efficient from an encoding point of view would be:
ChangeFPS(19.98)
followed by DGPulldown set for 19.98->29.97 after the encoding is complete. All encoding will be of progressive frames with many fewer of them, resulting in a much higher quality result for the same file size. I do this quite often for silent films.
johnmeyer
15th July 2010, 02:56
I think much more efficient from an encoding point of view would be:
ChangeFPS(19.98)
followed by DGPulldown set for 19.98->29.97 after the encoding is complete. All encoding will be of progressive frames with many fewer of them, resulting in a much higher quality result for the same file size. I do this quite often for silent films.I am not sure I follow the logic of this. The AVISynth documentation states that ChangeFPS "changes the frame rate by deleting or duplicating frames." I added the emphasis.
You never want to duplicate entire frames if instead you can duplicate just one field. Duplicating frames instead of fields substantially increases the stutter.
The beauty of pulldown is that it duplicates fields. This isn't some esoteric distinction, but instead is fundamental to making film look good on video.
In traditional 3:2 pulldown (the pattern used to get 24 fps progressive to 29.97 interlaced), the first frame of film is transferred to one frame of video. But, the next frame of film is copied not only to the next frame of video, but to the first field of the video frame after that. The next frame of film (the third in this sequence) starts by filling in the remaining field of video and then the second field is copied to the first field of the next frame of video. If you merely duplicate entire frames of film, you end up with a very jerky result.
There are dozens of excellent explanations on the web. Here is an illustration I found that shows what I'm describing:
Film Pulldown Illustration (http://www.kozco.com/3_2/picture.htm)
For those who think this will give you blended frames -- a common misperception -- this doesn't happen. The reason is that you have to realize that the whole process of displaying fields is continuous, and it really doesn't matter if a field belongs to a certain "frame" or not, as long as both fields of a given frame of film get displayed in the proper order. Thus, when developing pulldown patterns for various "odd" film speeds, you need to make sure that the fields in the selectevery statement always alternate even-odd-even-odd (never have two even fields or two odd fields in a row). And, you never want to skip ahead beyond the next frame.
There is no "right" or "wrong" way to do these conversions from frame rates other than 24 fps. The solution that VideoFred uses, of actually creating new frames using MFlowFPS, produces some very interesting results. I've experimented with this and, as I indicated in my previous post, thought that it produced too many artifacts. However, I have found that if I use large block sizes, and only change from 18 fps progressive to 24 fps progressive, the results are generally quite good. I then encode this to DVD using 23.976 with the pulldown flag set. If it is played on an NTSC TV, the DVD player adds the pulldown during playback. However, if it is played to a non-scanning device (like an LCD TV) and if the DVD player provides progressive output, you will get the 24fps result without further pulldown.
When I developed the scripts to convert kinescopes back to "real" video, I needed to go all the way from 24 fps to 60i. If you do all the right things (degrain, deshake, gamma correction, etc.) prior to the fps conversion, the result really does look like "real" video. However, when starting with something that really is film, I'm not sure this is what most people want. This, of course, is entirely an aesthetic decision, and, like letterboxing or colorizing movies, there will be people who come down on both sides of the argument.
manono
15th July 2010, 03:16
You're duplicating frames as well. Play your encoded script any way you want (except by blend deinterlacing which creates something much worse) and the deinterlacing will create duplicate frames, more than I have. Anything below 19.98fps (for NTSC) by necessity creates duplicate frames.
The beauty of pulldown is that it duplicates fields.
That's what DGPulldown does, and it doesn't encode them into the video stream, thus much better encoding quality.
johnmeyer
15th July 2010, 04:42
You're duplicating frames as well. Play your encoded script any way you want (except by blend deinterlacing which creates something much worse) and the deinterlacing will create duplicate frames, more than I have. Anything below 19.98fps (for NTSC) by necessity creates duplicate frames.
That's what DGPulldown does, and it doesn't encode them into the video stream, thus much better encoding quality.I'm afraid neither thing you say is entirely correct, although perhaps it depends on how you define "duplicating frames." To me, duplicating frames means that I display the entire frame twice in a row. This is NOT what 3:2 pulldown does. I already explained in my last post what is really going on, so I won't repeat that here.
I've tested all my scripts by adding a separatefields() statement at the end, and then looking, field-by-field, at what the script has produced.
Now, it is true that if you get to a slow enough starting frame rate, like 15 fps, then you are 100% correct: to get to 30 fps, each frame is duplicated twice. And it is also true that when going from 16 fps or 18 fps, some[I] frames do get repeated. But, some do not. So you are partly right because some frames get repeated in their entirety, but not all of them.
Now as for DGPulldown, I just went to Donald Graft's site to make sure I understood what DGPulldown does:
DGPulldown (http://neuron2.net/dgpulldown/dgpulldown.html)
To quote directly from that page:
[I]"DGPulldown works by altering the MPEG2 RFF/TFF flags to increase the number of display frames to exactly the right number to generate the specified output frame rate during playback."
So, this plugin is only useful when encoding to MPEG2, and it does its magic by changing the pulldown flags and not by actually altering the video. For it to work, the playback device must understand what to do with these flags. If encoding for DVD, there is a very narrow limit to what flags can be used, and I don't think this plugin would be useful.
manono
15th July 2010, 05:00
I'm afraid neither thing you say is entirely correct,
Everything I've said is entirely correct.
This is NOT what 3:2 pulldown does.
Who's talking about 3:2 pulldown? That's for 23.976->29.97. This is 19.98->29.97. It's 3:3 pulldown.
And it is also true that when going from 16 fps or 18 fps, some frames do get repeated.
Which is what I said. Nowhere did I say they all get repeated. What I said was that with your script more get repeated than with 'my' method ('my' because I didn't invent it. neuron2 gets credit for DGPulldown).
So, this plugin is only useful when encoding to MPEG2
Isn't that what you're doing here - providing a script for encoding progressive 18fps sources as interlaced 29.97fps for DVD?
...it does its magic by changing the pulldown flags and not by actually altering the video.
Well, it sets the flags, similar to the way applying 3:2 pullldown sets the TFF/RFF flags.
If encoding for DVD, there is a very narrow limit to what flags can be used, and I don't think this plugin would be useful.
Oh, it's very useful. Its greatest use, perhaps, is for PAL to NTSC conversions without altering the audio. It allows the video to stay the same length and progressive. But it's also very useful for many other kinds of unusual framerates (I used the example of silent films earlier), allowing them to be encoded progressively, rather than as interlaced. It's 100% DVD compliant, plays properly on almost all software and hardware DVD players, and if you'd open your mind just a little bit you may find it useful even in your work.
videoFred
15th July 2010, 07:35
The solution that VideoFred uses, of actually creating new frames using MFlowFPS, produces some very interesting results. I've experimented with this and, as I indicated in my previous post, thought that it produced too many artifacts. However, I have found that if I use large block sizes, and only change from 18 fps progressive to 24 fps progressive, the results are generally quite good.
The artifacts created by MFlowFPS() are way less when using RemoveDirtMC() before. MFlowFPS() is great for low motion scenes. Nice smooth panning scenes etc. On high motion scenes it fails sometimes.
I might be wrong, but is the future not HD progressive? I have done some tests with 720p30 and even 720p60. Very simple with duplicate frames. AssumeFPS() followed by ChangeFPS(). This plays remarkable good on a fast computer.
But for a nice experiment it is possible to create extreme slow motion with MFlowFPS(). Try AssumeFPS(1) followed by MFlowFPS(num=30) for example.
Fred.
Gavino
15th July 2010, 10:05
Thus, when developing pulldown patterns for various "odd" film speeds, you need to make sure that the fields in the selectevery statement always alternate even-odd-even-odd (never have two even fields or two odd fields in a row). And, you never want to skip ahead beyond the next frame.
Note that instead of working out the pulldown pattern, you can just use ChangeFPS to do it for you - much simpler, especially for 'odd' film speeds. See here.
2Bdecided
15th July 2010, 11:20
The artifacts created by MFlowFPS() are way less when using RemoveDirtMC() before. MFlowFPS() is great for low motion scenes. Nice smooth panning scenes etc. On high motion scenes it fails sometimes.That's my experience too.
The artefacts are less noticeable if you (for example) double the frame rate using MFlowFPS (so you still keep all the original frames), and then changefps or pulldown from that to whatever you really want. Of course it's not as smooth.
There was a script (can't remember its name - I think it was in the Alchemist thread) that adaptively switched between motion compensation and blending (block-based), depending on the complexity of motion (I think). Unfortunately that added block-based artefacts.
Cheers,
David.
videoFred
15th July 2010, 11:32
There was a script (can't remember its name - I think it was in the Alchemist thread) that adaptively switched between motion compensation and blending (block-based), depending on the complexity of motion (I think).
This is something I was thinking of myself. But would it not be better to switch between motion compensation and simple frame duplicating?
Fred.
johnmeyer
15th July 2010, 16:36
I decided to try some of the things manono has been suggesting. Here is what I found.
ChangeFPS(59.94)
AssumeTFF() # or BFF, as required
SeparateFields()
SelectEvery(4, 0,3)
Weave()
AssumeFPS(29.97, true)
This is from one of the links in manono's posts. This produces correct pulldown because, while ChangeFPS does indeed duplicate entire frames, by using it to go to twice the final framerate and then decimating with SelectEvery, we end up with the desired 4 3 3 pulldown pattern. As he described in the linked thread, this technique can be used for any starting framerate (15, 16, 18, etc.). So, this is good stuff. Thank you!
I am doing some tests with DGPulldown, and am less convinced as to whether this is going to produce a useful result. I'll create a test DVD and see what happens.
P.S. I did try encoding using the "ChangeFPS(19.98)" script, but this (as I expected) changes from 18 fps to 19.98 fps by duplicating entire frames. Given this, I don't see how DGPulldown is going to give me a smooth looking result.
fabioseixal
15th July 2010, 16:46
I've got a silly question. In your video hosted at vimeo, on the 6 second is that a bird that have been removed? xD
And on the 26 second that mosquito appeared from nothing.
At the end of this idiocy of mine, congratulations, very, very good work that you've acomplished.
Sorry for my bad english...
videoFred
15th July 2010, 16:55
I've got a silly question. In your video hosted at vimeo, on the 6 second is that a bird that have been removed? xD
And on the 26 second that mosquito appeared from nothing.
At the end of this my congratulations, very, very good work.
Sorry for my bad english...
You have a good eye :)
Yes, the bird is gone and the mosquito appears from nothing. RemovedirtMC has done this. Perhaps I should have set the RemoveDirt strength a bit lower on these scenes..
Fred.
manono
15th July 2010, 16:58
I decided to try some of the things manono has been suggesting.
You mean Gavino, not me. His is a more elegant way of hard telecining it.
P.S. I did try encoding using the "ChangeFPS(19.98)" script, but this (as I expected) changes from 18 fps to 19.98 fps by duplicating entire frames.
Of course it does, roughly one dupe frame in every 10. Now, play your output in a hardware or software DVD player and figure the percentage of duplicate frames.
And you haven't ever addressed my main points. I contend that yours will be at least as jerky playing, but having purposely interlaced it, which requires a lot more bits for the same quality as progressive encoding, and with 50% more encoded frames, the output for the same filesize will also be of considerable poorer quality, probably something like 40% poorer quality as measured by the average quant.
johnmeyer
15th July 2010, 17:34
And you haven't ever addressed my main points.Well if the basic point you are making is that duplicating frames will produce better "quality" measured by average quant, I agree that is true. It is also, however, not the only measure of quality and in fact is a measurement that will lead you into doing the wrong thing.
The problem with any sort of pulldown is that it introduces stutter (which is different than judder, the artifact you get on film when the camera pans horizontally). Stutter is where you can actually perceive the motion starting and stopping as frames are duplicated. The problem is that when you duplicate an entire frame (rather than duplicating only one field, a process which results in half the temporal disturbance), you introduce a HUGE discontinuity in the temporal cadence of the resulting video. This is a really bad thing and is visually very disturbing. I see it frequently on commercial broadcasts of theatrical films that have been (badly) decimated to fit a two hour time slot. I also have seen it in many NTSC->PAL and PAL->NTSC conversions that people have given to me to rescue. As people in the TFM threads have discovered, there is some amazingly bad stuff that gets done to video.
The amount of visual disturbance any of these bad conversions create is a function of how often these discontinuities occur. The less frequent they are, the worse, because they are not part of the flow and when they happen during fast motion, they stick out like a sore thumb (for example, the 19.98 video I created in my failed attempt to use DGPulldown looked absolutely horrible because it repeats one entire frame, but only every ten frames). By contrast, the difference in encoding quality between encoding purely progressive video (with entire frames duplicated), and encoding interlaced video with pulldown fields is going to be noticed as a slight increase in encoding artifacts (mosquito noise, blockiness at transitions, etc.). At reasonably high bitrates, with a professional encoder using multi-pass encoding, the difference in these encoding artifacts can be so minor as to be unnoticeable.
In addition, I think that underlying your comments is the belief that interlaced is somehow "worse" than progressive. It is true that interlaced presents additional challenges when editing, and it is also unfortunately true that many of the modern television sets cannot display it natively (something that does not have to be that way and which I hope will change), but interlaced video looks fantastic, unless you try to freeze an individual frame.
Oh, and as I mentioned in passing above, I tried to follow your suggestion to encode a 19.98 AVI file (resulting from ChangeFPS(19.98) to a 19.98 MPEG-2 file and then apply DGPulldown to the result. However, I could not get Vegas, the standalone MainConcept MPEG-2 encoder, or TMPGEnc to encode a 19.98 MPEG-2 file.
Gavino
15th July 2010, 17:49
I did try encoding using the "ChangeFPS(19.98)" script, but this (as I expected) changes from 18 fps to 19.98 fps by duplicating entire frames. Given this, I don't see how DGPulldown is going to give me a smooth looking result.
The DGPulldown method is well proven and should produce identical results to hard pulldown when played back on a conforming player. However, for DGPulldown the input framerate must be no lower than 2/3 of the playback rate (I think this is because the MPEG flags can only produce a maximum of 3 fields per frame, ie up to 3:3 pulldown). So for playback at 29.97 fps, the minimum input rate is 19.98.
Manono's solution is to use ChangeFPS to get from 18 to 19.98 and then use DGPulldown to go the rest of the way. It seems to me this will produce, instead of the optimal 4:3:3 pattern, something like 6:6:3:3:...:3, because of the repeated frames resulting from the initial ChangeFPS.
Are you sure this works, Manono?
Edit: Actually, what might work is to combine 'my' hard pulldown (instead of a simple ChangeFPS) to get to 19.98 before using DGPulldown:
ChangeFPS(39.96)
SeparateFields()
SelectEvery(4, 0,3)
Weave() # is now 19.98
This would allow to encode the smallest number of frames while still getting as smooth playback as possible.
johnmeyer
15th July 2010, 18:31
It seems to me this will produce, instead of the optimal 4:3:3 pattern, something like 6:6:3:3:...:3, because of the repeated frames resulting from the initial ChangeFPS.That's what I thought, and is what I was seeing when I actually did it, and then used "separatefields()" to analyzer the resulting pattern. And, since 6:6:3:3 ....:3 is repeating frames instead of fields, this is what I was trying to avoid in order to minimize the stuttering artifact.
The method that seems to hold the best promise (at least for my work) for 16 and 18 fps material is to use MFlowFPS to go from either of these two framerates to 24 fps progressive. This reduces the number of interpolations that MVTools must do (compared to having it interpolate all the way to 59.94 interlaced, i.e., 60i). Then, encode this 24 fps as 23.976 progressive MPEG-2 with the pulldown flags set, something that any MPEG-2 encoder can do. I've test this, and for most material it works well. You get the clean encoding that manono talked about; and you produce a DVD that can either be viewed as 29.97 with traditional 3:2 pulldown (which will be supplied by the DVD player) or as 24 fps progressive, if the DVD player and TV set can ignore the pulldown flag and display the material as it was encoded.
For this application, I have found that using blksize=16 (for the MAnalyze function that precedes MFlowFPS) reduces the "broken leg" artifacts that MFlowFPS often produces. I call it this because you see the problem when people walk in front of the camera. Depending on the distance from the camera, their legs will appear to warp ("break") in mid stride. With the larger block size, this is reduced. Since 8mm and Super8 (and even most 16mm film) doesn't have the detail of HD video, this larger block size seems to work well for this application without much downside compared to blksize=8.
P.S. I saw that Gavino was posting at the same time I posted. That code looks more promising, but I still don't see how I can encode a 19.98 MPEG-2 file, which I think is what is required in order to have the proper input to DGPulldown. And, I'm still not sure whether the output of DGPulldown can be used as the input to a DVD authoring tool. But, I'm willing to try to see what it look like. Any advice on how to encode 19.98 MPEG-2 would be appreciated (or, if I am not understanding correctly, a gentle nudge in the right direction ...)
Boulder
15th July 2010, 18:53
For this application, I have found that using blksize=16 (for the MAnalyze function that precedes MFlowFPS) reduces the "broken leg" artifacts that MFlowFPS often produces. I call it this because you see the problem when people walk in front of the camera. Depending on the distance from the camera, their legs will appear to warp ("break") in mid stride. With the larger block size, this is reduced. Since 8mm and Super8 (and even most 16mm film) doesn't have the detail of HD video, this larger block size seems to work well for this application without much downside compared to blksize=8.
You might also want to try using overlap of blocksize/2. It should help the motion compensation process.
johnmeyer
15th July 2010, 19:51
You might also want to try using overlap of blocksize/2. It should help the motion compensation process.I tried various overlaps, including blocksize/2, but as far as artifacts, using more overlap didn't help.
manono
16th July 2010, 03:47
Well if the basic point you are making is that duplicating frames will produce better "quality" measured by average quant, I agree that is true.
Your method at output also produces dupe frames, and many more of them.
The problem with any sort of pulldown is that it introduces stutter
3:3 pulldown (19.98->29.97) introduces no stutter at all. The only stutter is from the original dupe frames.
The problem is that when you duplicate an entire frame (rather than duplicating only one field, a process which results in half the temporal disturbance),
If played to a progressive display (computer monitor, HDTV), you're playing frames. And your frames will all have been deinterlaced where with progressive encoding you're playing the original progressive frames. You're at the mercy of the deinterlacer in the player or display. It might be good; it might not. Nor do I see the advantage of 4 duplicate frames in every 10 at playback over having just 1 dupe in 10. The difference is only noticeable during certain kinds of movement and, in my opinion, the quality gain from progressive encoding far outweighs any slight stutter. After all, we're NTSC and are so used to 3:2 pulldown jerkiness that we don't even notice it.
However, I could not get Vegas, the standalone MainConcept MPEG-2 encoder, or TMPGEnc to encode a 19.98 MPEG-2 file.
You can only encode at valid MPEG-2 framerates. Add an AssumeFPS(23.976) to the bottom of the script and when done run it through DGPulldown set for 19.98->29.97. CCE will accept the script as-is, but still requires 23.976fps encoding.
I ran some tests on both methods and have to modify something I said earlier because your script doesn't have as high a percentage of interlaced frames as I thought. Rather than your script producing 40% poorer quality, it's more like 30-35%. First I encoded 1000 frames using both scripts at constant quality (quant) in CCE. The progressive script produced a file of 35.7 MB and the interlaced script of 49.1 MB, a size difference of 35.7%. Then I did encodes for the same file size and the average quant as measured by BitRate Viewer was 6.08 for the progressive script and 7.63 for the interlaced script. I say these are significant differences.
Are you sure this works, Manono?
If I've done this once for sub-23.976 framerates, I've done it a hundred times.
Edit: Actually, what might work is to combine 'my' hard pulldown (instead of a simple ChangeFPS) to get to 19.98 before using DGPulldown:
You can't apply pulldown to interlaced output.
manono
16th July 2010, 05:27
More notes:
It seems to me this will produce, instead of the optimal 4:3:3 pattern, something like 6:6:3:3:...:3, because of the repeated frames resulting from the initial ChangeFPS
Yes, with this 3:3 pulldown each frame is repeated 3 times, and the dupes get repeated 6 times (lasting roughly one-tenth of a second in total). Your method, when bobbed for a 60 Hz progressive display, has 4 times as many dupe frames, and they're repeated twice. Four times as many dupe frames, each repeated fewer times. More but less noticeable stutter, either kind only noticeable at all during certain kinds of movement. Look, almost all DVDs with a 'base' framerate of less than 23.976 (silent films, home or cheaply made movies of different sorts) have used something similar to your script to get it to 29.97fps. I'm saying that's no longer necessary when there's a way to keep it progressive all the way through. When encoding for a DVD5 (as I do all the time as DVD9s are quite expensive where I am), and where bitrate is a consideration, and given the max bitrate of 9800 for DVD, often not high enough for interlaced encoding, interlaced encoding is sub-optimal, in my opinion.
About encoding at noncompliant framerates: Because you'll be encoding at 23.976fps rather than at 19.98fps, you have to make adjustments in the bitrates to get the file sizes you want. You multiply each by a factor of encoded framerate/'real' framerate. In this example, 23.976/19.98=1.2. You multiply each bitrate by a factor of 1.2. If, for example, you use min-ave-max bitrates of 500-4000-9000, then adjust to 600-4800-10800. Everything gets straightened out after the pulldown is applied
And if johnmeyer wants to try MFlowFPS on something like this, he might consider converting it to 19.98fps, rather than 23.976fps or 29.97fps, or whatever he's been trying. Fewer frames get interpolated and thus fewer artifacts. And by applying 3:3 pulldown after the encoding, there'll be no pulldown judder at all.
Gavino
16th July 2010, 10:11
If I've done this once for sub-23.976 framerates, I've done it a hundred times.
I wasn't doubting the method itself. When I asked 'does it work?', I was referring to whether it could produce a 4:3:3 pattern. Your answer seems to be "no it can't, but it doesn't really matter". I won't argue with that - I know you have a lot of experience with this sort of thing, while my knowledge is entirely theoretical. :)
You can't apply pulldown to interlaced output.
Right. Good point! :)
manono
16th July 2010, 12:19
I wasn't doubting the method itself. When I asked 'does it work?', I was referring to whether it could produce a 4:3:3 pattern. Your answer seems to be "no it can't, but it doesn't really matter".
Oh, I misunderstood. Sorry. Well, it could with a ChangeFPS(29.97). But that would defeat the purpose of keeping the encoded frames (and the stuttering) to a minimum.
I saw a novel way to do this which the Flicker Alley folks who restore and release silent films did. I'm a little foggy on the details now because it was a while back. If I remember correctly the 'base' framerate was 22 fps and they, instead of hard telecining it to 29.97fps, and rather than adding in duplicate frames to bring it up to 23.976fps so they could encode at that framerate progressively and add pulldown, added in blended frames to bring it up to 23.976fps, and then encoded it progressively with pulldown. It wasn't quite like what a ConvertFPS(23.976) does I don't think, because that seems to create more blended frames than they did. They created 2 new blended frames every second, with the original frames being left alone. If, for example, you were going from 18fps to 19.98fps, they would have had only 2 blended frames spread 10 frames apart created from the progressive frames on either side, with the rest the original progressive frames. You could probably figure a script for that. Although you might get a kind of strobing and blurring effect, the stutter wouldn't be anywhere near as jarring during certain kinds of movement.
Didée
16th July 2010, 12:34
No need to script that. For that purpose you can use BlendFPS from mg262's motion.dll. It has an "aperture" parameter to control the amount of blending ... aperture is related to the relative weight that a frame would get by ConvertFPS - if frame's weight is smaller than "aperture", no blending is used. Else, do normal blending.
Gerald1937
16th July 2010, 21:45
John
Quote:
I'm not sure what you mean by this. Aren't Blu-Ray blanks pretty cheap now?
I have no Blueray player, writer or disks. So yes the cost to me would be significant and probably unjustifiable. At 73 my friends and relations tend to have VHS tape or DVD players but few have Blueray players. So DVD is my currently preferred method of distribution used for SD transfers.
For distribution of the HD transfers I investigated: -
- Burn to Blueray disk. Currently too costly and the recipient must have a Blueray player.
- Burn a DVD disk compatible with the format and playable in a Blueray player. This works but needs a lower bit rate than that used by the HV20 tape transfer file. Cost effective but some degradation and again the recipient must have a Blueray player.
- Use Avisynth to frame serve MultiAVCHD to generate a SD/SDHC memory card MPEG4 file compatible with the Panasonic Viera SD requirements. Not tested yet. Is SD card a viable distribution media? Can all TV's read the same SD card video file?
-Burn a DVD data disk with the HV20 tape transfer file. The recipient or I copy the file to HDD or memory stick and they can play the file via USB2 to a Western Digital media box into their TV using the HDMI or other interface. The media box can apparently handle a wide range of input video file formats and types successfully. If the conversion quality is good/excellent then this could be the way to go.
The Cineform software package you quoted costs far more than my telecine system did to build (excluding my HV20 video camera). Does your IVTC method of capture work OK with the Cineform package? The BMP route I chose is simple and inexpensive, my current software program works for SD or HD and emulsion side or base layer capture. The original film transport system layout was mirrored when I changed to emulsion side capture.
If your film transport system repeatable positional accuracy of the film frame to frame is greater than zero pixels it produces a vertical displacement error of the same lines between adjacent frames. So any change of fps using fields from adjacent original frames to create an intermediate frame seems to me flawed because lines combined would be displaced from their desired position by the error. This is the beauty of MFlowFPS as it inherently computes the pixel positions for the generated frame from adjacent original frames, which includes the displacement error.
I agree MFlowFPS does introduce artifacts; your "broken leg" naming is appropriate. When you look at the source frames that cause such artifacts these are often blurred due to the slow 1/25 s shutter speed of the cine camera used and/or contra-movement of different objects in a frame and the adjacent ones. The other situation is at scene changes. My criteria for what to do when editing the transfer are as follows. If I cut the affected frames out will it spoil the flow of the scene? If I need to keep the flow of the scene can I substitute other frames for the affected ones, with the original frames only and accept the transient fps speed change or with frames generated from the originals normally using PPro speed change facility. You also need to consider the number of adjacent frames showing the artefacts and if there is a soundtrack involved with the transfer.
VideoFred
I like your restoration script very much and thank you for sharing it with us. Please can you explain the strategy you use for the stunning colour correction you achieve when using an Avisynth script? Have you an Avisynth script for generating the MPEG 4 uploads you make to the Vimeo site that you are willing to share with us?
Regards
Gerald
johnmeyer
16th July 2010, 23:46
I have no Blueray player, writer or disks. ... Can all TV's read the same SD card video file?
Given this, and given that your goal is to have something that all your friends can play, you have only two viable choices: burn to DVD, or get a Blu-Ray burner and burn to that. Any of the other options (like encoding to MPEG4 and saving on a memory device) is not guaranteed to play on all TV sets. Also, you need to decide whether your HD captures really will look much worse when encoded to DVD. Unless you are starting with 16mm film, I am pretty sure the loss will be minimal, if indeed it can be noticed at all. So, I recommend doing the best possible encode to DVD, using nothing but pulldown using the script code provided by Gavino. It will give you the sharpest, smoothest result, and it will play on equipment that everyone owns.
Burn a DVD data disk with the HV20 tape transfer file. The recipient or I copy the file to HDD or memory stick and they can play the file via USB2 to a Western Digital media box into their TV using the HDMI or other interface.I can't believe that anyone who would have this equipment, and also have the technical skill to install and use it, wouldn't also have a Blu-Ray player. After all, Blu-Ray players are getting pretty cheap.
Does your IVTC method of capture work OK with the Cineform package? I never tried it out because my initial tests, using HDV, convinced me that the gain in quality by capturing at 1440x1080 or 1920x1080 wouldn't be worth not only the financial cost, but the considerable cost in increased editing and rendering times.
If your film transport system repeatable positional accuracy of the film frame to frame is greater than zero pixels it produces a vertical displacement error of the same lines between adjacent frames. So any change of fps using fields from adjacent original frames to create an intermediate frame seems to me flawed because lines combined would be displaced from their desired position by the error. I understand what you are saying, but I'm not sure the logic is quite correct. Remember that each frame has movement compared to the adjacent frames. That's the whole point of film and video: everything is moving! So, since things are moving anyway, the additional slight movement caused by gate weave won't matter. In addition, you have to remember that even if you can get each frame of film to register perfectly in the gate compared to its adjacent neighbors, you still will have gate weave. Why? Because the camera that took the film has the same problem! So, I would argue that you are solving a problem that cannot really be solved or fixed because half of it is already "baked into" the film.
Also, the errors that become visible when using motion estimation seem, in my experience, to come more from motion of small objects within the frame, or from things which move into the frame, close to the camera. If the whole frame moves, motion estimation does an amazing job of correcting for this. VideoFred's script shows what can be done, and indeed the Depan settings he has created pretty much completely eliminate the motion caused by gate weave.
As to any scan line errors, I guess you may be referring to the artifacts such as you get when bobbing interlaced material, problems on diagonal lines, and other things that happen when details jump back and forth across scan line or pixel boundaries. Again, this happens all the time not only for the reasons I mentioned, but also because most amateur 8mm, Super8, and 16mm film was shot hand-held, without the benefit of motion stabilization, and so is already bouncing all over the place.
manono
17th July 2010, 02:35
For that purpose you can use BlendFPS from mg262's motion.dll.
Thank you for the suggestion, Didée. Ordinarily I shun blending like the plague, but for framerates below 19.98fps (the DGPulldown threshold for NTSC) where dupe frames have to be added, this works well. Although ChangeFPS(19.98) is fine for me, I guess because I'm not very sensitive to the added stutter, creating an 18fps source and then using:
BlendFPS(19.98,Aperture=0.2)
made it play silky smooth with the blending not very noticeable. The next time I have an appropriate source I'll give BlendFPS a try. Thanks again, and to mg262, because I wasn't aware of this filter.
videoFred
19th July 2010, 08:10
VideoFred
I like your restoration script very much and thank you for sharing it with us. Please can you explain the strategy you use for the stunning colour correction you achieve when using an Avisynth script?
It's the lack of color correction. :) The denoising helps a lot for better color reproduction and I increase saturation. I have added color correction in the script, but I seldom use it. However, the Avisynth auto-white "ColorYUV(autowhite=true)" can help sometimes on very 'bluish' colored films for example.
Let me explain further: As you might know, I'm using a machine vision camera for capturing. With a machine vision camera one can set the correct color balance according to the live histogram. The (RGB) histogram is included in the camera software. But I'm using a custom app. made by Frank Vine. He has custom made it for capturing film with machine vision cameras. It has a live histogram and lots of other options.
http://www.cine2digits.co.uk/
Please check 'Control and Capture' to see some screenshots from the software.
Resumed: I have barely to do any color corrections because the source has a correct (RGB)color balance to begin with.
Have you an Avisynth script for generating the MPEG 4 uploads you make to the Vimeo site that you are willing to share with us?
No special Mpeg4 script. It's the output of my filmscript. In VDub, I use Microsofts Mpeg4 codec, V3. One keyframe every second, highest bitrate. That's it.
Fred.
2Bdecided
21st July 2010, 15:35
I can't believe that anyone who would have this equipment, and also have the technical skill to install and use it, wouldn't also have a Blu-Ray player. After all, Blu-Ray players are getting pretty cheap.If you really want to distribute something "HD" to lots of people, something low-end* that plays on a PC is currently the best way to go. More people have PCs than BluRay players (though I guess it depends who your friends are, and where you live).
* 18fps 1440x1080 or 960x720 is easy; pick MPEG-1, MPEG-2, or x264 depending on your audience. Even an old-ish PC will managed 18fps 960x720 MPEG-1, and it'll look quite nice. Some safe x264 profile is slightly more likely to play on a TV or media extender though.
I'm fairly sure that the best DVD you can make will be more than good enough, and everyone will be able to play it. Encode it properly, and people with decent equipment will see it upscaled very nicely too.
Cheers,
David.
Gerald1937
21st July 2010, 21:06
VideoFred
After looking at the www.cine2digits.co.uk site I can understand why you need little or no colour
correction in your post processing when you use a machine vision camera and their software. I can
only try to get a White balance or use one of the presets in my HV20 and the rest in PPro.
I Googled but I failed to find the Microsoft MPEG4 codec, V3 in VFW form that I assume I need for
VDub. The only MPEG4 codec I found in VFW form was the H264 version. Are they compatible?
Have you used them, quality etc?
I have tried to modify your latest script to work with the HD transfer method I described above (14 July 2010). It seems to work
OK but I would appreciate your confirmation that my modifications have not degraded you script's performance.
----------------------------------------------------------------------------------------
I changed the values for W and H but left the other values???
#SIZE, CROP AND BORDERS PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
CLeft=20 CTop=20 CRight=20 CBottom=20 #crop values after Depan and before final resizing
#W=768 H=576 #final size after cropping NB these are square pixel size for PAL DV??
W = 1440 H = 1080 # final size for 4:3 part of HD 1920 x 1080
bord_left=0 bord_top=0 bord_right=0 bord_bot=0 #720p= borders 150 ?????
#---------------------------------------------------------------------------------------------------------------------------
I increased the X and X2 values by *4 is this too much?? should X and X2 be a proportion of the frame size?
#AUTO LEVELS PARAMETER
#--------------------------------------------------------------------------------------------------------------------------------
X=4*4 # X is a special parameter for reducing the autolevels effect on the whites
X2=2*4 # X2 is a special parameter for reducing the autolevels effect on the blacks
#-------------------------------------------------------------------------------------------------------------------------------
# ADDED EXTRA PLUGIN TO USE BlendFPS
LoadPlugin("F:\AviSynth 2.5\Restore\motion_25_dll_20051212\Motion_12Dec05.dll")
#---------------------------------------------------------------------------------------------------------------------------
#REVISED METHOD OF CREATING SOURCE!
#source1= Avisource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
#Load sequence of 500 bmp images: end number needs to be changed!!!!!
ImageSource("N:\frames05\frame%06d.bmp", start = 0, end = 499, fps = 16, use_DevIL = false).converttoyv12
# Crop the image and flip before the speed change from 16 fps to 25 fps to reduce CPU load?
crop(240, 0, -240,0)
# FlipVertical to get the image right way up.
FlipVertical()
#Image size now 1440 x 1080
source1 = last
#--------------------------------------------------------------------------------------------------------------------------
Using MFlowFps made the script extremely slow ie Seconds per frame. To speed things up I commented out the
unwanted outputs and then substituted BlendFPS(25,Aperture=0.1) but kept the sharpen(last_sharp).sharpen(last_sharp).
I hope I have not destroyed the last part of your sharpening by making this change???
#CHANGING FRAME RATE WITH INTERPOLATION/FINALSHARPENING
#............................................................................................................................................................
interpolated=BlendFPS(25,Aperture=0.1).sharpen(last_sharp).sharpen(last_sharp)
#super= denoised.MSuper()
#backward_vec= MAnalyse(super, isb=true)
#forward_vec= MAnalyse(super, isb= false)
#interpolated= denoised.MFlowFps(super, backward_vec, forward_vec, num=numerator, den= denumerator, ml=100).sharpen(last_sharp).sharpen(last_sharp)
Thanks for your help VideoFred also to Manono and Didèe for the BlendFPS pointer, it seems faster than MFlowFps for HD even with a low Aperture value.
Regards Gerald1937
videoFred
27th July 2010, 09:02
I Googled but I failed to find the Microsoft MPEG4 codec,
Here it is:
http://www.free-codecs.com/download/Microsoft_MPEG-4_V1_2_3_VKI_Codec.htm
I have tried to modify your latest script to work with the HD transfer method I described above (14 July 2010). It seems to work OK but I would appreciate your confirmation that my modifications have not degraded you script's performance.
There are three ways to know this: testing, testing and testing. :)
And comparing the results.
But as a rule of thumb I can tell you that degraining and sharpening before any downscaling will produce much better results. Of cource this will slow down the script even more.
It must be possible to split an Avisynth script and run it on several chained computers. Has no one tried this yet?
Fred.
Gerald1937
28th July 2010, 22:41
Johnmeyer
Thanks for your response. I am sorry I did not respond sooner but I have been modifying Videofred's
restore script to handle HD captures made my way and doing some testing. As the modified script now
seems to work OK with either Mflowfps or Blendfps to effect the frame rate change from 16fps to 25fps
we need in the UK for PAL, I made some comparative tests of using each method of frame rate change. For
the tests I used 284 BMP images equating to 17.75 seconds of film and compressed the output using
Huffyuv to avi. The processing time for the Mflowfps script was 59min while the Blendfps script only
took 1min 14sec. The files were then processed in Ppro and exported to tape in the HV20. For playback I
used the HDMI output from my HV20 video camera directly into the HDMI input of my Viera TV to get
the best quality-viewing image available to me.
My observations were: MFlowfps was slightly smoother but the artefacts generated were much more
obtrusive except in the very low motion parts of the clip. Blendfps was not as smooth but was still very
acceptable throughout the clip. Identically numbered frames from each clip were exported as still frames
from Ppro for comparison purposes between the clips and with the original 284 BMP images from which
they were generated. The comparisons showed that the Mvflowfps clip still images showed significantly
more artefacts than the ones from Blendfps. The comparison with the original BMP image showed the
effect of a Blendfps blended image was generally far less obtrusive than that of the identically numbered
Mflowfps image. I concluded that the much shorter processing time of using Blendfps even with my test
Aperture = 0.1, the greater use of original BMP frames and the less obtrusive impact of the blended
frames produced a better quality clip for me. Initially I used calculations to determine which original BMP
image had been used to generate a frame but subsequently I numbered each BMP image before clip
generation. This speeded up the frame comparisons, improved my accuracy of detecting blended frames and
the pattern of original frames and blended frames used, I would be interested to hear the view of others
on their similar comparison tests. Videofred's script certainly improves the HD output regardless of which,
MFlowfps or Blendfps, is used.
I agree that the gain in quality that comes from making an HD capture from Standard or Super 8mm film
is probably un-warranted by the time and cost of doing it, capture, editing, rendering and possible burning
to Blue-Ray.
VideoFred
Thanks for the site information for MPEG4. In configure at what level do you set the 'Smoothness'
'Crispness' slider to?
Your idea of splitting the Avisynth script and running it on several chained computers is not logical to me
as it does not seem to speed up the end to end process of film capture to production of distribution media
significantly. Is that your objective? If it is I would suggest Computer 1 to capture from film, Computer 2
Avisynth script, Vdub encode if needed, PPro edit and render, Computer 3 DVD author and burn. Data
transfer by USB2/Firewire external HDD. I use Firewire for my Win 98 SE computers. I hope this helps.
Regards Gerald1937
manono
29th July 2010, 01:13
As the modified script now
seems to work OK with either Mflowfps or Blendfps to effect the frame rate change from 16fps to 25fps
we need in the UK for PAL...
This is for PAL DVD, right? You need only use BlendFPS (or Mflowfps) to get it to 16.67fps. Then you can encode progressively and run the result through DGPulldown set for 16.67->25. Very few blends and with 3:3 pulldown applied, no stuttering from the pulldown.
videoFred
29th July 2010, 09:03
My observations were: MFlowfps was slightly smoother but the artefacts generated were much more
obtrusive except in the very low motion parts of the clip. Blendfps was not as smooth but was still very
acceptable throughout the clip.
Of cource. BlendFPS() is not generating any new, interpolated frames. It just blends frames. Can someone tell me the difference between BlendFPS() and convertFPS() ? It looks pretty much the same to me. But to be sure I will have to compare the results from both.
I concluded that the much shorter processing time of using Blendfps even with my test Aperture = 0.1, the greater use of original BMP frames and the less obtrusive impact of the blended frames produced a better quality clip for me.
The aperture setting looks interesting... I will test this. This is something that can not be done with ConvertFPS().
Thanks for the site information for MPEG4. In configure at what level do you set the 'Smoothness'
'Crispness' slider to?
I set it to max. crispness.
Your idea of splitting the Avisynth script and running it on several chained computers is not logical to me
The realy slow part is MVDegrainMulti(). If we could run this on a separate computer, we could win some render time. To be clear: I mean running the script at the same time on several computers. Comp1 should send the result to Comp2 and so on. The script should be splitted at the point where MVAnalyseMulti begins().
Is that your objective?
No! My objective is to run the script faster.
Thank you for the feedback, it gives me new ideas :)
Fred.
Boulder
29th July 2010, 09:30
Why not simply split the video into multiple parts with Trim and join the results afterwards?
If you go for MPEG4, I'd rather choose XviD than some outdated Microsoft codec. It would be even better to use x264 but I don't know if that serves your purpose.
videoFred
29th July 2010, 09:47
Why not simply split the video into multiple parts with Trim and join the results afterwards?
I already do this at the source. I always capture scene by scene because of the different camera settings. The capture software is auto-numbering the AVI files.
If you go for MPEG4, I'd rather choose XviD than some outdated Microsoft codec. It would be even better to use x264 but I don't know if that serves your purpose.
I only use Mpeg4 for my clips on Vimeo. My end result is standard PAL for TV use, perhaps HD for the future. But I keep my original 1024x768 transfers on portable harddisks, encoded with Huffyuv.
I have also noticed that standard PAL, upscaled by the computer (MplayerClassic+ffdshow) looks very good. So there is no need to produce huge HD files with Avisynth. For now that is... that's why I keep my originals, I can always render them again, with other settings.
Fred.
rightall
31st July 2010, 07:51
I'm at the begining of using avisynth and videoFred's script to improve my transferred 8mm and S8 films. My questions aim at meeting the conditions and assumptions of the script:
a) one film frame = one AVI frame
b) no duplicate frames
c) Progressive, not interlaced input
I own 2 Bauer T 5xx projectors remanufactured by telecine components of Telgte, all running at 16 2/3 fps, one for Super8 and one for Normal/Regular 8. I take a Hitachi HV-D30P for transfer, using Y/C signal (S-Video) . The Y/C Signal (and sound, see below) is fed to a Canopus ADVC 300 http://www.grassvalley.com/products/advc300 delivering an AVI-file. The Hitachi HV-D30P http://www.hitachi-keu.com/content/industry/kameras_3ccd/pdf/hv-d30_datasheet.pdf is a 3CCD PAL-Video Camera which uses interlacing by definition of PAL. The Bauer T 5xx Projectors use a rotary disc shutter with 3 sectors (blades). So my projectors show each frame 3 times, producing a sequence like
111222333444555666... By this I get 3 * 16 2/3 = 3 * 50/3 = 50 occurrences per second. Each occurence is captured to a PAL-field giving 50 fields per second or 25 f(rames)ps. In terms of frames indicated by [], this looks like: [11] [12] [22] [33] [34] [44] [55] [56] [66] . Removing every third "mixed" frame [12], [34], [56], ... (which shoud be easy with avisynth) results in a clip which - for my opinion - is equivilent to progressive scan at 16 2/3 fps (With respect to the amount of information contained).
Coming back to my question: Will avisynth consider this clip as progressive or
1) do I have to apply some deinterlacing filter or
2) do I have to apply other means (like "interlaced=false") to force avisynth handle the clip as "progressive"?
There are 3 reasons that I would like to find a way that avisynth considers my clip as progressive (staying with my current equipment) :
c1) I spent a remarkable amount of money for it,
c2) the HV-D30P is a 3CCD Camera, not just 1CCD
c3) I have a lot of films with sound on the magnetic tape track which is simultanously captured and contained in the AVI-file.
Regards
Klaus
Nephilis
1st August 2010, 01:16
Hi Fred,
I think there is someting wrong with the notation of the RemoveDirtMC() script added in first page..
The second part (RemoveDirtMC part) looks like so;
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
}
And I think it should be so;
Function RemoveDirtMC(clip clp,int limit, bool "_grey")
{
_grey = default(_grey, false)
limit = default(limit,6)
i=MSuper(clp,pel=2)
bvec = MAnalyse(i,isb=true, blksize=8, delta=1, truemotion=true) # for a backward search isb should be "true" not "false"
fvec = MAnalyse(i,isb=false, blksize=8, delta=1, truemotion=true) # for a forward search isb should be "false" not "true"
backw = MFlow(clp,i,bvec)
forw = MFlow(clp,i,fvec)
clip=interleave(backw,clp,forw)
clip=clip.RemoveDirt(limit,_grey)
clip=clip.SelectEvery(3,1)
return clip
}
supernater
5th August 2010, 03:11
I can't get your script to work...
MVAnalyseMulti won't run. I need the 1.9 version of mvtools, but it is not available. That version of mvtools is older and outdated as I understand it. Why is it still being used? Is it still necessary? Can someone tell me where I can download it?
videoFred
5th August 2010, 06:31
Removing every third "mixed" frame [12], [34], [56], ... (which shoud be easy with avisynth)
Yes, with SelectEvery().
Coming back to my question: Will avisynth consider this clip as progressive
If both fields of a frame are from the same frame, then I think it does not matter if Avisynth considers the clip as progressive or interlaced but I might be wrong here.
1) do I have to apply some deinterlacing filter
No, not if you have removed the mixed frames.
2) do I have to apply other means (like "interlaced=false") to force avisynth handle the clip as "progressive"?
I am not sure about this. Try it!
c1) I spent a remarkable amount of money for it,
I understand. :)
Fred.
videoFred
5th August 2010, 06:43
Hi Fred,
Hi Nephilis :)
I think there is someting wrong with the notation of the RemoveDirtMC() script added in first page..
Why do you think this? It works fine. I have copied it from John Meyer...
I have not studied the making of functions yet, but I have my doubts about the use of "clip clp" you are suggesting.
Fred.
videoFred
5th August 2010, 06:48
I can't get your script to work...
MVAnalyseMulti won't run. I need the 1.9 version of mvtools, but it is not available. That version of mvtools is older and outdated as I understand it. Why is it still being used? Is it still necessary? Can someone tell me where I can download it?
The full MVToolsMulti package V1.9.7.7 is available for download on my webspace. See post 1 of this thread. It is included in the 'Film_Restoring.zip' package. It can be found in the 'Source code' folder.
Because I use two versions of MVTools in my script (MVToolsMulti for degraining and Fizicks MVTools2 for interpolation) I have named the first one 'MVTools.dll' and the other one 'MVTools2.dll.
Fred.
Gavino
5th August 2010, 09:03
I have not studied the making of functions yet, but I have my doubts about the use of "clip clp" you are suggesting.
The "clip clp" change makes the syntax cleaner, but makes no practical difference to the function's operation.
Nephilis's other change, to the isb values used in creating backw and forw, is valid, but the way the vectors are used it might not matter in the end.
JK1974
5th August 2010, 10:54
Each occurence is captured to a PAL-field giving 50 fields per second or 25 f(rames)ps. In terms of frames indicated by [], this looks like: [11] [12] [22] [33] [34] [44] [55] [56] [66] . Removing every third "mixed" frame [12], [34], [56], ... (which shoud be easy with avisynth) results in a clip which - for my opinion - is equivilent to progressive scan at 16 2/3 fps (With respect to the amount of information contained).
Coming back to my question: Will avisynth consider this clip as progressive or
1) do I have to apply some deinterlacing filter or
2) do I have to apply other means (like "interlaced=false") to force avisynth handle the clip as "progressive"?
I have tested and used the same setup with the CCD camera delivered by telecine.de, and I also wanted to extract the progressive frames by using the SelectEvery command. Unfortunately I recognized, that the recording is not really 100% at 16,66666, meaning that after some time, there seem to be duplicate frames where they normally should not be. I nearly got mad when I first tried this because at the beginning, everything works as expected, and if you go to later scenes, you suddenly get interlaced frames, jumps etc. - because of the slight desync.
The only thing that could help is a manual editing of the source or using some kind of duplicate frame detector (or error detector which kicks in when an interlaced frame has been detected), but I haven´t seen something like this yet.
@all, even if it is a little off-topic:
Has anybody seen a capturing solution using a "normal" digital DSLR (like Canon EOS 350 or similar) with some kind of macro lens? Or using e.g. a 20x microscope with an appropriate camera? Or are there bigger disadvantages on those approaches instead of using a specialized expensive CCD, because I have not seen anybody experimenting with it?
A DSLR also is not as cheap but I think that a lot of people already own such a camera and would "only" need to buy the appropriate lenses (a good macro lens for the Canon is said to start at around 200 Euros)...
Using a cheap USB microscope (around 30 Euros) did not give satisfying results because there is some auto-white and exposure time/lense functionality and at least at 10x, the resolution was little above 1000 dpi. Kodachrome 25 is said to achieve around 100 lines/mm which calculates to around 2400 dpi.
videoFred
5th August 2010, 11:38
The only thing that could help is a manual editing of the source or using some kind of duplicate frame detector (or error detector which kicks in when an interlaced frame has been detected), but I haven´t seen something like this yet.
Perhaps this could help you?
http://www.avisynth.org.ru/getdups/getdups.html
Has anybody seen a capturing solution using a "normal" digital DSLR (like Canon EOS 350 or similar) with some kind of macro lens?
Yes, it has been tested. Same problem as usual: it is difficult to set the camera parameters. Also, the mechanical shutter will wear out after thousands of frames. And because of the mechanical shutter there might be a problem of different exposure between frames. The result will be a slight variation in luminance between frames.
Kodachrome 25 is said to achieve around 100 lines/mm which calculates to around 2400 dpi.
Believe me, my 1024 x 768 machine vision camera shows every detail on the 8mm film. I have tested nearly all filmstocks and I have compared my results with all known other systems.
The only reason to use a high rez camera is to avoid software upscaling to HD.
Fred.
JK1974
5th August 2010, 13:01
Perhaps this could help you?
http://www.avisynth.org.ru/getdups/getdups.html
Thank you very much for this hint. I am going to check this out very soon because I really thought that my previous recordings (I saved them as DV-AVIs) are some kind of "lost" for further improvements e.g. with your great script.
Yes, it has been tested. Same problem as usual: it is difficult to set the camera parameters.
On my Canon EOS 350, I think that I can set every important parameter manually. I even thought about using the auto-exposure feature which is normally used to do HDR compositions.
Also, the mechanical shutter will wear out after thousands of frames.
This is something that I did not think about - and will kill this idea completely.
Believe me, my 1024 x 768 machine vision camera shows every detail on the 8mm film. I have tested nearly all filmstocks and I have compared my results with all known other systems.
Your examples are really impressive. But this camera really isn´t cheap, especially if I have a higher resolution DSLR camera and an AVCHD movie camera at home. The DSLR solution has died now, and I currently can´t use the AVCHD way because I don´t have the Bauer telecine system anymore. The "old" test recording are SD and I would prefer 720p now - see below.
The only reason to use a high rez camera is to avoid software upscaling to HD.
I have a FullHD tv set since the beginning of this year, and watching the old telecine SD recordings from DVD, I am not really satisfied. But I know that one of the main reasons for this is the bad MPEG-2 compression of this uncleaned material which I would exchange against a cleaned version and the much better H.264 compression. And upscaling from SD to HD (which is IIRC necessary for blu-ray compatibility) is something that I previously always called "faking" ;).
Finally, one little note about your script (besides of saying "thank you for this great work"): When I tried to make an 720p encoding with meGUI (for H.264), I get a video with a size of 1280x1440@25i. Looking in the logfile, I found out that the meGUI source analyzer seems to be missing a closing "AssumeFrameBased()" in your script. After appending this to your script, I get a working 720p25 file. Maybe this is something you could add at the end of your script - or finally a new parameter that allows you to produce either progressive output (e.g. 23.976p, 25p etc.) or interlaced output (50i, 60i etc.).
videoFred
5th August 2010, 15:20
On my Canon EOS 350, I think that I can set every important parameter manually.
Yes, but you will have to do this all the time, at nearly every scene change. The exposure changes, and the RGB histogram changes. With a machine vision camera, one can do this on the computer screen, while watching the live preview and the histogram.
I even thought about using the auto-exposure feature which is normally used to do HDR compositions.
This would be very nice indeed for capturing individual frames for example. And to compare with other transfer methods. I have a new Canon EOS 500 myself.. perhaps I get myself a macro lens and do the test myself. :)
Maybe this is something you could add at the end of your script - or finally a new parameter that allows you to produce either progressive output (e.g. 23.976p, 25p etc.) or interlaced output (50i, 60i etc.).
For now, I prefer to leave this to the user. There are so many options these days.. For example: my Philips DVD player ignores interlacing and converts on the fly to progressive.
Fred.
JK1974
5th August 2010, 15:58
This would be very nice indeed for capturing individual frames for example. And to compare with other transfer methods. I have a new Canon EOS 500 myself.. perhaps I get myself a macro lens and do the test myself. :)
The result would be really interesting, but also frustrating if it works, because, as you pointed out, the camera´s mechanic is going to suffer if you really want to use this approach for a whole movie. However, a newer EOS with video recording functionality might be an alternative then. If have seen some people discussing this solution but I haven´t seen any results yet.
For now, I prefer to leave this to the user. There are so many options these days.. For example: my Philips DVD player ignores interlacing and converts on the fly to progressive.
However, there is still this "bug" that meGUI thinks that it gets an interlace movie as long as there is no "AssumeFrameBased()" at the end of the script. And setting this as default is no solution for all those who in fact want to produce an interlaced version. Maybe you can add this hint to the documentation so that other people don´t need to waste time for debugging or creating non-working meGUI H.264 encodings.
Didée
5th August 2010, 17:21
If it really is that way (I didn't check), then it's really a bug. It's not even related to interlacing, Avisynth does not have any flag for that. The only flag is "field based", to mark that the videostream consists of separated fields, which should be weaved again to form full frames.
It has nothing to do with "the choice of the user". When the script outputs full frames, but has them flagged as being field separated, then it's just wrong.
Probably you have used SeparateFields() somewhere in the script, and used that clip as base clip for further operations, so the is_fieldbased flag got propagated.
a = interlaced.bob()
b = interlaced.separatefields()
c = b.resize(b.width, b.height*2)
d = c.merge(a,0.9999)
a: is_fieldbased = false (correct)
b: is_fieldbased = true (correct)
c: is_fieldbased = true (still true. It's debatable if that's wrong or correct. In practice, it's most probably wrong.)
d: is_fieldbased = true (definetly wrong)
videoFred
6th August 2010, 06:28
Probably you have used SeparateFields() somewhere in the script, and used that clip as base clip for further operations, so the is_fieldbased flag got propagated.
I have not used no SeparateFields() nowhere :)
As far as I know the output of my script is progressive and no one was complaining so far.
Perhaps JK1974 has added a SeparateFields() somewhere in the script?
Fred.
JK1974
6th August 2010, 10:30
I have not used no SeparateFields() nowhere :)
As far as I know the output of my script is progressive and no one was complaining so far.
Perhaps JK1974 has added a SeparateFields() somewhere in the script?
Fred.
No, definately not.
Maybe someone is willing to feed meGUI with the script and try to reproduce it.
One thing however: I used ImageSource instead of AVISource, but I can´t believe that this is the reason as Images are frame based by nature...
videoFred
6th August 2010, 12:03
Please try Info() at the end of the script, after the "Eval(result)" line.
It tells me :
Fieldbased (Separated) Video: NO
I think your input is already separated... Mine is progressive. My script is not changing this, it just takes what it gets.
This means you should add 'AssumeFrameBased()' in the first line of the script, in the 'source1=.....' line.
Fred.
supernater
7th August 2010, 16:07
Thanks for your help videoFred. Your results are truly impressive. I'm very interested in the anti-shaking aspect of your script, I think it is perfect for some of the video I've shot on my camera/phone.
I'm kind of new to this and I had a few questions....
#1: In your code you use this line...
stab=DePanStabilize(source1,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=1,mirror=15).deflicker()
The method is set to 1. In the depan/depanestimate documentation it says...
method - used method for stabilization:
0 - inertial (default);
1 - average (new since v1.10). dxmax, dymax, rotmax, zoommax, fitlast parameters are ignored.
So does this mean that the dxmax/dymax values aren't needed?
#2: In the depan/depanestimate documentation I usually see example codes like this...
mdata = DePanEstimate(i)
DePanStabilize(i, data=mdata)
However, in your script you create a clip that is cropped by 40, greyscaled, and inverted and call it a stab_reference as the input for DePanEstimate. What is the advantage of doing this?
#3 At the end of your code, stab2 is cropped by less than the maxstabH, maxstabV values. Why is this done? Shouldn't the cropped values of stab2 be the same as the maxstabH, maxstabV values? I guess I don't understand why you decrease the cropping progressively as you move from stab_reference, to stab, to stab2 (I pasted your code below for reference).
stab_reference= source1.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(source1,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=1,mirror=15).deflicker()
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom)
Gerald1937
8th August 2010, 13:14
Quote Rightall
c3) I have a lot of films with sound on the magnetic tape track which is simultanously captured and contained in the AVI-file.
Klaus
If your projectors are now set to playback at 16.666 fps and the sound track was originally recorded using 16 fps you may find the sound quality poor/strange due to the speed change. From memory the extra tape speed causes a frequency shift upwards +df that is added to all component frequencies of the originally recorded sound. The harmonic relationships of the original sound i.e. F , 2F, 3F become (F+df), (2F+df), (3F+df) that are not harmonically related.
If you require lip synchronization in certain scenes you may want to un-link the sound track from the video then adjust cut/shorten silent periods to obtain lip synch, then re-link the tracks.
Regards Gerald1937
Gavino
8th August 2010, 14:08
If your projectors are now set to playback at 16.666 fps and the sound track was originally recorded using 16 fps you may find the sound quality poor/strange due to the speed change. From memory the extra tape speed causes a frequency shift upwards +df that is added to all component frequencies of the originally recorded sound. The harmonic relationships of the original sound i.e. F , 2F, 3F become (F+df), (2F+df), (3F+df) that are not harmonically related.
I don't think that's right.
All frequencies are multiplied by the same factor (16.666/16), so harmonic relationships are preserved.
(Just like playing a 33rpm disc at 45rpm, as I'm sure you remember. :))
videoFred
9th August 2010, 08:11
#1: In your code you use this line...
stab=DePanStabilize(source1,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=1,mirror=15).deflicker()
The method is set to 1. In the depan/depanestimate documentation it says...
method - used method for stabilization:
0 - inertial (default);
1 - average (new since v1.10). dxmax, dymax, rotmax, zoommax, fitlast parameters are ignored.
So does this mean that the dxmax/dymax values aren't needed?
Thank you for tracking this, Supernater!
You are right. In my documentation this is not mentioned. It only says 0= inertial and 1= average. I guess Fizick has updated it later. I did not understood fully what Fizick meanth with this parameter.
But it works somehow because dxmax and dymax is also defined in DePanEstimate(). Sometimes with incorrect results and I blaimed it always on a possible bug. But with method=0 it works like it should now.
#2: In the depan/depanestimate documentation I usually see example codes like this...
mdata = DePanEstimate(i)
DePanStabilize(i, data=mdata)
However, in your script you create a clip that is cropped by 40, greyscaled, and inverted and call it a stab_reference as the input for DePanEstimate. What is the advantage of doing this?
Well, for stabilizing we only need motion analisys. No colors and no crawling pixels. This is the reason why I have binarised, greyscaled and inverted the stab_reference clip.
The cropping has another reason: sometimes the stabilizer is following a moving object, and sometimes we don't want this. For example if you only want to stabilize a slight vertical jitter, you can crop to an area where only this jitter can be analyzed while ignoring all de rest.
#3 At the end of your code, stab2 is cropped by less than the maxstabH, maxstabV values. Why is this done? Shouldn't the cropped values of stab2 be the same as the maxstabH, maxstabV values?
In principle you are right. But very often the maxstab. values are never reached or perhaps only on a few frames. This depends on the amount of shaking on the source of cource. Thus I try to crop as less as possible to avoid removing to much from the picture. This is also the reason why I have set mirror=15. You will barely notice it if a few -mirrored- frame borders are visible.
I guess I don't understand why you decrease the cropping progressively as you move from stab_reference, to stab, to stab2 (I pasted your code below for reference).
Stab_reference is only a reference clip for analyzing motion and creating the mdata clip. Then I apply the stabilizing on source1, using the information from the mdata clip, and create a stabilized clip called stab. To keep the code readable and because I use different versions of stab further in the script, I have named them stab2, stab3 and so on.
Fred.
supernater
9th August 2010, 18:54
Thank you for the reply videoFred, I understand a lot better now. Recently I've acquired an Android phone and I've been recording videos on it. I've been attempting to adapt that part of your script to stabilize some of the shake that my videos have. In the future I will probably use other aspects of your script to address some of the other issues with my phone videos.
Thanks again for the wonderful script! Your results are simply amazing.
Gerald1937
12th August 2010, 21:52
Gavino
I stand corrected. A tape recorder speed error does not change the harmonic relationship as I suggested.
Regards
Gerald1937
videoFred
30th August 2010, 09:09
Script update 30/08/2010:
see page one of this thread.
Fred.
Undead Sega
31st August 2010, 06:48
Could avisynth filters, scripts or the scripts mentioned in this thread possibly recover a faded 16mm film??? For example, a faded film that looks more reddish than what it is suppose to be.
videoFred
31st August 2010, 07:18
Could avisynth filters, scripts or the scripts mentioned in this thread possibly recover a faded 16mm film??? For example, a faded film that looks more reddish than what it is suppose to be.
Perhaps...Please upload an example clip. AVI if possible.
Fred.
Emulgator
31st August 2010, 09:48
Undead Sega, you may use AdjustY followed by ColourYUV.
Use SourceHistogram to look where the remaining U and V of the source sit.
Or use SmoothTweak to shift U and V and then SmoothCurve to spread these values.
Both apply dithering while processing, very valuable to reconstruct values that otherwise would be omitted.
Undead Sega
1st September 2010, 03:20
At this moment of time, i do not have the capability or the equipment to view, transfer or even capture 16mm film so I am not able to show it to you in the way it was meant to be.
However, I did my best to give you an idea, i hooked up my old HP scanner and taped down a section of the 16mm film itself and scanned a single frame on its own at the highest DPI i could (its that old so it wont look great), i cropped and straightened the frame and here it is:
http://img819.imageshack.us/img819/453/16mmchristmascarol2.png
looks familiar anyone? :D
johnmeyer
1st September 2010, 05:49
As I indicated in another thread, I think you'd be much better off doing color correction in a competent editing program rather than try to do this using AVISynth. You really need the immediate feedback, scopes, external monitor, masks, selective color correction, etc. AVISynth is simply the wrong tool for this task, IMHO.
The image from the leader of your film isn't ideal for knowing how well you'd be able to recover the image. I have dealt with lots of old movie film that is either mostly blue and white, or like yours, red and white. In some cases there is not enough of the faded layers left to do a lot other than subtract out the red. Sometimes you are better off just turning it into B&W film, which of course is easy. However, depending on how much time you want to spend, you can use selective color correction combined with masks to make sure the sky is blue and the trees are green. In effect, you are colorizing the film, but since there is still some hint of the original color, you can "amplify" what is left and get decent results.
Here's what I did in Vegas, in less than one minute, with your single frame:
https://i.imgur.com/SSIxMS4.jpg
With a little more time I could attack the blue that inevitably emerges as you subtract out the red. This is where the selective color tools become important: as you introduce artifacts from the correction process, you can selective remove them.
Unfortunately, as I said above, this frame isn't a good one to use because there is nothing that is white, black, or neutral gray. Usually you can find some of this in the course of going through the reel and they provide reference points for setting the color compensation.
I have some examples on my YouTube page of old 16mm film that had faded to red and which I've corrected. Go to the 5:10 mark in this video:
1937 - Caribbean and Central America (http://www.youtube.com/watch?v=LoOMI-RGIxk)
This was originally nothing but red and white, about as bad as any old faded film I've transferred.
Here's another example from a similar reel:
Yellowstone Park 1937 (http://www.youtube.com/watch?v=cM6UQITactI)
This was in similarly bad shape and indeed the opening, even after restoration, shows very little color. However, instead of the overwhelming red cast, there is only a hint of red. By the time you get to the one minute mark, you can actually start to see some greens and blue, some of it introduced by me using the selective color correction I mentioned.
There is no way you can do these things, especially when you apply correction selective to different parts of the image depending on what should be there, if you only use a script.
I had the best luck on this short clip:
Salt Lake City 1937 (http://www.youtube.com/watch?v=7CockAucXBg)
You will see, right from the opening frame, that I was able to coax a little green and some blue out of the film. It doesn't take much, but you have to have some residual dye left in order to make any of this work.
As to which version of "Christmas Carol" this came from, I don't know. I grew up watching the Alastair Sim version. I also have collected both the 78 rpm and the rarer 33 1/3 audio recording featuring Basil Rathbone in the title role. He made a great Scrooge. I played the 78 rpm version every Christmas as a child and it still brings back great memories
pirej
1st September 2010, 13:20
Here is an example using virtualdub filter ColorMill(it can be used in avisynth too).
Emulgator
1st September 2010, 14:42
A pure Avisynth solution, 1 extra region right, still unfeathered.
An NLE like Vegas or Edius would come in handy to apply feathering here,
but at least Edius makes visible steps while feathering over only 2..3..4 steps.
Maybe I will try feathering in Avisynth as well sooner or later. This script took quite a bit longer than 1 minute...
http://dvd-manufactur.de/files/16mmchristmascarol_DVD-MF.0000.jpg
Undead Sega
1st September 2010, 15:52
To johnmeyer and Emulgator, those are great responses and I would like to say that you both have done good work attempts on these old films to keep them alive. Really good job :D
This is 16mm film print of Richard Williams' (sound familiar anyone?) A Christmas Carol:
http://en.wikipedia.org/wiki/A_Christmas_Carol_(1971_movie)
which was voiced by Alastair Sim who did indeed star in the version you are talking about, he was merely asked to reprise his role for the animation as his film is usually regarded as the best version of A Christmas Carol. At the same time, I have managed to grab a frame of the same frame that i have uploaded of what it is orginally suppose to look like:
http://img843.imageshack.us/img843/5638/originalchristmascarolf.png (http://img843.imageshack.us/i/originalchristmascarolf.png/)
Hope this helps, also as a reference as well. Let me know what you think.
videoFred
1st September 2010, 16:23
At this moment of time, i do not have the capability or the equipment to view, transfer or even capture 16mm film so I am not able to show it to you in the way it was meant to be.
Then there is not much we can do, can we? :p
Fred.
johnmeyer
1st September 2010, 16:52
Yes that helps. With two minutes in Vegas I produced this:
https://i.imgur.com/wQUpdEh.jpg
Of course I don't know what the rest of it would look like. It looks like some AVISynth noise reduction would help when the color correction is finished.
Undead Sega
1st September 2010, 16:53
I am planning one day to get ahold of the wonderful Lumix GH2 and someone with a 16mm project, and record directly from the lens output straight to the image sensor, this way i should get unparrell picture quality? :D
pgb
3rd September 2010, 13:00
You'll be lucky to find a projector lens that will focus an image onto the camera sensor (about 1cm max). You might do better to put a macro lens on the camera and focus on the projector gate (remembering to dim your lamp otherwise you'll burn out the camera sensor).
Undead Sega
3rd September 2010, 18:44
You'll be lucky to find a projector lens that will focus an image onto the camera sensor (about 1cm max). You might do better to put a macro lens on the camera and focus on the projector gate (remembering to dim your lamp otherwise you'll burn out the camera sensor).
Indeed, this is what I plan to do, however when dimming down the light, wouldnt i be sacrificing the amount of light that is suppose to be projecting through the film?
Also, with this way, would i get the best, all the detail or the information that a film frame would contain?
johnmeyer
3rd September 2010, 19:34
Taking the image directly from the lens is by far the least of the issues in getting a quality transfer. The biggest issue is getting a frame-accurate transfer like a Rank Cintel or Workprinter. If you merely point the video camera at the projector and record the image, you will get a junk transfer.
As to the specific issue of how to capture the image directly from the lens, you must use a telephoto lens in the projector, i.e., something used for projecting from the back of an auditorium. The wide angle lens used for home projectors will not work. And, as pgb noted, you MUST use a much dimmer bulb or you will ruin your camcorder. The bulb used in most projectors generates a huge amount of light and also heat. Even if you don't fry the sensor in your camera, you will almost certainly not be able to stop down the lens enough to get a good exposure. In addition, most camcorder lenses produce the sharpest image at relatively large apertures. I replaced the 300W bulb in my projector with a 15W bulb. A properly diffused daylight color LED bulb is your best bet.
Undead Sega
4th September 2010, 18:48
Indeed that would be the case and also i believe it is now a common practise for those who want their film transfered to a digital form. I have seen the Rank Cintel, that thing is quite a monster and i dont believe i have access to one either but im sure it performs as it looks. With and talking about the Workprinter, I thought this was quite funny:
http://www.moviestuff.tv/quick16_HD.html
because in here it is using the exact camcorder as i am :D And i suppose anyone can do very similar to this with a working 16mm projector :D
On the topic of how to capture the image directly from the lens, this is something I might need to know more about, I have read that one would need to use a Macro lens and zoom in to the film's frame for capture. And yes, I can understand that a bright light can ruin the image sensor of a camera, this is where i read as well, that many people doing this replaces the bulb with a 'RGB LED' lights? Please correct me if i am wrong on this.
johnmeyer
4th September 2010, 20:54
I capture directly from the lens of my Eiki SSL-O 16mm projector. It is a 100mm lens and I put my Sony FX-1 HD camcorder about two inches from the lens. This captures the image before the image has become upright, which is the key. There is no need for any fancy lens on the camcorder. I discovered this arrangement by accident when I was trying to improve on Roger Evan's Workprinter, a device which uses an external aerial lens to re-focus the image onto a spot about four feet from the projector. That arrangement is very tricky to set up and can result in chromatic aberrations around the edge. Once I realized how this worked, I called Roger and explained what I'd done. He then improved upon the setup and created the device you linked to. I also told him how I had eliminated the need for the sync cam and interface to the left mouse button that is the heart of his Workprinter. My approach uses IVTC software to recover the film frames from unsyncrhonized capture of the film from a shutterless projector (I removed the shutter from my Eiki). My approach works perfectly, but Roger is a hardware guy and so he took the idea in a different direction and came up with the sound sync pulse that he uses in his Sniper and some of his other units. Both his approach and mine let you get frame-accurate transfer while running the projector at full speed. This not only speeds up the transfer compared to a Workprinter or Cintel, but also lets you easily and quickly transfer sound film.
As for the bulb, the LED has some advantages in terms of heat (no damage to the film) and longevity. However, after I had my Workprinter upgraded a few months back (I had one of the very first units, and Roger has made all sorts of improvements) and started transferring using the LED light, the one thing I noticed is that the color is a little more difficult to correct compared to a light source that has a more standard Tungsten light spectrum, something that most editing software is more "familiar" with and therefore has more built-in color correction tools. In the end, the LED light source can be color corrected just fine, but it requires a little more custom effort.
My unit doesn't use an LED light source, but instead I was able to find a 20 watt 24 volt MR16 bulb to replace the 250 watt 24 volt MR16 that is the standard projection bulb in my Eiki. I also added an additional diffuser to further soften the light. I am able to capture at 1/1000 shutter speed (which is needed for my unique software method of getting frame accurate results) with the aperture on the camcorder between f4.5 and f11, with no ND filter. I can stop the film for as long as I want to focus the camcorder (perfect focus is essential for a good transfer). I always check focus before I start each reel.
I don't know what an "RGB LED" might be, but if you do go the LED route, you simply want one that is balanced for either daylight or tungsten. The package will either use those terms, or will use the Kelvin equivalents.
Gargamel
5th September 2010, 10:33
Hello everybody,
Thank you for that very interesting thread! And thank you for sharing these scripts.
Transferring old footages is a hobby for many people, especially when they have family films.
In my case, I have only 2 Regular 8mm little reels, but a lot of Super 8 (no sound).
With a few others (a little club!), we began using, between our projector (with a standard 25mm lens for S8) and the camera, a home-made 'condenser' (an optical mirror + a 3d or 5d large lens, about 120mm diameter).- Results may be correct, but after a very long fine adjustment... chromatic fringes were often a problem.
Actually, we use a "lens-in-lens" system, easier to mount. The camera shoots directly in the projector lens, without a mirror nor additional lens.- But the usual projector lenses don't fit; for S8, we have generally to mount a 75 to 85mm lens, and another problem is to find a lens "projector-compatible"; sometimes an old 24x36 projector lens is OK (for example, old 85mm Will-Wetzlar, cutting its plastic external tube); sometimes a wonderful Angenieux or Paillard-Bolex 70mm lens can fit (for instance, on Beaulieu projectors).
We always replace the original bulb either by a little halogen one (20W max, but I only used 5W bulbs) + a white plexiglass diffusor, or by a LED (some guys use multi-LEDs... but I'm very happy with a Falker system: a 3W LED with diffusor and regulator, supposed to give a 5500°K light).
To avoid light sparkling (capturing 18 f/s, PAL), generally the projector speed is adjusted to ~16.7 f/s.- The more lucky ones have a camera with SmartScan or so, which can shoot the 18 f/s projection.- A little few capture picture by picture.
The final aim is to burn DVD for our children or relatives. Obviously, the result isn't a professional one, but itsn't too bad for ~40 year old footages...
http://vimeo.com/11983446
(That example was before the videoFred/johnmeyer scripts, but now stabilization and cleaning will improve a lot! )
Sorry for my English.
Have a nice day!
Undead Sega
7th September 2010, 03:24
I capture directly from the lens of my Eiki SSL-O 16mm projector. It is a 100mm lens and I put my Sony FX-1 HD camcorder about two inches from the lens. This captures the image before the image has become upright, which is the key. There is no need for any fancy lens on the camcorder. I discovered this arrangement by accident when I was trying to improve on Roger Evan's Workprinter, a device which uses an external aerial lens to re-focus the image onto a spot about four feet from the projector. That arrangement is very tricky to set up and can result in chromatic aberrations around the edge. Once I realized how this worked, I called Roger and explained what I'd done. He then improved upon the setup and created the device you linked to. I also told him how I had eliminated the need for the sync cam and interface to the left mouse button that is the heart of his Workprinter. My approach uses IVTC software to recover the film frames from unsyncrhonized capture of the film from a shutterless projector (I removed the shutter from my Eiki). My approach works perfectly, but Roger is a hardware guy and so he took the idea in a different direction and came up with the sound sync pulse that he uses in his Sniper and some of his other units. Both his approach and mine let you get frame-accurate transfer while running the projector at full speed. This not only speeds up the transfer compared to a Workprinter or Cintel, but also lets you easily and quickly transfer sound film.
As for the bulb, the LED has some advantages in terms of heat (no damage to the film) and longevity. However, after I had my Workprinter upgraded a few months back (I had one of the very first units, and Roger has made all sorts of improvements) and started transferring using the LED light, the one thing I noticed is that the color is a little more difficult to correct compared to a light source that has a more standard Tungsten light spectrum, something that most editing software is more "familiar" with and therefore has more built-in color correction tools. In the end, the LED light source can be color corrected just fine, but it requires a little more custom effort.
My unit doesn't use an LED light source, but instead I was able to find a 20 watt 24 volt MR16 bulb to replace the 250 watt 24 volt MR16 that is the standard projection bulb in my Eiki. I also added an additional diffuser to further soften the light. I am able to capture at 1/1000 shutter speed (which is needed for my unique software method of getting frame accurate results) with the aperture on the camcorder between f4.5 and f11, with no ND filter. I can stop the film for as long as I want to focus the camcorder (perfect focus is essential for a good transfer). I always check focus before I start each reel.
I don't know what an "RGB LED" might be, but if you do go the LED route, you simply want one that is balanced for either daylight or tungsten. The package will either use those terms, or will use the Kelvin equivalents.
johnmeyer, that is priceless advice, I dont actually know where to begin or how to respond to that but really thanks very much, this is all so much for me for wanting to restore just one 16mm film that i purchased out of love for the director and hoping to do a restoration on the print as well but at the highest quality, but of course after from what you've said, it comes at a price and I'm not surprised. Also because of you, the consumers will now be able to purchase a better transfer machine :D
I mean, would it be so bad to purchase an Elmo-CL or any 16mm projector just for one 16mm film that has a 50/50 chance of getting brilliant results? Or would any 16mm projector (with sound) would do the job?
Regarding the light, I suppose I can understand you on the LED thing, however would something like the Philips CFL lights (them Energy saving ones)do the job?
Nightshiver
7th September 2010, 14:37
You do realize it's not going to be cost effective at all if your only going to transfer 1 film, right? Unless you already have a camera, film projector, capture method, software, etc.
Undead Sega
8th September 2010, 00:33
Well that's what I thought exactly, but I want to give it my best shot on this. I've got the film, very soon I will have my dream camera :D which will give me the necessary capture method and software (HDMI to RAW :D) or I can just use my Canon HV30. It is only a matter of getting an excellent transfer which I assume would involve having the right projector and adjusting it correctly.
Emulgator
20th September 2010, 14:43
Just in case somebody wants to use RemoveDirtMC outside of videoFreds Script
(recent version from 30-08-2010, and I guess this might apply to a few versions before as well):
I found the last two variables to be handed over to Removedirt swapped.
bool _grey is expected before int limit.
The following version works as standalone for me. (I went on from the nephilis fix from 2010 08 01)
#RemoveDirtMC by heini011 on 26.February 2006
#Suggested by johnmeyer on 09.June 2010
#Incorporated into Filmrestoration script by videoFred on 08.July 2010
#Fixed (vector direction) by nephilis on 01.August 2010
#Fixed (swapped parameters) by Emulgator to work with recent MVTools 2.5.10.1 on 20.September 2010
#
function RemoveDirtMC(clip clp, bool _grey, int limit)
{
_grey = default(_grey, false)
limit = default(limit, 6)
i=MSuper(clp, pel=2)
bvec = MAnalyse(i, isb=true, blksize=8, delta=1, truemotion=true) # for a backward search isb should be "true" not "false"
fvec = MAnalyse(i, isb=false, blksize=8, delta=1, truemotion=true) # for a forward search isb should be "false" not "true"
backw = MFlow(clp, i, bvec)
forw = MFlow(clp, i, fvec)
clipa=interleave(backw, clp, forw)
clipb=RemoveDirt(clipa, _grey, limit)
clipc=SelectEvery(clipb, 3, 1)
return clipc
}
Be careful, I did not try it in videoFreds recent script yet.
videoFred
24th September 2010, 11:41
I have made some modifications on the sharpening. I have figured out there is some relationship between the different sharpening steps I am using.
As a rule of thumb we can say that unsharpmask() sharpening strength can be doubled on every next step with a radius lower than the previous step.
For example:
First sharpening: radius=3 strength = 30
Second sharpening: radius= 2 strength= 60
Third sharpening: radius= 1 strength= 120
Sharpening is much better, when using this method.
I have made a few albums on Facebook:
1958 regular-8 Kodachrome anamorphic:
http://www.facebook.com/album.php?aid=2055923&id=1298449764&l=f29566379a
1974 super-8 Kodachrome:
http://www.facebook.com/album.php?aid=2058406&id=1298449764&l=9830569e79
Fred.
Gargamel
24th September 2010, 13:14
Thank you a lot for your script, and for that new sharpening, Fred.
In my case, it seems ok with only:
First sharpening: radius=3 strength = 10
Second sharpening: radius= 2 strength= 15 or 20
Third sharpening: radius= 1 strength= 30 or 40
With stronger values, the result is grainy. But with these little ones, it's quite correct.
http://vimeo.com/15119321
"Correct", but of course, far from your albums: your pictures are terrific !!!
clive18
25th September 2010, 19:54
Hi
Thanks for a wonderful script.
I am just getting the hang of things, so this is my first post. My question is regarding the mirror image of the capture, as my capture looks fine, but when I saw a car number plate in the film, I realized the the whole film is a mirror image, as I am using the straight (projector)-->(plano-convex-lens)--->(camcorder) setup without a mirror.
So my question is how does one correct the mirror image in avisynth, and when is the best place to do this, (beginning or end of the script). Other concerns are if this will have an effect on the interlacing etc.
Thanks again.
regards
Clive
Undead Sega
26th September 2010, 07:55
You do realize it's not going to be cost effective at all if your only going to transfer 1 film, right? Unless you already have a camera, film projector, capture method, software, etc.
Well that's what I thought exactly, but I want to give it my best shot on this. I've got the film, very soon I will have my dream camera :D which will give me the necessary capture method and software (HDMI to RAW :D) or I can just use my Canon HV30. It is only a matter of getting an excellent transfer which I assume would involve having the right projector and adjusting it correctly.
well...sorry for bringing this up again, but what will I do now then if that's the case? I'm worried also of my 16mm film, its still in the box that it came with through the post :D
Jenyok
20th October 2010, 18:35
There is a specific question to you.
.
Do anything have checked, operating scripts of removal of scratches, points (dirt) of development a film, other defects and artifacts of cinema film 8 mm ?
.
I have read all the theory here and on other web sites, wrote and tried many scripts and avisynth's plugins, but there are no good results.
Sending me on plugins is not interesting to me, I will repeat once again, checked and worked scripts are necessary to me.
Jenyok
21st October 2010, 04:10
Emulgator
Script is really worked.
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_10\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS_20071112\mvtools.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_10\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
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)
}
# RemoveDirtMC2 by heini011 on 26 February 2006
# Suggested by johnmeyer on 09 June 2010
# Incorporated into Filmrestoration script by videoFred on 08 July 2010
# Fixed (vector direction) by nephilis on 01 August 2010
# Fixed (swapped parameters) by Emulgator to work with recent MVTools 2.5.10.1 on 20 September 2010
#
function RemoveDirtMC2(clip clp, bool "_grey", int "limit")
{
_grey = default(_grey, false)
limit = default(limit, 6)
i = MSuper(clp, pel=2)
bvec = MAnalyse(i, isb=true, blksize=8, delta=1, truemotion=true) # for a backward search isb should be "true" not "false"
fvec = MAnalyse(i, isb=false, blksize=8, delta=1, truemotion=true) # for a forward search isb should be "false" not "true"
backw = MFlow(clp, i, bvec)
forw = MFlow(clp, i, fvec)
clipa = interleave(backw, clp, forw)
clipb = RemoveDirt(clipa, _grey, limit)
clipc = SelectEvery(clipb, 3, 1)
return clipc
}
Emulgator
21st October 2010, 22:18
Happy to help !
frustum
9th November 2010, 19:45
I've been in close email exchange with Fred (author of the script) and have used it to great effect for about 35-ish 50ft 8mm reels. I can't thank him enough for sharing this script.
However, things haven't been entirely smooth, and this tax has cost a lot of time.
(1) multithreading doesn't work for me with Fred's script
(2) avisynth crashes a LOT when I attempt to reload a script in virtualdub (via <f2>)
I have a new dell system bought just for this task. It has a quad core i5-750 cpu, 8GB RAM, 1.5TB drive, running windows 7 x64. 32b virtualdub and 32b avisynth are installed and work well except as noted below.
I've tried 2.57mt and 2.58mt and neither helps problem (1). If I make a small script and do some busywork like resize the image large then small then large then small, setmtmode() does its job and I get a hefty speedup. But with Fred's script, no matter what setmode() options I use, no matter where I move them in his script, or if I simply remove them, it doesn't change the speed of the render. It is frustrating to have a quad core cpu and sit there knowing only one core is in use. Is this a known issue with configurations like mine? Is it a matter of the script being too complicated? On the other hand, fred sees a speedup using a dual core processor using the same script.
Are other people using Fred's script and seeing a speedup (or not) from setmtmode()?
On point (2), I will process a scene, tweak some parameter in the script, hit <F2> in virtualdub to reload, and very often, I get some address exception and I need to reload. In the worst case it is 100% of the time when my editing script gets long. This also means avsmodp is useless to me because avisynth is unstable so it brings down avsmodp with ease.
Part of the problem is the length of my script. To give a flavor of my scripts, they look somewhat like this:
orig = directshowsource("mymovie.avi")
scene1 = orig.trim(100,200)
scene2 = orig.trim(202,350)
...
scene20 = orig.trim(4215,4555)
fix_film(scene1, cleft=16,cright=24,ctop=20,cbottom=16, gamma=1.3) + \
fix_film(scene2, cleft=32,cright=16,ctop=20,cbottom=16, gamma=1.0) + \
...
fix_film(scene20, cleft=16,cright=24,ctop=20,cbottom=16, saturation=1.3, result="2", red=-5, blue=+5)
where each call to fix_film() is invoking a subroutine-wrapped version of Fred's script. My understanding is that avisynth essentially flattens all that out, that subroutines are really akin to macros that get inlined. as a result, I might have 20 copies of every filter in the chain from Fred's script. If I have about 25 scenes or more, avisynth dies immediately before rendering the first frame.
I haven't bothered yet trying to get avisynth x64 and all the required plugins (perhaps not even possible?) x64 to see if that will fix what appears to be a memory limitation. Does it seem worth the hassle to try it, or does the x64 version not address limitations in complexity (eg, there is some table somewhere harcoded with up to 255 calls per script no matter which version of avisynth is being run)?
creaothceann
9th November 2010, 20:48
Have you tried SetMemoryMax with a large value?
As a last resort you could write the script like this:
directshowsource("mymovie.avi")
#Trim( 100, 200).fix_film(cleft=16, cright=24, ctop=20, cbottom=16, gamma=1.3)
#Trim( 202, 350).fix_film(cleft=32, cright=16, ctop=20, cbottom=16, gamma=1.0)
...
#Trim(4215, 4555).fix_film(cleft=16, cright=24, ctop=20, cbottom=16, saturation=1.3, result="2", red=-5, blue=+5)
Uncomment and encode one or several line at a time (use a lossless codec like ffdshow's HuffYUV (http://img153.imageshack.us/img153/4803/ffdshowhuffyuv.png)) and combine the results.
johnmeyer
9th November 2010, 22:01
I was the one who added the setmtmode() statements when I suggested some modifications. However, my version of the script was specifically designed to work multi-threaded, something I achieved by removing some of Fred's magic. So, my suggestion is that if you use the "stock" script as posted by Fred, you should comment out all the setmtmode() statements. As you have found, even if the script doesn't crash, they don't help much because of the way the script is currently structured. With my version, I did get about a 2:1 speed up, something obviously worth doing, but far from the 4-8 times improvement I have sometimes achieved with scripts that are linear and only use one instance of one plug-in.
Tiberiust
9th November 2010, 22:52
@frustrum
I feel yr pain ;) . Avisynth is very reliable. MT in Avisynth is not really 'official', and it's certainly not reliable unless you really know exactly what version of what filter is doing what at what time in relation to whatever else - not a process for the beginner. I reckon I've spent as much time over the past 6 months testing MT routines as actually refining my still basic scripting knowledge. I've ran encodes for 10 hrs only for them to crash at 92%. Encodes have completed only to have messed up frames somewhere...anywhere...and the problems are rarely consistent.
So I've binned MT for anything other than a simple deint and one or 2 basic filters after that - quick DVD rips for instance. Consistently lighting up all 8 cores on my 4ghz i7 became an unachievable obsession :(
I'd recommend trying 2.6 Alpha from IanB and the 'official' team. I use it and now get 99pct script reliability without a SetMTMode in sight. JoshyD's 64bit works well (tho I've read abt resizer problems) and it's all awesomely fast with MT, but it only works for me in very specific limited scripts.
However with decent RAM (yu have 8GB) and Win 7 x64, yu can run multiple instances of 32bit Avisynth with great stability using VDub 32. I often leave mine running 4 or more concurrent encodes, all without MT, and they all finish properly.
Maybe I'm being clueless and other people's experiences are different....but I'm MT'ed out...
T
frustum
10th November 2010, 05:57
creaothceann -- Yes, I have tried 800 (what fred's script uses), and 1024. If I go much larger, say 1300, it seems to crash avisynth. yes, cutting a film into smaller pieces works, and I've done it, but it is simply more convenient to have everything done in one script. I was hoping to find a way to allow that.
johnmeyer -- that seals it then -- I'm done with setmtmode. I've spent a LOT of time trying to get it to work, but it is just too unpredictable when and how it will work and when it and how it will crash. I can live with bugs if their causes and consequences are predictable, but that isn't the case here.
tiberiust -- my experience with 2.57mt was it crashes a lot, but then I seem to be pushing too hard on its limits. now that I've sworn off mt, I've installed 2.58 (no mt, not x64) and it does seem to be a lot more stable. I can edit and it <f2> in virtualdub many times (but not unlimited) without crashing. at least that is one problem mostly solved. Some day when I'm feeling adventurous I'll try 2.60.
Thanks for your input, everyone. It has helped me resolve what to expect and what I want to do about the problem.
videoFred
10th November 2010, 07:49
I've been in close email exchange with Fred (author of the script) and have used it to great effect for about 35-ish 50ft 8mm reels. I can't thank him enough for sharing this script.
You are most welcome :)
It is time to mention that you have improved the autolevels plugin, and I thank you for that. It's a great improvement.
http://forum.doom9.org/showthread.php?t=128585&page=3
I will soon update my script to work with the new autolevels() plugin. I will also add a 'light' version of the script, without removedirtMC() and without degraining. This script runs in real time.
It is very obvious that removerdirtMC() and the degraining afterwards are slowing down the script. Splitting the script could help here. But then we have to work with a few intermediate files of cource.
RemovedirtMC() is using MVTools. Perhaps we could make it faster when using MVToolsMulti() instead? Talking about MVToolsMulti(): there are several (6) versions of the dll. Have you tried them all?
Fred.
stoffal
20th November 2010, 18:38
Thank you, Fred, for your fantastic work on 8mm restoration!
It is just too bad AviSynth is not supported by Mac/Apple... =(
I have a question on the process:
Does it make more sense to first stabilize the footage and then bring it from 18->25 frames? Or is it better to first bring it from 18->25frames and then do the stabilization?
What is your experience ?
Thank you!
Chris
creaothceann
21st November 2010, 02:24
18->25
Are you sure this would improve the video? If you're not playing it on a (PAL) TV the result might look about the same.
And afaik stabilization doesn't depend on the framerate...
johnmeyer
21st November 2010, 03:23
The framerate change he is talking about in Fred's script uses motion estimation. Fred's script does it the right way, as far as I can tell. However, the real question is whether you want that effect or not. Also, Fred's script outputs progressive 25 or 30 fps, and if you want to show on an interlaced TV set, then you need to do the conversion differently, at least if the goal is to make the film look like video.
In the end, for most projects, I don't enable this portion of the script because the result begins to stray too far from what film "is supposed" to look like. Of course this is entirely personal preference.
Undead Sega
22nd November 2010, 04:45
Hi everyone, its me again, how are you all and how is everything? I hope all is well.
I'm here to ask something once again in relation to my faded 16mm film reel I have, does anyone recommend this Elmo CL-16 projector for transfering?
Also, in what format do you lot capture in? Because I was thinking, if one was able to capture raw from the image sensor directly from their cameras to a computer, or to a codec by the name of 'Cineform Raw (if anyone's heard of it)' does this give you alot of freedom to play and adjust the colours of the captured film?
videoFred
22nd November 2010, 07:43
:
Does it make more sense to first stabilize the footage and then bring it from 18->25 frames? Or is it better to first bring it from 18->25frames and then do the stabilization?
What is your experience ?
Thank you!
Chris
Hello Chris,
First, you only need the frame rate conversion for playback on DVD or HD. For computer playback, you can leave the files as they are. Then you have 18fps progressive.
Second, if frame rate conversion is needed, there are lots of options.
Option1: disable the frame rate conversion in my script and let your NLE do it.
Option2: for slow landscape panning scenes, the interpolation option in my script works remarkable good.
Option3: I'm working on a script with frame blending instead of interpolation. I will upload it as soon as possible.
Fred.
videoFred
22nd November 2010, 07:47
Also, in what format do you lot capture in? Because I was thinking, if one was able to capture raw from the image sensor directly from their cameras to a computer, or to a codec by the name of 'Cineform Raw (if anyone's heard of it)' does this give you alot of freedom to play and adjust the colours of the captured film?
With a machine vision camera, it is even possible to capture the not debayered picture. But then you need a good debayer tool in post. But I do not do this. I have always captured to uncompressed RGB24 Avi, but Huffyuv is very good too and the files are half the size.
Fred.
frustum
22nd November 2010, 08:52
Fred, maybe your blending script has improved, but when I last played with it, the blended frames had a different average luma. With my 2:1 upsampling, every other frame was darker, and so flickered badly. Have you seen this effect?
In my film conversions, there is the occasional scene where the current interpolation fails noticeably, so it would be nice to have the blend option to use in such cases.
videoFred
22nd November 2010, 09:03
Fred, maybe your blending script has improved, but when I last played with it, the blended frames had a different average luma. With my 2:1 upsampling, every other frame was darker, and so flickered badly. Have you seen this effect?
No, I have never seen this effect and it should not be there. Perhaps you have changed the filter chain? Autolevels must be before the blending!!!
In my film conversions, there is the occasional scene where the current interpolation fails noticeably, so it would be nice to have the blend option to use in such cases.
Yes, I will send you the new frame blending script by mail. I have one version with cleaning and one version without the cleaning. The version with cleaning is using RemoveDirtMC only. This way, we have more the filmlook because there's still a bit of grain left over. I'm using your exellent autolevels modification and another way of blending. From the motion.dll package. With this kind of blending we have control over the amount of blending.
Fred.
Undead Sega
25th November 2010, 06:08
With a machine vision camera, it is even possible to capture the not debayered picture. But then you need a good debayer tool in post. But I do not do this. I have always captured to uncompressed RGB24 Avi, but Huffyuv is very good too and the files are half the size.
Fred.
Wow a machine vision camera, I dont know if I could ever go to one of those, what are the tech specs of one exactly?
My method of tranfering was to purchase a 16mm projector and replace the bulb to a lower watt and colder bulb but I will need more expertise on this area. The projector I was hoping to get was an Elmo 16-CL, can anyone confirm to me if this is a good projector for transfering? asI only have less than a day to probably get one at a good price.
After hopefully aquiring one, I was hoping to use a recent DSLR mounted on front of the projection lens and for it ot be captured directly to the image sensor. It will be captured to a computer via Firewire or HDMI to a lossless codec, most likely Lagarith? OR Cineform Raw, which ever is better.
Can anyone tell me if this is a good way of tranfering 16mm film? or how does it compare to how you lot do yours. Thanks.
johnmeyer
25th November 2010, 09:00
You need a telephoto lens to capture directly from the projector. I posted earlier in this thread about the specs (my 16mm projector is put away at the moment, so I can't look at the lens).
Undead Sega
25th November 2010, 14:36
Yes I remember your specs and very nice they are too :D But are you sure its a Telephoto lens? Isnt it a Macro lens that is used when placing a camera directly onfront of the projector's output?
johnmeyer
25th November 2010, 18:09
It is a telephoto lens, designed for projecting to a screen a long way away, like in an auditorium. There is no such thing, I don't think, as a "macro" lens for a projector.
You put the video camera about four inches from the lens, which is prior to the focal point. This means that the image is upside down (it becomes right side up after it crosses the focal point). If you get the correct lens, you can fill the video frame, and will get a sharp image edge-to-edge. I contacted Roger Evans (inventor of the Workprinter) after I accidentally discovered this when trying to adapt his Workprinter aerial lens to my home-made setup. I just happened to have purchased a projector on eBay that had been used for projection in a school auditorium, so it had a telephoto lens, rather than the shorter lens used for projection in a classrooom.
videoFred
26th November 2010, 07:18
Wow a machine vision camera, I dont know if I could ever go to one of those, what are the tech specs of one exactly?
I'm using this one for many years now:
http://www.theimagingsource.com/en_US/products/cameras/firewire-ccd-color/dfk31bf03/
All my clips and stills on the internet are made with this camera. The only limit of this camera is the output: 8 bits.
After hopefully aquiring one, I was hoping to use a recent DSLR mounted on front of the projection lens and for it ot be captured directly to the image sensor.
Believe me, nothing beats a machine vision camera. I capture directly to the image sensor too. I'm using a C-mount marco zoom lens.
http://www.ccddirect.com/store/customer/product.php?productid=17234
Fred.
Undead Sega
27th November 2010, 05:36
It is a telephoto lens, designed for projecting to a screen a long way away, like in an auditorium. There is no such thing, I don't think, as a "macro" lens for a projector.
You put the video camera about four inches from the lens, which is prior to the focal point. This means that the image is upside down (it becomes right side up after it crosses the focal point). If you get the correct lens, you can fill the video frame, and will get a sharp image edge-to-edge. I contacted Roger Evans (inventor of the Workprinter) after I accidentally discovered this when trying to adapt his Workprinter aerial lens to my home-made setup. I just happened to have purchased a projector on eBay that had been used for projection in a school auditorium, so it had a telephoto lens, rather than the shorter lens used for projection in a classrooom.
I see, because from when I was seeing the Workprinter projecters, like the one I posted awhile ago, it literally had a Canon HV30 stuck right at the front of the projector. So I suppose what you're suggesting is to shoot far away and zoom in right into the fiilm plane?
I'm using this one for many years now:
http://www.theimagingsource.com/en_US/products/cameras/firewire-ccd-color/dfk31bf03/
All my clips and stills on the internet are made with this camera. The only limit of this camera is the output: 8 bits.
Believe me, nothing beats a machine vision camera. I capture directly to the image sensor too. I'm using a C-mount marco zoom lens.
http://www.ccddirect.com/store/customer/product.php?productid=17234
Fred.
Just checked out the link on the Machine Vision camera, and yeah, as I said before I dont think I would be getting one of those, especially at that price, I also dont see why it would be that costly.
P.S. I found another (and more expensive) Workprinter that describes what I've said before: http://www.moviestuff.tv/sniper_16_hd.html
johnmeyer
27th November 2010, 07:44
So I suppose what you're suggesting is to shoot far away and zoom in right into the fiilm plane?No, that's not what I said. You do it just like you see with the versions of Roger Evan's products that don't use an external aerial lens.
sdinet
23rd December 2010, 02:48
Hey everyone, first time posting, very excited to be part of this thread and use the POWERFUL tools to clean up my 8mm footage. Recently I had my entire families 8mm footage converted to digital using the DV8 8mm Sniper HD. The 18fps film was captured frame by frame and converted to 29.97 interlaced avi files. I am attempting to run the virtualdubmod scripts in 29.97, but it is causing sever JELLO effects where there is fast motion. If I convert to 18fps progressive, then process it then it appears to clean up the footage without the jello effect.
My question is:
-Is there a way to use the scripts in the native interlaced 29.97fps AVI files (even though it is really 18fps converted to 29.97fps)
-If not, what is the best way to convert the 29.97fps file to 18fps and ONLY remove the duplicate frames (I am afraid if I convert, it will drop 12 random frames instead of the duplicate frames). I have tried using virtualdubmod to convert the frame rate, but wanted to ensure I used the proper settings to remove only duplicate frames.
This is a Christmas present for the family, so if you can reply tonight I would be forever grateful!
Also, I really like the denoise, stabilize and color/level correction, however the sharpening is TERRIBLE for my footage. Therefor I changed the sharpening script to: "sharp1=denoised.sharpen(0.0)", not sure if this removes the sharpening correctly, but it seems to work in removing the sharpening and leave me with fantastic footage after-wards!
manono
23rd December 2010, 02:53
Post a 10 second sample, one showing steady movement.
And welcome to the forum.
sdinet
23rd December 2010, 03:34
Thanks! Here are 10 seconds of the footage: https://docs.google.com/leaf?id=0B_bYKM0Y9AhFN2FkNjE4ZmQtNmNiNi00YmI4LWI1ODItMGViMjMzOWI4NDA3&hl=en&authkey=CNDuxsMG
manono
23rd December 2010, 04:17
You might try:
Tdecimate(Mode=0,Cycle=30,CycleR=12)
I thought I saw some dropped frames in the source, but I could be wrong, I guess. That was converted to 29.97fps in a very peculiar way. And it's not interlaced.
sdinet
23rd December 2010, 04:33
Thanks! Guess I should attach my script, where should I add the code you provided, also any other tips on framerate, resolution, interlace/progressive code, to ensure it works natively the footage I uploaded?
videoFred
23rd December 2010, 07:21
Hey everyone, first time posting,
You are most welcome here :)
Recently I had my entire families 8mm footage converted to digital using the DV8 8mm Sniper HD. The 18fps film was captured frame by frame and converted to 29.97 interlaced avi files.
Leave the files as 18fps progressive and do the conversion with my script. You are using Cinecap and the Velocity software, right? It must be possible to set the frame rate conversion off.
-Is there a way to use the scripts in the native interlaced 29.97fps AVI files (even though it is really 18fps converted to 29.97fps)
Why would you capture 18fps progressive, then convert to 29.97 and then go back to 18fps? Like I say, use the original 18fps progressive files. My script will deal with the conversion. Use my frame blending script if you do not like the interpolation artefacts.
however the sharpening is TERRIBLE for my footage. Therefor I changed the sharpening script to: "sharp1=denoised.sharpen(0.0)",
Please do not change my script if you do not know what you are doing. Use my original script and set all sharpening parameters to zero. Then increase them at your taste. It's that simple. ;)
Fred.
videoFred
23rd December 2010, 08:02
Thanks! Here are 10 seconds of the footage: https://docs.google.com/leaf?id=0B_bYKM0Y9AhFN2FkNjE4ZmQtNmNiNi00YmI4LWI1ODItMGViMjMzOWI4NDA3&hl=en&authkey=CNDuxsMG
To use my script you must remove the black borders, otherwise the autolevels will not work correctly. Also, your color balance is not OK. The reds are blown out completely.
The ideal situation is a capture program with a live RGB histogram. But you can do a lot by eye. It is much better to stay within the 0-255 range with a safety margin and do the 0-255 stretching in post.
Fred.
johnmeyer
23rd December 2010, 09:50
You should never convert to 29.97, except when making your final video to view on an NTSC TV set. Fred's script will definitely not work on video that has been telecined (i.e., fields duplicated to pad out from 18 to 29.97). The motion estimation in the script goes nuts when it sees absolutely no movement between the duplicated fields, and then sees motion between the next set of fields, and so on.
The advice of using TFM followed by TDecimate to recover the original progressive 18 fps footage is exactly what I would do and, in fact, have done in the past. Here is the main part of the script I used:
#Inverse Telecine Using TIVTC (TFM) - for removing pulldown
#from 18 fps that was telecined to 29.97
AssumeBFF()
tfm(display=false)
tdecimate(display=false,mode=0,cycleR=2,cycle=5)
Edit: I just tried this script on your test clip, and it correctly removed the extra fields.
manono
23rd December 2010, 12:15
Funny, when I played the video the first time using MPC-HC and advanced a frame at a time I didn't see any regular pattern. After reading what you had to say, johnmeyer, I looked at it again, this time in VDub, and it showed that regular 2 3 2 3 pattern. So, although my original TDecimate works to restore 18fps, your TDecimate is simpler. But it is progressive, so you need neither the AssumeBFF nor the TFM lines. Although I don't guess that including them hurts anything. It's not telecined, but was converted to 29.97fps by adding duplicate frames. That's why I said earlier it was converted to 29.97fps in a peculiar way.
sdinet
23rd December 2010, 15:50
Hey everyone thanks for the advice, I had the footage captured by a local vendor, I was shocked when I discovered the footage was 29.97fps, I assume he did this because he thought I would export to DVD... Anyone, thats what I am stuck with. I will try to TDecimate script (thanks John!), then I will try Fred's script after I convert to 18fps. Keep you posted!
sdinet
23rd December 2010, 16:27
First time writing a script from scratch it this correct?
LoadPlugin("C:\Users\X68K\Downloads\Film_Restoring\05) Film_Restoring\Source_code\dgmpgdec158\DGDecode.dll")
LoadPlugin("C:\Users\X68K\Downloads\Film_Restoring\05) Film_Restoring\Source_code\TIVTC\tivtc.dll")
AVISource("D:\8mm\Dad\08_NTSC-HD_18_fps.avi")
#Inverse Telecine Using TIVTC (TFM) - for removing pulldown
#from 18 fps that was telecined to 29.97
AssumeBFF()
tfm(display=false)
tdecimate(display=false,mode=0,cycleR=2,cycle=5)
videoFred
23rd December 2010, 16:27
Just for fun, try this:
DirectShowSource("yourfile.avi")
crop(160,0,-160,-0)
coloryuv(autowhite=true)
This already corrects the color balance pretty good.
Fred.
sdinet
23rd December 2010, 18:22
Hey everyone, I am finally getting the hang of these scripts. I now have TRUE progressive 18fps (actually 17.982) from my original 29.97fps footage.
When I run these scripts in virtualdub, can I do Direct Stream Copy, to avoid re-compressing? It appears to work this way, which is awesome! Also, can I run all avisynth scripts and save them as direct stream copy (Freds cleanup scripts included)?
If not, should I use Fast recompress? If so, which codec do you recommend I use under the Save as Video compression settings, as I will need to do this multiple times (once to convert to 18fps and a 2nd time to run Fred's cleanup script)
Gavino
23rd December 2010, 19:10
When I run these scripts in virtualdub, can I do Direct Stream Copy, to avoid re-compressing? It appears to work this way, which is awesome! Also, can I run all avisynth scripts and save them as direct stream copy (Freds cleanup scripts included)?
Avisynth scripts deliver uncompressed video to their client, so you can't use Direct Stream Copy in VirtualDub - use fast recompress with some suitable codec.
sdinet
23rd December 2010, 19:15
Thanks! It appears my source material uses Sony Motion Jpeg, I will use that along with Fast Recompress to save my video out of VirtualDub.
sdinet
23rd December 2010, 19:35
I have uploaded a 10second clip with the video converted back to 18fps. This is really awesome, I am so excited to have it in the correct format!
One question if you all still have time, when I run Fred's cleanup scripts the autocolors seem to be out of whack.
I have attached a screenshot of the issue, my script file, and a 10second clip of my 18fps footage which I am attempting to cleanup (maybe some saintly person on this board can download my 10second clip and attempt to use the attached script and achieve the same results, and understand how to correct it).
Here is the download link to my 10second 18fps file without any corrections applied: https://docs.google.com/uc?export=download&confirm=no_antivirus&id=0B_bYKM0Y9AhFOTgzMzY3ZGYtOTRjOS00MWM2LWJiOTAtZDM5MjczYjc2MDJl&authkey=CJjAobwF
Thanks, I feel like I need to buy everyone a couple drinks after all your help =)
Boulder
23rd December 2010, 20:49
Thanks! It appears my source material uses Sony Motion Jpeg, I will use that along with Fast Recompress to save my video out of VirtualDub.
If you have the diskspace to spare, better use HuffYUV (can be found in ffdshow for example) or Lagarith as they are lossless codecs. MJPEG is lossy which means that the quality will degrade slightly.
johnmeyer
23rd December 2010, 21:01
The quality degradation issue of using slightly lossy codecs, when dealing with 8mm film source, is generally not a huge deal because small-gauge film lacks fine detail and structure. Therefore, given the considerable disk space (and resultant performance) advantages of using MJPEG, I'd recommend sticking with that for this particular project. When dealing with higher resolution, the Lagarith and HuffYUV recommendations will result in slight, but sometimes important, quality improvements.
Color and gamma are going to be your biggest issues in getting good results. When I played with your footage last night (using Sony Vegas), I did quite a bit of color correction and gamma adjustment (in order to bring out detail from the shadows). I find that the adjustments possible in Vegas provide more accurate control over these things than can be done in any script, especially since color balance in film transfers can vary considerably from scene to scene, and therefore don't always get corrected accurately by automatic controls.
If you are doing your own transfers, and have more film yet to do, you should use some sort of exposure limitation to avoid blowing out the highlights. Some camcorders have a "spotlight" function that attempts to reduce exposure until most highlights are below the clipping level. You may also have to use an AE- correction, available on some camcorders, which will subtract a fixed f-stop amount from the auto-exposure level. This lets you get the advantage of having the camera exposure respond to the considerable variation in exposure from scene to scene, while still reducing the exposure enough to avoid blown out highlights. When transferring film, you always want to expose for the highlights, and then do what you can to recover detail from the shadows, using various controls in your video editing program. I think VideoFred's special camera permits gamma control within the camera, something that would be a huge help, but something not available in many prosumer camcorders (I think the Sony Z1 has it).
sdinet
23rd December 2010, 21:12
Thanks everyone, and John you are correct, in my testing as well motion Jpeg seems to preserve the quality with virtually no loss due to the lack of detail at HD captures.
One last question.
Now that I am ready render back from 18fps up to a modern frame rate. What is a better option 23.97fps or 29.97fps? Either way it will duplicate frames, is either one optimal from a conversion perspective? Since modern DVD players will play both 24P and 30P material, just curious which option is best for old 18fps material.
johnmeyer
23rd December 2010, 21:22
Render to 29.97. It is true that 24p would give you a much cleaner render initially, but unless you can always be assured that your playback equipment and monitor can maintain the 24p, you'll end up in some situations where the equipment adds the pulldown (the normal situation when playing a 24p DVD to a standard NTSC monitor). In this case, the pulldown added during the 18p to 24p encoding will then have a second set of pulldown added to go from 24p to 29.97 interlaced (a.k.a. 60i). There is no way to sync these two cadences, and therefore it is likely that you will end up with too many repeated fields in one part of the cadence, resulting in slightly jerky playback.
However, as in all things, you should render a 30 second clip to a DVD rewritable, using 24p and also 29.97, and see which looks the best up on your own monitor. There is no single "right" way to do these things, and a lot depends on your particular setup.
videoFred
24th December 2010, 11:51
Here is the download link to my 10second 18fps file without any corrections applied: https://docs.google.com/uc?export=download&confirm=no_antivirus&id=0B_bYKM0Y9AhFOTgzMzY3ZGYtOTRjOS00MWM2LWJiOTAtZDM5MjczYjc2MDJl&authkey=CJjAobwF
I'm very sorry but it's not a good transfer.
Color balance is wrong and the highlights are blown out.
Blown out highlights can never be recovered.
Get yourself a new transfer. ;)
Fred.
sdinet
25th December 2010, 21:21
Hey everyone, I am finally complete with my 8mm cleanup!
The highlights that look blown out are actually not from the transfer, but from the source (must have been from the camera light and how the film exposed, etc).
I find the AVIsynth scripts to be amazing with deshake, denoise, autolevels. But, I do not like the sharpening or autocolor.
I used the color correction scene by scene in Sony Vegas, and found my best results when fine tuning the mids and highs (usually left the lows alone, or black turns funky colors).
Anyway, you have all been amazing and JUST in time for Christmas!
videoFred
27th December 2010, 10:16
The highlights that look blown out are actually not from the transfer, but from the source (must have been from the camera light and how the film exposed, etc).
It's not the source. It's the transfer. Use a histogram.
I find the AVIsynth scripts to be amazing with deshake, denoise, autolevels. But, I do not like the sharpening or autocolor.
Autolevels can be set off and sharpening has parameters. Set them low.
Anyway, you have all been amazing and JUST in time for Christmas!
Get yourself a new transfer for next year :)
Fred.
aymeric106
31st December 2010, 13:25
Hello !
Those scripts are really amazing !
Just a quick copy of the readme included
The script needs a good quality digital film transfer file to begin with.
The file must be frame accurate: one film frame = one AVI frame.
The script will not work good if the original file contains duplicate frames.
It will also not work good if the original file is interlaced.
You will have to remove interlacing and/or duplicate frames before using my script.
This script is not made to work with old low resolution film-to-video transfers.
To improve VHS and other formats, there are other solutions available.
But if the original film is still available, please consider a new transfer.
What can I expect from a capture I made with a DV camera (shutter speed 1/50 s, the movie being played around 16,6 fps) ?
What should be added to the script ? (deinterlace, duplicate frame remover or something )
Thanks for any answer and a big thank you to VideoFred for letting this freely available to all of us ! :thanks:
johnmeyer
31st December 2010, 17:33
Videofred's readme gives you the answer: if you don't use frame accurate film capture (one frame of film = one frame of video) the scripts will not work.
sdinet
2nd January 2011, 02:14
John, since I am using your version of the cleanup scripts, and since we both appear to be using Sony Vegas to color correct our film footage, have you thought of adding a Auto Low/Medium/High color corrector?
For instance, on my footage I believe if I used your script, and set the Low color levels to manual (or No Change), and the Medium and High levels to AUTO, I think it would color correct very nicely for me. Make sense what I am asking for?
johnmeyer
2nd January 2011, 03:40
Automatic color correction seldom works, and certainly cannot be counted on in all situations. I typically serve small segments out of Vegas using Satish's "frameserver" and change the script settings to get optimal results for each segment. Once in awhile the auto color correct works better than what I can do in Vegas, but most of the time it does not. The issue with ALL film-to-video transfer is that the gamma of film is completely different than video. Therefore you have to correct the transfer in order to get reasonably natural-looking shadows and mid-tones. However, as you correct for this, the way in which color correction works will change. Also, as the exposure of the film changes, you have to make changes. Finally, many of my film transfers are made from film that has faded in some way. Automatic color correction has a hard time correcting for film that has a blue, red, or yellow cast to it (the three types of fading that you'll typically encounter).
videoFred
2nd January 2011, 09:26
What can I expect from a capture I made with a DV camera (shutter speed 1/50 s, the movie being played around 16,6 fps) ?
Not so much I'm afraid. :(
What should be added to the script ? (deinterlace, duplicate frame remover or something )
Both, but again do not expect miracles. It all depends on the quality from the DV camera.
Thanks for any answer and a big thank you to VideoFred for letting this freely available to all of us ! :thanks:
You are welcome :)
Fred.
Plexi47
3rd January 2011, 13:16
@Fred,
Thanks to the hints you've given to me via email, I'm now almost satisfied of the results.
As I said my transfers are done with an ImagingSource camera (DFK-31BF03) used in trigger mode
Y800 ,debayered in software, saved as AVI non compressed.
Quality of the file (before processing) is normally good but unfortunately I notice some artefacts (digital).
I use auto exposure, could that be the problem ?
Thanks
Mauro
videoFred
3rd January 2011, 13:22
use auto exposure, could that be the problem ?
Hi Mauro,
Yes, auto exposure is a disaster. Do not use it and set exposure manual with the shutter speed. Probably auto-gain is enabled, right? Gain should be set to zero, it's a noise amplifier.
Fred.
frustum
17th January 2011, 01:09
I decided to write up a short report about some of the issues one might face when deciding to have old home movies digitized. In fact, this is the report I would have liked to have had when I approached it in total ignorance last July. It doesn't cover every topic and it doesn't cover them in depth -- hopefully it is enough to allow someone to know what questions to ask and what search terms to use when looking to learn more.
I'm posting it here because a big part of my solution relies on Fred's excellent script.
Comments on my writeup (http://www.thebattles.net/video/8mm_restoration.html) are welcomed.
johnmeyer
17th January 2011, 01:35
frustum: Great writeup! That was a lot of work, and it will help many people.
VideoFred: I just discovered something when doing a restoration of old VHS video that may also be useful if you have film that has an abnormal amount of flicker. Here's the "trick:" use DCT=1 in the two MAnalyze calls. This makes MVTools2 run much slower (not good), but it does wonders at removing flicker, and is far more effective than Deflicker. Use both Deflicker and this setting if you really want to nail the flicker.
videoFred
17th January 2011, 07:41
frustum: Great writeup! That was a lot of work, and it will help many people.
I agree.. It covers everything one should know about transfering film. :)
Here's the "trick:" use DCT=1 in the two MAnalyze calls. This makes MVTools2 run much slower (not good), but it does wonders at removing flicker, and is far more effective than Deflicker. Use both Deflicker and this setting if you really want to nail the flicker.
Thank you for the hint John! I will use these settings when needed.
Fred.
@MeGui
10th February 2011, 20:16
Hi there :))
Trying to fix this old video sample, PAL-VOB file.
Lot of dirt and noise...
http://www.mediafire.com/?8g6wx0j9w8h6c8c
Any advice using this videoFred's script?
Tnx and regards...:)
videoFred
11th February 2011, 08:03
My script removes the dirt spots pretty good on this example. But there's a problem on the scene with the clouds. The clouds are 'moving' and I can not solve this.
Anyhow, you will have to play with the parameters yourself, Megui. Set sharpness low (20-30) to begin with.
Fred.
Gargamel
16th February 2011, 13:35
Hello Fred,
Your last script works very well, thank you again (that changed my "transferrer" life !), but what about your new one ?
videoFred
16th February 2011, 15:21
Hello Fred,
Your last script works very well, thank you again (that changed my "transferrer" life !), but what about your new one ?
You will have to do it with the current upload, Gargamel. I have no time now to work on the script.
Fred.
Gargamel
16th February 2011, 17:59
OK Fred, it was just a question.
I understand you can't spend all your time on the script, and obviously you are right.
As I said, the current version is already a wonderful tool, which helps many amateurs.
Thanks !
johnmeyer
16th February 2011, 19:42
I'm not sure what you mean by a "new" script. Perhaps it is not obvious to everyone, because he doesn't put revision numbers in the scripts, but he has been modifying and upgrading this script since before this thread started, and if you look at this thread, you will see that it started over two years ago! He has heavily modified the script many times over those two years, adding new functionality, replacing some techniques with things that work better, and doing a lot of tweaking. I'll bet that the current script is at least his tenth published iteration, and that for each published iteration, there were probably several that he tried that never got released.
So, you DO have the new script, and one that is well tested and tried by many people! It works really well, but you still need to adapt it to each reel of film because in film or video restoration, no two reels are the same, and each is going to require custom tweaking. That's just the nature of the beast.
Gargamel
16th February 2011, 20:52
John, I agree, and am very happy to improve my Super 8 transfers with the 08-30-2010 script, where your own participation was important. I began to use this script in 2009, and saw the improvement of that tool (and now, I really couldn't do without it).
That question about a "new" script was just referring a future update Fred mentioned in a post, on 10th November, maybe with the last Autolevels plugin.
videoFred
17th February 2011, 07:19
That question about a "new" script was just referring a future update Fred mentioned in a post, on 10th November, maybe with the last Autolevels plugin.
Ah yes, now I see. Well.. you can do it yourself. Just replace the old autolevels.dll with the new one, and add some of the new parameters if you need them. But Frustum is still working on it, there's a thread about it:
http://forum.doom9.org/showthread.php?t=128585&page=4
Fred.
Gargamel
17th February 2011, 09:18
Sorry, my english was (is) not very clear... ;-)
I'll do as you say. Thank you for the link.
One thing more: In the first times, I intended to use the script, only to cure a few Super 8 footages (those which were a little too unstable and/or "dirty"). But I quickly saw the obvious improvement, and now ALL the family films I transfer to burn DVD, even the best ones, are cleaned and stabilized, trying to set the corrections "just as I have to do" for each reel, sometimes each take, for as John said "no two reels are the same, and each is going to require custom tweaking".
Logar
5th March 2011, 02:17
I need help. I would like to improve the quality of my Super 8 films. I followed the "film restoration script by videoFred". Intalled Avisynth
and other programs for it. Changed only two parameters in -> play speed=20 and numerator=30 because I record my films in NTSC with 1/60, I can
run my .avi file in VirtualDub. Unfortunatelly when I want to run the restoration script I got the following: Avisynth open failure: I don't
know what "stab_reference" means.
MT command commented out with # because my CPU is AMD Athlon 64 Processor 3500+ 2.2GHZ
Please advice me how can I run this Avisynth script without error. BTW is it any chache to improve on this film: http://www.youtube.com/svaradi#p/a/u/1/w740GzJYO1c ?
Thanks.
johnmeyer
5th March 2011, 03:58
I got the following: Avisynth open failure: ... BTW is it any chache to improve on this film:
I can't help you with the AVISynth error. Someone else will have to do that.
However, if you want to use the script, you won't get good results with the film you linked to. I downloaded your video from YouTube, and it looks like you used a 100 fps camera to capture the film from your projector. There are many, many duplicate frames where no motion occurs. These must be eliminated using an inverse telecine script (IVTC using TFM and TDecimate). In addition, even after you eliminate the duplicates, you still have some ghost frames that result from using the video camera to capture film from a projector. You may still be able to get results from Fred's script, but these ghost frames will probably reduce the ability to get good sharpness, and may fool the motion estimation algorithms.
Logar
6th March 2011, 01:20
These must be eliminated using an inverse telecine script (IVTC using TFM and TDecimate).
I see an IVTC filter in VirtualDub this will working for me? I do not know what is TFM and TDecimate. Sorry, I just start to learn this film restoration process.
Thanks for the advice.
Logar
6th March 2011, 01:41
I forget to explain how I captured this film. I used my videocamera setting exposure 1/60 sec. in NTSC system. Projector set on 20fsp. After I edit this film in iMovie: slow it down 15%,flipped, crop, rotate. Maybe the ghost frames came from the slowing down the film?? BTW in VirtualDub I see 7127 frames playing time 3:57:804 this is 29.97 fps as standard NTSC. Should I change something in this workflow order??
What program determine: "used a 100 fps camera" ?
Thanks.
johnmeyer
6th March 2011, 22:38
The 100 fps is what GSpot reported on the MP4 that I downloaded from YouTube. From what you say, you just used a normal video camera, so I don't know how the file got set to 100 fps. That actually isn't important. What IS important is that there are a LOT of duplicated fields and frames. If you want to use Videofred's script, you have to remove these. The IVTC in VD isn't useful: you have to use the TIVTC.dll plugin for AVISynth and then use these two functions:
tfm(display=false)
tdecimate(mode=0)
However, for your video, you will have to use settings other than the defaults, because you have a very non-standard cadence.
videoFred
7th March 2011, 07:54
Unfortunatelly when I want to run the restoration script I got the following: Avisynth open failure: I don't
know what "stab_reference" means.
This means you have disabled or perhaps deleted the first line of the stabilisation code. Why have you done this?
Fred.
Logar
7th March 2011, 21:04
I have to command out this line because it contain MT_binarize also. I do not have multi core CPU:( Ok I break the line before MT_binarize. Now the next error: Avisynth open failure: I don't know what "result5" means
Is it possible to run this script with single core CPU computer? How?
Thanks.
Logar
7th March 2011, 21:08
I comment out. Sorry for my mistake.
um3k
7th March 2011, 23:45
MT_binarize isn't for multithreading, it is part of MaskTools. Leave it enabled. :)
Logar
8th March 2011, 07:16
Thank you very much! Finaly Avisynth is running without error. The result is not satisfy me yet, but at least some progress. Now come the "fine tuning".
Thanks again.
Logar
9th March 2011, 01:27
One more question: I see now in the VirtualDub right panel "Result3: autolevels, manual color correction" What happened with Result4 and Result5?? Maybe my script is working only partially?? Any idea how can I get more details from the "dark" exposure parts?
Thanks
johnmeyer
9th March 2011, 05:09
One more question: I see now in the VirtualDub right panel "Result3: autolevels, manual color correction" What happened with Result4 and Result5?? Maybe my script is working only partially?? Any idea how can I get more details from the "dark" exposure parts?
ThanksYou get different results by changing the Results parameter.
result="result3"
will give you #RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
If you put an "S" in front of the number, you can see both the original and the corrected version side-by-side.
Result5 is a special test clip. Don't use it.
To get a brighter clip, use Results1 or Results3, since they both have Autolevels. You can then brighten the image further by setting the "gamma" parameter to something other than 1.0. If you use manual levels, you will probably find settings in the 1.05 - 1.20 are all you'll need. With Autolevels, you may need to use larger amounts.
videoFred
9th March 2011, 08:20
@ Johnmeyer: thank you for the support John. :)
One more question: I see now in the VirtualDub right panel "Result3: autolevels, manual color correction"
It's not the VirtualDub right panel. It's the left panel. The split screen is done by the script.
What happened with Result4 and Result5??
I have added a manual, Logar. Please read it.
Fred.
Logar
10th March 2011, 01:02
[QUOTE=videoFred;
I have added a manual, Logar. Please read it.
Fred.[/QUOTE]
Thank you for your support. I was so eager to start the project I forget to read BOTH files. I read only the installation help.
Now I read Film_restoring_help.txt also.
I still do not know how to save .avi file with the result ONLY panel in it?
Do you know any similar program for Mac OS X?? My MacBook Pro is much faster than my windows computers.
johnmeyer
10th March 2011, 01:16
I still do not know how to save .avi file with the result ONLY panel in it?Please read my last post. I already answered that question! Repeating myself: remove the "S" from the result:
result="resultS1"
gives you both the before and after video in the same frame;
result="result1"
gives you the "result ONLY panel," as you described it.
Undead Sega
10th March 2011, 04:55
It is a telephoto lens, designed for projecting to a screen a long way away, like in an auditorium. There is no such thing, I don't think, as a "macro" lens for a projector.
You put the video camera about four inches from the lens, which is prior to the focal point. This means that the image is upside down (it becomes right side up after it crosses the focal point). If you get the correct lens, you can fill the video frame, and will get a sharp image edge-to-edge. I contacted Roger Evans (inventor of the Workprinter) after I accidentally discovered this when trying to adapt his Workprinter aerial lens to my home-made setup. I just happened to have purchased a projector on eBay that had been used for projection in a school auditorium, so it had a telephoto lens, rather than the shorter lens used for projection in a classrooom.
Hi again, sorry for bringing this up but I am still liking to restore my 16mm animated film reel that's faded red, but from re-reading our past posts I believe there was a misunderstanding.
What I was trying to say regarding the lens, I was merely talking about the lens on the camera and not the projector, thus wouldnt one remove the projector's lens so one can directly see the film plane, and use a macro lens on the camera itself to record the film that's projecting in the film plane. Not a macro lens on the projector which lead you to say that there isnt one to your knowlege, this is where I think the confusion was.
And once again, would an Elmo 16-CL projector be a good choice for a project like this or similar to yours?
Anyways I hope that clears some things up, and I hope to hear back.
johnmeyer
10th March 2011, 07:13
There is no way to focus on the 16mm frame without using a lens in the projector. Just put a frame of 16mm film on a table and see if you can get it to fill the entire frame on your video camera. I don't think you can do it.
I don't know anything about the Elmo 16-CL, so I can't help you there.
Pieter8mm
16th March 2011, 18:01
Hello everyone, first time posting and a little scared to join the 8mm-grandfathers. It all started by Fred vimeo example's for me, and I was blowing away seeing the results by the script from Freddy!!
A few questions
Wy are the output avi files so big?
input file avi 3Gb and the output file from the script is around 30Gb.
Pieter
johnmeyer
16th March 2011, 18:42
Wy are the output avi files so big?
PieterYou have to choose a codec to compress the video. Otherwise, you get uncompressed video, which is huge.
If you are using VirtualDub to read the output of the script, then go to the Video menu and choose Compression. Choose something other than "uncompressed." There are many choices, and you may have to download a codec to get something that works for you. Free lossless codecs include HuffYUV and Lagarith. You can also use codecs with higher levels of compression such as DivX and Xvid.
Boulder
16th March 2011, 19:47
Also don't forget to set "Fast recompress" to avoid conversion to RGB and then to the compressed format which often is in YV12.
tin3tin
17th March 2011, 09:30
Check out this setup for transfering 8mm with a Canon 5Dmk2:
http://vimeo.com/20950590 (http://vimeo.com/20950590)
Pieter8mm
18th March 2011, 12:48
Thanks for the response. I tried both codecs and the file size is smaller but Pinnacle 12 don't recognize this codecs.
If you are using VirtualDub to read the output of the script
Do I need to change something in the script for the right output?
videoFred
18th March 2011, 13:05
Do I need to change something in the script for the right output?
Please read post #414. John Meyer has explained this to someone else.
Fred.
Pieter8mm
18th March 2011, 14:47
Dear Fred ,
I understand the output thread 414. I thought John meant something else in the script has to change but it's clear for me now. Thanks.:)
Undead Sega
25th March 2011, 03:48
Check out this setup for transfering 8mm with a Canon 5Dmk2:
http://vimeo.com/20950590 (http://vimeo.com/20950590)
This guy is doing almost exactly what I was trying to say before! :D
torwart
26th March 2011, 08:56
Hello gyes.
I think only this forum can help me. I have a video(mpeg2DVD) from an old 8mm film and I want to clean it from dust, scratches and dirt. I tried different plugins for avisynth and even Freds script, but nothing helped. Maybe it is very dirty. :) . If you can suggest some filters or scripts for this video it would be great. Here are 3 screenshots from video:
http://i064.radikal.ru/1103/c7/f76094d67d7a.jpg
http://s016.radikal.ru/i334/1103/52/49b84a6d7668.jpg
http://s014.radikal.ru/i327/1103/8a/9679f58a7d42.jpg
Thank you!
johnmeyer
26th March 2011, 16:39
Hair is almost impossible. Long scratches are also difficult. However, the "RemoveDirt" plugin, used in Fred's script does a remarkable job on the dirt spots.
If you still have the film, then you should try to clean it with Edwal Film Cleaner or similar product. Use a clean pure cotton cloth or a "Pec Pad" dampened with this solution. You can also use pure isopropyl alcohol (not rubbing alcohol, which contains water), but it doesn't dry as fast as the Edwal.
torwart
26th March 2011, 18:53
Thank you John, but I have only video file. Also I tried remove dirt plugin but result i 0. I don't know what to do.
Didée
26th March 2011, 19:12
Usually, the difficult part isn't the dirt removal. Temporal Median Filters are mighty at this. The bigger problem is to avoid the artifacts from false clamping. That's because in case of "big" dirt, it is very difficult to decide what is good and what is bad. Figuring whether temporal neighbor pixels are related or not-related is difficult, and spatial safeguarding also is somewhere between "very difficult"..to.."impossible", because the neighbors of dirt pixels are ... dirt pixels.
Something along the lines of global/pan compensated temporal median filtering. Probably as one step of a multi-step approach.
johnmeyer
26th March 2011, 19:50
I have restored dozens of hours of 16mm, 8mm and Super 8 film. The RemoveDirt plugin really works well, and seldom removes things it shouldn't. Here is all you need:
loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\plugins\RemoveDirtSSE2.dll")
RemoveDirtMC(source,23,false)
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)
}
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(forw,clip,backw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}
Before/after results here:
Remove Dirt (http://www.youtube.com/watch?v=4Gy9ZG23TTk&feature=channel_video_title)
Although the above example on YouTube used VideoFred's script, all of the improvement in dirt reduction that you see was from the removedirt function above.
Didée
26th March 2011, 21:24
That works out for relatively small speckles, but will necessarily fail for bigger spots of dirt. RemoveDirt on its own can not distinguish between local motion and local dirt. MVTools necessarily fails on sufficiently polluted blocks.
I'm not arguing against the practical improvements that can be achieved by such a script. Just want to point out that the measurings and decisions are rather vague and contain a good amount of uncertainty. The underlying problem is unsolved.
See ...
The RemoveDirt plugin really works well, and seldom removes things it shouldn't.
... when I use that script, I hardly need to search for removed objects.
Arrow? what arrow? - Arm? what arm?
http://img217.imageshack.us/img217/8361/remdrtmc01.th.png (http://img217.imageshack.us/i/remdrtmc01.png/) - http://img163.imageshack.us/img163/4871/remdrtmc02.th.png (http://img163.imageshack.us/i/remdrtmc02.png/)
I spare you the examples of deformed structures. (Unless you insist.) In fact, those are a bit harder to find.
johnmeyer
26th March 2011, 21:47
Are you saying that in the practical before/after example I posted, that the "after" wouldn't be 100 times more enjoyable to watch?
I agree that some real objects are occasionally removed, but when you deal with dirty film, rather than pristine video, and are simply watching the result rather than looking for flaws, the improvements, IMHO, completely negate the occasional small problems. Also, using a smaller input to RemoveDirt often takes care of the problems you show.
I can't think of any tool or algorithm that doesn't introduce artifacts or cause problems with some types of input. I therefore do not think this is a valid way to measure the success or failure of that tool. The correct measure is whether the resulting video is more enjoyable for most people to watch.
If someone has a better solution, then I will use it instead. Until then, in the real world of amazingly dirty amateur 8mm, Super8 and 16mm film, this tool does a great job and will give you something that is much better to watch than if you hadn't used it.
Didée
26th March 2011, 22:44
I'm not questioning the enjoyability of your examples. Just warning about worship of the golden calf.
From the screens posted by torwart, it is to be feared that Motion Search/Compensation will fail severely. If MC fails, everything fails. My guts are telling me that he'd rather need a multi-stage approach, like pre-cleaning before doing the MC for cleaning. Maybe even pre-pre-cleaning before pre-cleaning before final cleaning. Asymptotic solution, you know. A bit more tricky than plugging together the default-usage-examples of RemoveDirt and MFlow.
I know my [screenshot] examples could be considered "a bit unfair" -- obviously, low-contrast scenery is inherently problematic. But since you said "it seldom removes anything it shouldn't", I could not resist. ;)
torwart
27th March 2011, 10:35
Thank you John for your script , but it didn't work. I tried to change the parameters, but nothing changed. Steel searching for a solution. :)
videoFred
28th March 2011, 06:20
Thank you John for your script , but it didn't work.
The first thing you must do is deinterlace the source and remove any duplicate frames. Then you might have a chance..
Good luck!
Fred.
johnmeyer
28th March 2011, 06:27
Yes, you must have exactly one frame of film on each frame of video, or nothing will work. If instead you have one frame of film spread out over several frames of video, or two frames of film blended together into one frame of video, none of these scripts will work at all.
drewcox
28th March 2011, 18:20
Hi, my first post on the forum, though I have been lurking for a while. I've been working with Fred's film restoration scripts and think I've had pretty good success with pretty bad source material. See a sample of work in progress here (http://www.youtube.com/watch?v=YzVnTWkfZTw&hd=1):
http://www.youtube.com/watch?v=YzVnTWkfZTw&hd=1
I've been very impressed with the remove dirt process, certainly for single frame blemishes it is almost flawless for me.
My current challenge is a bad case of vertical scratches our old projector has carved into all these prints. I've tried to incorporate descratch into your scripts Fred, with some success. As you say, it's not perfect, but certainly more enjoyable to watch than without.
Have you done any experimenting with trying to remove these? Where in your workflow would you attempt it. After some experimentation I am doing it after stabilisation, before remove dirt. On that note, can you say a few words on why it is best to stabilise first, before removing dirt and noise?
Cheers
Drew
torwart
29th March 2011, 07:49
Thanks gyes! Script started to work after multidecimate plugin. There were random duplicate frames. You were right. Now the problem is , that I don't know what parameters(values) is better to change to have a script with more strict(hard) working. For me is better to loose some quality, but to erase this lines.
Thanks again.
videoFred
29th March 2011, 08:10
Have you done any experimenting with trying to remove these? Where in your workflow would you attempt it. After some experimentation I am doing it after stabilisation, before remove dirt. On that note, can you say a few words on why it is best to stabilise first, before removing dirt and noise?
Welcome here, Drew!
You are doing some nice film restoration work. I remove the vertical scrathes at the source: wetgate transfer.
Somehow it seems logical to me to do the stabilising first. But I have no scientific arguments for this :p
Fred.
videoFred
29th March 2011, 08:15
Now the problem is , that I don't know what parameters(values) is better to change
All sources are different. You must do the testing yourself.
For me is better to loose some quality, but to erase this lines.
Erase lines? What lines?
Fred.
torwart
29th March 2011, 08:53
I am talking about these dirty black lines that are on screenshots.
videoFred
29th March 2011, 09:26
I am talking about these dirty black lines that are on screenshots.
I see... Please try dirt_strength=60 or even more.
Fred.
torwart
29th March 2011, 10:36
sorry for my stupid questions, but where can I write dirt_strenth=60 ?? I can not find this parameter in script:
loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")
loadplugin("C:\Program Files\AviSynth 2.5\plugins\RemoveDirtSSE2.dll")
RemoveDirtMC(source,23,false)
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)
}
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
29th March 2011, 11:03
sorry for my stupid questions, but where can I write dirt_strenth=60 ?? I can not find this parameter in script:
You will find it on top of my filmscript, in the parameters section:
#CLEANING PARAMETERS
#--------------------------------------------------------------------------------------------------------------
dirt_blur= 0.1 # some blur before cleaning to avoid pixel artifacts
dirt_strength=40 # set this lower for clean films.
Please do not change 03_RemovedirtMC.avs!
And only change the parameters in my filmscript.
Fred.
drewcox
29th March 2011, 15:38
Hi Fred, thanks for your responses, I have another question for you!
My target output from your scripts are files for importing into a traditional NLE (probably iMovie) for further editing and incorporating some voice-over work we recorded from my parents a few years ago.
This would be a NTSC 720p project for viewing on a computer and AppleTV. I believe my target framerate is 30 fps (or is it 29.97?) for easy compatibility with iMovie defaults.
I am thinking I would like to slow down the 18fps 8mm source to ~15fps and then generate 1 interpolated (or blended) frame between each of these to get back to 30fps.
This would have the added benefit of slightly slowing the overall playback, which is a good thing as my Dad seemed to never take a shot longer than 3 seconds. More jump-cuts than a 90's MTV music video. I guess that Super-8 film was expensive in the 70s...
Anyway, I am working with settings like:
play_speed=15 #trim frames and play speed (PAL: 16.6666 or 18.75)
numerator= 30 #numerator for the interpolator (final frame rate)
denumerator= 1 #denumerator example: 60000/1001= 59.94fps
Is this the right approach? Can you forsee any issues?
I am getting some interpolation artifacts in some high-motion shots, I might end up having to render both interpolated and frame-blended versions and picking and choosing between them during editing. But it's worth it for the smooth playback compared to 18fps...
Thanks
Drew
torwart
29th March 2011, 19:14
please somebody give me a link of Freds filmscript. I can' t find it on site. :thanks:
Didée
29th March 2011, 19:23
Ermh ... 1st link in the 1st post on the 1st page of this very thread?
torwart
29th March 2011, 21:14
Freds script works just amazingly. I have no words!!!! Now I have a last problem :) . how to make a final clip??? when I drop the script in virtual dub it shows 2 videos(before and after). what I have to do to have my final amazing clip???????
drewcox
29th March 2011, 21:47
Freds script works just amazingly. I have no words!!!! Now I have a last problem :) . how to make a final clip??? when I drop the script in virtual dub it shows 2 videos(before and after). what I have to do to have my final amazing clip???????
I am fairly new to Avisynth and VirtualDub(Mod) myself, but what I do is simply File/Save As and choose an appropriate encoding for the output, depending on what you want to do with it next.
Tell me, since you seen to be going through the same process as me over the last few days, I have a few questions:
- have you had many stability problems with the tools (not the script). I am constantly getting VirtualDubMod crashing and locking up.
- Are you using the Multi-Threaded version of AviSynth?
- What sort of sharpening settings are you using? I find I have to keep mine very low (like 10,10,10), probably because my source is so blurry to begin with.
I would love to see a sample of your output.
johnmeyer
29th March 2011, 21:53
when I drop the script in virtual dub it shows 2 videos(before and after). what I have to do to have my final amazing clip???????See my earlier posts in this thread. The short version: remove the "S" from the string assigned to the "results" variable (e.g., use 1 instead of S1).
torwart
30th March 2011, 10:31
I have a happy end!!!!!!!! :) Everything works!!!! This forum is a miracle I think and you gyes are geniuses!!!! Thanks for your answers!!!!
Answering to Drewcox
I think , that if script and plugins are right the result will be right too. I can't see any stability problems except my wrong acts. Maybe it is not true. I don't have enough experience to talk about this.
I don't use multithreaded avisynth.
For sharpening I use sharpen(), but I know that there are much better filters for this.for example limitedsharpen. Don't ask me about settings, becouse it is a dark forest for me. :)
P.S. Special :thanks: to Mr. Fred.
videoFred
30th March 2011, 11:29
Anyway, I am working with settings like:
play_speed=15 #trim frames and play speed (PAL: 16.6666 or 18.75)
numerator= 30 #numerator for the interpolator (final frame rate)
denumerator= 1 #denumerator example: 60000/1001= 59.94fps
Is this the right approach? Can you forsee any issues?
If you want 29,97 fps, then the parameters must be:
play_speed=15 #trim frames and play speed (PAL: 16.6666 or 18.75)
numerator= 3000 #numerator for the interpolator (final frame rate)
denumerator= 1001 #denumerator
I am getting some interpolation artifacts in some high-motion shots, I might end up having to render both interpolated and frame-blended versions and picking and choosing between them during editing. But it's worth it for the smooth playback compared to 18fps...
Yes, you will always have to make a choice here... You can also let iMovie do the frame rate conversion and see what you get.
With these paramerers my script will not change the final frame rate, only the play speed:
play_speed=15 #trim frames and play speed (PAL: 16.6666 or 18.75)
numerator= 15 #numerator for the interpolator (final frame rate)
denumerator= 1 #denumerator example: 60000/1001= 59.94fps
Fred.
stoffal
22nd April 2011, 09:17
Fred, thank you very much for this wonderful script. I have tested it on some clips and it is amazing how we can polish up with it. I love that I can influence all parameters in detail. It is crazy that still no plugin developer has published a video editing plugin for 8mm restoring (for FinalCut or Premiere or iMovie) that offers these features directly in your video editing software (I know there used to be FilmFix once but they canceled the plugin years ago).
A question into the community:
Maybe some of you use (just like me) a Mac. Unfortunatly, Avisynth is not working on Mac. Do you switch to a 'real PC' for running the script? Or do you use a virtual windows on your Mac to run the script?
And one more:
What codec do you prefer to output the video? Especially, when you want to edit it afterwards in Premiere/FinalCut/etc. For Mac users: As VirtualDub cannot output Quicktime codecs, what codec do you prefer?
Thank you!
Christopher
Pieter8mm
22nd April 2011, 18:58
Dear Stoffal,
I use a MacPro early2099 with 16GB memory, running VMWare fusion windows 7 for running Fred's script. It is a rock solid system with no errors. It doesn't make a different how many
cores you use for VMW the script don't go faster then 4fps
I use FCP7. After running the script I transcode it with Apple compressor to mov. I made a droplet (see download).
mathmax
23rd April 2011, 21:55
hi
when I load the script I get this error:
there is no function named unsharpmask
However I have this line in my script:
Line 100: Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\awarpsharp.dll")
and the dll is indeed in the plugins folder...
what is the problem?
Didée
23rd April 2011, 22:46
UnsharpMask is not part of aWarpSharp, but rather of the "WarpSharp package (http://avisynth.org/warpenterprises/#warpsharp)"
mathmax
23rd April 2011, 23:13
Thank you Didée :)
http://forum.doom9.org/showthread.php?p=987619#post987619
Amateur
2nd May 2011, 00:06
Wow your results are stunning. Is this script only good for 8mm film or can it create similar results with NTSC DVDs? I just got a Michael Jackson DVD of his music videos and would love to get them to look as good as you got your film to look. I can't even seem to get this script to work though. How do I call it in MeGUI? I tried copying the interpolation avs file to my avisynth folder and changing it to avsi then using the file name as a default like i do with other filters
film_restoring_frame_interpolation()
but that didn't work. so then i tried to just copy everything from within the avs file and adding that to megui but that doesn't seem to work either. i get an error window that pops up and says "load plugin: " then has a bunch of random symbols, none of which are letters.
here is a sample (http://www.mediafire.com/?xqj7o9uqszcdsyk) of one of the vids i'm trying to encode
here is a different sample (http://www.mediafire.com/?0auyam7thto68y6) from another of the videos on the DVD. this one might be better
videoFred
2nd May 2011, 06:43
Is this script only good for 8mm film or can it create similar results with NTSC DVDs?
I'm sorry, the script is not made for DVD files.
Fred.
Amateur
3rd May 2011, 23:43
DARN! I was afraid of that. I wish I could get my live shows to look that good. Incredible.
Hi everyone,
I just subscribed to Doom9 (well, 5 days ago :-) after entirely reading this thread, specifically to thank videoFred and all the other contributors for the wealth of knowledge contained herein.
Like several others here, I am saddled with my dear Dad's Super-8 legacy. All his equipment was stolen during a break-in ages ago, so he has only the reels left, which he can't look at.
Recently he decided (without consulting me first :-) to have them transferred to DVD by a local "professional" (we live 500 km apart).
As often, the guy turned out to be a fraud, charging professional prices for kitchen-table work, and the result is a disaster.
Thirty seconds of a typical scene can be found here (http://dl.dropbox.com/u/10354034/Super8/sample.mpg) (streets of Durban, RSA, 1969 - 14 MB).
I have over two hours of this crap.
Understandably my dad is quite dispirited about the whole business. I fully understand that the rational approach would be to bite the bullet, clean up the old reels and have them transferred again, in DV format, by a more competent operator. This may happen at some point, but in the meantime I would still like to try and salvage some of what's there : make it at least watchable (which it isn't), remount it in narrative order with subtitles, author a proper DVD with menu, etc. If I can do it in two month's time it would make a nice present for his next birthday.
Knowing next to nothing about (analog) video, I've spent quite a few nights reading up about VirtualDub, AviSynth, AVSpmod, etc., and blindly tinkering with those. I think I've learnt more in the hour I spent reading this topic :-)
I can't imagine the time it would take me to get to the level of videoFred's work, and some others here, so I'm really thankful for their sharing it.
Of course I didn't believe for a second the scripts would work as-is on my specific material, and they didn't, so I'd be even more grateful if anyone could spare a moment to peek at it and advise on what I should add/change...
First, I don't have an AVI source, only the VOBs or titles converted to MPEG, so AviSource() won't do. DirectShowSource() works, but it is said to "lose frames". I have found and used DGDecode (DGIndex and MPEG2Source), should I look for something better ?
Second, I suppose this source must be interlaced. Unfortunately I can't make much sense of all I've read on this topic... how should I go about making it progressive first ? Should I even do it, as it will be re-encoded to DVD eventually ? For the time being I'm using Decomb and FieldDeinterlace().
Next, the most obnoxious problem with the DVD transfer is the terrible and permanent stroboscopic effect (flash, flicker ?). My understanding is that it comes from a bad job compensating for the difference between the projector's 18 fps and the recorder's 25, but I can't seem to find the duplicated and blended frames that should result from that, so I think the usual "cures" would not work. Is that right ?
My "cut-n-paste" experiments so far have led me to this very simple script :
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\hotspot.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\ReduceFlicker.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\decomb.dll")
MPEG2Source("..\source1\VTS_01_1.d2v")
slideframe = ImageSource("slideframe.bmp")
HotSpot(mask="hotspot.bmp", mult=220, add=0)
ReduceFlicker(strength=3, aggressive=true)
FieldDeinterlace()
Overlay(slideframe, mask=slideframe.Invert())
ColorYUV(autogain=true, autowhite=true)
Result is here (http://dl.dropbox.com/u/10354034/Super8/sample.avi) (8 MB).
As you can see, ReduceFlicker does help a lot, but this is still treating the symptom rather than the cause. Is there anything else I could try ?
I have been unable to get any visible difference from more "advanced" plugins, like autolevels, Deflicker, RemoveDirt, despot etc.
Lastly, if/when I get the scripts right I will need to save the bits back to MPEG for DVD authoring. I've seen talk about different codecs to do this (ffmpeg, Hc etc.). Is this important ? Is there a clear choice ?
Thanks (a lot) in advance for any light you people could shed on my (very newbie-ish) questions...
fp
johnmeyer
5th May 2011, 23:11
I looked at your clip and see the following problems:
1. The transfer was done by pointing a video camera at the film projector (or screen) and as a result, you have some fields (fields as seen when you serve the video into a "separatefields()" script, not frames) that are blends of two adjacent film frames. I would recommend using TFM followed by Tdecimate to find these blended fields and remove them. With a little trial and error, I think you can turn this transfer into a frame-accurate (like a Workprinter) transfer.
2. The flicker is probably the most objectionable thing to your father. I have found that setting DCT=1 in MVTools does a remarkable job on film flicker, sometimes better than Deflicker. I have often used both. I think you can probably get good results if you use both. I briefly mentioned this elsewhere in this thread:
MVTools to Remove Flicker (http://forum.doom9.org/showthread.php?p=1471963#post1471963)
3. Overexposure. You are hosed with this one. Nothing can be done.
4. Poor resolution. Again, not much can be done here, but if you successfully are able to do #1 above, then you may be able to regain some "apparent" sharpness using VideoFred's script.
5. Color bands. This is easy since this particular footage is B&W. Simply apply a B&W filter. However for color footage, this is going to be tough to remove.
If you lived on the same continent as me, I'd volunteer to do a few reels so you could see the difference between what you got and a good frame-accurate transfer. Since you don't live nearby, I would suggest that you try to find a transfer house that either does Rank Cintel transfers or advertises "frame accurate" transfers. Here in the USA, there is a person named Roger Evans who sells a variety of transfer systems:
MovieStuff (http://www.moviestuff.tv/)
If you can find anyone who uses his frame accurate transfer systems, you should get much better results. Whatever you do, only have them transfer one or two reels, so you can see the results, before you spend a lot more money re-doing the whole thing.
John, thank you SO much for taking the time to look it over and write down such precise advice. Especially in so short a time (about an hour if the time zones are correct :-)... just one more confirmation that this forum, and the people it attracts, are a gem.
Identifying the real/main problems, and choosing the right tools for them, must be the #1 pitfall for the uninitiated in video, film transfer, AVISynth and its cornucopia of mildly documented plugins... Now I have a couple of very focused leads (TFM/Tdecimate and MVTools/Deflicker) which I'm going to follow up immediately. Hopefully I'll get better results than with my poking around in the dark, and save some time to boot !
Your only comment I don't understand is #5 : the footage is definitely not B&W ?... it has bad colour, yes, but colour nonetheless :-)
I just checked the .mpg sample I put online, it shows up fine here in mpHC, VLC etc. Also, the improvement by ColorYUV is plainly seen in the resulting AVI sample.
Otherwise, I fully concur that this is only a short-term stopgap (also an interesting learning process for me :-), and the real solution would be to start over. I had already read up on Roger's work, and yours also (the software side of which I understand is kind of a trade secret at this time :-). I don't know if such facilities are readily available on this side of the Pond, but I will scour what French (and maybe Belgian) forums I can find for hints on reputable operators.
Meanwhile, I'm off chasing the first two wild geese, will report back if they don't eat me :)
Again, thanks much !
fp
What most probably won't work out is the idea to use TFM+TDecimate to get rid of the blendings. (If that would work, then blend removers like Restore24 & SRestore never would've been developped.) The decimator simply watches for frames with the least difference to its predecessor and removes those. In some instances it will remove blended frames, in other instances it will remove good frames and let the blending stand. Decimators simply don't use metrics that could detect blendings.
The other way round, it's quite possible that SRestore could do a reasonable job to remove the blendings.
Didée, your comment is a relief... Right now I am stepping through a clip with tfm(d2v="...", display=true), and it seems to (mostly) get the clean/combed frames right.
However, when I feed that to TDecimate(), as you say, it drops good frames and keeps bad ones... Of course, I haven't really played with the parameters yet : there are so many, and I understand so little :-)
Thanks for the tip on SRestore... another wild goose chase :-)
fp
Undead Sega
6th May 2011, 15:46
Check out this setup for transfering 8mm with a Canon 5Dmk2:
http://vimeo.com/20950590 (http://vimeo.com/20950590)
Has anyone actually chekced this out??? :D
johnmeyer
6th May 2011, 16:21
Didée is correct about what TFM & TDecimate were originally intended to do. However, he is wrong that they can't be made to work for your situation. I know this because I spent several years developing a film transfer system based on capturing from a projector from which the shutter had been removed and then using TFM and TDecimate to remove the frames that are the least similar. The pharmaceutical drug companies call this sort of thing "off label" and it means using the drug (or in this case the software tool) for something different from what the drug was originally intended to treat. I actually talked to a patent lawyer about patenting the overall technique, but decided that it was too expensive. After I decided not to patent, I posted several times in these forums, providing an outline of my technique.
I have transferred hundreds of hours of film and made a LOT of money using this technique and it works extremely well, even on sound film.
So, in my technique, TFM and TDecimate can and DO work for removing both pulldown frame (the frame that happens when the film is being moved in a projector from which the shutter has been removed) and also from removing the third duplicate field (something that happens every 8-10 frames in a 24 fps shutterless projector when capturing with an unsynchronized 29.97 fps camera). To make this work, you use slightly different settings for TFM than you would normally. Send me a PM and I'll give you the settings.
John, I've read enough about your modus operandi, by following links in this huge thread, to conclude that you know perfectly well that which you speak about.
I was just saying that *I* could not, in the first few tries, get TDecimate to correct what TFM detected as "combed". Besides, I'm not having better success with SRecover, so that says it all :-)
And thanks for the kind offer, trying the PM right away...
John -- Since TDecimate is designed to remove the most-similar frame, I wonder how do you use it for
and then using TFM and TDecimate to remove the frames that are the least similar.
I mean, you can't just tell TDecimate "please don't remove the most similar frames like you usually do, but instead remove the most different frames." On its own, TDecimate just won't do that.
What else? Using 2-pass operation, then figuring the most-different frames from the stats file, and making an override file based on this? It's surely possible to do something this way. No doubt. But then, this doesn't quite comply with your "easy-go" recommendation
I would recommend using TFM followed by Tdecimate to find these blended fields and remove them. With a little trial and error, I think you can turn this transfer into a frame-accurate (like a Workprinter) transfer.
because with the "standard usage" of TFM().TDecimate(), this just can not be done.
Okay - while "LOTS of money" is made behind the scenes via PM:p;), I'll continue publicly ...
Besides, I'm not having better success with SRecover, so that says it all :-)
Oh, that probably means you didn't use SRestore like it should in this case here. Above all, to use SRestore you don't start with TFM a/o TDecimate, but with a simple bob filter.
The following script:
mpeg2source("sample_(fpp).d2v")
o=last
o.bob(-.2,.6)
SRestore(frate=20.0)
requestlinear()
rest=last
calm = rest.temporalsoften(1,255,255,32,2).merge(rest,0.25)#.repair(rest,1).removegrain(11)
calm = calm.temporalsoften(1,255,255,16,2).merge(calm,0.25)
LOP = calm.bicubicresize(180,144).bicubicresize(720,576,1,0)
HIP = rest.bicubicresize(180,144).bicubicresize(720,576,1,0)
HIP = mt_makediff(rest,HIP)
mix = LOP.mt_adddiff(HIP,U=2,V=2)
sup1=rest.msuper(levels=1)
sup2=mix.removegrain(11).msuper()
bv2=sup2.manalyse(isb=true, delta=2,blksize=16,overlap=8,DCT=5)
bv1=sup2.manalyse(isb=true, delta=1,blksize=16,overlap=8,DCT=5)
fv1=sup2.manalyse(isb=false,delta=1,blksize=16,overlap=8,DCT=5)
fv2=sup2.manalyse(isb=false,delta=2,blksize=16,overlap=8,DCT=5)
rest.mdegrain2(sup1,bv1,fv1,bv2,fv2,thSAD=640)
produced the following result: <KLICK> (http://www.mediafire.com/?7hm4cn80y2k82ra) (MediaFire, ~10MB)
Script made up in five minutes (between mowing the lawn and watering the hedgerow). Surely not perfect, but seems like a good start.
BTW, I didn't use DCT=1 because I didn't have the time for that (DCT=1 is very slow with blocksize=8, and pretty much unusably-slow with other blocksizes). Hence, I did a manual flicker-removal for MVTools' search clip. Runs much faster.
johnmeyer
6th May 2011, 20:36
I defer completely to Dideé. His script produces much better flicker reduction than what I've been doing. I was aware of the huge speed penalty in using DCT=1, but used it anyway, along with Deflicker, because I was unaware of his vastly superior method of reducing flicker.
As for his post about not being able to use TFM and TDecimate, here's the result of my script which does exactly that:
Recovered Film Clip (http://dl.dropbox.com/u/1561578/Recover%20Frames%20From%20Simple%20Projector%20Capture.avi)
The essential part of the script is this:
#Use "cthresh" to control amount of combing removed. Lower values removes more combing.
tfm(source,display=false,mode=2,pp=0,cthresh=35,micmatching=3,scthresh=2,mmsco=false)
#Use rate to determine how many fieds to decimate. Increase if you see duplicates; decrease if you have skips (jumps)
tdecimate(mode=7,display=false, rate=18)
requestlinear()
I took the additional liberty of cropping, gamma correcting, and color adjusting the clip. I did this in Vegas because color grading is obviously much easier to do in a capable editing program.
So, as I stated before, TFM/TDecimate were not made to do this, but they can be made to do the job. I could not have achieved the result if it didn't work.
"According to the greatest minds of science, it cannot fly. ... But what does the bumblebee do? It ignores the great minds, the skeptics, the computers... and it just goes ahead and flies. "
johnmeyer
6th May 2011, 22:22
I don't like to post twice in a row, but because editing a previous post to add more information can sometimes cause problems, I'm doing it anyway. So, with that apology, here is another result, this one using Didée's script, but then running that result through my variation (posted much earlier in this thread) of VideoFred's film restoration script that is the original subject of this thread, with both the Autolevels and Autocolor correction enabled:
Film Restoration Script (http://dl.dropbox.com/u/1561578/Dide%C3%A9%20Results%20Put%20Through%20VideoFred%27s%20script.avi)
I am not suggesting that doing further processing through VideoFred's script necessarily produces a better result, although it does add dirt removal and obviously changes levels and color [edit] and does motion stabilization [/end edit]
To me this particular result seems oversharpened, although I often have this issue with this script and usually substantially reduce the sharpening. The key things it will do for your film is to reduce the dirt, stabilize, and automatically adjust -- to some degree -- for the large exposure variations typical of amateur home movies.
As you will find, when trying to improve film transfers -- even those that were transferred with a better process -- there is no such thing as a "set it and forget it" script that will give good results on every foot of film you have.
Along these same lines, I did a frame-by-frame comparison between the output of Didée's script and my script and found that on some frames his produced a better output, and on some, mine produced a better result. Neither seemed to have a clear advantage over the other. My point in saying this is that removing the blended frames is not an exact thing, and therefore you may still need to adjust slightly the settings used (in either script) in order to get the best results. Clearly you should use Didée's script as the starting point for your further tweaking because its flicker reduction is much better, and it is 20% faster than my script.
Hey guys, hold your fire, I'm drowning ! :-)
Seriously now, a huge thanks (yet again) to both of you for the time you took, here and backstage, to explain and illustrate what I was missing.
All of your results are impressive compared to the original and my own tinkering, and much better than I even thought possible...
Didée, am I correct in supposing that in your script, everything after the SRestore() is (mostly) devoted to deflickering ? The effect is truly amazing, and I'm glad that my questions led to this exchange with John !
(unfortunately, if I wanted to understand how it works before mowing my own lawn and watering the plants, the garden would turn to jungle :-)
John, I tried to follow your advice and plug Didée's output into VideoFred's Restoration script, like you did. However it seems all that processing is a bit too much for my PC (either that, or something is wrong with my setup) : AVS doesn't crash or error out, but slows down to a crawl and looks basically frozen most of the time. I think I'll just try to re-use the levels/colour correction and leave out the costly bits.
You are very right that the quest for ever better results can turn into indefinite tweaking and tuning. It's probably a lot of fun, too, once you know what you're doing, but I'm a beginner working on a deadline... So now that you guys have set me on the right track, I need to get the AVS stuff to the "good enough" level, and then leave good enough alone. Because after that there will be a lot of encoding to do, and then a lot of authoring, which I know better but still takes a lot of time !
I'll work in whatever improvements I can till tomorrow night, then I'll move on. Thanks for getting me started !
johnmeyer
7th May 2011, 21:59
Didée will have to answer about how his de-flicker approach works.
As for how I "plugged into" VideoFred's script, what I did was to take your "sample.mpg" file, and then fed that into Didée's script. This produced the identical results that he got, but I saved it using a lossless codec (HuffYUV) as an intermediate file. I then opened this in VideoFred's script, modified some of the parameters, and then saved the result in the DivX format and uploaded. I didn't pay attention to PAR, so when you play the result, it may be horizontally stretched.
VideoFred's script relies on lots of different plugins. If you are having problems, I would suggest going to the first post in this thread, downloading the "Film_Restoring.zip" file, and then reading the "Installing_help.txt" file. Perhaps you have already done this, but if not, I think this will help you get it running. One problem with many of these somewhat complex scripts found here in this forum is that you need to have specific versions of plugins in order for everything to work.
You will have to decide if it is worth it to get his script to work. As you pointed out, Didée's script fixes the two main problems of frame/field blending and flicker. The main reason I uploaded the VideoFred script's modification the Didée script output is to help you decide whether you like what the VideoFred script does on this particular clip.
Here's my opinion after using VideoFred's script on lots of film (some of which earned "lots" of money :) -- apologies for sounding like a jacka$$ in the previous post, and thank you to Didée for keeping me honest):
I find that the dirt removal and stabilization make home movies MUCH more enjoyable to watch. The color and levels adjustments sometimes help, but sometimes make the film look worse: it really depends on the source material. The many levels of sharpening and resolution enhancement sometimes work miracles (take a look at some of the sample VideoFred has posted at Vimeo for some unbelievable results) and other times tend to make the film look "phony." As for the frame interpolation, rather than frame and field repeating (when changing from 16, 18, or 24 fps progressive to either 25 or 29.97 interlaced), I personally don't usually do this because the results don't look as much like film. Having said that, if your footage has a lot of horizontal camera movement, this interpolation works very well on camera pans and will reduce or eliminate the judder that results from the slow temporal cadence of these old film speeds.
John, thanks for the details on your process. As I have quite a lot of material, and am still in the first step (LOL), I want something "batchable" -- in fact I have already written a Python script that writes DOS batch files to process entire directories from one template .AVS : create a .d2v and .avs for each .mpg segment, then use those to encode to .m2v. So I'd rather avoid cutting up the work in chunks, although I understand the PC suffers less that way.
Actually VideoFred's script does work : it is installed as per the instructions, with its own packaged plugins. It's just overwhelming my machine, and I won't even consider the time it would need to encode all my stuff: law of diminishing returns...
So, as you say, I've made my choices so I can move on : Didée's deblender/deflicker, plus your RemoveDirtMC, plus color/levels adjustments, are now declared "good enough", especially compared to the original :-)
Encoding time is plenty long as it is, no need to make it worse... Would SetMTMode help here ? Need to try that.
Oh, and about your last sentence : yes, at the end of the script I'm left with the 18 fps from SRestore. HCenc won't encode that because it's not DVD-compliant ; I just added "AssumeFPS(25)" to test the encoding, but obviously the result runs faster that the source. I'm currently scouring the Avisynth Wiki for the right way to do "frame and field repeating", but sometimes an answer comes faster here than I can find it myself :-)
johnmeyer
8th May 2011, 18:06
Would SetMTMode help here ? If you have a multi-core computer, SetMTMode can make things run much faster, so yes, it should help. However, some plugins don't play "nice" with the MT mode. For a simple test to see if it will work, download and copy the MT version of the Avisynth DLL, and then add SetMTMode (5,0) before your AVISource (or equivalent) command, and then add SetMTMode(2) immediately after that AVISource statement. There are other modes you can use.
I always encode about 10-15 seconds of video both with SetMTMode and then without it, and then A/B them on the timeline in my video editor. On one or two occasions I wrote scripts where the results from the various threads got out of sync and I ended up with different video with the MT version. The other problem you can have is instability (crashes), but you'll see that problem pretty quickly, if it is there :). Sometimes you can still get the script to work if you add a SetMemoryMax statement, although it always "feels" to me like you are just delaying the inevitable by doing this (i.e., if something is eating memory, sooner or later you're going to have a problem).
I'm left with the 18 fps from SRestore. HCenc won't encode that because it's not DVD-compliant ; I just added "AssumeFPS(25)" to test the encoding, but obviously the result runs faster that the source. I'm currently scouring the Avisynth Wiki for the right way to do "frame and field repeating", ...
You want to repeat fields and not frames because repeating frames makes the video too "jerky." I got started doing this years ago, and back then the advice was to use a SelectEvery statement. Here's one that I've used for years to go from 18 fps to 30 fps:
separatefields()
selectEvery(6, 0,1, 0,3, 2,3, 2,5, 4,5)
weave()
AssumeFPS(29.97, true)
If you go this route, and want to make your own SelectEvery statement, always check that the fields always alternate between even and odd, and that when you go "backwards" to an earlier field, you only go back one number.
When I have posted the above code in the past, someone always responds by pointing out that you can do the same thing, and do it much more generically, using the following (this is someone else's code):
ChangeFPS(59.94)
AssumeBFF() # or TFF, as required
SeparateFields()
SelectEvery(4, 0, 3)
weave()
For your PAL situation, I think you would simply substitute 50 in the first line (in place of 59.94) and 25 in the AssumeFPS line. Make sure you use the appropriate BFF or TFF statement. Also, make sure that the frame rate of your input video is correctly identified prior to the ChangeFPS statement, because it will do its work based on what it believes to be the current frame rate.
Since I got used to doing it the first way, and since that gives me exact control over the cadence I create, I continue to do it that way. Thus, other than doing a few test several years ago, I haven't used the above code much, but I'm pretty sure it works.
Hope that helps!
at the end of the script I'm left with the 18 fps from SRestore.
I'm not perfectly sure if 18fps is the framerate that should be gotten from this source.
When I did the quick jump at it, I first tried SRestore(frate=18.0), too. Looked at the preview, and had the impression that there were "jumps" in the motion, i.e. missing frames. Then I tried frate=20.0, and the preview seemed smooth.
Maybe the original playback was slightly accelerated? When I look at (my) 20fps sample, it also seems that things are moving slightly too fast - - the pedestrians all appear to be in a hurry, don't they?
Closer examination is recommended. Never rely on what "should be" ... always check what actually is.
Gavino
8th May 2011, 18:50
When I have posted the above code in the past, someone always responds by pointing out that you can do the same thing, and do it much more generically,
Probably me, as I was about to do it again... :)
using the following (this is someone else's code):
ChangeFPS(59.94)
AssumeBFF() # or TFF, as required
SeparateFields()
SelectEvery(4, 0, 3)
weave()
AssumeFPS(29.97, true).separatefields()
I don't think that's 'my' code though, or at least the last line isn't.
You don't want the final separatefields, and the AssumeFPS is redundant.
Just use twice the required final rate in the ChangeFPS call (eg 50 for PAL).
If you have a multi-core computer, SetMTMode can make things run much faster, so yes, it should help. However, some plugins don't play "nice" with the MT mode. For a simple test to see if it will work, download and copy the MT version of the Avisynth DLL, and then add SetMTMode (5,0) before your AVISource (or equivalent) command, and then add SetMTMode(2) immediately after that AVISource statement. There are other modes you can use.
After posting I realized I had MTMode enabled when I tried VideoFred's script. It was still slow as molasses, but after I added the required DLLs, it stopped erroring out and seemed to work.
He uses the more aggressive SetMTMode(1), and I have far fewer plugins loaded, so I tried that and it seems to work too. On my script, in interactive mode inside AVSPmod, the speedup is indeed quite perceptible !
You want to repeat fields and not frames because repeating frames makes the video too "jerky." I got started doing this years ago, and back then the advice was to use a SelectEvery statement. Here's one that I've used for years to go from 18 fps to 30 fps:
(...)
Hope that helps!
You bet it does (as always) ! My debt is starting to look like the Niagara Falls :-)
Just to be sure : is this something you do at the very end of the script, when all processing is done ?
johnmeyer
8th May 2011, 19:18
Didée makes a very interesting point about 18 fps possibly not being the correct framerate, and I think he is definitely correct.
In fact, there are two different "framerates" you need to think about here.
The first is the framerate (the one Didée refers to) that is actually used for the transfer. The projector could have been running at any speed from 15 fps up to 24 fps (or even a little higher). You have no way of knowing. Many projectors used for "quick and dirty" film to video transfer (like your father had done) have a variable speed control, and the operator adjusts this while watching a monitor connected to the camera, and changes the speed until the flicker is minimized. The slower the projector goes, the more duplicates SRestore will need to remove, and it will do this based on the frame rate you set.
So, you'll need to adjust the SRestore (and maybe other parameters as well) until you get the best result in eliminating the blends and duplicates in the captured video. I would temporarily put a "separatefields()" statement at the end of your SRestore script and then walk through several dozen fields to make sure you get exactly two fields per frame, and that none (or almost none) are blended. You also need to make sure that you don't end up with "jumps" which will happen if you decimate too much and end up remove entire frames. I haven't used SRestore, but with the method I described (using TFM and TDecimate) setting the incorrect framerate definitely could cause frames to be dropped.
Once you get that framerate adjusted correctly, you then have a second, and totally different framerate to figure out, namely what fps was used during the initial filming? This is the one you want to use when adding the pulldown using the ChangeFPS or Selectevery approach I posted above. For amateur video, the cameras were not very precise, and often varied quite a bit. This was especially true of cameras that used a manual windup spring to drive the camera (and the really early ones were hand-cranked ...). As a guideline, most early standard 8mm film was 16 fps; almost all Super 8 was 18 fps; and some later (post-1960) standard 8mm was 18 fps. So, if your dad's film truly was Super 8 and not 8mm, I'd start by making the assumption that it is 18 fps.
In a few cases I've been lucky enough to have a clock with a sweep hand (and one time I had an early digital scoreboard clock in the frame) and was able to determine exactly what fps to use. However, in most cases you'll just have to use the above information as a guideline and then adjust "to taste" based on whether the resulting movement appears natural.
...
I was in the middle of editing this prior to posting and noted that Gavino had posted. He caught a mistake: the separatefields() in the final line of the code in my previous post. As I indicated, I always check my work by temporarily adding that separatefields() line and then look at the resulting fields to make sure I don't have any temporal errors (fields that cause retrograde motion) or spatial errors (each successive field should bob up and down).
In order to avoid confusion for anyone who later reads these posts, I'll remove that separatefields() from my post above.
I'm not perfectly sure if 18fps is the framerate that should be gotten from this source.
When I did the quick jump at it, I first tried SRestore(frate=18.0), too. Looked at the preview, and had the impression that there were "jumps" in the motion, i.e. missing frames. Then I tried frate=20.0, and the preview seemed smooth.
Maybe the original playback was slightly accelerated? When I look at (my) 20fps sample, it also seems that things are moving slightly too fast - - the pedestrians all appear to be in a hurry, don't they?
Closer examination is recommended. Never rely on what "should be" ... always check what actually is.
You mean the fraud that committed the crime also had the projector running faster than 18fps, on top of everything else ? I'll find him and shoot him :-)
Is there anything else to "closer examination" than trial and error to determine a rate where movements "feels natural" ?
Every time I try to figure out the relationships between all these fps (the 18 - we hope - of the camera, the XX of the projector, and the 25 of the recorder), my brain melts faster than the cores at Fukushima... :-(
johnmeyer
8th May 2011, 19:27
You mean the fraud that committed the crime also had the projector running faster than 18fps, on top of everything else ? I'll find him and shoot him :-)We're all posting at the same time, so you may not have read what I wrote above. However, just to make sure I got the point across, when pointing a video camera at a projector screen and filming the process, you actually have to adjust the projector speed to something other than the speed at which the original movie was filmed. In fact, almost every transfer system uses a projector speed that is different than the original frame rate. The best transfer systems, like the Rank Cintel or Roger Evan's Workprinters scan or project at a much lower frame rate. The system I developed actually projects at 24 fps, even for 16 fps film.
So, no need to commit mayhem: the transfer house did exactly what was required by that particular method of transfer.
Probably me, as I was about to do it again... :)
I don't think that's 'my' code though, or at least the last line isn't.
You don't want the final separatefields, and the AssumeFPS is redundant.
Just use twice the required final rate in the ChangeFPS call (eg 50 for PAL).
Thanks. As an old-school programmer, I'm always in favour of cutting out two unneeded instructions :-)
Didée makes a very interesting point about 18 fps possibly not being the correct framerate, and I think he is definitely correct.
In fact, there are two different "framerates" you need to think about here.
The first is the framerate (the one Didée refers to) that is actually used for the transfer. The projector could have been running at any speed from 15 fps up to 24 fps (or even a little higher). You have no way of knowing. Many projectors used for "quick and dirty" film to video transfer (like your father had done) have a variable speed control, and the operator adjusts this while watching a monitor connected to the camera, and changes the speed until the flicker is minimized. The slower the projector goes, the more duplicates SRestore will need to remove, and it will do this based on the frame rate you set.
So, you'll need to adjust the SRestore (and maybe other parameters as well) until you get the best result in eliminating the blends and duplicates in the captured video. I would temporarily put a "separatefields()" statement at the end of your SRestore script and then walk through several dozen fields to make sure you get exactly two fields per frame, and that none (or almost none) are blended. You also need to make sure that you don't end up with "jumps" which will happen if you decimate too much and end up remove entire frames. I haven't used SRestore, but with the method I described (using TFM and TDecimate) setting the incorrect framerate definitely could cause frames to be dropped.
OK, that makes it so much clearer.... and thanks for the tip on how to proceed !
So much for that "last, easy question"... *SIGH* :-)
Once you get that framerate adjusted correctly, you then have a second, and totally different framerate to figure out, namely what fps was used during the initial filming? This is the one you want to use when adding the pulldown using the ChangeFPS or Selectevery approach I posted above. For amateur video, the cameras were not very precise, and often varied quite a bit. This was especially true of cameras that used a manual windup spring to drive the camera (and the really early ones were hand-cranked ...). As a guideline, most early standard 8mm film was 16 fps; almost all Super 8 was 18 fps; and some later (post-1960) standard 8mm was 18 fps. So, if your dad's film truly was Super 8 and not 8mm, I'd start by making the assumption that it is 18 fps.
Definitely Super 8, and dad's cam was from 1969, with a battery-operated motor, so 18 is probably a "safe enough" bet...
We're all posting at the same time, so you may not have read what I wrote above.
Definitely some crosstalk going on :-)
However, just to make sure I got the point across, when pointing a video camera at a projector screen and filming the process, you actually have to adjust the projector speed to something other than the speed at which the original movie was filmed. In fact, almost every transfer system uses a projector speed that is different than the original frame rate. The best transfer systems, like the Rank Cintel or Roger Evan's Workprinters scan or project at a much lower frame rate. The system I developed actually projects at 24 fps, even for 16 fps film.
Quite. On a French forum over here, some advertise continuous, shutterless filming at 16.66fps, with post processing that sounds a lot like yours (find the two good frames for each image, recombine them in the right order and dump the rest).
In this particular case, whatever reason the operator set the speed for, it certainly wasn't to reduce flicker :-)
So, no need to commit mayhem: the transfer house did exactly what was required by that particular method of transfer.
That's noble of you, but his others sins were sufficient anyway :-)
Okay, so John's "fps detection" method works, once you get the hang of it... and Dirée certainly has a very, very sharp eye !
The best value I was able to determine (based on appearance of first duplicate, and absence of jumps) is... 19.75. I sort of ran out of patience after that :-)
Running the AVS script in VirtualDub, and the original MPEG side-to-side show no meaningful drift, so I guess it's accurate enough. Problem solved, thanks guys !
However, the "Gavino way" of going back to 25fps adds a whole lot of *very* combed frames (last two out of every five actually). Is that to be expected ?...
Gavino
8th May 2011, 23:36
However, the "Gavino way" of going back to 25fps adds a whole lot of *very* combed frames (last two out of every five actually). Is that to be expected ?...
Combed frames are certainly to be expected, since the result is interlaced (and should be encoded as such). That's the point of repeating fields rather than frames.
John's approach with SelectEvery would do the same - this is basically 'hard telecine'. An alternative approach is 'soft telecine' - encode progressive at 18fps (or 19.75 or whatever) and use DGPulldown, as often recommended by manono (eg in this thread).
johnmeyer
9th May 2011, 00:22
To add to what Gavino said, go back to my various recent posts, and I always recommend using the "separatefields()" statement, temporarily at the end of your script, so you can make sure that the repeated fields are where you want them.
One thing I didn't mention, but I assume that you understand, is that when fields are repeated in order to make something which only has 18 actual frames per second play at the correct speed on a device which insists on playing everything at 25 frames per second (your PAL TV set), you have to either synthesize new frames (which is an option in VideoFred's script, or which you can do yourself with MVTools2) or you have to repeat frames. However, since repeating entire film frames often results in noticeable hesitations and jumps, the better way which has been used since day one of NTSC television -- and which works when going from 16 or 18 fps for PAL TV -- is to repeat fields instead of frames. This makes the repeat last 1/2 as long, and that makes a big difference in how smooth the result looks. However, this means that you will indeed end up with some frames which contain fields from two adjacent frames. That is perfectly OK, and looks absolutely fine when played on a TV capable of displaying interlaced material (e.g., any PAL TV set). As long as each field in a frame is either from the same moment in time, or the next moment in time, the viewer will not see anything they haven't seen many, many times before.
videoFred
9th May 2011, 07:06
@Johnmeyer, Didée, Gavino
--------------------------
Thank you all for contributing to this thread. :)
This is all very interesting information for those who are interested in transfering film.
@fpp:
------
You are in Paris, I am in Gent, Belgium. I can transfer one reel for you, to show you the difference :D
One reel only.. My free time is very limited.
Fred.
videoFred
9th May 2011, 07:45
Has anyone actually chekced this out??? :D
Originally Posted by tin3tin
Check out this setup for transfering 8mm with a Canon 5Dmk2:
http://vimeo.com/20950590
Yes, I have. It's very well done. :)
Fred.
@fpp:
------
You are in Paris, I am in Gent, Belgium. I can transfer one reel for you, to show you the difference :D
One reel only.. My free time is very limited.
Fred.
Fred, that's really generous of you (just like John if he hadn't been so far away) ! I imagine someone of your talent must get a lot of requests from "friends" :-)
I will talk with my father and ask him to bring a reel on his next trip over (should be soon). As you say, it would at least prove how badly the job was done, and what could be gained by starting over with a real professional...
I'll keep you posted by MP, thanks much !
BTW, I'm a "Fred", too :-)
@ John & Gavino :
Thanks for the clarifications & the thread on DGPulldown -- I might want to play a bit with that, or the parameters to SelectEvery.
I think I mostly understand what you're telling me, but I still find the result a bit strange. I'm at lunch break right now, but tonight I'll post a couple of screen caps to show you what I mean and see what you think...
videoFred
9th May 2011, 14:16
As you say, it would at least prove how badly the job was done, and what could be gained by starting over with a real professional...
I'm not a professional :)
This film project is my free time project. I do something completely different for a living.
Fred.
I'm not a professional :)
This film project is my free time project. I do something completely different for a living.
Fred.
Yes, that was already clear to me... What I really meant is that this is a field in which some "amateurs" are quite plainly as good or better than most "professionals", so one needs to choose carefully :-)
johnmeyer
9th May 2011, 17:05
... What I really meant is that this is a field in which some "amateurs" are quite plainly as good or better than most "professionals", so one needs to choose carefully :-)Boy is that ever true. I've talked to some of the people who run these local film to video transfer businesses and ask them things like, "do you clean the film?" or "how do you monitor and change exposure during the transfer," and I get no answer, bad answers, or just blank stares.
@ John & Gavino :
Thanks for the clarifications & the thread on DGPulldown -- I might want to play a bit with that, or the parameters to SelectEvery.
I think I mostly understand what you're telling me, but I still find the result a bit strange. I'm at lunch break right now, but tonight I'll post a couple of screen caps to show you what I mean and see what you think...
Okay, so here is how it looks with SelectEvery(4,0,2).
Most of the time I get three consecutive "clean" frames like this one :
http://dl.dropbox.com/u/10354034/Super8/28.jpg
and then two others like this one :
http://dl.dropbox.com/u/10354034/Super8/30.jpg
Is this the norm ? I feel the resulting clip is not as nice as the fast-running, uncorrected version.
I'm encoding it at 19.75 again right now, and will run DGPulldown on it for comparison. Thankfully that one has a command-line interface too, so if it looks better things will stay scriptable :-)
johnmeyer
9th May 2011, 22:27
I'll try once more.
The blending you were seeing in the original transfer was caused by two film frames being projected during the time that one frame of video was captured. These had to be removed. By contrast, what you are seeing now is the standard interlacing "teeth" that are caused by the two fields coming from different moments in time but, when the video is stopped, and you examine both fields at the same time in the freeze frame, you see these herringbone patterns.
So, as I've stated twice now, everything is normal. If you want to post two seconds of this video, I'll look at it and make sure.
Have you actually tried making a test DVD (using a DVD re-writeable) and looking at the result on a TV? That is something you also should always do, and it should give you confidence that your new result looks good.
I'll try once more.
The blending you were seeing in the original transfer was caused by two film frames being projected during the time that one frame of video was captured. These had to be removed. By contrast, what you are seeing now is the standard interlacing "teeth" that are caused by the two fields coming from different moments in time but, when the video is stopped, and you examine both fields at the same time in the freeze frame, you see these herringbone patters. So, as I've stated twice now, everything is normal. If you want to post two seconds of this video, I'll look at it and make sure.
Thanks, but I don't want your patience to wear any thinner... if you say it's OK, then it's OK :-)
Have you actually tried making a test DVD (using a DVD re-writeable) and looking at the result on a TV? That is something you also should always do, and it should give you confidence that your new result looks good.
Not yet, but you're right, I intend to. I need to encode some more material from different scenes and burn it to disc, so I can see it like other people will (I never watch TVs, myself :-).
Okay - while "LOTS of money" is made behind the scenes via PM:p;), I'll continue publicly ...
Oh, that probably means you didn't use SRestore like it should in this case here. Above all, to use SRestore you don't start with TFM a/o TDecimate, but with a simple bob filter.
The following script:
mpeg2source("sample_(fpp).d2v")
o=last
o.bob(-.2,.6)
SRestore(frate=20.0)
requestlinear()
rest=last
calm = rest.temporalsoften(1,255,255,32,2).merge(rest,0.25)#.repair(rest,1).removegrain(11)
calm = calm.temporalsoften(1,255,255,16,2).merge(calm,0.25)
LOP = calm.bicubicresize(180,144).bicubicresize(720,576,1,0)
HIP = rest.bicubicresize(180,144).bicubicresize(720,576,1,0)
HIP = mt_makediff(rest,HIP)
mix = LOP.mt_adddiff(HIP,U=2,V=2)
sup1=rest.msuper(levels=1)
sup2=mix.removegrain(11).msuper()
bv2=sup2.manalyse(isb=true, delta=2,blksize=16,overlap=8,DCT=5)
bv1=sup2.manalyse(isb=true, delta=1,blksize=16,overlap=8,DCT=5)
fv1=sup2.manalyse(isb=false,delta=1,blksize=16,overlap=8,DCT=5)
fv2=sup2.manalyse(isb=false,delta=2,blksize=16,overlap=8,DCT=5)
rest.mdegrain2(sup1,bv1,fv1,bv2,fv2,thSAD=640)
produced the following result: <KLICK> (http://www.mediafire.com/?7hm4cn80y2k82ra) (MediaFire, ~10MB)
Script made up in five minutes (between mowing the lawn and watering the hedgerow). Surely not perfect, but seems like a good start.
BTW, I didn't use DCT=1 because I didn't have the time for that (DCT=1 is very slow with blocksize=8, and pretty much unusably-slow with other blocksizes). Hence, I did a manual flicker-removal for MVTools' search clip. Runs much faster.
Which part of the script is the manual flicker-removal? Is it the lines I've marked in red? I'd like to try it in a different situation where I've needed to use DCT=1 to get satisfactory results.
Hi all, everyone asleep ? :-)
Here is a question for recent contributors (John, Dirée, Gavino...) and especially for Fred (this is "his" topic after all :-)...
You have all been wonderfully helpful and patient with my barging into this topic in total ignorance, and helping me out with a problem that is related to Fred's original subject , but quite different in practice.
Now I would like to give back to this great community, and sum up all I've had explained to me or found using those clues, into something like a (hopefully) comprehensive "Howto"... just in case another newbie comes along some day, with exactly the same goal that I had : salvaging a botched transfer with only a DVD to work from :-)
The question is simply this : do I write this up right here, which would mean keeping everything "8mm related" in one place, but also more highjacking of Fred's topic, taking it further from its real intent ? Or would it be better to create a separate topic, linking back to this one in the introduction ?
I subscribed to Doom9 specifically to participate in this one topic, so I don't know how these things are done here -- or even *if* there is an agreed-upon way to do them :-)
Thanks for your opinions,
fp
Edit : PS - something fun and on-topic that came through my RSS feeds :
http://www.peaceman.de/blog/index.php/lego-technic-super-8-movie-projector
:-)
videoFred
17th May 2011, 16:00
The question is simply this : do I write this up right here, which would mean keeping everything "8mm related" in one place
I suggest to start a new thread because this one becomes pretty heavy. Then I will place a link in the first post of this thread. You can do the same in your thread. This way, people with 8mm transfers on VHS will not have to search this entire thread. And people with frame-to frame transfers will find their way to my thread. :)
Fred.
Sounds good, will do !
Thanks,
Fred
amendegw
28th May 2011, 17:57
All,
I'm a real newbie with AviSynth, so this might be a stupid question (on the other hand, that might make the answer easy).
In another forum, Johnmeyer referred me to the following script (authored by Didee, I believe). I made minor mods to fit my directory structure.
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\MVTools\mvtools2.dll")
import("c:\Program Files (x86)\AviSynth 2.5\plugins\srestore.avs")
avisource("C:\Users\Jerry\Documents\Vegas Projects\Testing\WhiteSands\WhiteSands.avi").ConvertToYV12(interlaced=true)
o=last
o.bob(-.2,.6)
SRestore(frate=17.36)
requestlinear()
rest=last
calm = rest.temporalsoften(1,255,255,32,2).merge(rest,0.25)#.repair(rest,1).removegrain(11)
calm = calm.temporalsoften(1,255,255,16,2).merge(calm,0.25)
LOP = calm.bicubicresize(180,144).bicubicresize(720,480,1,0)
HIP = rest.bicubicresize(180,144).bicubicresize(720,480,1,0)
HIP = mt_makediff(rest,HIP)
mix = LOP.mt_adddiff(HIP,U=2,V=2)
sup1=rest.msuper(levels=1)
sup2=mix.removegrain(11).msuper()
bv2=sup2.manalyse(isb=true, delta=2,blksize=16,overlap=8,DCT=5)
bv1=sup2.manalyse(isb=true, delta=1,blksize=16,overlap=8,DCT=5)
fv1=sup2.manalyse(isb=false,delta=1,blksize=16,overlap=8,DCT=5)
fv2=sup2.manalyse(isb=false,delta=2,blksize=16,overlap=8,DCT=5)
rest.mdegrain2(sup1,bv1,fv1,bv2,fv2,thSAD=640)
Since I'm starting from nearly ground zero with AviSynth, I've found that I've had to install numerous additional plugins & windows\system32 dll's to get the script to execute.
Now, I'm stuck now with the following error:
http://dl.dropbox.com/u/20447760/AviSynth-FFTW3-Error.png
I've found, downloaded & placed fftw3.dll in my windows/system32 folder, but there still seems to be a problem.
Here's my AviSynth plugin folder:
http://dl.dropbox.com/u/20447760/AviSynth-Plugins.png
I've spent about a hour with Google to no avail. Can anyone here help me out?
...Jerry
Didée
28th May 2011, 18:14
If you're on a 64-bit version of Win-7 (or Vista), you have to put fftw3.dll in the "windows/SysWow64" folder.
And you should *not* have *both* versions of mt_masktools in your Avisynth folder. Only the ..-25.dll if you're using Avisynth 2.5.x, or only ..-26.dll if you're using Avisynth 2.6.
amendegw
28th May 2011, 18:43
If you're on a 64-bit version of Win-7 (or Vista), you have to put fftw3.dll in the "windows/SysWow64" folder.
And you should *not* have *both* versions of mt_masktools in your Avisynth folder. Only the ..-25.dll if you're using Avisynth 2.5.x, or only ..-26.dll if you're using Avisynth 2.6.
Wunderbar! That fixed it. I'm now down to the last line of the script and get "Script error: there is no function named "mdegrain2" C:\Users\Jerry\Documents\Vegas
Projects\Testing\WhiteSands\deflicker.avs, line 29﴿"
...Jerry
Didée
28th May 2011, 19:06
That's strange. Mdegrain2 is part of MVTools2.dll, and your script is correctly importing that dll. Are you using a recent version of the dll, from avisynth.org.ru (http://avisynth.org.ru/mvtools/mvtools2.html)?
Uh, that server doesn't answer right now. What's the file date of your mvtools2.dll?
Edit: Here's a mirror of Fizick's latest MVTools2: v2.5.11.2 (http://www.mediafire.com/?35o8i667h62xdnt) - (unalterd original ZIP package)
amendegw
28th May 2011, 19:44
Yeah, when I couldn't connect to avisynth.org.ru I got downloaded mvtools2 elsewhere. Unfortunately, in the throws of gathering all the plugins I needed, I forget the source site. Here's some screen prints that might help:
http://dl.dropbox.com/u/20447760/mvtools2-details.png
http://dl.dropbox.com/u/20447760/mvtools2-details2.png
If the solution isn't immediately apparent, I'll wait 'til avisynth.org.ru gets back online and download from there.
Thanks so much for your help. Once I get your script working, I'll report back with the results.
...Jerry
Hi folks,
I am *really* pleased -- and relieved -- to announce that I have just finished burning the first DVD of my "salvaging the botched transfer of Dad's Super 8 reels" project :-)
It has been just a bit over three weeks since my initial plea for help in this forum (5/5), which is a good deal less than I feared !
Actually, the relevant part (getting the AVIsynth script right, and re-encoding the source) was over on May 19th : the authoring took me a lot longer than I expected, because my previous experience was mostly with DV tape source, and did not serve me well with this new material. I had to find and learn new tools, like for encoding sound from external sources.
But all's well that ends well, and this is of course 100% thanks to the knowledgeable (and patient !) people in this thread, who put up with my silly questions and kept me busy with hints, code, explanations and support for all that time.
To John, Didée, Fred, Gavino & all the others, again, a thousand thanks !
Now that I've met this milestone, and have at least the first disk in stock for my father's birthday, I'm going to take a little break, hoping the second one will go much smoother... and meanwhile, work on keeping my promise : documenting the entire adventure in a specific thread, before it all slips out of my mind :-)
Here's to AVIsynth, Doom9 and its resident wizards,
Fred
In preparation for the new topic I needed some "before/after" video examples. To avoid readers having to download them I put them online on Vimeo, so you can look at them in the meantime :
http://vimeo.com/24361245 is the original clip from the DVD. It's the same scene I posted in my first message, only about 50% longer.
http://vimeo.com/24361560 is the result of my bespoke Avisynth script, that went on the new DVD I made for my father.
http://vimeo.com/24690815 is a side-by-side, before/after comparison -- added as suggested by John in the post below.
The clip on the left side is not *exactly* the same as the original above (in fact it is a bit better), but it still gets the message across :-)
johnmeyer
28th May 2011, 23:22
Great before/after comparison. If your editing software permits it, it is sometimes useful to do a split screen, either like VideoFred did in the Vimeo post in the first post in this thread, or else by showing the scene only once, but with the left side showing the "before" and the right side showing "after." This makes it much easier to get across the amazing difference between the original and the improved versions.
I look forward to reading which things you ended up doing. It looks like you did the excellent Didée flicker reduction, but may also have done a little color correction as well.
I am not at my main computer right now, and that computer has a properly calibrated monitor. On my laptop, however, your "after" shot still looks like it has too much contrast. If this is because of my uncalibrated monitor, then ignore the following suggestion. However, if others also think it is too contrasty, you might want to consider using one of several plugins and/or AVISynth functions to remedy that. These remedies have been discussed in earlier posts in this thread, and some are incorporated into VideoFred's script.
So, great job. I'm sure your dad must be thrilled!! I did this for my dad many years ago. He is gone now, but long before he died, he watched them all and I set up a microphone and recorded what he had to say about each scene. I then re-burned the DVDs, but with his audio track added. This may or may not be important for you, but I thought I'd mention it just in case you hadn't thought of it. I learned an amazing amount about each scene in each movie that neither I nor the rest of my family would have otherwise have known.
amendegw
29th May 2011, 00:46
Okay, I've got this script working thanks to Didée's reference to an MVtools2 mirror site.
Publicly, I'd like to say "thanks" to Didée and johnmeyer. This script is quite amazing!
Click here (http://www.jazzythedog.com/testing/whitesands.html) for my test. (I also did some color correction in Sony Vegas).
...Jerry
PS: I also learned I'm going to have to do a re-capture - some focus problems, etc. This was amateur 16mm color video captured in 1949!!!
PPS: I'm the kid with my Mom. Dad rolls down the sand dune - 62 years ago!
johnmeyer
29th May 2011, 02:44
This was amateur 16mm color video captured in 1949!!!Probably color film, not video.
amendegw
29th May 2011, 09:49
Probably color film, not video.Correct! I just had senior moment. Now a color "video" in 1949 would really be something.
...Jerry
Great before/after comparison. If your editing software permits it, it is sometimes useful to do a split screen, either like VideoFred did in the Vimeo post in the first post in this thread, or else by showing the scene only once, but with the left side showing the "before" and the right side showing "after." This makes it much easier to get across the amazing difference between the original and the improved versions.
Thanks for the compliment. Of course you know you played no small part in the achievement :-)
And you know what ? The split scene idea occurred to me just as I finished uploading the two separate clips... but it was a bit late at night to act upon it. I gave it a try this morning, thinking it would be child's play with Avisynth, but I hit a snag: the original is standard 25fps interlaced mpeg from DVD, while the processed clip is progressive, 19.75fps with pulldown. When I encode them side-to-side I get good synchronisation between the two, but whatever I try, the right one (processed) is much degraded with combed frames that are not supposed to be there... I'm a bit stumped about that.
I look forward to reading which things you ended up doing. It looks like you did the excellent Didée flicker reduction, but may also have done a little color correction as well.
Oh yes, I invented nothing, it's just a patchwork of various recipes from you guys, with due credit... The main issues were finding out what worked on such a bad source and what didn't, keeping the encoding time to something reasonable (about 10 for 1)... and knowing when to stop :-)
There are so many possibilities that one can spend ages trying them all out, tweaking this and that... and I didn't have forever. Besides, all this will probably have to be redone at some point, so it wasn't worthwhile.
I am not at my main computer right now, and that computer has a properly calibrated monitor. On my laptop, however, your "after" shot still looks like it has too much contrast. If this is because of my uncalibrated monitor, then ignore the following suggestion. However, if others also think it is too contrasty, you might want to consider using one of several plugins and/or AVISynth functions to remedy that. These remedies have been discussed in earlier posts in this thread, and some are incorporated into VideoFred's script.
Do tell me what you think when you get a chance to see it on the right monitor. This sounds like something I could add easily to the next batch, without increasing encoding time, but I don't have the trained eye and experience to evaluate it myself...
So, great job. I'm sure your dad must be thrilled!!
Thanks again. Well, he is thrilled... in anticipation, as his bday is later in June :-)
Actually they dropped by a fortnight ago on the return leg of a trip, and I showed him a few of the individual clips I'd just encoded. He was amazed at the difference, and much comforted. What he'll get with the full DVD is the authoring : menus, clips cut & reordered for a better narrative, title screens and relevant sound tracks...
(I forgot to say that the original transfer, adding insult to injury, had unbearable elevator music muxed in :-).
I did this for my dad many years ago. He is gone now, but long before he died, he watched them all and I set up a microphone and recorded what he had to say about each scene. I then re-burned the DVDs, but with his audio track added. This may or may not be important for you, but I thought I'd mention it just in case you hadn't thought of it. I learned an amazing amount about each scene in each movie that neither I nor the rest of my family would have otherwise have known.
What an amazing notion, it would never have occurred to me, thanks ! I will ask him if he'd like to do that, although sadly his memory is not what it used to be : when I questioned him about certain scenes while authoring, his answers were sometimes uncertain. But the value lies elsewhere, I guess...
johnmeyer
30th May 2011, 01:53
.. What an amazing notion, it would never have occurred to me, thanks ! I will ask him if he'd like to do that,I have posted many short clips of my film transfers. In most cases I stripped out my dad's narration, but FWIW, here is a short clip that includes him talking. You can decide if this sort of thing would be appropriate.
Oak Park and Chicago 1930 (http://www.youtube.com/watch?v=d2dcV7hUOJA&feature=channel_video_title)
I have posted many short clips of my film transfers. In most cases I stripped out my dad's narration, but FWIW, here is a short clip that includes him talking. You can decide if this sort of thing would be appropriate.
Oak Park and Chicago 1930 (http://www.youtube.com/watch?v=d2dcV7hUOJA&feature=channel_video_title)
Thanks John, I'll listen to that tonight.
I'm also "upping" my current question in the post above, which maybe got lost in the noise :
Anyone knows how I could create a side-by-side display of two clips, one a standard 25fps interlaced mpeg from DVD, and the other a progressive .m2v with 19.75/25 pulldown, without degrading the latter ?...
Well, that was enlightening. Beforehand I had trouble envisioning an off-voice monologue along the reel, but it turns out it's more like a conversation, with you and another person commenting and prompting him when he falters, and it's actually quite lively and authentic. Thanks for the idea !
And of course, I don't know how good the film was to begin with, but the quality of the picture you got out of it is unbelievable for something that ancient. "Chapeau" ! :-)
johnmeyer
31st May 2011, 18:54
De rien.
I suggest to start a new thread because this one becomes pretty heavy. Then I will place a link in the first post of this thread. You can do the same in your thread. This way, people with 8mm transfers on VHS will not have to search this entire thread. And people with frame-to frame transfers will find their way to my thread. :)
Fred.
As promised, the new topic is online :
http://forum.doom9.org/showthread.php?t=161493
I tried to cram a lot of stuff inside, and may have gone a bit overboard.
Comments & suggestions welcome :-)
Hello !
Those scripts are really amazing !
What can I expect from a capture I made with a DV camera (shutter speed 1/50 s, the movie being played around 16,6 fps) ?
What should be added to the script ? (deinterlace, duplicate frame remover or something )
Aymeric,
Maybe this is a little bit late, but probably some of the notions explained in my new topic (see previous post) could be adapted to your case...
I finally gathered back some common sense and succeeded in making a side-by-side, before/after comparison, as suggested earlier by John:
http://vimeo.com/24690815
clive18
7th July 2011, 20:42
Hi.
I have been making nice progress with the script, thanks very much for this magical software.
My difficulty has come from the fact that some of my captures were done in 16:9 (wide screen) and some in "regular" 4:3 aspect ratio. After the script has run , I cannot get the wide screen captures to play in a wide format, so everyone looks thinner than they should be :)
The settings I am wondering about are on this line:
"W=720 H=576 #final size from the returned clip"
I was thinking maybe I need to change these setting for wide screen, but I am not sure.
Also what would one change these settings to if one were to capture in HD? 1920 X 1080 ? (planning for the future..:)
Any comments are welcome, and I appologise if this is a video newbie question.
regards
Clive
videoFred
8th July 2011, 06:24
The settings I am wondering about are on this line:
"W=720 H=576 #final size from the returned clip"
I was thinking maybe I need to change these setting for wide screen, but I am not sure.
Why do you not try it?
Fred.
Pieter8mm
8th July 2011, 19:38
Originally Posted by clive18
My difficulty has come from the fact that some of my captures were done in 16:9 (wide screen) and some in "regular" 4:3 aspect ratio. After the script has run , I cannot get the wide screen captures to play in a wide format, so everyone looks thinner than they should be
I got very nice footage to 16x9 with this script from Robert Martens. See his tutorial on;
http://www.gyroshot.com/simpleslug.htm
2Bdecided
8th July 2011, 21:46
The settings I am wondering about are on this line:
"W=720 H=576 #final size from the returned clip"For "PAL" DVD, all content is 720x576 (704x576, or, rarely, some lower resolution version). Whether it's displayed as 16x9 or 4x3 depends on a flag in the encoding, not the number of pixels - you must set the flag in your MPEG encoder (or hack it after encoding) - AVIsynth cannot set the flag in the AVI file because there is none to set.
For web use, it's usual to render square pixels - e.g. 768x576 for 4x3, 1024x576 for 16x9. The "NTSC" frame sizes are more usual on the web - e.g. 640x480 for 4x3 and 640x360 or something like 856x480 for 16x9. It's quite common to upscale to 1280x720 for YouTube to make it deliver higher quality, even if the original isn't HD.
Cheers,
David.
mathmax
14th July 2011, 13:53
I always have a problem with this script. Some frames are badly processed... colors are suddenly very dark. Please look:
http://img843.imageshack.us/img843/5847/0000pfj.jpg
http://img232.imageshack.us/img232/8166/0001ng.jpg
What is that problem?
johnmeyer
14th July 2011, 17:05
Make sure you crop the black borders before you feed the video to the script.
mathmax
14th July 2011, 20:28
indeed, I added the black borders before I applied the script. Does that cause the problem?
johnmeyer
14th July 2011, 21:10
indeed, I added the black borders before I applied the script. Does that cause the problem?
VideoFred may have to reply to this. It has been over a year since I posted all my suggestions and updates to his script, and I am now forgetting some of the things I found back then.
You will find that he temporarily adds a border before doing the Autolevels in order to "soften" (his words) the effect. I seem to remember that I played around with that quite a bit and ended up with something similar to what you posted, namely that a frame would suddenly go very dark, and then, a few frames later, the levels would "pop" back up to normal again.
I was initially using the script on 8mm film which is almost exactly square. Because of this, you end up with pillar borders when you capture and edit using a 4:3 aspect ratio. These pillars resulted in very bad things happening with the Depan motion stabilization, so I modified his script to permit you to remove them before submitting the video to the script, and then adding them back in as the last step. That solved the Depan problems, and seemed to make everything else in the script "happier."
If you look at my version of the script, posted in one of my first responses in this thread, and you'll see how I did that.
mathmax
14th July 2011, 21:23
VideoFred may have to reply to this. It has been over a year since I posted all my suggestions and updates to his script, and I am now forgetting some of the things I found back then.
You will find that he temporarily adds a border before doing the Autolevels in order to "soften" (his words) the effect. I seem to remember that I played around with that quite a bit and ended up with something similar to what you posted, namely that a frame would suddenly go very dark, and then, a few frames later, the levels would "pop" back up to normal again.
I was initially using the script on 8mm film which is almost exactly square. Because of this, you end up with pillar borders when you capture and edit using a 4:3 aspect ratio. These pillars resulted in very bad things happening with the Depan motion stabilization, so I modified his script to permit you to remove them before submitting the video to the script, and then adding them back in as the last step. That solved the Depan problems, and seemed to make everything else in the script "happier."
If you look at my version of the script, posted in one of my first responses in this thread, and you'll see how I did that.
In fact, I have the same problem with MDegrain2() or MVDegrainMulti() isolated in a script.. the error seem to come from these functions...
videoFred
15th July 2011, 06:42
You will find that he temporarily adds a border before doing the Autolevels in order to "soften" (his words) the effect.
Yes, I did this because the original Autolevels was far from perfect. Frustum has tracked a colorspace bug in this filter and he has fixed this. His modified version of Autolevels is working pretty good now. He has added lots of new parameters also. The autolevels effect can now be limited with output_high and output_low. So there is no reason anymore now to add borders before processing.
I have my new scripts ready, the are all using the modified autolevels filter. I have also improved the stabilizing and the sharpening. And I have made a new helpfile.
Upload is coming soon :)
Fred.
mathmax
15th July 2011, 14:21
Yes, I did this because the original Autolevels was far from perfect. Frustum has tracked a colorspace bug in this filter and he has fixed this. His modified version of Autolevels is working pretty good now. He has added lots of new parameters also. The autolevels effect can now be limited with output_high and output_low. So there is no reason anymore now to add borders before processing.
I have my new scripts ready, the are all using the modified autolevels filter. I have also improved the stabilizing and the sharpening. And I have made a new helpfile.
Upload is coming soon :)
Fred.
videoFred, your script is very nice.. but unfortunatly I always have the error I mentioned before on some frames when I use it.. Any idea of the problem?
videoFred
16th July 2011, 15:20
videoFred, your script is very nice.. but unfortunatly I always have the error I mentioned before on some frames when I use it.. Any idea of the problem?
No, I have no idea. Never have seen this kind of error before. You are using my script on video, right? It's not made for this... There are other solutions for video.
Fred.
mathmax
16th July 2011, 17:33
No, I have no idea. Never have seen this kind of error before. You are using my script on video, right? It's not made for this... There are other solutions for video.
Fred.
well.. no matter the source. I always get this error when I perform the script. I'm pretty sure it comes from MVAnalyseMulti() cause I got the same kind of error on scripts containing that function
Maybe it's a problem with the DLL.. is that function part of mvtools 2?
videoFred
16th July 2011, 19:34
Maybe it's a problem with the DLL.. is that function part of mvtools 2?
No, MVTools2 is from Fizick and it's used in the script for the interpolation only.
MVAnalyseMulti() is part of -guess what- :) MVToolsMulti. MVToolsMulti is a modified version of the original MVTools. The dll is named MVTools.dll. Perhaps it would be better to rename it to MVToolsMulti.dll.
But there are several MVToolsMulti dll files, optimised for different computer systems. I just took the one that was working on all my computers. XP and Vista, I have not checked the script on Win7 yet.
Anyhow, you will find all these versions in the 'Source' directory of the package. Perhaps another dll will solve your problem. Be careful because they all have the same name: MVTools.dll.
Fred.
mathmax
16th July 2011, 19:46
No, MVTools2 is from Fizick and it's used in the script for the interpolation only.
MVAnalyseMulti() is part of -guess what- :) MVToolsMulti. MVToolsMulti is a modified version of the original MVTools. The dll is named MVTools.dll. Perhaps it would be better to rename it to MVToolsMulti.dll.
But there are several MVToolsMulti dll files, optimised for different computer systems. I just took the one that was working on all my computers. XP and Vista, I have not checked the script on Win7 yet.
Anyhow, you will find all these versions in the 'Source' directory of the package. Perhaps another dll will solve your problem. Be careful because they all have the same name: MVTools.dll.
Fred.
Indeed I didn't have this problem when working in XP. I'm on win 7 now. My processor is a core i5 but I removed the call to SetMTMode() to process the script on a single thread.. maybe that causes a problem.
The dll are all from 2008.. aren't there new version? Which one do you think I should use?
videoFred
17th July 2011, 10:29
The dll are all from 2008.. aren't there new version? Which one do you think I should use?
I do not know. Try them all :p
MVToolsMulti() is from Josey_Wells and you will find it in the MVTools thread around page 50. As far as I know there are no newer versions.
Fred.
clive18
16th August 2011, 23:24
Thanks Pieter8mm and 2Bdecided for your feedback regarding my widescreen capture. Its a bit strange that wide screen SD is the same resolution as 4:3 in SD. The pixels are actually rectangular, giving it the extra width.
I have decided to recapture in normal 4:3 aspect ratio as I now realise that by capturing in widescreen I have effectively reduced the number of vertical pixel resolution by 30%.
Thanks again
regards
Clive
stoffal
21st August 2011, 11:28
I am playing around with the 8mm script for some months now. It is AMAZING how many details and image quality it provides on my 50 years old material (I have never seen my grandpa that sharp! ;-)
I am wondering what codec you all use to output the processed video? Uncompressed? A special Photo-JPG? Xvid H264?
Like many of you, I am first processing the script and then edit the videos into one final movie in Premiere or FinalCut. So: What is your prefered codec to output 8mm from Fred's script?
fpp
21st August 2011, 12:44
All I know is that VideoFred's homemade machine outputs 1024 x 768 AVI, using the huffyuv codec :
http://neuron2.net/www.math.berkeley.edu/benrg/huffyuv.html
I am guessing his Avisynth scripts output to the same format to avoid losing quality in the editing step.
After that the result can be encoded according to whichever media you want : DVD, AVCHD, etc.
videoFred
21st August 2011, 17:03
Hello all,
I have done many tests, lately.
But let's begin with the codec issue. The output from my machine vision camera is 1024x768 BY8. This is an uncompressed, not debayered format. The debayering is done on the fly by the capturing software. Then, I can select a codec for saving the files. On my old 34bits XP machine, I was using Huffyuv for this. But now I have a new 8-core 64 bits machine and Huffyuv is not working on this machine. But I have plenty of HD space, so I capture in uncompressed RGB for now.
Now, about Avisynth:
---------------------------
The output of an Avisynth script is always uncompressed, no matter the input. The color space is the one we have specified in the script. The output of my filmscript is uncompressed YV12. This is what VDub will save in direct stream modus.
About resolution and aspect ratio:
----------------------------------------
I just got myself a new Sony Bravia TV. Full HD, 40".
Guess what: there's no need for software upscaling, the TV takes care of that.
It looks like the internal hardware upscaling is very good on these new flatscreens.
I can play standard 720x576 PAL files on my TV in full 1080p, with very good quality.
Those files are relative small in size and they can be streamed straight from my PC to my TV.
The TV is connected to the home network.(wifi). Great for testing purposes, no more DVD burning.
I had to install PS3 Media Server on my PC, this tool makes the files suitable for streaming.
Of cource everything is 16:9 these days. Film was 4:3. 720x576 is not exactly 4:3 so 768x576 is better.
We can do two things: adding borders left and right (pillarbox), or cropping to 16:9.
768x576 cropped to 16:9 is 768x432.
Those 768x432 files are playing fine in full 1080p HD on the Sony flatscreen.
I have done some tests with true 720p (1280x720) files and the difference is minor.
About frame rates:
----------------------
Regular-8 was captured in 16fps, Super-8 in 18fps.
Standard frame rates for HD are 25, 50 and 60fps.
Scenes with fast moving objects can be converted to 25fps with frame blending.
But if you like smooth panning and zooming, frame interpolation is the way to go.
Super-smooth playing can be archieved by frame interpolation from 16 or 18 to 50fps.
Many greetings from a sunny Belgium, :cool:
Fred.
fpp
21st August 2011, 20:24
Thanks for the (many) corrections Fred, I was way off-base :-)
Good news about the new TV ! I also have a 40" Sony, I must also try the upscaling on it.
Greetings from sunny (for once) Paris :-)
johnmeyer
22nd August 2011, 01:29
I agree with all of VideoFred's comments and suggestions posted above, but I would like to propose an alternative to the frame blending or frame interpolation.
The first alternative is to do nothing. Save the file at 16, 18, or (for sound film) 24 fps. Then, play this file back directly on the big screen TV. My TV lets me plug in a thumb drive and play most video files directly from that.
The second alternative is to add hard pulldown by duplicating fields using a simple script something like this (if you are making an NTSC DVD):
assumefps(18)
changefps(59.94)
separatefields()
selectevery(4,0,3)
weave()
I do like the smoother playback you can get from frame blending or frame interpolation that VideoFred recommends, but I do not like the fact that you introduce some level of distortion. Blended frames are fuzzy, and interpolated frames (using MVTools2) can be distorted. Yes, I understand that the old-fashioned pulldown fields mean that the film will exhibit judder during camera pans, and these pans are unfortunately much more prevalent on amateur film than professionally shot "Hollywood" films. However, that is what film looks like.
This is strictly an "artistic" decision, and each person needs to decide which "look" they prefer. I am posting just so everyone understands what alternatives are available.
[edit]Added "Weave()" at the end of the above script.
Baxich
22nd August 2011, 03:43
Then, I can select a codec for saving the files. On my old 34bits XP machine, I was using Huffyuv for this. But now I have a new 8-core 64 bits machine and Huffyuv is not working on this machine. But I have plenty of HD space, so I capture in uncompressed RGB for now.
There are several lossless options on 64-bit OS's - for example Lagarith (comes in 32 and 64-bit versions in the same package - http://lags.leetcode.net/codec.html) and ffdshow's FFV1 (http://www.free-codecs.com/ffdshow_download.htm - different installation package for 32 or 64-bit versions - you can actually install both).
FFV1 has somewhat better compression than Lagarith (both of these codecs have better compression than Huffyuv), but doesn't work with some apps (and I think is slower), so I combine them - whenever I can I use FFV1, but if incompatibility arrises, I use Lagarith.
videoFred
22nd August 2011, 07:53
The second alternative is to add hard pulldown by duplicating fields using a simple script something like this (if you are making an NTSC DVD):
assumefps(18)
changefps(59.94)
separatefields()
selectevery(4,0,3)
As usual, thank you for your input, John! :)
You have forgotten weave() at the end of your script :p
You are creating interlacing with this script. It might be a good alternative for frame blending. I will test it for sure.
Can you explain some more please? I do not have any experience with separatefields() and selectevery().
And how do I change this to go from 18fps to 25fps PAL?
Fred.
Gargamel
22nd August 2011, 11:09
Hi everybody,
Thank you for all these infos.
About codecs...
Capturing in SD mode, my original clips come out from the cam with the old DVSD codec.
Then, as long as I works using VirtualDub and AviSynth, I remain strictly in uncompressed RGB, till the point where the video is given to my NLE software for editing and burning.
But each capture clip (or some important intermediate video) is archived using the last Lagarith codec, which saves a lot of Gb... and many Gb usually make some Tb in the end...
Try it out a bit, Fred: Lagarith likes 64bit and multicore ;-)
Have a nice day !
videoFred
22nd August 2011, 11:50
Try it out a bit, Fred: Lagarith likes 64bit and multicore ;-)
Ok, I will try it out. Thank you both for the hint, Gargamel and Baxich!
Fred.
videoFred
22nd August 2011, 11:57
Good news about the new TV ! I also have a 40" Sony, I must also try the upscaling on it.
A Bravia, a smart TV? Then you can connect it to your home network, right? Then you realy must try PS3 media server. The Sony can not read to many codecs, only mpeg2 and h264. PS3 media server is transcoding everything (in real time) so the Sony can read it. I can even stream uncompressed RGB and YV12 this way. :)
Fred.
johnmeyer
22nd August 2011, 16:12
As usual, thank you for your input, John! :)
You have forgotten weave() at the end of your script.I edited my script above to add that. I was in a hurry and didn't grab enough of the script. Thanks for catching my error.
Can you explain some more please? I do not have any experience with separatefields() and selectevery().
And how do I change this to go from 18fps to 25fps PAL?
The above script is designed to go from 18 fps to 29.97 interlaced. This permits 18 fps progressive film to be displayed on a standard NTSC interlaced display. The script creates a variant of the traditional "3:2" pulldown which takes 23.976 (nominally 24 fps) and converts it to 29.97 (nominally 30 fps) interlaced. With traditional pulldown, the "fields" of the progressive film are repeated. (Progressive video can be broken down into odd and even fields, despite the fact that there is no temporal difference between those fields as is the case with interlaced video.) Thus, you get the first two fields from the first frame, followed by the two fields from the next frame, but then the first field displayed from the second frame is repeated (that's the "3" in the "3:2"). The two fields from the next frame are then displayed, and so on.
This same conversion could be done by repeating entire frames, but the stutter and judder would be twice as apparent. By repeating fields instead of frames, you end up with half the temporal disruption that you would get by duplicating entire frames.
The 3:2 pulldown is how film has been displayed on NTSC TVs since the beginning of time.
For PAL, 24 fps film is often just broadcast as is, resulting in slightly fast playback. No pulldown is done. However, for 18, 16, and slower film (a lot of my old film transfers from the 1920s and 1930s need to be played back even slower than 16 fps, probably because the cameras were still sometimes hand-cranked in those days) you have to add pulldown for PAL playback. This pulldown is done by repeating fields.
You can search these forums and find various scripts I've posted, mostly for adding pulldown to go from 18 fps progressive to 29.97 interlaced. However, many years ago, someone told me I was being rather thick and that I could use a much more generic script that would handle adding pulldown from any starting frame rate, and go to any desired final interlaced frame rate (including PAL 25 fps interlaced, i.e., 50i). The only things you need to change are:
1. Change the AssumeFPS in the first line of the above script to match your film frame rate (18 fps in the script example).
2. Alter the ChangeFPS to double the final frame rate (so that would be 50 for PAL instead of 59.94).
Here's a link to a very short, but useful, discussion about this from quite a number of years ago:
Telecine (http://forum.doom9.org/showthread.php?p=445906#post445906)
Hope that helps!
videoFred
22nd August 2011, 16:35
Here's a link to a very short, but useful, discussion about this from quite a number of years ago:
Telecine (http://forum.doom9.org/showthread.php?p=445906#post445906)
Hope that helps!
It sure helps, thank you John!
Fred.
bizz & buzz
24th September 2011, 23:10
This script does wonders! but I noticed that scene-changes remain dirty and not being cleaned... is there a way to fix it?
bizz & buzz
26th September 2011, 15:39
Please, any help will be much apperciated
videoFred
26th September 2011, 15:55
Because the denoiser is averaging several frames, it takes a few frames at scene change before it works like it should be. There's nothing we can do about that, you will have to cut a few frames at scene change manually. (after running the script).
Fred.
johnmeyer
26th September 2011, 18:21
The other alternative is to denoise each scene individually. This is what I do on critical film scenes. I also adjust the script parameter for each scene. One issue for any sort of denoising is that that is no "one size fits all" script, and even a great script like this one requires that the settings be tuned for the specific problems in each scene.
videoFred
27th September 2011, 06:27
The other alternative is to denoise each scene individually. This is what I do on critical film scenes. I also adjust the script parameter for each scene.
Yes, this is the only good way to do a realy perfect job. This is one of the reasons why I capture scenes, never an entire reel in one shot. So at the end of a capture session, I have reel#1.01.avi, reel#1.02.avi etc... Scriptwriter is a great help here, it creates one script for every scene. Then it's easy to tweak the parameters for every individual file. Then I run all the scripts in a VDub jobfile.
But if a filmreel contains not to many different scenes, you can get away with one setting for the entire reel.
Fred.
joka
27th September 2011, 16:10
bizz & buzz
I have tested the script some time ago and found also, that the last frame before and the first frame after a scene change is not cleaned (no dirt remomal). IIRC the RemoveDirt function do not care about scene changes.
bizz & buzz
27th September 2011, 22:13
Thanks for your comments guys.
Came across a little suggestion by Didée, (see the MC version HERE (http://forum.doom9.org/showthread.php?p=1206869#post1206869)), that did a great job.
LoadPlugin("RemoveDirt.dll") # v0.9 of RemoveDirt
LoadPlugin("MVTools.dll") # There're plenty of incompatible-to-each-other versions currently.
# v1.10.2.1 would be good for this little script here
source = last # whatever you have
prev = source.MVCompensate(source.MVanalyse(isb=false,blksize=16,overlap=8,idx=8),idx=8)
next = source.MVCompensate(source.MVanalyse(isb=true, blksize=16,overlap=8,idx=8),idx=8)
source.SCSelect(next,prev,source,dfactor=2.0)
Sure there are sometimes MC artifacts, but they are unnoticeable in normal playback speed.
Perhaps it will be a good idea to implement this as an option in VideoFred's script.
Thanks again :)
fpp
6th October 2011, 21:08
A Bravia, a smart TV? Then you can connect it to your home network, right? Then you realy must try PS3 media server. The Sony can not read to many codecs, only mpeg2 and h264. PS3 media server is transcoding everything (in real time) so the Sony can read it. I can even stream uncompressed RGB and YV12 this way. :)
Yes, a KDL40EX500. I did some tests for fun initially on Ethernet (the previous TV was a 12-year old CRT :-).
The inbuilt player is very limited indeed.
I also tried PS3 media server, which works really well... but I didn't like the idea of my PC transcoding stuff while the kids were watching a movie, so in the end I just added a Popcorn Hour A200 to take care of that :-)
It doesn't seem to like your uncompressed files however, so if I want to see the raw transfers on the TV I'll give PS3mp another try, thanks for the tip !
PS: sorry for answering so late, but somehow Doom9 decided to stop sending me notifications for this thread around August 22nd, so I though nothing was happening until I got suspicious and checked back in today...
dodgyknee
19th October 2011, 18:48
Sorry, novice here.
I have been very impressed with the results of this script - but so far this hasn't been possible for me!
I have an avi which is the output of a frame-by-frame scanned standard 8 film but when I plug the file into Fred's script it fails with an avisynth open failure, error code 2, on line 122 with the interpolation script and line 120 with the blending script. I have, honestly spent hours trying to figure this out but I am very stuck!
Can anyone give me a hand with this?
Sandy
videoFred
20th October 2011, 06:38
Sorry, novice here.
Hi Sandy, you are most welcome here. :)
It looks like Avisynth can not open your AVI file.
Line 120 and 122 is where the file is opened.
Please show me a screenshot of the error message.
Or at least give me the full error message.
Fred.
dodgyknee
20th October 2011, 18:56
Thank you very much Fred for the warm welcome, it is much appreciated.
I started typing out the error message for you and this made my mistake obvious! I had missed out part of the file directory (the folder). Having fixed this, I then was presented with another error which I have also sorted by installing yuvcodecs.exe.
The film is being restored now (slowly) but I'm not not sure what to do when it ends but I'll need to figure that out later.
This is really great Fred!
Sandy
mammo1789
26th October 2011, 03:04
Thanks Fred for the wonderful package. After I run you script the result is much sharper ( too much for my taste) and less blurry and stable. I recorded directly trough canon power shot a720 camera in 6400x480 30fps progressive. But the spots and lines ( like black not straight and constant lines are still there) I tough the script should solve that. Another question is how to see only the final video when encoding and not the original result ( and on the result part there is text describing the usage of auto levels and so on) I know that I should delete something from the script but I don't know what
Thanks
videoFred
26th October 2011, 06:21
Thanks Fred for the wonderful package.
You are welcome. But please read the helpfiles. :)
Fred.
mammo1789
26th October 2011, 16:07
You are welcome. But please read the help files
Thanks Fred I read the files but i still don't understand how to get only one picture. I changed the sharpening and blurring parameters to make it more subtle and i played with the denoising parameters. But if i try to delete some lines ( results lines ) i get script error. Can you just explain me plain simple how to get only the result output as a single picture without the text, I'm not to good in avisynth.
The screen i get is this i would like only the middle.
http://imageshack.us/photo/my-images/683/screenshot001ek.png/
mammo1789
26th October 2011, 16:09
http://http://imageshack.us/f/683/screenshot001ek.png/
johnmeyer
26th October 2011, 17:12
Thanks Fred I read the files but i still don't understand how to get only one picture. Remove the "S" from this line.
result="resultS4" #specify the wanted output here
videoFred
27th October 2011, 06:41
Thank you John. :)
Fred.
Boffee
28th October 2011, 20:49
I am afraid I am also having trouble with Fred's script. It just will not run. I only have a single core processor and hopefully I have edited the script to run it but I get the following error."Avisynth open failure. Evaluate System exception- Illegal Instruction (C:\Users\KEITHW\Documents\Film_Restore\05) Film_Restoring\Script_and Plugins\04_Film_Restoring_Frame_Blending.avs, line 160)"
Can anyone suggest what is wrong? Perhaps I have edited it wrongly. I must admit I am confused as to what lines are mt calls to disable. Can anyone post what Fred's script should look like edited ror single core working?
Pieter8mm
30th October 2011, 15:43
Erase al the SetMode lines. There are 3 of them in the script:
SetMTMode(5) #disable all MT calls if you are using a single core computer
SetMTMode(1,0)
SetMTMode(5)
Good luck ;)
Boffee
30th October 2011, 21:13
Thanks for that, still fails line 160 though. I have no idea how to fix this.
johnmeyer
31st October 2011, 03:27
You could try my version of the script, posted much earlier in this thread. I removed all references to the original MVTools, only using the newer MVTools2. This gets rid entirely of the MVAnalyzeMulti statement (line 160 in your script). However, I also made a lot of other changes, and considerably reduced the amount of sharpening. You are welcome to try it:
johnmeyer version of the script (http://forum.doom9.org/showpost.php?p=1406847&postcount=216)
If this doesn't work, then perhaps your problem with Fred's script lies somewhere else.
Boffee
31st October 2011, 21:31
Brilliant, your version of the script works. Thanks very much John. One thing I notice is I get a strange frosted glass type of effect over the picture for a few frames every time there is a scene change, see scene shot. Any ideas what this could be?
screen shot http://flic.kr/p/aCJY8R
johnmeyer
8th November 2011, 18:45
Brilliant, your version of the script works. Thanks very much John. One thing I notice is I get a strange frosted glass type of effect over the picture for a few frames every time there is a scene change, see scene shot. Any ideas what this could be? This has been discussed earlier in this thread:
Scene Changes (http://forum.doom9.org/showthread.php?p=1528482#post1528482)
The problem is that not all the plugins have scene change detection built in, and even for those that do, there is no practical way to "tune" these for the huge range of scene types one might find in amateur film. If you read the above link and the replies in the posts which immediately follow, you'll find a few suggestions for how to deal with the problem.
Gerry62
9th November 2011, 07:33
Just found a sort of issue that I cannot find a awnser for,
Nowm I want to output 29.970 FPS NTSC, Ok sounds fine, But when I change the:
play_speed=
numerator=
to 29.970 It comes up with the following Error
"The Named Argument 'num' to MFlowFps had the wrong Type"
Now Ive tried all variations of 29, 29.9, 29.97 etc.
Is is there something I'm Doing Wrong?
Oh and what's denumerator= used for? I have no idea what the following means 60000/1001= 59.94fps
Anyone help? Probably stupid questions
Gavino
9th November 2011, 09:34
Gerry, set numerator=30000 and denumerator=1001, since the NTSC frame rate is 30000/1001 (= 29.97 approx).
('denominator' would be the correct English word.)
Jan Evertsen
23rd November 2011, 14:11
First post, so i'll start with a big THANK YOU for all your hard work and useful comments.
Some time ago- March 2011, Pieter8mm wrote something about a script
I found a other script on this site wich I like to share with you all.
http://www.homedvd.nl/Site/avisynth.html
I haven't tried yet. Put the picture example looks nice.
This site is down...
Does anyone have this script and can maybe post it or PM it to me?
I've been working with Fred's script and John's script with great success, but I would like to have a look at this one, too.
Gerry62
23rd November 2011, 19:35
Yeah, what was that script that is now down?
johnmeyer
23rd November 2011, 20:03
All you have to do is go to the root page, and you'll find that it is a Dutch movie transfer site. Here is a link, translated to English, to conform to this board's English-only requirement:
High End Scanning and Digital Restoration (http://translate.google.com/translate?sl=nl&tl=en&js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&u=http%3A%2F%2Fwww.homedvd.nl%2FSite%2F)
Perhaps if you click on some of the links, you can find the script.
[edit] None of the movies on their main page appears to have been restored with anything similar to VideoFred's script, although the actual film transfers are exceptionally good.
Oh, wait, the very last examples DO show restoration, but clearly not using anything resembling VideoFred's approach (no stabilization, for instance, and the chain link fence details have not been enhanced).
Jan Evertsen
23rd November 2011, 22:23
Thanks John.
I am dutch and already searched all pages of this site but the script was nowhere to be found. I still hope that a reader of this forum downloaded the script when Pieter8mm mentioned it.
I agree that the maker of this site clearly uses another script and so I am curious about this one, because I like the results (although a bit more stabilisation would be nice).
Now i have another question. I have a nice clean black&white transfer but it is very grey.
When I use Johns script I can adjust the whites and blacks but the results are a bit unnatural, like the shadows in this baby's face.
Original:
http://img43.imageshack.us/img43/9243/012original.th.jpg (http://imageshack.us/photo/my-images/43/012original.jpg/)
Avisynth output:
http://img821.imageshack.us/img821/171/012autowhite.th.jpg (http://imageshack.us/photo/my-images/821/012autowhite.jpg/)
Does someone have an advice to 'smoothen' this effect?
johnmeyer
24th November 2011, 01:51
I have a nice clean black&white transfer but it is very grey. When I use Johns script I can adjust the whites and blacks but the results are a bit unnatural, like the shadows in this baby's face.
Does someone have an advice to 'smoothen' this effect?
My answer to that is similar to what I've posted before: AVISynth is not necessarily the answer to every problem. In this case, my approach is to do most of the "levels" work inside my editing program (which is Vegas). This program has a "Color Curves" interactive fX which lets me draw a Bezier transfer curve that alters the exposure of the film, but with a different gain applied to each level. Most film to video transfers result in video that is too dark in the shadows, a little dark in the midtones, but just right or a little too bright in the lightest areas. Each scene typically requires slightly different exposure correction. So, I apply a "generic" gamma curve, using this color curve fX, to each scene, and then, using a calibrated monitor and the built-in real-time histogram, I interactively tweak the exposure while watching the instantaneous results on both the monitor and histogram displays.
I do not use any of the automatic levels or color correctors built in to VideoFred's script.
Here's what the color curves dialog looks like, in case my description above doesn't make sense:
https://i.imgur.com/tzTAkPk.jpg
I'm using this exact dialog right at this moment to correct a 1933 amateur 16mm silent film that I'm restoring for a French documentary director.
I wish I knew of some autogain function in AVISynth that would do this, and many people have certainly tried to produce such a thing. One such plugin that I used quite a bit, before I discovered VideoFred's work, was the "High Dynamic Range Automatic Gain Control" plugin. You can search this forum and find the plugin. Try it out, and perhaps it will do what you want, without having to do all the manual labor I describe above. I think it has been updated since I last tried it.
videoFred
24th November 2011, 07:24
Yeah, what was that script that is now down?
It's a clone of my script. Do not worry about it.
Fred.
Jan Evertsen
25th November 2011, 00:41
John, thank you again for your reply.
I tried to adjust levels in another program. So far i am very happy with the results.
I do not use any of the automatic levels or color correctors built in to VideoFred's script.
So i presume you use "Result4", saturation=1 and gamma=1 and set all black levels to 0 and the whites to 255?
Another question about your script: what does the "0.9" do in
sharp1=denoised.sharpen(0.9)
I already had a look at HDRAGC and had some very nice results on color film. But now i'm working on some b&w films, adjusting the levels is a lot faster.
johnmeyer
26th November 2011, 08:04
So i presume you use "Result4", saturation=1 and gamma=1 and set all black levels to 0 and the whites to 255?Yes.
Another question about your script: what does the "0.9" do in
sharp1=denoised.sharpen(0.9)If that is in my version of VideoFred's script, I don't remember it.
videoFred
28th November 2011, 07:26
what does the "0.9" do in
sharp1=denoised.sharpen(0.9)
It's the strenght of the sharpen filter. :D
Fred.
johnmeyer
30th January 2012, 22:48
I thought that readers of this thread might be interested in something I did using not only VideoFred's script, but also using MVTools2 to synthesize frames to replace totally broken frames.
Have a look here at the before/after:
Restoring Jumpy Film (http://www.youtube.com/watch?v=uzMFodrGHDs)
This 8mm film was taken in 1954, and the camera (not the projector) malfunctioned and didn't bring the film to rest before opening the shutter. As a result, not only were the frames jumping up and down, but many of those which jumped were blurred. I verified that this problem was indeed on the film itself, and not a malfunction in my film-to-video transfer equipment.
I went through by hand (thousands of frames) and marked each jump frame. I did this by writing a script in Sony Vegas which let me replace any bad frame with a duplicate of the prior frame. I had to do this by hand because there was no pattern to the bad frames, and the frames which were displaced vertically, but not blurred, could be easily repaired using Deshaker or Mercalli (motion stabilization tools).
I then used a variation of the old AVISynth "filldrops" function software which can detect perfect duplicates and the replace them with interpolated frames using mflowinter
So, on the right-side "after" version of the clip, about 50% of those frames are computer-generated.
I then fed this into VideoFred's script which stabilized and sharpened the result.
Emulgator
31st January 2012, 00:14
Wow, this is awesome work !
Gargamel
31st January 2012, 10:58
+1 !
Congratulations, John, and thank you for sharing that idea.
Your film rescue is really wonderful !
jinkazuya
14th February 2012, 22:18
Just wonder if Fred could reupload the whole thing and tell us what version of the plugins that we could use. Because there are a lot of errors running the script and now we use MEGUI to encode MKV...
Really hope to try the script on the video but encounter a whole bunch of errors. If Fred has time and reorganize the script and even give us the script used for MKV and the plugin versions, it would be great.
Anyway, thanks a lot. Cuz most of the videos I have are of bad quality just wanna rescue them.
johnmeyer
15th February 2012, 00:19
... most of the videos I have are of bad quality just wanna rescue them.Just a quick clarification ...
You keep saying "videos." The script really isn't designed to do anything with video, but is instead oriented towards improving film that has been captured to video using a "frame accurate" film-to-video transfer system.
jinkazuya
15th February 2012, 01:42
Just a quick clarification ...
You keep saying "videos." The script really isn't designed to do anything with video, but is instead oriented towards improving film that has been captured to video using a "frame accurate" film-to-video transfer system.
Yes...I know. But it also help to improve the quality of the video such as movies as well right.
If you ever see something amazing like that, you really don't wanna try it out right away:D
videoFred
15th February 2012, 07:35
Just wonder if Fred could reupload the whole thing and tell us what version of the plugins that we could use. Because there are a lot of errors running the script and now we use MEGUI to encode MKV...
I have 3 XP computers, one Vista and one new 64bits 8-core Win7 machine. The script runs fine on all these machines,without any problems, with the plugins I have uploaded. :sly:
Fred.
jinkazuya
15th February 2012, 08:58
hehehe...don't get wrong :D, I am just afraid of the compatible issues.
I know the script is fine. However, whenever I ran the script, it just gave me a bunch of error message (does not have this filter or errors in certain line of the function).
Anyway, is it possible to use the script for the original ripped DVD VOB.
BTW...Used this with MEGUI to encode MKV.
Also the SetMTMode won't work...I already followed the instruction as described in the help folder, put the dll file of the avisynth into System32 or SysWOW64.
These are the basic inbuilt function of the MEGUI.
LoadPlugin("C:\Users\Desktop\MeGui\tools\dgindex\DGDecode.dll")
DGDecode_mpeg2source("C:\Users\Desktop\Encoded Movies\VIDEO_TS\VTS_01_1.d2v", info=3)
LoadPlugin("C:\Users\Desktop\MeGui\tools\avisynth_plugin\ColorMatrix.dll")
ColorMatrix(hints=true, interlaced=true, threads=0)
videoFred
15th February 2012, 09:24
I know the script is fine. However, whenever I ran the script, it just gave me a bunch of error message (does not have this filter or errors in certain line of the function).
What errors? We will solve them one by one. :p
Also the SetMTMode won't work...I already followed the instruction as described in the help folder, put the dll file of the avisynth into System32 or SysWOW64.
Forget the MT and please remove all MT calls. Instead, run multiple instances of my script if you have a multi core computer. On my 8-core I can easily run 4 instances at the same time.
Fred.
Undead Sega
18th February 2012, 05:42
Hi guys, I know this may seem abit random but still relevant, I thought I would like to share this very simple Flash app that shows the different colour layers from the film 'The Patriot' when reconstructing the faded Yellow layer:
http://www.history.org/foundation/journal/summer04/patrest.swf
Original site is here:
http://www.history.org/foundation/journal/summer04/patriot.cfm
I thought the work was amazing, and I never thought that one could reconstruct or restore a faded layer in film. Tell me what you think, been meaning to mention this kind of topic for ages but didnt know how to do it exactly :)
johnmeyer
19th February 2012, 00:29
Interesting ... but:
1. How did they separate the layers? Is this something to which any of us would have access?
2. Once they have the yellow layer, which appears to have virtually no information, how did they restore it?
[edit]Ah, I just read the second link. They had B&W separation masters. So, I "can't do this at home."
videoFred
19th February 2012, 10:55
Interesting ... but:
1. How did they separate the layers? Is this something to which any of us would have access?
2. Once they have the yellow layer, which appears to have virtually no information, how did they restore it?
[edit]Ah, I just read the second link. They had B&W separation masters. So, I "can't do this at home."
I was asking myself the same questions ;)
However, it might be possible with masktools but this is beyond my knowledge.
Fred.
Undead Sega
20th February 2012, 02:55
I was asking myself the same questions ;)
However, it might be possible with masktools but this is beyond my knowledge.
Fred.
What would be done exactly with MaskTools??? :D
videoFred
20th February 2012, 07:42
What would be done exactly with MaskTools??? :D
Making color masks :p
Fred.
Undead Sega
21st February 2012, 04:43
But wouldnt that be done manually?
johnmeyer
22nd February 2012, 00:19
But wouldnt that be done manually?Yes, if it were possible (and I don't think it is) to create color masks in order to separate layers, it would certainly be a manual process. However, I'm pretty sure this sort of thing is not possible without having access to the three B&W separation prints, something that doesn't usually exist, even for many Hollywood films, and certainly not for anything that any of us ever have access to.
So, it is an interesting restoration story, but unfortunately not one that suggests any technique that we might be able to adapt and use with the tools available for AVISynth.
Abyssal
23rd February 2012, 01:12
Edit:
I have had countless amount of errors but it seems I solved them on my own so a tip - if you get any errors - is to replace the AviSynth.dll file in System32/SysWOW64 (I have 64bit Win7 Ultimate so my old AviSynth.dll file was in SysWOW64 and NOT in System32) with the other one. Personally I forgot this but I didn't find it at first either since it wasn't supplied with the .zip file but the one you need is supplied with the MT zip so get that one and pull the modified AviSynth.dll file out of the zip and replace your old one in System32/SysWOW64.
http://avisynth.org/mediawiki/MT
(Some of you might find this stupid but hey, someone might have done the same as me)
videoFred
25th February 2012, 09:35
New before/after examples on Vimeo:
http://vimeo.com/37394781
http://vimeo.com/37393841
Please download the XVid source files, they are much better than the Vimeo files.
For some reason XVid to Vimeo is reducing sharpness.
Fred.
rubento
26th February 2012, 23:12
Fred,
I have seen your new Super 8 restored footage on vimeo and it looks better than ever. Is the script you used the same posted here or has it been updated?
Thank you!
Undead Sega
27th February 2012, 02:42
Yes, if it were possible (and I don't think it is) to create color masks in order to separate layers, it would certainly be a manual process. However, I'm pretty sure this sort of thing is not possible without having access to the three B&W separation prints, something that doesn't usually exist, even for many Hollywood films, and certainly not for anything that any of us ever have access to.
So, it is an interesting restoration story, but unfortunately not one that suggests any technique that we might be able to adapt and use with the tools available for AVISynth.
Hmmm, I do understand where you are coming from, but I think theoretically this can be possible, like if there was somesort of reference frame (with all the colour layers) which can be used to help interpolate the missing colour, i.e. creating the missing or faded film layer.
I found some papers on people trying to do so but I need to do more research, but at the moment I stumbled something interesting:
(3rd post) http://www.apug.org/forums/forum40/75771-restoring-faded-transparency.html
Apprantly, this guy says soaking the right type of film in ferricyanide would restore the Cyan layer. Does anyone have any knowlege on this?
videoFred
27th February 2012, 07:26
Fred,
I have seen your new Super 8 restored footage on vimeo and it looks better than ever. Is the script you used the same posted here or has it been updated?
Thank you!
Hello Rubento,
The script is updated. I will upload it as soon as possible.
Fred.
rubento
27th February 2012, 17:31
Thank you Fred! Your work is awesome!
TheoRI
28th February 2012, 07:14
Dear Fred, I saw the new super8 16:9 conversions and they look very nice. Can you please provide the settings for each edit and the output you used for each (I am talking of result1, result2, result3, or result4 of the original script) and then the settings for color, sharpening etc?
Once again great work! Looking forward to the updated scripts!!
Theo
videoFred
28th February 2012, 07:27
Hi Theo,
It makes no sence to give you those settings because all sources are different.
many greetings,
Fred.
Gargamel
2nd March 2012, 10:31
Hello Fred,
"Bravo" again for your last two clips ++, terrific for regular 8mm.
- A first question: while processing, were your settings the same, all along each clip, or were they different from a scene to another one ?
- A second (more general) one: to interpole, did you test InterFrame-1.13 instead of MFlowFps ? In some quick moving scenes, sometimes InterFrame seems to be interesting... Yesterday, Bernard launched that idea in a thread about "L'interpolation des images", on "Le Transfert Pellicule".
videoFred
2nd March 2012, 15:37
Hello Fred,
"Bravo" again for your last two clips ++, terrific for regular 8mm.
- A first question: while processing, were your settings the same, all along each clip, or were they different from a scene to another one ?
Hello Gargamel,
Settings like sharpness, grain reduction etc. where all the same. On some scenes I had to change the gamma a bit.
- A second (more general) one: to interpole, did you test InterFrame-1.13 instead of MFlowFps ? In some quick moving scenes, sometimes InterFrame seems to be interesting... Yesterday, Bernard launched that idea in a thread about "L'interpolation des images", on "Le Transfert Pellicule".
No, I have never tested Interframe and I will have a look at it.
many greetings,
Fred.
Gargamel
2nd March 2012, 18:22
OK, thank you Fred !
Many greetings,
Andre.
TheoRI
5th March 2012, 01:37
Dear Fred,
While waiting for the new version of your scrip I had a couple of questions:
1) Have you thought of creating the script in a format that is compatible with AvsPmod that uses sliders and maybe section toggles
2) What are your thoughts on using SmoothAdjust plug in for color correction (http://forum.doom9.org/showthread.php?t=154971)
3) Any thoughts of integrating a tool like SmoothGradationRGB for color correction? (http://forum.doom9.org/showthread.php?p=1530964#post1530964)
4) Any thoughts on the interpolated portion using the Interframe vs the MflowFPS scripts
Kind Regards,
Theo
johnmeyer
5th March 2012, 01:52
While waiting for the new version of your scrip I had a couple of questions:
1) Have you thought of creating the script in a format that is compatible with AvsPmod that uses sliders and maybe section toggles
2) What are your thoughts on using SmoothAdjust plug in for color correction (http://forum.doom9.org/showthread.php?t=154971)
3) Any thoughts of integrating a tool like SmoothGradationRGB for color correction? (http://forum.doom9.org/showthread.php?p=1530964#post1530964)
4) Any thoughts on the interpolated portion using the Interframe vs the MflowFPS scriptsGood suggestions, but why not just try it yourself? You'd only have to replace one or two lines of code for each of these changes. If you do try any of these things, I'd be interested in the results.
TheoRI
5th March 2012, 08:00
John,
I tried converting videoFred's script to be AvsPMod compatible (see http://forum.doom9.org/showthread.php?p=1563069#post1563069)
However I have issues with AvsPMod being stable to process and adjust settings.
I also tried out integrating the smoothadjust plugins but have major issues with AvsPMod. It does not want to stay up and process much.
:(
rubento
13th March 2012, 13:18
Fred,
I am anxiously awaiting your new script...
Regards!
videoFred
13th March 2012, 13:26
John,
I tried converting videoFred's script to be AvsPMod compatible (see http://forum.doom9.org/showthread.php?p=1563069#post1563069)
However I have issues with AvsPMod being stable to process and adjust settings.
:(
I guess the grain reduction is to slow for AvsPMod. It takes several second to reload the script after modifying.
However, my script works fine with VirtualDubMod and the build in Avisynth editor.
Fred.
egrimisu
16th March 2012, 21:02
Hey guys,
i have tried to use the destrobing efect and get an error:
rest=last
calm = rest.temporalsoften(1,255,255,32,2).merge(rest,0.25)#.repair(rest,1).removegrain(11)
calm = calm.temporalsoften(1,255,255,16,2).merge(calm,0.25)
LOP = calm.bicubicresize(180,144).bicubicresize(720,576,1,0)
HIP = rest.bicubicresize(180,144).bicubicresize(720,576,1,0)
HIP = mt_makediff(rest,HIP)
mix = LOP.mt_adddiff(HIP,U=2,V=2)
sup1=rest.msuper(levels=1)
sup2=mix.removegrain(11).msuper()
bv2=sup2.manalyse(isb=true, delta=2,blksize=16,overlap=8,DCT=5)
bv1=sup2.manalyse(isb=true, delta=1,blksize=16,overlap=8,DCT=5)
fv1=sup2.manalyse(isb=false,delta=1,blksize=16,overlap=8,DCT=5)
fv2=sup2.manalyse(isb=false,delta=2,blksize=16,overlap=8,DCT=5)
rest.mdegrain2(sup1,bv1,fv1,bv2,fv2,thSAD=640)
return(last)
and error:
mdegrain2 : wrong source or super frame size
anyone know what this is ? Thanks in advance
Solved it:
LOP = calm.bicubicresize(180,144).bicubicresize(720,576,1,0)
HIP = rest.bicubicresize(180,144).bicubicresize(720,576,1,0)
should contain the input resolution on the second bicubic resize and at the first bicubic resize, the second/4. Ibelieve :)
librarian
16th March 2012, 23:12
A better way :
rest=last
w=rest.width()
h=rest.height()
calm = rest.temporalsoften(1,255,255,32,2).merge(rest,0.25)#.repair(rest,1).removegrain(11)
calm = calm.temporalsoften(1,255,255,16,2).merge(calm,0.25)
LOP = calm.bicubicresize(w/4,h/4).bicubicresize(w,h,1,0)#gaussianblur(4)#
HIP = rest.bicubicresize(w/4,h/4).bicubicresize(w,h,1,0)#gaussianblur(4)#
HIP = mt_makediff(rest,HIP)
mix = LOP.mt_adddiff(HIP,U=2,V=2)
sup1=rest.msuper(levels=1)
sup2=mix.removegrain(11).msuper()
bv2=sup2.manalyse(isb=true, delta=2,blksize=16,overlap=8,DCT=5)
bv1=sup2.manalyse(isb=true, delta=1,blksize=16,overlap=8,DCT=5)
fv1=sup2.manalyse(isb=false,delta=1,blksize=16,overlap=8,DCT=5)
fv2=sup2.manalyse(isb=false,delta=2,blksize=16,overlap=8,DCT=5)
return rest.mdegrain2(sup1,bv1,fv1,bv2,fv2,thSAD=640)
As to downsize 1/4 --> upsize 1 see here (http://forum.doom9.org/showthread.php?p=568119#post568119)
stoffal
18th March 2012, 19:32
Wonderful new clips, Fred! Quality work made in Flanders =)
I can't wait to see the updated script... Cheers!
Chris
phate89
18th March 2012, 19:55
Hello Rubento,
The script is updated. I will upload it as soon as possible.
Fred.
Great... I'm starting now for the first time to play with your script... But at this point i'll wait the version with updated plugins and script..
Thanks!
Boffee
21st March 2012, 15:46
I am trying Fred's script but now get error in Line 229:-
StackHorizontal:image heights do not match. I have tried changing the values from 28 to 32 but no differerence. Anyone help
videoFred
21st March 2012, 15:55
I am trying Fred's script but now get error in Line 229:-
StackHorizontal:image heights do not match. I have tried changing the values from 28 to 32 but no differerence. Anyone help
Hello Boffee,
What is the size of the source file?
Fred.
Boffee
21st March 2012, 18:48
Hello Fred
According to gspot it is 720 x 576 which was taken with a camcorder and a condensor lens, I have tried the script on another video taken from a CCTV camera pointing at the gate of a projector, which is 640 x 480 but I get the same error. I have changed your degraining/sharpening part to that as posted in post #37 as i get error "illegal instruction line 161" if I leave it as original. Don't think my single core pc will run MVDegrainMulti for some reason although I have all the plugins in the script and plugins folder.
videoFred
22nd March 2012, 07:31
Hi Boffee,
Your single core pc should run MVDegrainMulti and this has nothing to do with the StackHorizontal error.
Please upload a clip and send me the script you are using, I will take a look at it.
Fred.
Boffee
22nd March 2012, 12:50
Thanks for your help Fred. Video is at http://vimeo.com/39078729. I have send a copy of the script which causes error on line 160. Only difference is SETMTMODE is disabled as far as I can see.
egrimisu
22nd March 2012, 22:20
A better way :
rest=last
w=rest.width()
h=rest.height()
calm = rest.temporalsoften(1,255,255,32,2).merge(rest,0.25)#.repair(rest,1).removegrain(11)
calm = calm.temporalsoften(1,255,255,16,2).merge(calm,0.25)
LOP = calm.bicubicresize(w/4,h/4).bicubicresize(w,h,1,0)#gaussianblur(4)#
HIP = rest.bicubicresize(w/4,h/4).bicubicresize(w,h,1,0)#gaussianblur(4)#
HIP = mt_makediff(rest,HIP)
mix = LOP.mt_adddiff(HIP,U=2,V=2)
sup1=rest.msuper(levels=1)
sup2=mix.removegrain(11).msuper()
bv2=sup2.manalyse(isb=true, delta=2,blksize=16,overlap=8,DCT=5)
bv1=sup2.manalyse(isb=true, delta=1,blksize=16,overlap=8,DCT=5)
fv1=sup2.manalyse(isb=false,delta=1,blksize=16,overlap=8,DCT=5)
fv2=sup2.manalyse(isb=false,delta=2,blksize=16,overlap=8,DCT=5)
return rest.mdegrain2(sup1,bv1,fv1,bv2,fv2,thSAD=640)
As to downsize 1/4 --> upsize 1 see here (http://forum.doom9.org/showthread.php?p=568119#post568119)
Thanks for the script, strobes are removed but also alot of grains, is there a way to preserve the grains, i mean as much as possible. Also shadow are inserted like blending can this be fixed?
librarian
23rd March 2012, 02:22
Thanks for the script, strobes are removed but also alot of grains, is there a way to preserve the grains, i mean as much as possible. Also shadow are inserted like blending can this be fixed?
That script is essentially a degrainer (and temporal stabilizer).
Save grain (before the script):
grain=mt_makediff(removegrain(4))# any degrainer you like
reinsert grain (after the script):
mt_adddiff(grain)
In addition you can try to:
use mdegrain1 (and may be to lower blksize to 8 and overlap to 4),
and/or reduce the thresholds in temporalsoften,
but both operations may lessen the desired effects.
egrimisu
23rd March 2012, 11:40
That script is essentially a degrainer (and temporal stabilizer).
Save grain (before the script):
grain=mt_makediff(removegrain(4))# any degrainer you like
reinsert grain (after the script):
mt_adddiff(grain)
In addition you can try to:
use mdegrain1 (and may be to lower blksize to 8 and overlap to 4),
and/or reduce the thresholds in temporalsoften,
but both operations may lessen the desired effects.
Thanks, some of the grains are kept, much better than without it.
My last and more important concern is that the wholse script introduces blending, is this something that can be fixed?
TheoRI
31st March 2012, 16:25
Dear Fred,
I am waiting for the new script you mentioned earlier in the month and was wondering when you could upload it.
Kind Regards,
Theo
GMJCZP
1st April 2012, 05:54
Same here, heh, heh.
I like the work of videofred and tried to use part of your script into other applications. Now I would like to learning and use the stabilization.
I had problems with Deshaker and Depan package :helpful:, so I'd like to stabilize some videos with slight movement.
Thanks a lot.
TheoRI
14th April 2012, 15:07
Fred,
Is there any news on the new version of the script?
Kind Regards,
Theo
Emulgator
18th April 2012, 23:26
I had problems with Deshaker and Depan package :helpful:, so I'd like to stabilize some videos with slight movement.
Thanks a lot.
A simple Stab() works wonders sometimes.
GMJCZP
10th May 2012, 15:48
A simple Stab() works wonders sometimes.
Thanks Emulgator. I'll try.
GMJCZP
12th May 2012, 06:39
It works very well, I activate the mirror option for to fill the black parts. Thanks.
Just noticed that sometimes the right side of the image does not fill it, it will be offset = -1?
Honeyko
20th May 2012, 08:19
///Warning: total Avisynth newb///
- - - -
I have:
1. Installed Avisynth (v2.5; it's in my Program Items folder).
2. Installed VirtualDub-1.9.10
3. Downloaded Fred's stuff.
4. Have a file ready to process ("abc.avi") in C:\test
....what do I next?
Note: I don't want to change a thing as far as the basic settings of Fred's script go; it looks like he's done a phenominal job of tweaking the heck out of it.
stoffal
20th May 2012, 09:52
Hello Honeyko,
welcome to this forum and to digital film restauration...
If you have downloaded the latest version of Fred's script, you can unpack the zip file. Here you will find some help files explaining what to do with the files. After setting up everything, you will need to adapt the avisynth script to your needs. Open it and read through it, modify it so it works with your file. It is really no "one click solution" -- you will need to understand what the script does, but then you have it all in your hands ! It might help you to take a look at the Avisynth website and go through some tutorial scripts there. Hope it helps!
Honeyko
20th May 2012, 10:04
Hello Honeyko,
welcome to this forum and to digital film restauration...
If you have downloaded the latest version of Fred's script, you can unpack the zip file. Here you will find some help files explaining what to do with the files. After setting up everything...That's the tricky part. Just setting everything up is about as obtuse as it could possibly be. (By "total newb", I meant exactly that. I.e., how do you even open a script in Avisynth? -- There certainly seems to be a lot of other software which calls Avisynth, but using it straight-up is something I've never done.)
I'm trying to avoid massive duplication of learning-curves here. A link to a simple 1-2-3 guide would be handy here.you will need to adapt the avisynth script to your needs. Open it and read through it, modify it so it works with your file. It is really no "one click solution"....Well, actually, there should be, *in this case*. My file is a plain vanilla progressive XviD avi, already cropped, mod16, yadda yadda. XviD is installed. x264 is there as well (if that's used). I don't need to worry about audio, resizing, combing or anything at all other than modifying path names to point to it.
If the input is better handled as mpeg2 or something else, I can easily convert it ahead of time.
videoFred
20th May 2012, 10:39
how do you even open a script in Avisynth?
This is not the thread to discuss this. Learn the Avisynth basics first and then come back here. ;)
Fred.
01010001
17th June 2012, 00:15
First off -- THANK YOU SO MUCH videoFred for making this available to us! :D It's simply amazing. Also thank you to anyone else who contributed to its development.
I keep reading about a new version, but I don't see videoFred making any comments about it. Is a new version coming out soon? I'm preparing to convert dozens of my family 8mm films sometime within the next week.
videoFred
18th June 2012, 07:38
I keep reading about a new version, but I don't see videoFred making any comments about it.
Send me a PM.
Fred.
videoFred
20th June 2012, 14:01
OK, new version of the script is uploaded, see first page of this thread.
Fred.
01010001
20th June 2012, 18:59
OK, new version of the script is uploaded, see first page of this thread.
Fred.
Thanks Fred. :)
Boffee
23rd June 2012, 12:56
Could I ask a question please? My cine transfer system consists if a c mount CCTV camera with a macro lens pointing at the gate of a cine projector. I am doing a frame by frame transfer using a hall effect transistor within the projector to give a pulse on each frame to trigger the mouse on my capture program. As the output of the CCTV camera is interlaced but I am making a progressive avi from the individual frames, do I need to de-interlace before using Fred's scripts?
videoFred
23rd June 2012, 13:00
As the output of the CCTV camera is interlaced but I am making a progressive avi from the individual frames, do I need to de-interlace before using Fred's scripts?
If there is no difference between fields, I don't think you will have to deinterlace. Try it and see what you get.
Fred.
johnmeyer
23rd June 2012, 16:14
You most definitely do not need to deinterlace IF the two fields come from the same moment in time. If you point two cameras at a completely stationary scene, with no motion occurring, with one camera shooting interlaced and the other progressive, the results from the two cameras will be the same. (And this, of course, is one of the reasons we have adaptive de-interlacers ...).
If you are unsure as to whether you are really getting two fields from the same moment in time, just run the output from your transfer through a one-line AVISynth script that just contains a single "separatefields()" statement. You should see pairs of fields with absolutely zero horizontal motion between them, but between those same pairs you will see a slight up or down motion due to the fact that they represent a slightly different spatial location. If you see something else, then your capture system is not doing what you think it is.
P.S. What speed (fps) does your transfer system operate?
Boffee
24th June 2012, 13:00
Thank you Fred and John. I have tried the new scripts and all seems OK. Had to change the MVtools.dll for another version as received illegal instruction error on AVIsynth. My PC is quite old but runs Windows 7 OK. My transfer system uses a Eumig 610D set on 3FPS. Anyway, thank you both for the clarification.
stoffal
24th June 2012, 14:04
Thank you Fred! Will try out the new script on this rainy sunday =)
millercentral
30th June 2012, 21:29
So I've been working with some very old 8mm reels - some as early as 1940...
Some of the reels are seriously degraded, to the point that some of the oldest film is quite brittle and breaks easily. I'm building a scanner based capture solution, and trying to make the film path as straight as possible, but does anyone know any tricks to reduce the brittleness of this old film?
I've heard suggestions like heating it, or wetting it, but haven't found any specific guides or techniques. Does anyone here have any tips to extract just a little more life out of this film in order to capture it safely?
Thanks!
johnmeyer
1st July 2012, 00:13
A good place to find answers about film itself:
8mm Film Forum (http://8mmforum.film-tech.com/)
Does you film smell like vinegar? If so, it has "vinegar syndrome." (https://www.google.com/search?q=%22VINEGAR+syndrome%22&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a#hl=en&client=firefox-a&hs=XCU&rls=org.mozilla:en-US%3Aofficial&sclient=psy-ab&q=%22vinegar+syndrome%22&oq=%22vinegar+syndrome%22&gs_l=serp.3..0l4.35350.36325.0.36776.8.8.0.0.0.7.267.1658.0j4j4.8.0...0.0.8Sq7pbR-FWM&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.,cf.osb&fp=f02dca5de27feb08&biw=1067&bih=509) This is where the acetate base of the film breaks down and "out-gasses" acetic acid. The smell will be quite obvious. A smell of camphor (mothballs) is normal and of no concern.
Any film affected by vinegar syndrome cannot be salvaged, nor can it be made supple and flexible again. Your scanning solution may or may not work because the film generally does not shrink uniformly, and also because the film tends to not only shrink and get brittle, but also it usually curls.
You can Google "vinegar syndrome" and get more information on the problem and also, perhaps, other people's ideas on what can be done about it.
I have received about half a dozen cans over the past few years that have been infected with this problem. I tried one time to do a transfer, but it didn't work. I then had to thoroughly clean my transfer system because any infected film tends to infect good film that comes in contact with the dust left behind by the disintegrating film.
There are several products, such as Film Renew and FilmGuard, that will clean film and make it more supple. I have not had any need to use it, so I don't have any.
millercentral
1st July 2012, 04:22
Thanks John, that is super helpful information. I do believe some of this film suffers from vinegar syndrome unfortunately. We'll see if I have any success.
Again, I really appreciate the help. I'll followup once I get my rig setup and start attempting the captures.
Gargamel
3rd July 2012, 21:14
Hello Fred,
Thank you for your last edition ! [Sorry, I wasn't here for some days...]
A lot of new tests to perform now ;-))
stoffal
4th July 2012, 14:47
Hi Fred! Just a short question regarding the dirt removal plugin you are using: Have you also tested the "SpotRemoval" plugin as an alternative? Any experiences or comparisons? It looks interesting and is still actively developed. http://spotremoverfilter.com/
videoFred
5th July 2012, 11:28
Hi Fred! Just a short question regarding the dirt removal plugin you are using: Have you also tested the "SpotRemoval" plugin as an alternative? Any experiences or comparisons? It looks interesting and is still actively developed. http://spotremoverfilter.com/
Hello Stoffal,
RemoverdirtMC() works very well, there is no need for an alternative.
Fred.
em66
25th July 2012, 11:14
Hello,
Just a few words to say I spent some time trying the script and was very impressed with the results. The noise / grain reduction and the dust busting especially. I really thought I would lose more details with de-graining.
The result is very interesting with 16mm films, and even 35mm film transferts. There're always a few issues, like the behaviour of RemovedirtMC on black and white films with flicker (deformation of parts of the picture) but I hope I'll find a suitable setting. I'll try DeSpot too.
I tried to combine the script with DeScratch, and it worked not so bad for the actual scratches, but produces too many artifacts on vertical elements that are not scratches, so I guess it's not a process that can be fully automated successfully.
Congratulations to videoFred and the other helpers.
Thank you for sharing your work.
Gargamel
26th July 2012, 08:56
Hi em66,
I use DeScratch sometimes too. It can help to minimize vertical scratches, but only ".DeScratch(mindif=1,maxwidth=1)" works OK for me, without noticeable artifacts.
".DeScratch(mindif=1)" is too strong here, and always wipes a lot of vertical lines which aren't scratches on my 8mm footages.
em66
26th July 2012, 12:41
Hi em66,
I use DeScratch sometimes too. It can help to minimize vertical scratches, but only ".DeScratch(mindif=1,maxwidth=1)" works OK for me, without noticeable artifacts.
".DeScratch(mindif=1)" is too strong here, and always wipes a lot of vertical lines which aren't scratches on my 8mm footages.
Hi Gargamel,
Thank you for the advice. There are less artifacts indeed with maxwidth=1, but some of the scratches, a bit wide, are not processed. I guess it depends on the film.
Gargamel
27th July 2012, 12:31
I guess it depends on the film.
Sure !
Probably very difficult to wipe wide scratches without artifacts.
But often DeScratch works well when scratches are thin.
jkf123
15th August 2012, 07:19
Hi Fred,
first of all I also want to say thank you for the great script. The results are amazing. Old N8 movies are looking like HD Video now !
After I restored maybe 10 films with great results, I faced a strange problem now. The processed film has some kind of triangle with green stripes on the right corner, like you can see in the picture. Also changing the parameters of the script does not solve this. ( I also reinstalled all involved software, tried it on another PC and tested the beta version of avisynth, but the triangle is still there).
Does anybody has a clue what I do wrong ?
Thx for your help and your great work
Kristian
videoFred
15th August 2012, 08:15
Hi JFK123,
This problem is very easy to solve. All clip dimensions must be divisible by 16.
For example if we have a clip of 720x576 and we crop 20 pixels on each side, we will have a 680x536 clip. That's not good because both width and height are not divisible by 16. But if we crop 16 pixels on each side, we have a 588x544 clip and these values are divisible by 16.
Fred.
em66
22nd August 2012, 16:01
Hi,
I'm still pleased and impressed with the possibilities offered by this script.
It was even able to restore bad video tapes (interlaced material !) with many drop-outs on the pictures. When the drop outs are only on one frame/field, there're removed just like dirt. And the denoising works well for video too.
There's still one thing that I can't do properly : dealing with b&w film. I get strange pumping (deformation) on parts of the picture, on some shots. It seems to happen where there is flicker.
The problem is caused by RemoveDirtMC. Is it because it normally works with color information ? Does anyone know what setting should be changed ?
Thanks !
videoFred
23rd August 2012, 12:47
There's still one thing that I can't do properly : dealing with b&w film. I get strange pumping (deformation) on parts of the picture, on some shots. It seems to happen where there is flicker.
The problem is caused by RemoveDirtMC. Is it because it normally works with color information ? Does anyone know what setting should be changed ?
Thanks !
We need a sample clip to analyze this. It is not caused by the lack of color. Do you have this effect when returning result4 too?
Fred.
johnmeyer
23rd August 2012, 17:02
I get strange pumping (deformation) on parts of the picture, on some shots. It seems to happen where there is flicker.I suspect that you are using the "frame interpolation" script which gives you 30 fps frame rate from 16, 18, or 24 fps original material. This uses MVTools to synthesize the intermediate frames, and this can definitely cause the problems you describe. I understand and appreciate what this technique can do, and sometimes use it myself, but I find that far too often the artifacts introduced are far worse than the "juddering" that is inherent in the low-fps original frame rates. So, I always recommend just adding pulldown (duplicated fields). I am not sure whether any of VideoFred's current scripts do that (field blending is not the same thing).
FWIW, pulldown is how film has been shown on TV since television was invented.
I'm not knocking or disparaging either motion interpolation or field blending, but just pointing out that one has morphing issues and the other will result in "soft" intermediate frames. Pulldown has neither of those problems and it shows the film just almost exactly like it would have looked if projected. However, when the camera pans, it will judder: that's just the nature of low-fps image projection.
videoFred
24th August 2012, 06:47
I find that far too often the artifacts introduced are far worse than the "juddering" that is inherent in the low-fps original frame rates. So, I always recommend just adding pulldown (duplicated fields). I am not sure whether any of VideoFred's current scripts do that (field blending is not the same thing).
I have included a frame blending script, but this can easily be changed to frame duplicating by changing "BlendFPS(final_framerate, frame_blend)" to "ChangeFPS(final_framerate)".
Can you show a code example of how to add duplicated fields John? This means introducing interlacing or am I wrong here?
Anyhow, lately I play my transfered film files straight from a portable USB HD to my flatscreen 40" Sony Bravia, at the original framerate (16, 18 or 24). It plays remarkable smooth. I use XVid for the codec. Perhaps the TV hardware is doing something to make it look smoother, I do not know. I can not skip frame-by-frame on that TV. Also, the internal upscaling from the TV to full HD works remarkable well too. For example a 960x720 (4:3) clip will be upscaled to 1440x1080 and the TV will show two black borders, no need to add them in the clip.
However, when the camera pans, it will judder: that's just the nature of low-fps image projection.
Yes. And in those cases the interpolation works remarkable well without the "rubber" artefacts, if the panning is not to fast.
Fred.
johnmeyer
24th August 2012, 19:19
Can you show a code example of how to add duplicated fields John? This means introducing interlacing or am I wrong here?
I am still showing my work on television sets, and while modern TV sets can deal with progressive, much of the intermediate chain still expects interlaced (other than for 24 fps film). Also, many people still watch TV on an interlaced TV set (CRT). So, my code is all designed to produce 29.97 interlaced output. Here is the code for various input framerates, along with a generalized way of accomplishing the same thing using ChangeFPS (the last code snippet below).
# Pulldown for 24 fps
# separatefields()
# SelectEvery(8, 0,1, 2,3,2, 5,4, 7,6,7)
# weave()
# Pulldown for 18 fps using repeats normal-repeat-normal-weave-normal
# separatefields()
# selectevery(6, 0,1, 0,1, 2,3, 2,5, 4,5)
# weave()
# Pulldown for 18 fps using all weaves normal-weave-normal-weave-normal (I like this the best)
# separatefields()
# selectEvery(6, 0,1, 0,3, 2,3, 2,5, 4,5)
# weave()
# Pulldown for 16 fps using all weaves
# separatefields()
# SelectEvery(16, 0,1, 0,3, 2,3, 2,5, 4,5, 4,7, 6,7, 6,9, 8,9, 8,11, 10,11, 10,13, 12,13, 12,15, 14,15)
# weave()
# Pulldown to go from 16 fps to 18 fps
# separatefields()
# selectEvery(16, 0,1, 2,3, 4,5, 6,7, 6,9, 8,9, 10,11, 12,13, 14,15)
# weave()
# Pulldown from ANY fps using a technique in the Doom forums (seems to produce same as above)
# Seems to work well and should be able to handle ANY input frame rate
# Designed for 29.97 interlaced output
# ChangeFPS(59.94) #Double the final framerate
# AssumeTFF() # or BFF, as required
# SeparateFields()
# SelectEvery(4, 0, 3) #selectevery(4,1,2) can be used if you get field reversal, although TFF/BFF above should do the same thing, I think
# weave()
em66
3rd September 2012, 16:10
Hi and thank you for your answers, videoFred and johnmeyer.
We need a sample clip to analyze this. It is not caused by the lack of color. Do you have this effect when returning result4 too?
The effect is the same with result4.
I did a sample focusing on the zone which causes a problem.
It's short and small but I think it's enough to see the matter. It's actually not a 8mm film but a raw transfer of a very old 35mm movie :
http://wtrns.fr/oQ1UT1yYkRtTMU
I suspect that you are using the "frame interpolation" script which gives you 30 fps frame rate from 16, 18, or 24 fps original material.
I didn't use any frame interpolation, and "BlendFPS" is not even in the script I used.
There's no artefact if I don't use RemoveDirt so I'm pretty sure it's the cause, I just wonder if there's a setting to avoid this issue. Maybe de-flickering before RemoveDirt ? I'm not sure where the DeFlicker is used in the script.
videoFred
3rd September 2012, 16:43
It's a difficult one. If the flickering is on the original film, then the grain pattern is changing constantly between bright and dark frames. We need an example of the original transfer!
Fred.
johnmeyer
3rd September 2012, 18:01
Your original description made me think you were having a different problem.
I don't know what versions of the script you are using. The version I created changed everything to MVTools2 instead of MVtools. In that version, the MAnalyze calls have a parameter called "dct." For flicker, you change this from the default dct=0 to dct=1. Since the dct parameter is not included in the parameters setting of the script, you have to add it yourself to each instance of MAnalyze. I also used the deflicker function. With both of these enabled, here is the result I was able to get:
Deflickered Result (http://dl.dropbox.com/u/1561578/test.avi)
My personal taste would be to not do any grain reduction. The problem is that the grain is so large in size that you end up losing detail when trying to eliminate it and you are inevitably left with the grain morphing effect that is not particularly pleasant. I don't think this is necessarily a defect in the script but rather the result of the size of the structure that you are attempting to remove. The result I have posted above does have the grain removal enabled and you can see that it creates a somewhat unpleasant "gooey" effect. However, the flicker is almost entirely removed, as is the major "pumping" that you saw in your clip.
em66
4th September 2012, 13:10
Thanks again for your answers.
Yes the film is flickering a lot...(1928 !).
I'm using a script based on "01_A_Film_Restoring_Frame_Interpolation.avs" downloaded in the first post. Where is your version johnmeyer ?
If I set the "denoising_strenght" to "0", I get the same effect.
However, with "dirt_strenght=0", the annoying effect is gone. That's why I really think it has to do with RemoveDirtMC.
I don't mind a bit of grain and flicker, but I was trying to clean some of the dust without getting any obvious artefact like this picture deformation.
I posted only a portion of the picture where the artefact was very visible. Of course, the full picture doesn't look as grainy, but the original film has some grain for sure.
TheoRI
13th September 2012, 14:34
Have a look at the restoration of the oldest "color" film
http://youtu.be/XekGVQM33ao
Jenyok
14th September 2012, 16:04
RemoveDirt functions...
.
#
#
# File: RemoveDirt.avsi
#
# RemoveTempGrain, RemoveDirt and moution compensated RemoveDirt functions
#
# Functions:
#
# function NullClip(clip clp)
#
# function RemoveTempGrain(clip clp, int "_mode")
#
# function RemoveDirt(clip clp, int "limit", bool "_grey")
# function RemoveDirtMC(clip clp, int "limit", bool "_grey", int "Vectors")
#
# function RemoveDirt2(clip clp, int "limit", int "rgrain", bool "_grey")
# function RemoveDirtMC2(clip clp, int "limit", int "rgrain", bool "_grey", int "Vectors")
#
# function RemoveDirt_HQ(clip clp, int tlimit, int rgrain, bool "_grey")
# function RemoveDirt_HQMC(clip clp, int "limit", int "rgrain", bool "_grey", int "Vectors")
#
# function RemoveDirtCareful(clip clp, int "th", bool "show")
# function RemoveDirtCarefulMC(clip clp, int "th", bool "show", int "Vectors")
#
# function RemoveDirtS(clip clp, int "limit", bool "_grey")
# function RemoveDirtSMC(clip clp, int "limit", bool "_grey", int "Vectors")
# function HQ_FilterS(clip clp, int "Vectors")
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\YLEVELS\ylevels.avsi")
function NullClip(clip clp)
{
return (BlankClip(clp, length=0))
}
# =============================================================================
#
#
function RemoveTempGrain(clip clp, int "_mode")
{
_mode = Default(_mode, 17)
rg = RemoveGrain(clp, mode=_mode)
clp = TemporalRepair(rg, clp)
return clp
}
# =============================================================================
#
#
function RemoveDirt(clip clp, int "limit", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 16)
clmode = 17
clensed = Clense(clp, grey=_grey, cache=4)
sbegin = ForwardClense(clp, grey=_grey, cache=-1)
send = BackwardClense(clp, grey=_grey, cache=-1)
alt = Repair(SCSelect(clp, sbegin, send, clensed, debug=true), clp, mode=limit, modeU = _grey ? -1 : limit)
restore = Repair(clensed, clp, mode=limit, modeU = _grey ? -1 : limit)
corrected = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, gmthreshold=70, dist=1, \
dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
clp = RemoveGrain(corrected, mode=clmode, modeU = _grey ? -1 : clmode)
return clp
}
# RemoveDirtMC2 by heini011 on 26 February 2006
# Suggested by johnmeyer on 09 June 2010
# Incorporated into Filmrestoration script by videoFred on 08 July 2010
# Fixed (vector direction) by nephilis on 01 August 2010
# Fixed (swapped parameters) by Emulgator to work with recent MVTools 2.5.10.1 on 20 September 2010
#
function RemoveDirtMC(clip clp, int "limit", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirt(clp, limit=limit, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function RemoveDirt2(clip clp, int "limit", int "rgrain", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
rgrain = Default(rgrain, 2)
_dgr1 = 0.35 + rgrain * 0.3
_dgr2 = 0.45 + rgrain * 0.4
repmode = 1
clensed = Clense(clp, grey=_grey, cache=4)
restore = clp.FluxSmoothST(3 + 3 * rgrain, rgrain)
restore = Repair(restore, clp, mode=repmode, modeU=(_grey) ? -1 : repmode)
restore = (rgrain == 0) ? restore.RemoveGrain(1) : \
restore.VagueDenoiser(threshold=_dgr1, chromaT=_dgr1, nsteps=7, percent=75).RemoveGrain(1)
alt = clp.VagueDenoiser(threshold=_dgr2, chromaT=_dgr2, nsteps=7, percent=100).RemoveGrain(5)
clp = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, \
pthreshold=4 + 2 * rgrain, cthreshold=6 + 2 * rgrain, gmthreshold=40, \
dist=1, dmode=2, debug=false, noise=limit, noisy=12, grey=_grey)
# Alternative settings
#
# clp = RestoreMotionBlocks(clensed, clp, alternative=alt, pthreshold=4, cthreshold=6, gmthreshold=40, dist=1, dmode=2, \
# debug=false, noise=limit, noisy=12, grey=_grey, show=true)
#
# clp = RestoreMotionBlocks(clensed, clp, alternative=alt, pthreshold=6, cthreshold=8, gmthreshold=40, dist=3, \
# tolerance=12, dmode=2, debug=false, noise=limit, noisy=12, grey=_ grey, show=false)
return clp
}
# RemoveDirtMC2 by heini011 on 26 February 2006
# Suggested by johnmeyer on 09 June 2010
# Incorporated into Filmrestoration script by videoFred on 08 July 2010
# Fixed (vector direction) by nephilis on 01 August 2010
# Fixed (swapped parameters) by Emulgator to work with recent MVTools 2.5.10.1 on 20 September 2010
#
function RemoveDirtMC2(clip clp, int "limit", int "rgrain", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
rgrain = Default(rgrain, 2)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirt2(clp, limit=limit, rgrain=rgrain, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function RemoveDirt_HQ(clip clp, int "limit", int "rgrain", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
rgrain = Default(rgrain, 2)
_dgr = 0.4 + rgrain * 0.25
clensed = clp.RemoveTempGrain(1).FluxSmoothST(limit, rgrain)
restore = clp.VagueDenoiser(threshold=_dgr, nsteps=6, chromaT=_dgr, percent=100).RemoveGrain(1)
alt = restore
clp = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, pthreshold=3 + 2 * rgrain, \
cthreshold=3 + 2 * rgrain, gmthreshold=40, dist=1, dmode=1, debug=false, \
noise=limit + 1, noisy=12, grey=_grey)
return clp
}
function RemoveDirt_HQMC(clip clp, int "limit", int "rgrain", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
rgrain = Default(rgrain, 2)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirt_HQ(clp, limit=limit, rgrain=rgrain, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function RemoveDirtCareful(clip clp, int "th", bool "show")
{
th = Default(th, 16)
show = Default(show, false)
dirtless = clp.RemoveDirt()
# dirtless = clp.RemoveDirt2()
maskd = yv12lutxy(clp, dirtless, yexpr="x y - abs 16 > 255 0 ?", Y=3, U=-128, V=-128)
maskd = maskd.expand().reduceby2().reduceby2().expand(Y=3, U=-128, V=-128)
dirtless = (show == true) ? dirtless.subtitle("removedirt-ed") : dirtless
clp = Conditionalfilter(maskd, clp, dirtless, "Ydifferencefromprevious()+Ydifferencetonext()", "greaterthan", string(th))
# scriptclip(maskd, "subtitle(string(Ydifferencefromprevious()+Ydifferencetonext()))")
return clp
}
function RemoveDirtCarefulMC(clip clp, int "th", bool "show", int "Vectors")
{
th = Default(th, 16)
show = Default(show, false)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirtCareful(clp, th=th, show=show)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
Jenyok
14th September 2012, 16:05
RemoveDirt functions continuos...
.
# =============================================================================
#
#
function RemoveDirtS(clip clp, int "limit", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
clensed = clp.Clense(grey=_grey, cache=4)
alt = clp.RemoveGrain(2)
clp = RestoreMotionBlocks(clensed, clp, alternative=alt, pthreshold=4, cthreshold=6, gmthreshold=40, \
dist=1, dmode=2, debug=false, noise=limit, noisy=16, grey=_grey)
return clp
}
function RemoveDirtSMC(clip clp, int "limit", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
limit = Default(limit, 6)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirtS(clp, limit=limit, _grey=_grey)
dnc = RemoveTempGrain(clp, 1)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
dnc = (Vectors == 1) ? SelectEvery(dnc, 3, 1) : \
(Vectors == 2) ? SelectEvery(dnc, 5, 2) : \
SelectEvery(dnc, 7, 3)
clp = clp.SeeSaw(dnc, Sstr=0.26, Szp=12, SdampHi=20, bias=40)
return clp
}
function HQ_FilterS(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveDirtSMC(limit=6, Vectors=Vectors)
clp = clp.YlevelsS(0, 1.05, 255, 0, 255)
clp = clp.LimitedSharpenFaster(Smode=4, strength=18, overshoot=1, wide=false)
return clp
}
Jenyok
14th September 2012, 16:06
RemoveDust functions...
.
#
#
# File: RemoveDust.avsi
#
# RemoveDust and moution compensated RemoveDust functions
#
# Functions:
#
# function NullClip(clip clp)
#
# function RemoveDustOld(clip clp, int "_mode", bool "_grey")
#
# function RemoveDustOldMC(clip clp, int "_smooth", bool "_grey")
#
# function RemoveDust(clip clp, int "_mode", bool "_grey")
# function RemoveDustMC(clip clp, int "mode", bool "_grey", int "Vectors")
#
# function RemoveDust2(clip clp, int "repmode", int "_smooth", bool "_grey")
# function RemoveDustMC2(clip clp, int "mode", int "smooth", bool "_grey", int "Vectors")
#
# function RemoveDust3(clip clp, int "repmode", int "TRsmooth", int "RGmode", int "RGmodeChroma", bool "_grey")
# function RemoveDustMC3(clip clp, int "mode", int "smooth", int "RGmode", int "RGmodeChroma", bool "_grey", int "Vectors")
#
# function LRemoveDust_YUY2(clip clp, int "clmode", int "limit")
# function LRemoveDust_YUY2MC(clip clp, int "mode", int "limit", int "Vectors")
#
# function LRemoveDust_YV12(clip clp, int "clmode", int "limit")
# function LRemoveDust_YV12MC(clip clp, int "mode", int "limit", int "Vectors")
#
# function LRemoveDust(clip clp, int "_mode", int "limit")
# function LRemoveDustMC(clip clp, int "mode", int "limit", int "Vectors")
#
# function RemoveDustDirt(clip clp, int "repmode", int "clmode", int "limitY", int "limitUV")
# function RemoveDustDirtMC(clip clp, int "mode", int "clmode", int "limitY", int "limitUV", int "Vectors")
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\ssetools.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
function NullClip(clip clp)
{
return BlankClip(clp, length=0)
}
# =============================================================================
#
#
function RemoveDustOld(clip clp, int "_mode", bool "_grey")
{
_grey = Default(_grey, false)
_mode = Default(_mode, 5)
repmode = 2
_modeU = (_grey) ? -1 : repmode
clensed = Clense(clp, grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU=_modeU)
clp = RemoveGrain(rep, mode=_mode, modeU=_modeU)
return clp
}
# =============================================================================
#
#
function RemoveDustOldMC(clip clp, int "_smooth", bool "_grey")
{
_smooth = Default(_smooth, 0)
_grey = Default(_grey, false)
repmode = 2
clmode = 4
quad = Quadruple(clp, grey=_grey) # each pixel is quadrupled, SSETools are needed
qpel = RemoveGrain(quad, mode=12, modeU=-1) # blur the luma for searching motion vectors
super = MSuper(qpel, pel=2, sharp=2)
bvec1 = MAnalyse(super, isb=true, blksize=8, delta=1, overlap=4, truemotion=true, lambda=200)
fvec1 = MAnalyse(super, isb=false, blksize=8, delta=1, overlap=4, truemotion=true, lambda=200)
backw1 = MCompensate(quad, super, bvec1)
forw1 = MCompensate(quad, super, fvec1)
clensed = Clense(quad, backw1, forw1, grey=_grey).shrinkby2(grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU=(_grey) ? -1 : repmode)
rg = RemoveGrain(rep, mode=clmode, modeU=(_grey) ? -1 : clmode)
clp = TemporalRepair(rg, rep, grey=_grey, smooth=_smooth)
return clp
}
# =============================================================================
#
#
function RemoveDust(clip clp, int "_mode", bool "_grey")
{
_grey = Default(_grey, false)
_mode = Default(_mode, 5)
_smooth = 0
repmode = 2
_modeU = (_grey) ? -1 : repmode
clensed = Clense(clp, grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU=_modeU )
rg = RemoveGrain(rep, mode=_mode, modeU=_modeU)
clp = TemporalRepair(rg, rep, grey=_grey, smooth=_smooth)
return clp
}
function RemoveDustMC(clip clp, int "mode", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
mode = Default(mode, 5)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDust(clp, _mode=mode, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function RemoveDust2(clip clp, int "repmode", int "_smooth", bool "_grey")
{
_grey = Default(_grey, false)
repmode = Default(repmode, 16)
_smooth = Default(_smooth, 0)
clmode = 4
clensed = Clense(clp, grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU=(_grey) ? -1 : repmode)
rg = RemoveGrain(rep, mode=clmode, modeU=(_grey) ? -1 : clmode)
clp = TemporalRepair(rg, rep, grey=_grey, smooth=_smooth)
return clp
}
function RemoveDustMC2(clip clp, int "mode", int "smooth", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
mode = Default(mode, 16)
smooth = Default(smooth, 0)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDust2(clp, repmode=mode, _smooth=smooth, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function RemoveDust3(clip clp, int "repmode", int "TRsmooth", int "RGmode", int "RGmodeChroma", bool "_grey")
{
_grey = Default(_grey, false)
repmode = Default(repmode, 9)
TRsmooth = Default(TRsmooth, 0)
RGmode = Default(RGmode, 2) # 1, 2, 5, 17, 18
RGmodeChroma = Default(RGmodeChroma, 1) # 1, 2, 5, 17, 18
clensed = Clense(clp, grey=_grey)
rep = Repair(clensed, clp, mode=repmode, modeU=(_grey) ? -1 : repmode)
rg = RemoveGrain(rep, mode=RGmode, modeU=(_grey) ? -1 : RGmodeChroma, modeV=(_grey) ? -1 : RGmodeChroma)
clp = TemporalRepair(rg, rep, grey=_grey, smooth=TRsmooth)
return clp
}
function RemoveDustMC3(clip clp, int "mode", int "smooth", int "RGmode", int "RGmodeChroma", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
mode = Default(mode, 9)
smooth = Default(smooth, 0)
RGmode = Default(RGmode, 2) # 1, 2, 5, 17, 18
RGmodeChroma = Default(RGmodeChroma, 1) # 1, 2, 5, 17, 18
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDust3(clp, repmode=mode, TRsmooth=smooth, RGmode=RGmode, RGmodeChroma=RGmodeChroma, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
Jenyok
14th September 2012, 16:07
RemoveDust functions continuos...
.
# =============================================================================
#
#
function LRemoveDust_YUY2(clip clp, int "clmode", int "limit")
{
clmode = Default(clmode, 17)
limit = Default(limit, 2)
repmode = 2
clensed = Clense(clp, grey=true)
rep = Repair(clensed, clp, mode=repmode, modeU=-1)
rg = RemoveGrain(rep, mode=clmode, modeU=-1)
clp = LimitChange(rg, clp, limit, limitU=255)
return clp
}
function LRemoveDust_YUY2MC(clip clp, int "mode", int "limit", int "Vectors")
{
mode = Default(mode, 17)
limit = Default(limit, 2)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = LRemoveDust_YUY2(clp, clmode=mode, limit=limit)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function LRemoveDust_YV12(clip clp, int "clmode", int "limit")
{
clmode = Default(clmode, 17)
limit = Default(limit, 2)
repmode = 2
clensed = Clense(clp)
rep = Repair(clensed, clp, mode=repmode)
rg = RemoveGrain(rep, mode=clmode)
clp = LimitChange(rg, clp, limit)
return clp
}
function LRemoveDust_YV12MC(clip clp, int "mode", int "limit", int "Vectors")
{
mode = Default(mode, 17)
limit = Default(limit, 2)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = LRemoveDust_YV12(clp, clmode=mode, limit=limit)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function LRemoveDust(clip clp, int "_mode", int "limit")
{
_mode = Default(_mode, 2)
limit = Default(limit, 4)
repmode = 2
LL = string(limit)
STR = "x " + LL + " + y < y " + LL + " - x " + LL + " - y > y " + LL + " + x ? ?"
clensed = Clense(clp)
rep = Repair(clensed, clp, mode=repmode)
rg = RemoveGrain(rep, mode=_mode)
trep = TemporalRepair(rg, rep)
trep2 = isyuy2(clp) ? trep.ConvertToYV12() : trep
input2 = isyuy2(clp) ? clp.ConvertToYV12() : clp
clp = (limit != 0) ? yv12lutxy(trep2, input2, yexpr=STR, U=2, V=2) : clp
clp = isyuy2(clp) ? clp.ConvertToYUY2().MergeChroma(trep) : clp
return clp
}
function LRemoveDustMC(clip clp, int "mode", int "limit", int "Vectors")
{
mode = Default(mode, 2)
limit = Default(limit, 4)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = LRemoveDust(clp, _mode=mode, limit=limit)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
#
function RemoveDustDirt(clip clp, int "repmode", int "clmode", int "limitY", int "limitUV")
{
repmode = Default(repmode, 16)
clmode = Default(clmode, 5)
limitY = Default(limitY, 5)
limitUV = Default(limitUV, 255)
clensed = Clense(clp)
repaired = Repair(clensed, clp, mode=repmode)
degrained = RemoveGrain(repaired, mode=clmode)
clp = mt_lutxy(degrained, clp, \
expr="x y - abs " + string(limitUV + 1) + " < x x y - 128 + 128 < y " + string(limitUV) + " - y " + string(limitUV) + " + ? ?", \
yexpr="x y - abs " + string(limity + 1) + " < x x y - 128 + 128 < y " + string(limity) + " - y " + string(limity) + " + ? ?", \
Y=3, U=3, V=3)
return clp
}
function RemoveDustDirtMC(clip clp, int "mode", int "clmode", int "limitY", int "limitUV", int "Vectors")
{
mode = Default(mode, 16)
clmode = Default(clmode, 5)
limitY = Default(limitY, 5)
limitUV = Default(limitUV, 255)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDustDirt(clp, repmode=mode, clmode=clmode, limitY=limitY, limitUV=limitUV)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
Jenyok
14th September 2012, 16:09
RemoveNoise functions...
.
#
#
# File: RemoveNoise.avsi
#
# Moution compensated RemoveNoise and variuos filters functions, used RemoveNoise
#
# Functions:
#
# function NullClip(clip clp)
#
# function RemoveNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", bool "sharp", float "csharpen", bool "_grey", int "Vectors")
#
# function HQ_Filter(clip clp, int "Vectors")
# function MQ_Filter(clip clp, int "Vectors")
# function LQ_Filter(clip clp, int "Vectors")
#
# function RemoveNoise_HQMC(clip clp, int "tlimit", int "rgrain", float "csharp", int "Vectors")
# function HQ_Filter2(clip clp, int "Vectors")
#
# function RemoveHighNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", float "csharp", bool "_grey", int "Vectors")
#
# function VLQ_Filter(clip clp, int "Vectors")
# function VLQ_Filter_Ultimate(clip clp, int "Vectors")
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FFT3DFILTER_20070220\fft3dfilter.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\ZZZ_OLD\DEEN_25_DLL_20030813\deen.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEBLOCK_25_DLL_20060214\deblock.dll")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SHARPFUNCTION_LIMITEDSHARPENFASTER\limitedsharpenfaster.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SEESAW\seesaw.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.avsi")
function NullClip(clip clp)
{
return BlankClip(clp, length=0)
}
# =============================================================================
#
#
function RemoveNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", bool "sharp", float "csharpen", \
bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
rdlimit = Default(rdlimit, 11)
rgrain = Default(rgrain, 2)
denoise = Default(denoise, 8)
sharp = (rgrain < 1) ? Default(sharp, true) : Default(sharp, false)
csharpen = (rgrain > 2) ? Default(csharpen, 0.17) : (rgrain > 1) ? Default(csharpen, 0.15) : Default(csharpen, 0.13)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
csharpen = (sharp) ? csharpen : csharpen + 0.08
_dgr = 0.45 + rgrain * 0.4
cbs = 8
cov = (cbs > 4) ? cbs / 4 : 0
ccf = cbs * cbs / 64
cpn = (denoise > 12) ? 50 * ccf : (denoise > 8) ? 58 * ccf : (denoise > 5) ? 66 * ccf : 72 * ccf
csh = (sharp) ? 1 : 0
super = MSuper(clp, pel=2, sharp=csh)
bvec3 = MAnalyse(super, isb=true, delta=3, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
bvec2 = MAnalyse(super, isb=true, delta=2, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
fvec2 = MAnalyse(super, isb=false, delta=2, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
fvec3 = MAnalyse(super, isb=false, delta=3, blksize=cbs, overlap=cov, truemotion=true, pnew=cpn)
backw3 = ((Vectors == 3) && (rdlimit > 13)) ? ((Vectors == 3) && (rdlimit > 20)) ? \
MFlow(clp, super, bvec3).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec3).Deblock(quant=16, aOffset=4, bOffset=4) : \
(Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = ((Vectors >= 2) && (rdlimit > 13)) ? ((Vectors >= 2) && (rdlimit > 20)) ? \
MFlow(clp, super, bvec2).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec2).Deblock(quant=16, aOffset=4, bOffset=4) : \
(Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = (rdlimit > 13) ? (rdlimit > 20) ? MFlow(clp, super, bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec1).Deblock(quant=16, aOffset=4, bOffset=4) : \
MFlow(clp, super, bvec1)
forw1 = (rdlimit > 13) ? (rdlimit > 20) ? MFlow(clp, super, fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec1).Deblock(quant=16, aOffset=4, bOffset=4) : \
MFlow(clp, super, fvec1)
forw2 = ((Vectors >= 2) && (rdlimit > 13)) ? ((Vectors >= 2) && (rdlimit > 20)) ? \
MFlow(clp, super, fvec2).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec2).Deblock(quant=16, aOffset=4, bOffset=4) : \
(Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = ((Vectors == 3) && (rdlimit > 13)) ? ((Vectors == 3) && (rdlimit > 20)) ? \
MFlow(clp, super, fvec3).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec3).Deblock(quant=16, aOffset=4, bOffset=4) : \
(Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirt2(clp, limit=rdlimit, rgrain=rgrain, _grey=_grey)
dnc = RemoveTempGrain(clp, rgrain)
dnc = (Vectors == 1) ? SelectEvery(dnc, 3, 1) : \
(Vectors == 2) ? SelectEvery(dnc, 5, 2) : \
SelectEvery(dnc, 7, 3)
dnc = (denoise == 0) ? dnc : NullClip(clp)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
dnc = (denoise == 0) ? dnc : MDegrain3(clp, super, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, \
thSAD=190 + 15 * denoise, thSCD1=230 + 5 * denoise)
vid_mo = dnc.VagueDenoiser(threshold=_dgr, chromaT=_dgr, nsteps=7, percent=75)
vid_mo = (rgrain == 1) ? vid_mo.RemoveGrain(1) : vid_mo.RemoveGrain(5)
dnc = dnc.ConditionalFilter(dnc, vid_mo, "(YDifferenceFromPrevious()+YDifferenceToNext())/AverageLuma()", "<", "0.3")
clp = clp.SeeSaw(dnc, Sstr=csharpen, Szp=12, SdampHi=20, bias=40)
return clp
}
# for slight noisy video or spot/dirt removing only
#
function HQ_Filter(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveNoiseMC(rdlimit=6, rgrain=1, denoise=0, Vectors=Vectors)
clp = clp.LimitedSharpenFaster(Smode=4, strength=18, overshoot=0, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# medium noise, higher grain:
#
function MQ_Filter(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveNoiseMC(rdlimit=10, rgrain=2, denoise=8, Vectors=Vectors)
clp = clp.LimitedSharpenFaster(Smode=4, strength=20, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# high noise or analog capture:
#
function LQ_Filter(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveNoiseMC(rdlimit=18, rgrain=3, denoise=14, Vectors=Vectors)
clp = clp.VagueDenoiser(threshold=0.6, nsteps=6, chromaT=0.6, percent=75)
clp = clp.deen("a3d", rad=3, thrY=3, thrUV=5, min=0.25, tthY=2, tthUV=3, scd=6)
clp = clp.LimitedSharpenFaster(Smode=4, strength=24, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
# =============================================================================
#
#
function RemoveNoise_HQMC(clip clp, int "tlimit", int "rgrain", float "csharp", int "Vectors")
{
tlimit = Default(tlimit, 4)
rgrain = Default(rgrain, 1)
csharp = (rgrain > 1) ? Default(csharp, 0.14) : Default(csharp, 0.13)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
cbs = 4
ccf = cbs * cbs / 64
cpn = (tlimit > 6) ? 70 * ccf : 75 * ccf
super = MSuper(clp, pel=2, sharp=1)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=cbs, overlap=4, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=cbs, overlap=4, truemotion=true, pnew=cpn)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
dnc = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
dnc = RemoveDirt_HQ(dnc, tlimit, rgrain)
dnc = (Vectors == 1) ? SelectEvery(dnc, 3, 1) : \
(Vectors == 2) ? SelectEvery(dnc, 5, 2) : \
SelectEvery(dnc, 7, 3)
clp = (csharp == 0) ? dnc : clp.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40)
return dnc
}
function HQ_Filter2(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveNoiseMC_HQ(tlimit=4, rgrain=1, Vectors=Vectors)
clp = clp.LimitedSharpenFaster(Smode=4, strength=15, overshoot=1, wide=false, ss_x=1.3, ss_y=1.3)
return clp
}
Jenyok
14th September 2012, 16:09
RemoveNoise functions continuos...
.
# =============================================================================
#
#
function RemoveHighNoiseMC(clip clp, int "rdlimit", int "rgrain", int "denoise", float "csharp", \
bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
rdlimit = Default(rdlimit, 24)
rgrain = Default(rgrain, 3)
denoise = Default(denoise, 15)
csharp = (rgrain > 2) ? Default(csharp, 0.32) : Default(csharp, 0.28)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
_dgr = 0.7 + rgrain * 0.5
cbs = 8
ccf = cbs * cbs / 64
cpn = (denoise > 12) ? 50 * ccf : 57 * ccf
super = MSuper(clp, pel=2, sharp=0)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=cbs, overlap=4, truemotion=true, pnew=cpn)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=cbs, overlap=4, truemotion=true, pnew=cpn)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=cbs, overlap=4, truemotion=true, pnew=cpn) : NullClip(clp)
backw3 = ((Vectors == 3) && (rdlimit > 20)) ? MFlow(clp, super, bvec3).Deblock(quant=22, aOffset=6, bOffset=6) : \
(Vectors == 3) ? MFlow(clp, super, bvec3).Deblock(quant=16, aOffset=4, bOffset=4) : NullClip(clp)
backw2 = ((Vectors >= 2) && (rdlimit > 20)) ? MFlow(clp, super, bvec2).Deblock(quant=22, aOffset=6, bOffset=6) : \
(Vectors >= 2) ? MFlow(clp, super, bvec2).Deblock(quant=16, aOffset=4, bOffset=4) : NullClip(clp)
backw1 = (rdlimit > 20) ? MFlow(clp, super, bvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, bvec1).Deblock(quant=16, aOffset=4, bOffset=4)
forw1 = (rdlimit > 20) ? MFlow(clp, super, fvec1).Deblock(quant=22, aOffset=6, bOffset=6) : \
MFlow(clp, super, fvec1).Deblock(quant=16, aOffset=4, bOffset=4)
forw2 = ((Vectors >= 2) && (rdlimit > 20)) ? MFlow(clp, super, fvec2).Deblock(quant=22, aOffset=6, bOffset=6) : \
(Vectors >= 2) ? MFlow(clp, super, fvec2).Deblock(quant=16, aOffset=4, bOffset=4) : NullClip(clp)
forw3 = ((Vectors == 3) && (rdlimit > 20)) ? MFlow(clp, super, fvec3).Deblock(quant=22, aOffset=6, bOffset=6) : \
(Vectors == 3) ? MFlow(clp, super, fvec3).Deblock(quant=16, aOffset=4, bOffset=4) : NullClip(clp)
clp = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveDirt2(clp, limit=rdlimit, rgrain=rgrain, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
dnc = MDegrain3(clp, super, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, thSAD=160 + 12 * denoise, \
thSCD1=255 + 4 * denoise)
vid_mo = dnc.VagueDenoiser(threshold=_dgr, chromaT=_dgr, nsteps=6, percent=75)
vid_mo = (rgrain == 1) ? vid_mo.RemoveGrain(1) : vid_mo.RemoveGrain(5)
dnc = dnc.ConditionalFilter(dnc, vid_mo, "(YDifferenceFromPrevious()+YDifferenceToNext())/AverageLuma()", "<", "0.3")
clp = ((csharp == 0) ? dnc : clp.SeeSaw(dnc, Sstr=csharp, Szp=12, SdampHi=20, bias=40))
return clp
}
function VLQ_Filter(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveHighNoiseMC(rdlimit=24, rgrain=3, denoise=16, csharp=0.3, Vectors=Vectors)
clp = clp.VagueDenoiser(threshold=1.0, nsteps=6, chromaT=1.2, percent=75)
clp = clp.deen("a3d", rad=3, thrY=4, thrUV=7, min=0.25, tthY=2, tthUV=3, scd=7)
clp = clp.LimitedSharpenFaster(Smode=4, strength=28, overshoot=1, wide=false, ss_x=1.2, ss_y=1.2)
return clp
}
function VLQ_Filter_Ultimate(clip clp, int "Vectors")
{
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
clp = clp.RemoveHighNoiseMC(rdlimit=24, rgrain=3, denoise=16, csharp=0.48, Vectors=Vectors)
clp = clp.fft3dfilter(sigma=1.2, sharpen=0.4, plane=4)
clp = clp.deen("a3d", rad=3, thrY=4, thrUV=7, min=0.25, tthY=2, tthUV=3, scd=7)
return clp
}
Jenyok
14th September 2012, 16:10
RemoveSpots functions...
.
#
#
# File: RemoveSpots.avsi
#
# RemoveSpots and moution compensated RemoveSpots functions
#
# Functions:
#
# function NullClip(clip clp)
#
# function RemoveSpots(clip clp, int "limit", bool "_grey")
# function RemoveSpotsMC(clip clp, int "limit", bool "_grey", int "Vectors")
#
# function RemoveSpotsMC2(clip clp, int "type", bool "show", int "Vectors")
#
# function RemoveSpotsMC3(clip clp, int "Vectors", int "Show")
#
# function RemoveSpotsMC4(clip clp, int "Vectors", int "Show")
#
# function RemoveSpotsMC5(clip clp, int "Vectors", int "Show")
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirts.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\repairt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINT-1_0\removegraint.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEDIRT_20050507\removedirt.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FLUXSMOOTH_25_DLL_20040729\fluxsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEFLICKER_25_DLL_20040816\deflicker.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DESPOT_3_6_1\despot.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MASKTOOLS-V2_0A48\mt_masktools-25.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MASKTOOLS-V1_5_8\masktools.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FFT3DFILTER_20070220\fft3dfilter.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEPAN_20061128\depan.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEPAN_20061128\depanestimate.dll")
(_use_VDub_ == true) ? LoadVirtualDubPlugin("C:\PROGRAM FILES\VIRTUALDUB 1.9.11\PLUGINS\spotremover.vdf", "SpotRemover", 11) : NOP()
function NullClip(clip clp)
{
return BlankClip(clp, length=0)
}
# =============================================================================
#
#
function RemoveSpots(clip clp, int "limit", bool "_grey")
{
_grey = Default(_grey, false)
limit = Default(limit, 16)
clmode = 17
clensed = Clense(clp, grey=_grey, cache=4)
sbegin = ForwardClense(clp, grey=_grey, cache=-1)
send = BackwardClense(clp, grey=_grey, cache=-1)
alt = Repair(SCSelect(clp, sbegin, send, clensed, debug=true), clp, mode=limit, modeU = _grey ? -1 : limit)
restore = Repair(clensed, clp, mode=limit, modeU = _grey ? -1 : limit)
clp = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, gmthreshold=70, dist=1, \
dmode=2, debug=false, noise=10, noisy=12, grey=_grey)
return clp
}
function RemoveSpotsMC(clip clp, int "limit", bool "_grey", int "Vectors")
{
_grey = Default(_grey, false)
limit = Default(limit, 16)
Vectors = Default(Vectors, 1)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
super = MSuper(clp, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(super, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(super, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(super, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(super, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1)
forw1 = MFlow(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3) : NullClip(clp)
clp = (Vectors == 1) ? interleave(backw1, clp, forw1) : \
(Vectors == 2) ? interleave(backw2, backw1, clp, forw1, forw2) : \
interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
clp = RemoveSpots(clp, limit=limit, _grey=_grey)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
# =============================================================================
#
# SpotRemover() function VirtualDub
#
function RemoveSpotsMC2(clip clp, int "type", bool "show", int "Vectors")
{
# Constant
#
TypeMax = 4
# Variables
#
type = Default(type, 1)
show = Default(show, false)
Vectors = Default(Vectors, 2)
type = (type < 1) ? 1 : (type > TypeMax) ? TypeMax : type
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
# create auxialiary smooth clip for easier motion detection
#
filter = clp.DeFlicker(noise=6).Blur(1.58)
# this is for internal use by MVtools functions. MVtools' version must be 2.0 or higher.
#
super = MSuper(clp, pel=2, sharp=2)
superfi = MSuper(filter, pel=2, sharp=2)
# calculate the motion vectors
#
bvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=true, delta=3, blksize=8, overlap=4, search=3, truemotion=true) : NullClip(clp)
bvec2 = MAnalyse(superfi, isb=true, delta=2, blksize=8, overlap=4, search=3, truemotion=true)
bvec1 = MAnalyse(superfi, isb=true, delta=1, blksize=8, overlap=4, search=3, truemotion=true)
fvec1 = MAnalyse(superfi, isb=false, delta=1, blksize=8, overlap=4, search=3, truemotion=true)
fvec2 = MAnalyse(superfi, isb=false, delta=2, blksize=8, overlap=4, search=3, truemotion=true)
fvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=false, delta=3, blksize=8, overlap=4, search=3, truemotion=true) : NullClip(clp)
# create 6 additional clips: two predicted backward and two predicted forward
#
backw3 = (Vectors == 3) ? MCompensate(clp, super, bvec3) : NullClip(clp)
backw2 = (Vectors >= 2) ? MCompensate(clp, super, bvec2) : NullClip(clp)
backw1 = MCompensate(clp, super, bvec1)
forw1 = MCompensate(clp, super, fvec1)
forw2 = (Vectors >= 2) ? MCompensate(clp, super, fvec2) : NullClip(clp)
forw3 = (Vectors == 3) ? MCompensate(clp, super, fvec3) : NullClip(clp)
# clpdeg = (Vectors <= 2) ? MDegrain2(clp, superfi, bvec1, fvec1, bvec2, fvec2, plane=4, thsad=400) : \
# MDegrain3(clp, superfi, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, plane=4, thsad=400)
clpdeg = clp
# combine the 5 frames (2 + 1 + 2), the central one undergoes the degrain filter
# combine the 3 frames (1 + 1 + 1), the central one undergoes the degrain filter
# combine the 7 frames (3 + 1 + 3), the central one undergoes the degrain filter
#
clp = (Vectors == 1) ? interleave(backw1, clpdeg, ff1) : \
(Vectors == 2) ? interleave(backw2, backw1, clpdeg, forw1, forw2) : \
interleave(backw3, backw2, backw1, clpdeg, forw1, forw2, forw3)
# run SpotRemover over each block of 5 (3, 7) frames
# removing spots only, no smoothing
# !!! change to DSD:0 to turn the debug mode off
# !!! change to DSD:1 to turn the debug mode on
#
# SSI - Smooth Strength Intensity
# SSC - Smooth Strength Color
# SKW - Smooth Kernel Width
# SLI - Smooth Locking level for Intensity
# SLC - Smooth Locking level for Color
# SLD - Smooth Locking Debug
# DLS - Detect Level for Spot detection
# DLC - Detect Level for Clearance
# DPC - Detect Perimeter Clearance
# DSF - Detect Spot Fullness factor
# DSD - Detect Spot Debug
# MTX - Motion Table X (columns)
# MTY - Motion Table Y (columns)
# MTL - Motion Table Level to flag cells
# MDX - Motion Distance X
# MDY - Motion Distance Y
# MIH - Motion Interrupted History
# CBR - Color BRightness
# CCO - Color COntrast
# CSA - Color SAturation
# CBA - Color Balance
# CSR - Color Shift Red
# CSB - Color Shift Blue
# FCI - Frame Control Interlaced
clp = clp.ConvertToRGB32()
clp = (type == 1) ? (show == false) ? \
clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:16 DPC:16 DSF:0 DSD:0 MTX:16 MTY:12 MTL:25 MDX:1 MDY:1 MIH:0", "") : \
clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:16 DPC:16 DSF:0 DSD:1 MTX:16 MTY:12 MTL:25 MDX:1 MDY:1 MIH:0", "") : clp
clp = (type == 2) ? (show == false) ? \
clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:15 DPC:14 DSF:1 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : \
clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:24 DLC:15 DPC:14 DSF:1 DSD:1 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : clp
clp = (type == 3) ? (show == false) ? \
clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:10 DSF:2 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : \
clp.SpotRemover("SSI:0 SSC:-5 SKW:3 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:10 DSF:2 DSD:1 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : clp
clp = (type == 4) ? (show == false) ? \
clp.SpotRemover( "SSI:7 SSC:0 SKW:5 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:16 DSF:2 DSD:0 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : \
clp.SpotRemover( "SSI:7 SSC:0 SKW:5 SLI:2 SLC:2 SLD:0 DLS:26 DLC:18 DPC:16 DSF:2 DSD:1 MTX:16 MTY:12 MTL:22 MDX:1 MDY:1 MIH:0", "") : clp
# clp = clp.ConvertBackToYUY2()
clp = clp.ConvertToYV12()
# discard extra frames, keep only the central one
#
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
# compensate for the SpotRemover lag. We will loose the last frame in the movie, but the audio will be in sync
#
# clp = clp.Trim(1, 0) # Maybe not needed
# enhance the contrast (optional)
#
# clp = clp.ColorYUV(gain_y=0, off_y=10, gamma_y=0, cont_y=80, cont_u=0, cont_v=0)
return clp
}
Jenyok
14th September 2012, 16:12
RemoveSpots functions continuos...
.
global Width2 = 768
global Height2 = 576
# =============================================================================
#
# DeSpot() function
#
function RemoveSpotsMC3(clip clp, int "Vectors", int "Show")
{
# Constants
#
_thSCD1 = 400
Vectors = Default(Vectors, 3)
Show = Default(Show, 0)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
Show = (Show < 0) ? 0 : (Show > 2) ? 2 : Show
filter = DeFlicker(clp, border=150, percent=70, lmin=5, lmax=240)
super = MSuper(clp, pel=2, sharp=2)
superfi = MSuper(filter, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=true, delta=3, blksize=8, overlap=4, truemotion=true)
bvec2 = (Vectors >= 2) ? MAnalyse(superfi, isb=true, delta=2, blksize=8, overlap=4, truemotion=true)
bvec1 = MAnalyse(superfi, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(superfi, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(superfi, isb=false, delta=2, blksize=8, overlap=4, truemotion=true)
fvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=false, delta=3, blksize=8, overlap=4, truemotion=true)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3, thSCD1=_thSCD1) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2, thSCD1=_thSCD1) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1, thSCD1=_thSCD1)
forw1 = MFlow(clp, super, fvec1, thSCD1=_thSCD1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2, thSCD1=_thSCD1) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3, thSCD1=_thSCD1) : NullClip(clp)
# clpdeg = (Vectors <= 2) ? MDegrain2(clp, superfi, bvec1, fvec1, bvec2, fvec2, plane=4, thsad=400) : \
# MDegrain3(clp, superfi, bvec1, fvec1, bvec2, fvec2, bvec3, fvec3, plane=4, thsad=400)
clpdeg = clp
clp = (Vectors == 1) ? Interleave(backw1, clpdeg, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clpdeg, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clpdeg, forw1, forw2, forw3)
clp = clp.Deflicker(percent=99, lag=5, scene=15, info=false)
# ==== большие черные пятна ====
clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
pwidth=50, pheight=50, ranked=true, sign=1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
# ==== большие белые пятна ====
clp = clp.DeSpot(p1=10, mthres=8, p2=6, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, \
pwidth=100, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=0, color=true, mscene=40, minpts=0)
# ==== маленькие точки и пыль ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
pwidth=6, pheight=5, ranked=true, sign=0, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=2, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=10, p2=6, \
pwidth=720, pheight=576, ranked=true, sign=2, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
# ==== Маленькие компактные пятна ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
pwidth=10, pheight=10, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
# ==== линии, входящие в контакт с движением, избегите области движения ====
clp = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=16, interlaced=false, median=false, p1=15, p2=13, \
pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
# ====================================
clp = clp.DeSpot(p1=20, p2=4, pwidth=200, pheight=150, mthres=22, merode=33, sign=2, show=Show, seg=0, color=false, \
motpn=true, fitluma=true, mark_v=255)
clp = clp.DeSpot(p1=20, p2=12, pwidth=768, pheight=576, mthres=80, merode=33, sign=0, show=Show, seg=0, color=true, \
motpn=true, mark_v=255)
clp = clp.DeSpot(p1=12, p2=22, pwidth=100, pheight=100, mthres=22, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
color=true, motpn=true, mark_v=255)
clp = clp.DeSpot(p1=15, p2=1, pwidth=40, pheight=40, mthres=4, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
color=true, motpn=true, mark_v=255)
clp = clp.DeSpot(p1=35, p2=11, pwidth=250, pheight=250, mthres=23, merode=40, p1percent=1, sign=1, show=Show, seg=2,\
color=true, motpn=false, minpts=6, dilate=1, mscene=100, fitluma=true, blur=1, mark_v=255)
clp = clp.DeSpot(p1=22, p2=5, pwidth=100, pheight=140, mthres=11, merode=58, p1percent=25, sign=1, show=Show, seg=1, \
color=true, motpn=false, minpts=6, maxpts=1200, mwidth=7, mheight=5, dilate=2, mscene=90, fitluma=true, \
blur=2, ranked=true, interlaced=false, mark_v=255)
clp = clp.DeSpot(p1=30, p2=22, pwidth=400, pheight=300, mthres=20, merode=33, p1percent=10, sign=1, show=Show, seg=2, \
color=true, motpn=true, mark_v=255)
clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
show=Show, mark_v=255)
clp = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show, mark_v=255)
clp = clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, \
p1percent=5, mscene=98, merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, \
motpn=true, fitluma=true, blur=1, mark_v=255)
clp = clp.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, \
mscene=98, merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
clp = clp.Despot(p1=28, p2=8, mthres=45, pwidth=850, pheight=850, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, motpn=true, fitluma=true, \
blur=1, mark_v=255)
clp = clp.Despot(p1=25, p2=14, mthres=25, pwidth=555, pheight=555, minpts=3, dilate=3, p1percent=5, mscene=98, \
merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
# big black spots
# clp = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, show=Show, mark_v=255)
# thin white lines
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, show=Show, mark_v=255)
# thick hair lines (avoid real hair)
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, show=Show, mark_v=255)
# lines contacting motion, avoid motion areas
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, show=Show, mark_v=255)
# small dots and dust
# clp = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, show=Show, mark_v=255)
# Long horizontal scratches
# clp = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=true, show=Show, mark_v=255)
# Small compact spots
# clp = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=true, show=Show, mark_v=255)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
Jenyok
14th September 2012, 16:15
RemoveSpots functions continuos...
.
# =============================================================================
#
# DeSpot() function
#
function RemoveSpotsMC4(clip clp, int "Vectors", int "Show")
{
# Constants
#
_thSCD1 = 400
_ml = 100
Vectors = Default(Vectors, 1)
Show = Default(Show, 0)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
Show = (Show < 0) ? 0 : (Show > 2) ? 2 : Show
filter = FFT3Dfilter(clp, sigma=6, plane=4, bw=32, bh=32, ow=8, oh=8, bt=3)
super = MSuper(clp, pel=2, sharp=2)
superfi = MSuper(filter, pel=2, sharp=2)
bvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=true, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec2 = (Vectors >= 2) ? MAnalyse(superfi, isb=true, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
bvec1 = MAnalyse(superfi, isb=true, delta=1, blksize=8, overlap=4, truemotion=true)
fvec1 = MAnalyse(superfi, isb=false, delta=1, blksize=8, overlap=4, truemotion=true)
fvec2 = (Vectors >= 2) ? MAnalyse(superfi, isb=false, delta=2, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
fvec3 = (Vectors == 3) ? MAnalyse(superfi, isb=false, delta=3, blksize=8, overlap=4, truemotion=true) : NullClip(clp)
backw3 = (Vectors == 3) ? MFlow(clp, super, bvec3, thSCD1=_thSCD1) : NullClip(clp)
backw2 = (Vectors >= 2) ? MFlow(clp, super, bvec2, thSCD1=_thSCD1) : NullClip(clp)
backw1 = MFlow(clp, super, bvec1, thSCD1=_thSCD1)
forw1 = MFlow(clp, super, fvec1, thSCD1=_thSCD1)
forw2 = (Vectors >= 2) ? MFlow(clp, super, fvec2, thSCD1=_thSCD1) : NullClip(clp)
forw3 = (Vectors == 3) ? MFlow(clp, super, fvec3, thSCD1=_thSCD1) : NullClip(clp)
sadb = MMask(clp, bvec1, ml=_ml, gamma=1, kind=1, thSCD1=_thSCD1)
sadf = MMask(clp, fvec1, ml=_ml, gamma=1, kind=1, thSCD1=_thSCD1)
msadb = MT_Binarize(sadb, 20, upper=true)
msadf = MT_Binarize(sadf, 20, upper=true)
msad = MT_Logic(msadf, msadb, "or")
msad = MT_Expand(msad)
msadi = Interleave(msad, msad, msad)
clp = (Vectors == 1) ? Interleave(backw1, clp, forw1) : \
(Vectors == 2) ? Interleave(backw2, backw1, clp, forw1, forw2) : \
Interleave(backw3, backw2, backw1, clp, forw1, forw2, forw3)
# ==== большие черные пятна ====
clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
pwidth=50, pheight=50, ranked=true, sign=1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
# ==== большие белые пятна ====
clp = clp.DeSpot(p1=10, mthres=8, p2=6, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, \
pwidth=100, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=0, color=true, mscene=40, minpts=0, extmask=msadi)
# ==== толстые линии типа волос (избегают реальных волос) ====
clp = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=24, interlaced=false, median=false, p1=15, p2=13, \
pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
# ==== линии, входящие в контакт с движением, избегите области движения ====
clp = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=16, interlaced=false, median=false, p1=15, p2=13, \
pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0, extmask=msadi)
# ==== маленькие точки и пыль ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
pwidth=6, pheight=5, ranked=true, sign=0, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=2, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0, extmask=msadi)
clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=10, p2=6, \
pwidth=720, pheight=576, ranked=true, sign=2, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0, extmask=msadi)
# ==== Длинные горизонтальные затиры ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
pwidth=100, pheight=2, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
# ==== Маленькие компактные пятна ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
pwidth=10, pheight=10, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0, extmask=msadi)
# ====================================
clp = clp.DeSpot(p1=20, p2=4, pwidth=200, pheight=150, mthres=22, merode=33, sign=2, show=Show, seg=0, color=false, \
motpn=true, fitluma=true, extmask=msadi)
clp = clp.DeSpot(p1=20, p2=12, pwidth=768, pheight=576, mthres=80, merode=33, sign=0, show=Show, seg=0, color=true, \
motpn=true, extmask=msadi)
clp = clp.DeSpot(p1=12, p2=22, pwidth=100, pheight=100, mthres=22, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
color=true, motpn=true, extmask=msadi)
clp = clp.DeSpot(p1=15, p2=1, pwidth=40, pheight=40, mthres=4, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
color=true, motpn=true, extmask=msadi)
clp = clp.DeSpot(p1=35, p2=11, pwidth=250, pheight=250, mthres=23, merode=40, p1percent=1, sign=1, show=Show, seg=2,\
color=true, motpn=false, minpts=6, dilate=1, mscene=100, fitluma=true, blur=1, extmask=msadi)
clp = clp.DeSpot(p1=22, p2=5, pwidth=100, pheight=140, mthres=11, merode=58, p1percent=25, sign=1, show=Show, seg=1, \
color=true, motpn=false, minpts=6, maxpts=1200, mwidth=7, mheight=5, dilate=2, mscene=90, fitluma=true, \
blur=2, ranked=true, interlaced=false, extmask=msadi)
clp = clp.DeSpot(p1=30, p2=22, pwidth=400, pheight=300, mthres=20, merode=33, p1percent=10, sign=1, show=Show, seg=2, \
color=true, motpn=true, extmask=msadi)
clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
show=Show, extmask=msadi)
clp = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show, \
extmask=msadi)
clp = clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, \
p1percent=5, mscene=98, merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, \
motpn=true, fitluma=true, blur=1, extmask=msadi)
clp = clp.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, \
mscene=98, merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, \
extmask=msadi)
clp = clp.Despot(p1=28, p2=8, mthres=45, pwidth=850, pheight=850, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, motpn=true, fitluma=true, blur=1, \
mark_v=255, extmask=msadi)
clp = clp.Despot(p1=25, p2=14, mthres=25, pwidth=555, pheight=555, minpts=3, dilate=3, p1percent=5, mscene=98, \
merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255, \
extmask=msadi)
# big black spots
# clp = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, show=Show, extmask=msadi)
# thin white lines
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, show=Show, extmask=msadi)
# thick hair lines (avoid real hair)
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, show=Show, extmask=msadi)
# lines contacting motion, avoid motion areas
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, show=Show, extmask=msadi)
# small dots and dust
# clp = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, show=Show, extmask=msadi)
# Long horizontal scratches
# clp = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=true, show=Show, extmask=msadi)
# Small compact spots
# clp = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=true, show=Show, extmask=msadi)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
Jenyok
14th September 2012, 16:15
RemoveSpots functions continuos...
.
# =============================================================================
#
# DeSpot() function
#
function RemoveSpotsMC5(clip clp, int "Vectors", int "Show")
{
Vectors = Default(Vectors, 1)
Show = Default(Show, 0)
Vectors = (Vectors < 1) ? 1 : (Vectors > 3) ? 3 : Vectors
Show = (Show < 0) ? 0 : (Show > 2) ? 2 : Show
d = clp.DePanEstimate(trust=3, range=1)
clp = clp.DePanInterleave(data=d, prev=Vectors, next=Vectors)
# ==== большие черные пятна ====
clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
pwidth=50, pheight=50, ranked=true, sign=1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
# ==== большие белые пятна ====
clp = clp.DeSpot(p1=10, mthres=8, p2=6, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, \
pwidth=100, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=0, color=true, mscene=40, minpts=0)
# ==== маленькие точки и пыль ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=33, interlaced=false, median=false, p1=15, p2=8, \
pwidth=6, pheight=5, ranked=true, sign=0, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=2, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
clp = clp.DeSpot(mthres=8, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=10, p2=6, \
pwidth=720, pheight=576, ranked=true, sign=2, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
# ==== Маленькие компактные пятна ====
clp = clp.DeSpot(mthres=12, mwidth=7, mheight=5, merode=25, interlaced=false, median=false, p1=15, p2=8, \
pwidth=10, pheight=10, ranked=true, sign=-1, maxpts=0, p1percent=2, dilate=1, fitluma=true, \
blur=4, tsmooth=4, show=Show, mark_v=255, motpn=false, seg=2, color=true, mscene=40, minpts=0)
# ==== линии, входящие в контакт с движением, избегите области движения ====
clp = clp.DeSpot(mthres=13, mwidth=7, mheight=5, merode=16, interlaced=false, median=false, p1=15, p2=13, \
pwidth=140, pheight=100, ranked=true, sign=-1, maxpts=0, p1percent=10, dilate=1, fitluma=true, \
blur=1, tsmooth=0, show=Show, mark_v=255, motpn=false, seg=1, color=true, mscene=40, minpts=0)
# ====================================
clp = clp.DeSpot(p1=20, p2=4, pwidth=200, pheight=150, mthres=22, merode=33, sign=2, show=Show, seg=0, color=false, \
motpn=true, fitluma=true, mark_v=255)
clp = clp.DeSpot(p1=20, p2=12, pwidth=768, pheight=576, mthres=80, merode=33, sign=0, show=Show, seg=0, color=true, \
motpn=true, mark_v=255)
clp = clp.DeSpot(p1=12, p2=22, pwidth=100, pheight=100, mthres=22, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
color=true, motpn=true, mark_v=255)
clp = clp.DeSpot(p1=15, p2=1, pwidth=40, pheight=40, mthres=4, merode=25, p1percent=10, sign=0, show=Show, seg=1, \
color=true, motpn=true, mark_v=255)
clp = clp.DeSpot(p1=35, p2=11, pwidth=250, pheight=250, mthres=23, merode=40, p1percent=1, sign=1, show=Show, seg=2,\
color=true, motpn=false, minpts=6, dilate=1, mscene=100, fitluma=true, blur=1, mark_v=255)
clp = clp.DeSpot(p1=22, p2=5, pwidth=100, pheight=140, mthres=11, merode=58, p1percent=25, sign=1, show=Show, seg=1, \
color=true, motpn=false, minpts=6, maxpts=1200, mwidth=7, mheight=5, dilate=2, mscene=90, fitluma=true, \
blur=2, ranked=true, interlaced=false, mark_v=255)
clp = clp.DeSpot(p1=30, p2=22, pwidth=400, pheight=300, mthres=20, merode=33, p1percent=10, sign=1, show=Show, seg=2, \
color=true, motpn=true, mark_v=255)
clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
show=Show)
clp = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show)
clp = clp.DeSpot(sign=2, pwidth=Width2, pheight=Height2, p1=10, p2=6, mthres=8, tsmooth=4, seg=2, blur=4, p1percent=2, \
show=Show, mark_v=255)
clp = clp.DeSpot(p1=30, p2=15, pwidth=Width2, pheight=Height2, mthres=20, motpn=true, dilate=1, seg=1, show=Show, mark_v=255)
clp = clp.DeSpot(p1=30, p2=10, mthres=45, pwidth=Width2, pheight=Height2, minpts=10, dilate=0, ranked=true, \
p1percent=5, mscene=98, merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, \
motpn=true, fitluma=true, blur=1, mark_v=255)
clp = clp.DeSpot(p1=25, p2=14, mthres=25, pwidth=Width2, pheight=Height2, minpts=3, dilate=3, p1percent=5, \
mscene=98, merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
clp = clp.Despot(p1=28, p2=8, mthres=45, pwidth=850, pheight=850, minpts=10, dilate=0, ranked=true, p1percent=5, mscene=98, \
merode=35, mwidth=20, mheight=10, sign=2, show=Show, seg=0, color=true, motpn=true, fitluma=true, blur=1, \
mark_v=255)
clp = clp.Despot(p1=25, p2=14, mthres=25, pwidth=555, pheight=555, minpts=3, dilate=3, p1percent=5, mscene=98, \
merode=35, sign=-2, show=Show, seg=2, color=true, motpn=true, fitluma=true, blur=1, mark_v=255)
# big black spots
# clp = clp.DeSpot(sign=1, pwidth=45, pheight=45, p1=15, p2=8, mthres=8, color=true, show=Show)
# thin white lines
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=8, p2=1, mthres=5, show=Show)
# thick hair lines (avoid real hair)
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=24, show=Show)
# lines contacting motion, avoid motion areas
# clp = clp.DeSpot(sign=-1, pwidth=140, pheight=100, p1=15, p2=13, mthres=13, merode=16, seg=1, show=Show)
# small dots and dust
# clp = clp.DeSpot(pwidth=6, pheight=5, p1=15, p2=8, mthres=12, tsmooth=2, show=Show)
# Long horizontal scratches
# clp = clp.DeSpot(sign=-1, pwidth=100, pheight=2, p1=15, p2=8, mthres=12, color=true, show=Show)
# Small compact spots
# clp = clp.DeSpot(sign=-1, pwidth=10, pheight=10, p1=15, p2=8, mthres=12, color=true, show=Show)
clp = (Vectors == 1) ? SelectEvery(clp, 3, 1) : \
(Vectors == 2) ? SelectEvery(clp, 5, 2) : \
SelectEvery(clp, 7, 3)
return clp
}
johnmeyer
12th October 2012, 22:26
I posted an update to my version of VideoFred's script over in his newer film restoration thread:
Capturing and restoring old 8mm films - Newest version of my variation of Fred's Script (http://forum.doom9.org/showthread.php?p=1595606#post1595606)
juliuskarli
8th December 2012, 15:17
hey.
i am totally new with virtualdub and avisynth. but i want to try this scripts. has anybody a good walkthrough? or tutorials? i just want to put my digitalized 8mm films into this powerful tool.
thank you,
jules
videoFred
10th December 2012, 07:50
Hi Jules,
You are welcome here. :)
Please learn some Avisynth basics first, before using my script.
many greetings,
Fred.
juliuskarli
11th December 2012, 17:08
hey. thank you fred.
i just worked on the basics and can run the scripts via virtualdubmod. very nice!
just on the output i can`t get rid of this "dual screen" and the yellow text on it ... ?
where can i turn this off?
thank you very much
videoFred
13th December 2012, 09:10
Hi Jules,
:readfaq:
;)
Fred.
papcom
5th February 2013, 21:06
Big Thank You for Your Scripts and Your efforts.
I am new with AVISynth Scripts but have some experience with VirtualDub, I can run Your scripts but I always have the comparison mode dual window as the videoresult at the rendered output.
I did not find out how to change this in order that I have my 720 x 576 pixel output.
You wrote that one has to read the FAQ to find out about this item. But Where is the FAQ? In the package with Your scripts there are 3 helpfiles but no further FAQ.
Thank You for the hint.
fpp
5th February 2013, 21:13
Near the beginning of the script, where all the variables are declared, you must change the
result = ...
line and set the value according to what you want to see.
The different result values are described inside the script.
HTH,
Fred (the other one)
papcom
5th February 2013, 21:28
thank You @fpp - I have seen this line but I did not check the relation between e.g. "resultS2" und "result2" - Now it's clear, thanks a lot for the hint.
papcom
7th February 2013, 14:29
I tried these Scripts on 25p uncompressed video from frame synchronized Filmtransfer. It worked very well and gives quite
interesting results. I am not very well into Avysynth and programming but I understand partially what's going on.
Anyway I cannot find an easy solution when I want to mute out or add certain functions in the script. E.G. If I would like to "skip" the stabilizer oder if I would like to adapt the script for 1080P Video (1920x1080pixel). Or otherwise add a horizontal flip function, or adapt the script for 25 fps Output.
Is anybody willing to help me finding the appropriate changements in the script in order to achive my goals? Thank You very much.
juliuskarli
18th February 2013, 16:57
hey fred.
would it be possible to add (film)grain to the footage? is there a plugin for this? can you add it to your scripts?
it would be great to add a script line where a videofile with realgrain is located on your harddisk and is appending to the 8mm footage.
this would avoid and hide artefacts and add a little bit of history ;)
this would be so great fred :)
thnx jules
basil3w
18th March 2013, 16:25
Here's what I hope will wind up as a totally Noob question:
I wish to post-process some 8mm to avi files that I have captured and that are currently in raw form. When I was looking
for ideas for my capture machine I found examples of VideoFred's capture and process work,(Wow!). Working from there, I
finally tracked down this forum and the amazing work you people are doing. Long story short: I was familiar with
VirturalDubMod but decided to take Fred's advice and learn some AviSynth basics. After doing that I downloaded
VirturaFred's scripts and the bottom seemed to fall out...
I installed the folder per Fred's instructions, qued up a small .avi, edited the source clip line and gave the .avs file
a go in VDubMod. I immediately received an Avisynth Open Failure message:
LoadPlugin: unable to load "plugins/removegrain.dll" (C:\Fred\20Film_Restoring_vs_06_2012
\01_A_Film_Restoring_Frame_Interpolation.avs, line 132)
I tried the other scripts and got the same error in scripts b and c, but received a similar message for warpsharp.dll in
script d, (script e seemed to work just fine). I noticed that script d didn't contain removegrain.dll, so I went back to
script a and commented out the loadplugin line for removegrain.dll. I ran that and got the same error for removedirt.dll,
I commented that line out and received the same error for warpsharp.dll.....
The other plugins from the plugin subdirectory appear to be loading and fuctioning normally but not removegrain,
removedirt or warpsharp. (I've read that removedirt has a problematic history but no one has commented on this forum
regarding any problems the plugin included with Fred's script package).
I've scoured the web looking at the AviSynth and VDub FAQ's, troubleshooters and tutorials, I've Googled for similar
problems but no luck. I've uninstalled and removed and reinstalled Avisynth, VDubMod and Fred's download, run a good
registry cleaner, tried both AviSynth 2.58 and 2.6 and the avisynth.dll is in the System32 folder. My machine (Win XPPro) runs fine, virus free and no other problems.
I know you guys are busy solving real video processing problems, but I seem to have hit the wall. If anyone has had a
similar problem or has a suggestion, I'd really appreciate the help!
Thanks,
-George
StainlessS
18th March 2013, 16:41
RemoveGrain has dependency on MSVCR71.dll from Visual Studio Toolkit 3
I normally just copy a dll of that name into system32 (although MS advise is to have it in the
local directory of the program that requires it)
The one I normally use it 348,160 bytes in size, do a search on your 'Programs Files' folder, you are likely
to find many copies (of perhaps differing sizes) there.
EDIT: Removedirt has same dependency, although Warpsharp does not (leastwise not my version).
Also, some plugs require AVSRecursion.dll in System32, not sure if RemoveGrain et al is one of them (EDIT: No its not).
Not sure if used in Fred's script but, other filters (FFT3DFilter and dfttest) need fftw3.dll and libfftw3f-3.dll in System32,
they are actually the same dll but named differently.
basil3w
18th March 2013, 21:00
StainlesS-
Thanks so much for the quick reply! I checked on the MSVCR70.dll file and it IS in the system32 folder (344,064 bytes). The fftw3.dll is in Fred's scripts folder, the libfftw3-3 is not. I checked, but did not find AVSRecursion.dll file in System32.
I'm willing to re-format and reinstall Windows, but at this point I'm really not sure that is where the problem lies... I'll keep on trying!
Thanks again for your suggestion!
-George
StainlessS
18th March 2013, 21:19
MSVCR70.dll is I think from VS Dot Net 2002, not the correct one, ie MSVCR71.dll is required one.
from Docs/english/faq.htm
WarpSharp, Xsharpen, UnsharpMask, KenKunNR, KenKunNRT, UVTimingH, UVTimingV, LoadAviUtlInputPlugin, LoadAviUtlFilterPlugin, ConvertYUY2ToAviUtlYC, ConvertAviUtlYCToYUY2, EraseGhost, SearchGhost, EraseGhostV, SearchGhostV, Auto24FPS, AutoDeint, FrameCache, AVIEncodeVideo, LoadPluginEx (by our Japanese friend): Ported VirtualDub filters and AviUtl filters. Some documentation can be found [here]. You need to copy the [msvcp71.dll/msvcr71.dll] (Microsoft C Runtime Library, v7) to your windows system directory. [YV12, YUY2]
http://www.geocities.com/wilbertdijkhof/71.cab
EDIT: Leave MSVCR70.dll one alone, it is required for something else.
DO NOT REFORMAT, just need to sort out the requisite dll's.
johnmeyer
18th March 2013, 23:35
When you unzip the files from Fred's zip file, you must preserve all the paths in the Zip file.
As an alternative, you can modify the script to explicitly load each DLL (i.e., give the full disk/path).
As a third alternative, you can put all the DLLs into whatever folder you have designated as the default AVISynth folder.
basil3w
19th March 2013, 02:31
StainlessS-
You are the MAN! Thank You so very much! I sourced those msvcr_71 files and dropped them in the System32 folder and it was 'Off to the Races!'. Fred's script fired right up! I am very excited to be able to start my new learning process, (I apologize in advance for the 'new' questions I'm sure to have).
I truly appreciate what you did for me, you didn't have to stop what you were doing and do the research for a stranger, but you did -Thanks!
Now I'll spend a few hours learning...
-George
basil3w
19th March 2013, 02:43
JohnMeyer-
Thanks very much for your suggestions.
I did keep Fred's file structure intact.
I didn't think of absolute addressing (good idea!)
I did try putting removegrain.dll into the avisynth plugin subfolder but it still didn't seem to work.
This forum seems to be populated by a bunch of very knowledgeable (and friendly), members!
-George
StainlessS
19th March 2013, 12:46
basil3w,
See here for Depends.exe (part of an MS package) which shows you what dll's an executable has dependence
upon, its quite handy to have (normally comes with full VS).
Some plugins depend upon other C++ runtimes, eg VS 2005, 2008 & 2010 (no doubt 2012 in future)
and seem rarely to point out their dependency in docs.
http://support.microsoft.com/kb/198038
EDIT: Here is a link to the latest version, Vista+W7 compatible, + 64bit versions:
http://www.dependencywalker.com/ Get This one.
basil3w
20th March 2013, 04:35
StainlessS-
An excellent link, you treat me all too well!
Many Thanks,
-George
Jenyok
20th March 2013, 06:36
There are some questions to you.
.
There is a function RemoveGrain(mode=17) .
.
Could I use function FFT3dFilter(...) instead of function RemoveGrain(mode=17) to achive equal result of function RemoveGrain(mode=17) (result FF3dFilter(...) = result RemoveGrain(mode=17)) ?
Which parameters and values of those parameters could I use in function FFT3dFilter(...) to achive this result ?
.
.
There are another similar questions.
.
There is a function RemoveGrain(mode=1) .
There is a function RemoveGrain(mode=2) .
There is a function RemoveGrain(mode=3) .
There is a function RemoveGrain(mode=5) .
.
result FF3dFilter( ??? ) = result RemoveGrain(mode=1) ?
Parameters and values of those parameters to function FFT3dFiler() in this case ?
.
result FF3dFilter( ??? ) = result RemoveGrain(mode=2) ?
Parameters and values of those parameters to function FFT3dFiler() in this case ?
.
result FF3dFilter( ??? ) = result RemoveGrain(mode=3) ?
Parameters and values of those parameters to function FFT3dFiler() in this case ?
.
result FF3dFilter( ??? ) = result RemoveGrain(mode=5) ?
Parameters and values of those parameters to function FFT3dFiler() in this case ?
.
FFT3dFilter( ??? ) similar to and another "mode=" of RemoveGrain() function ?
mode=7
mode=9
mode=11
mode=19
.
Thanks.
.
egekhter
21st March 2013, 20:00
Does anybody know how to preserve 4:2:2 color space through a modification of the script? I capture film in 4:2:2 and the script's functions have to convert the video file to 4:2:0 in order to work with the plugins, so just wondering what would be involved in getting updated plugins that work with 4:2:2 (or 4:4:4).
johnmeyer
22nd March 2013, 00:06
Does anybody know how to preserve 4:2:2 color space through a modification of the script? I capture film in 4:2:2 and the script's functions have to convert the video file to 4:2:0 in order to work with the plugins, so just wondering what would be involved in getting updated plugins that work with 4:2:2 (or 4:4:4).I sent over half a dozen private emails to you on this subject. As I said in those emails, you can replace the YV12 with YUY2 conversions. After I sent my script, which I tested, you then had problems making it work with plugins on your system. It worked fine on my computer with the plugins I use, so I think you can get it working. I provided the exact version of those plugins in my version of the film restoration script that I posted here:
Capturing and restoring old 8mm films (http://forum.doom9.org/showthread.php?p=1595608#post1595608)
So, I have provided the answer, and if you use my version of the script, I'm pretty sure you can get it to work.
I also should mention that your film capture setup will have to be extraordinarily good in order to tell the difference. This is because there are so many other, much more diabolical, color issues when transferring from various film emulsions into video. You almost always have to do extensive gamma and color correction, and the issues surrounding those conversions will swamp whatever slight color fidelity increase you get from maintaining 4:2:2 throughout.
Jenyok
22nd March 2013, 04:56
Thera are some ConvertFPS() functions...
Begin...
.
#
# File: ConvertFPS.avsi
#
# various functions to convert FPS
#
#
# Last editing date: 20.03.2013 year
#
#
#
# function ConvertMFlowFPSOriginal(clip clp, int "numerator", int "denominator")
# function ConvertMFlowFPS(clip clp, int "numerator", int "denominator")
# function ConvertMFlowFPS2(clip clp, int "numerator", int "denominator")
# function ConvertMFlowFPS3(clip clp, int "numerator", int "denominator")
# function ConvertSmoothFPS2(clip clp, int "numerator", int "denominator")
# function pelclipfix(Clip clp)
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
#LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\EEDI3\eedi3.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\NNEDI3\nnedi3.dll")
#
# ConvertMFlowFPSOriginal() Original function ...
#
function ConvertMFlowFPSOriginal(clip clp, int "numerator", int "denominator")
{
# Defaults
#
numerator = Default(numerator, 2)
denominator = Default(denominator, 1)
# Here is code of function...
#
last = clp
fps_super = MSuper(last, hpad=8, vpad=8, rfilter=4)
fps_backward = MAnalyse(fps_super, isb=true, blksize=16, overlap=4, search=5, searchparam=3, dct=5)
fps_forward = MAnalyse(fps_super, isb=false, blksize=16, overlap=4, search=5, searchparam=3, dct=5)
fps_backward1 = MRecalculate(fps_super, fps_backward, blksize=8, overlap=2, search=3, searchparam=1, dct=5)
fps_forward1 = MRecalculate(fps_super, fps_forward, blksize=8, overlap=2, search=3, searchparam=1, dct=5)
return (MFlowFps(fps_super, fps_backward1, fps_forward1, \
num=FramerateNumerator(last) * numerator, \
den=FramerateDenominator(last) * denominator, \
mask=2, ml=10000))
}
#
# ConvertMFlowFps() function...
#
function ConvertMFlowFPS(clip clp, int "numerator", int "denominator")
{
# Constants
# Change those constants to tune for the best result of interpolation
# Constant
# MSuper()
#
hpad = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
vpad = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
pel = 2 # default=2 !changed 4 -> 2
sharp = 2 # default=2 !!!
rfilter = 4 # default=2
# Constant
# MAnalyse()
#
blkh = 16 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
blkv = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
overlap = 4 # Maybe 2, 4, 8, 16, !!! maybe blkh/2 or litle !!! Change this constant for best tuning !!!
overlapV = 2 # Maybe 2, 4, 8, 16, !!! maybe blkv/2 or litle !!! Change this constant for best tuning !!!
search = 5 # default=4
searchparam = 3 # default=2
dct = 5 # default=0
plevel = 2 # default=0
truemotion = false # default=true
badrange = (-24) # default=24
lambda = 100 * blkh * blkv / 64
lsad = 400 * blkh * blkv / 64
# Constant
# MRecalculate()
#
blkhR = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
blkvR = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
overlapR = 2 # Maybe 2, 4, 8, 16, !!! maybe blkhR/2 or litle !!! Change this constant for best tuning !!!
overlapVR = 2 # Maybe 2, 4, 8, 16, !!! maybe blkvR/2 or litle !!! Change this constant for best tuning !!!
searchR = 3 # default=4
searchparamR = 1 # default=2
lambdaR = 100 * blkhR * blkvR / 64
# Constant
# MFlowFps()
#
isse = true
thSCD1 = 320 # 300, 1500, 100, default=400
thSCD2 = 128 # 128, 130, 130, default=130
# Contour artifacts suppression / Подавление контурных артефактов
# Simple masking / Простое маскирование (mask = 0)
# Simple masking + Static vectors / Простое + Статические вектора (mask = 1)
# Simple masking + Vectors of related frames / Простое + Вектора смежных кадров (mask = 2)
#
mask = 2
# Artifact suppression level / Степень подавления артефактов
# Light / Легкая (ml = 100)
# Medium / Средняя (ml = 500)
# High / Высокая (ml = 2500)
# Huge / Нереальная (ml = 10000)
#
ml = 10000
# Defaults
#
numerator = Default(numerator, 2)
denominator = Default(denominator, 1)
# Here is code of function...
#
last = clp
pelclip = pelclipfix(last)
fps_super = MSuper(last, hpad=hpad, vpad=vpad, rfilter=rfilter, pel=pel, sharp=sharp, pelclip=pelclip)
fps_backward = MAnalyse(fps_super, isb=true, blksize=blkh, blksizeV=blkv, overlap=overlap, overlapV=overlapV, \
search=search, searchparam=searchparam, dct=dct, truemotion=truemotion, \
lambda=lambda, lsad=lsad, plevel=plevel, badrange=badrange)
fps_forward = MAnalyse(fps_super, isb=false, blksize=blkh, blksizeV=blkv, overlap=overlap, overlapV=overlapV, \
search=search, searchparam=searchparam, dct=dct, truemotion=truemotion, \
lambda=lambda, lsad=lsad, plevel=plevel, badrange=badrange)
fps_backward1 = MRecalculate(fps_super, fps_backward, blksize=blkhR, blksizeV=blkvR, overlap=overlapR, overlapV=overlapVR, \
search=searchR, searchparam=searchparamR, dct=dct, truemotion=truemotion, lambda=lambdaR)
fps_forward1 = MRecalculate(fps_super, fps_forward, blksize=blkhR, blksizeV=blkvR, overlap=overlapR, overlapV=overlapVR, \
search=searchR, searchparam=searchparamR, dct=dct, truemotion=truemotion, lambda=lambdaR)
# function MFlowFPS(clip source, clip super, clip mvbw, clip mvfw, int "num", int "den", int "mask", \
# float "ml", bool "blend", int "thSCD1", int "thSCD2", bool "isse", bool "planar")
#
return (MFlowFps(fps_super, \
fps_backward1, \
fps_forward1, \
num = FramerateNumerator(last) * numerator, \
den = FramerateDenominator(last) * denominator, \
mask = mask, \
ml = ml, \
blend = true, \
thSCD1 = thSCD1, \
thSCD2 = thSCD2, \
isse = isse, \
planar = false))
}
#
# ConvertMFlowFps2() function...
# There are Four (4) MRecalculate function.
#
function ConvertMFlowFPS2(clip clp, int "numerator", int "denominator")
{
# Constants
# Change those constants to tune for the best result of interpolation
# Constant
# MSuper()
#
hpad = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
vpad = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
pel = 2 # default=2, !changed 4 -> 2
sharp = 2 # default=2 !!!
rfilter = 4 # default=2
# Constant
# MAnalyse()
#
blkh = 16 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
blkv = 16 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
overlap = 8 # Maybe 2, 4, 8, 16, !!! maybe blkh/2 or litle !!! Change this constant for best tuning !!!
overlapV = 8 # Maybe 2, 4, 8, 16, !!! maybe blkv/2 or litle !!! Change this constant for best tuning !!!
search = 3 # default=4
searchparam = 3 # default=2
dct = 10 # default=0
plevel = 0 # default=0
truemotion = true # default=true
badrange = (-24) # default=24
lambda = 100 * blkh * blkv / 64
lsad = 400 * blkh * blkv / 64
# Constant
# MRecalculate()
#
blkhR = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
blkvR = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
blkhR2 = 4 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
blkvR2 = 4 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
overlapR = 4 # Maybe 2, 4, 8, 16, !!! maybe blkhR/2 or litle !!! Change this constant for best tuning !!!
overlapVR = 4 # Maybe 2, 4, 8, 16, !!! maybe blkvR/2 or litle !!! Change this constant for best tuning !!!
overlapR2 = 2 # Maybe 2, 4, 8, 16, !!! maybe blkhR/2 or litle !!! Change this constant for best tuning !!!
overlapVR2 = 2 # Maybe 2, 4, 8, 16, !!! maybe blkvR/2 or litle !!! Change this constant for best tuning !!!
searchR = 3 # default=4
searchparamR = 1 # default=2
dctR = 0 # default=0
lambdaR = 100 * blkhR * blkvR / 64
# Constant
# MFlowFps()
#
isse = true
thSCD1 = 320 # 300, 1500, 100, default=400
thSCD2 = 128 # 128, 130, 130, default=130
# Contour artifacts suppression / Подавление контурных артефактов
# Simple masking / Простое маскирование (mask = 0)
# Simple masking + Static vectors / Простое + Статические вектора (mask = 1)
# Simple masking + Vectors of related frames / Простое + Вектора смежных кадров (mask = 2)
#
mask = 2
# Artifact suppression level / Степень подавления артефактов
# Light / Легкая (ml = 100)
# Medium / Средняя (ml = 500)
# High / Высокая (ml = 2500)
# Huge / Нереальная (ml = 10000)
#
ml = 10000
# Defaults
#
numerator = Default(numerator, 2)
denominator = Default(denominator, 1)
# Here is code of function...
#
last = clp
# filt = RemoveGrain(mode=3)
filt = RemoveGrain(mode=17)
pelclip = pelclipfix(last)
fps_super = MSuper(last, hpad=hpad, vpad=vpad, rfilter=rfilter, pel=pel, sharp=sharp)
fps_super_f = MSuper(filt, hpad=hpad, vpad=vpad, rfilter=rfilter, pel=pel, sharp=sharp, pelclip=pelclip)
fps_backward = MAnalyse(fps_super_f, isb=true, blksize=blkh, blksizeV=blkv, overlap=overlap, overlapV=overlapV, \
search=search, searchparam=searchparam, dct=dct, truemotion=truemotion, \
lambda=lambda, lsad=lsad, plevel=plevel, badrange=badrange)
fps_forward = MAnalyse(fps_super_f, isb=false, blksize=blkh, blksizeV=blkv, overlap=overlap, overlapV=overlapV, \
search=search, searchparam=searchparam, dct=dct, truemotion=truemotion, \
lambda=lambda, lsad=lsad, plevel=plevel, badrange=badrange)
fps_backward1 = MRecalculate(fps_super, fps_backward, blksize=blkhR, blksizeV=blkvR, overlap=overlapR, overlapV=overlapVR, \
search=searchR, searchparam=searchparamR, dct=dctR, truemotion=truemotion, lambda=lambdaR)
fps_forward1 = MRecalculate(fps_super, fps_forward, blksize=blkhR, blksizeV=blkvR, overlap=overlapR, overlapV=overlapVR, \
search=searchR, searchparam=searchparamR, dct=dctR, truemotion=truemotion, lambda=lambdaR)
fps_backward2 = MRecalculate(fps_super, fps_backward1, blksize=blkhR2, blksizeV=blkvR2, overlap=overlapR2, overlapV=overlapVR2, \
search=searchR, searchparam=searchparamR, dct=dctR, truemotion=truemotion, lambda=lambdaR)
fps_forward2 = MRecalculate(fps_super, fps_forward1, blksize=blkhR2, blksizeV=blkvR2, overlap=overlapR2, overlapV=overlapVR2, \
search=searchR, searchparam=searchparamR, dct=dctR, truemotion=truemotion, lambda=lambdaR)
# function MFlowFPS(clip source, clip super, clip mvbw, clip mvfw, int "num", int "den", int "mask", \
# float "ml", bool "blend", int "thSCD1", int "thSCD2", bool "isse", bool "planar")
#
return (MFlowFps(fps_super, \
fps_backward2, \
fps_forward2, \
num = FramerateNumerator(last) * numerator, \
den = FramerateDenominator(last) * denominator, \
mask = mask, \
ml = ml, \
blend = false, \
thSCD1 = thSCD1, \
thSCD2 = thSCD2, \
isse = isse, \
planar = false))
}
Jenyok
22nd March 2013, 04:57
Thera are some ConvertFPS() functions...
End...
.
#
# ConvertMFlowFps3() easy function ...
# There are no MRecalculate functions.
#
function ConvertMFlowFPS3(clip clp, int "numerator", int "denominator")
{
# Constants
# MSuper()
#
hpad = 16 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
vpad = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
pel = 2 # default=2
# Constants
# MSuper()
#
blkh = 16 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
blkv = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
overlap = 4 # Maybe 2, 4, 8, 16, !!! maybe blkh/2 or litle !!! Change this constant for best tuning !!!
overlapV = 2 # Maybe 2, 4, 8, 16, !!! maybe blkv/2 or litle !!! Change this constant for best tuning !!!
searchparam = 1 # default=2
plevel = 2 # default=0
# Constants
# MFlowFps()
#
# Contour artifacts suppression / Подавление контурных артефактов
# Simple masking / Простое маскирование (mask = 0)
# Simple masking + Static vectors / Простое + Статические вектора (mask = 1)
# Simple masking + Vectors of related frames / Простое + Вектора смежных кадров (mask = 2)
#
mask = 2
# Artifact suppression level / Степень подавления артефактов
# Light / Легкая (ml = 100)
# Medium / Средняя (ml = 500)
# High / Высокая (ml = 2500)
# Huge / Нереальная (ml = 10000)
#
ml = 10000
# Defaults
#
numerator = Default(numerator, 2)
denominator = Default(denominator, 1)
# Here is code of function...
#
last = clp
pelclip = pelclipfix(last)
super = MSuper(last, pel=pel, hpad=hpad, vpad=vpad, pelclip=pelclip)
backward1 = MAnalyse(super, isb=true, blksize=blkh, blksizeV=blkv, overlap=overlap, overlapV=overlapV, \
searchparam=searchparam, plevel=plevel)
forward1 = MAnalyse(super, isb=false, blksize=blkh, blksizeV=blkv, overlap=overlap, overlapV=overlapV, \
searchparam=searchparam, plevel=plevel)
return (MFlowFps(super, backward1, forward1, \
num=FramerateNumerator(last) * numerator, \
den=FramerateDenominator(last) * denominator, \
mask=mask, ml=ml))
}
#
# ConvertSmoothFPS2() function...
# Using MBlockFps function.
#
function ConvertSmoothFPS2(clip clp, int "numerator", int "denominator")
{
# Constants
# MSuper()
#
hpad = 0 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
vpad = 0 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
pel = 2 # default=2
rfilter = 4 # default=2
# Constant
# MAnalyse()
#
blkh = 16 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
search = 3 # default=4
searchparam = 3 # default=2
dct = 5 # default=0
plevel = 0 # default=0
badrange = (-24) # default=24
chroma = false # default=true
# Constant
# MRecalculate()
#
blkhR = 8 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
blkhR2 = 4 # Maybe 4, 8, 16, 32, !!! Change this constant for best tuning !!!
searchR = 3 # default=4
searchparamR = 1 # default=2
searchparamR2 = 0 # default=2
dctR = 5 # default=0
# Defaults
#
numerator = Default(numerator, 2)
denominator = Default(denominator, 1)
# Here is code of function...
#
last = clp
pelclip = pelclipfix(last)
super = MSuper(last, pel=pel, hpad=hpad, vpad=vpad, rfilter=rfilter, pelclip=pelclip)
backward1 = MAnalyse(super, chroma=chroma, isb=true, blksize=blkh, searchparam=searchparam, plevel=plevel, \
search=search, badrange=badrange, dct=dct)
forward1 = MAnalyse(super, chroma=chroma, isb=false, blksize=blkh, searchparam=searchparam, plevel=plevel, \
search=search, badrange=badrange, dct=dct)
backward2 = MRecalculate(super, chroma=chroma, backward1, blksize=blkhR, searchparam=searchparamR, search=searchR, dct=dctR)
forward2 = MRecalculate(super, chroma=chroma, forward1, blksize=blkhR, searchparam=searchparamR, search=searchR, dct=dctR)
backward3 = MRecalculate(super, chroma=chroma, backward2, blksize=blkhR2, searchparam=searchparamR2, search=searchR, dct=dctR)
forward3 = MRecalculate(super, chroma=chroma, forward2, blksize=blkhR2, searchparam=searchparamR2, search=searchR, dct=dctR)
return (MBlockFps(last, super, backward3, forward3, \
num=FramerateNumerator(last) * numerator, \
den=FramerateDenominator(last) * denominator, \
mode=0))
}
#
# pelclipfix() function...
#
function pelclipfix(Clip clp)
{
# Original
#
# luma = EEDI3(clp, field=1).Spline64Resize(2 * width(clp), 2 * height(clp), src_left=0.25)
# chroma = EEDI3(clp, field=1).Spline64Resize(2 * width(clp), 2 * height(clp), src_left=0.50, src_top=0.50)
# Modified
#
luma = NNEDI3(clp, 1, true, nsize=0, nns=0).Spline64Resize(2 * width(clp), 2 * height(clp), src_left=0.25)
chroma = NNEDI3(clp, 1, true, nsize=0, nns=0).Spline64Resize(2 * width(clp), 2 * height(clp), src_left=0.50, src_top=0.50)
return (MergeChroma(luma, chroma, 1))
}
Jenyok
22nd March 2013, 05:13
!!! And one more time !!!
.
.
There are some questions to you.
.
There is a function RemoveGrain(mode=17) .
.
Could I use function FFT3dFilter(...) instead of function RemoveGrain(mode=17) to achive equal result of function RemoveGrain(mode=17) (result FF3dFilter(...) = result RemoveGrain(mode=17)) ?
Which parameters and values of those parameters could I use in function FFT3dFilter(...) to achive this result ?
.
.
There are another similar questions.
.
There is a function RemoveGrain(mode=1) .
There is a function RemoveGrain(mode=2) .
There is a function RemoveGrain(mode=3) .
There is a function RemoveGrain(mode=5) .
.
result FF3dFilter( ??? ) = result RemoveGrain(mode=1) ?
Parameters and values of those parameters to function FFT3dFiler() in this case ?
.
result FF3dFilter( ??? ) = result RemoveGrain(mode=2) ?
Parameters and values of those parameters to function FFT3dFiler() in this case ?
.
result FF3dFilter( ??? ) = result RemoveGrain(mode=3) ?
Parameters and values of those parameters to function FFT3dFiler() in this case ?
.
result FF3dFilter( ??? ) = result RemoveGrain(mode=5) ?
Parameters and values of those parameters to function FFT3dFiler() in this case ?
.
FFT3dFilter( ??? ) similar to and another "mode=" of RemoveGrain() function ?
mode=7
mode=9
mode=11
mode=19
.
Thanks.
egekhter
22nd March 2013, 21:43
I sent over half a dozen private emails to you on this subject. As I said in those emails, you can replace the YV12 with YUY2 conversions. After I sent my script, which I tested, you then had problems making it work with plugins on your system. It worked fine on my computer with the plugins I use, so I think you can get it working. I provided the exact version of those plugins in my version of the film restoration script that I posted here:
Capturing and restoring old 8mm films (http://forum.doom9.org/showthread.php?p=1595608#post1595608)
So, I have provided the answer, and if you use my version of the script, I'm pretty sure you can get it to work.
I also should mention that your film capture setup will have to be extraordinarily good in order to tell the difference. This is because there are so many other, much more diabolical, color issues when transferring from various film emulsions into video. You almost always have to do extensive gamma and color correction, and the issues surrounding those conversions will swamp whatever slight color fidelity increase you get from maintaining 4:2:2 throughout.
I'm having Virtual Dub crash with an out-of-bounds memory access violation when I try to load your script. I've commented out all the SetMT modes and for the time being have not changed the script to converttoYUY2 and am using the default YV12.
Have you tested your script with resolutions of higher than SD?
BTW, we are scanning all footage on a FlashScan HD and capturing at 10 bit 4:2:2.
- Eugene G.
egekhter
23rd March 2013, 00:11
So apparently installing Windows XP 32 bit solved the problem.
Will report back with results! Thanks John!
johnmeyer
23rd March 2013, 02:00
So apparently installing Windows XP 32 bit solved the problem.Ah yes, some plugins don't like 64-bit.
Have you tested your script with resolutions of higher than SD?
Yes I have, and there can be some problems. Someone contacted me last spring. He had captured film in HD, but the scripts were not working. With the help of people in this forum, I tracked it down to a deficiency in MFlowFPS. You can read about it here:
MVTools2 artifacts, but only at high resolution (http://forum.doom9.org/showthread.php?p=1576719#post1576719)
If you read both pages of that thread, you'll see that various people helped me come up with a workaround to the problem.
tonydokter
24th March 2013, 18:31
how do i get rid of the green on right side thanks guys
tonydokter
24th March 2013, 18:39
Sorry love the script works great thanks Fred added pic to show what I mean
johnmeyer
24th March 2013, 21:29
I'm not sure what is causing that, but perhaps it is from the Depan motion stabilization. You could try reducing the maxstabH and maxstabV stabilization parameters to 1/4 of their value, and also cut in half the crop/zoom factors used after motion stabilization (the defaults are: CLeft=32 CTop=32 CRight=32 CBottom=32). I don't know if this will actually fix the problem, but if the nature of the border changes or disappears, then you are on the right track.
If the above changes things, try turning off "mirror" in the Depanstabilize call by setting it to 0 instead of 15.
tonydokter
24th March 2013, 23:33
If I use the script with out remove dirt I do not get the green any ideas thanks John
Guest
24th March 2013, 23:48
My simplistic solution would be to not use RemoveDirt().
johnmeyer
25th March 2013, 02:05
I think there is a joke about a patient telling a doctor that it hurts when he breathes, and the doctor suggests that he simply stop breathing ...
RemoveDirt is pretty critical to the success of the script, although I'm still looking for a more modern solution, and one that would make it easier to understand the relationship between the settings and the results. So far, my various attempts with Despot and a few other plugins have not produced anything close to the remarkable results you get with RemoveDirt. Unfortunately, RemoveDirt can be unstable, and it also can cause things like a football (American football) to disappear when thrown (baseballs also disappear). I can't figure out settings to restrict object size.
Anyway, while I don't have a specific solution to your problem, you might try the newer version of the motion compensation part of the remove dirt chain ("RemoveDirtMC") that I posted several months ago. Here it is again:
function RemoveDirtMC(clip,int "limit", bool "_grey")
{
_grey=default(_grey, false)
limit = default(limit,6)
prefiltered = RemoveGrain(clip,2)
superfilt = MSuper(prefiltered, hpad=32, vpad=32,pel=2)
super=MSuper(clip, hpad=32, vpad=32,pel=2)
bvec = MAnalyse(superfilt,isb=true, blksize=16, overlap=2,delta=1, truemotion=true)
fvec = MAnalyse(superfilt,isb=false, blksize=16, overlap=2,delta=1, truemotion=true)
bvec_re = Mrecalculate(super,bvec,blksize=8, overlap=0,thSAD=100)
fvec_re = Mrecalculate(super,fvec,blksize=8, overlap=0,thSAD=100)
backw = MFlow(clip,super,bvec_re)
forw = MFlow(clip,super,fvec_re)
clp=interleave(forw,clip,backw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}
I made these changes to both improve performance, and also to slightly improve the dirt removal quality, but perhaps it will help your situation.
You should be able to simply drop this into the script and see if it works any better. Let us know what happens.
One last thought: I have observed problems like your green flash when the scene detection parameters in the motion estimation are set so that scene detection kicks in too often (i.e., in the middle of a scene). You may need to add a thSCD1 parameter to the MFlow statements and change the scene threshold.
The following should produce identical results to what I posted above (because thSCD1=400 is the default). Make sure this is so, and then try numbers like 100, 200, 600, & 800 to see if this makes any difference. I think there is a more scientific way of determining what value to use, and perhaps someone can tell us how to determine a good threshold value for a particular video clip.
backw = MFlow(clip,super,bvec_re,thSCD1=400)
forw = MFlow(clip,super,fvec_re,thSCD1=400)
Jenyok
25th March 2013, 05:57
There are some functions to convert FPS, gathered togather, lol :) .
Functions are described in code section, see below.
See attached RAR file.
.
#
# File: ConvertFPS.avsi
#
# various functions to convert FPS
#
#
# Last editing date: 25.03.2013 year
#
#
#
# function ConvertMFlowFPSOriginal(clip clp, int "numerator", int "denominator") Using MFlowFps, MRecalculate
# function ConvertMFlowFPS(clip clp, int "numerator", int "denominator") Using MFlowFps, MRecalculate
# function ConvertMFlowFPS2(clip clp, int "numerator", int "denominator") Using MFlowFps, MRecalculate two times (twice)
# function ConvertMFlowFPS3(clip clp, int "numerator", int "denominator") Using MFlowFps, MAnalyse only
# function ConvertSmoothFPS2(clip clp, int "numerator", int "denominator") Using MBlockFps, MRecalculate two times (twice)
#
#
# function pelclipfix(Clip clp) Additional function, create "pelclip"
#
#
Jenyok
25th March 2013, 07:07
Changes in function ConvertMFlowFPS2(...) .
.
Use for YUY2, YV12 color spaces
.
filt = FFT3DFilter(bt=1, sigma=2) # bt=1 2D filter
.
instead of (color space YV12 only)
.
# filt = RemoveGrain(mode=17)
.
videoFred
8th April 2013, 07:20
Sorry love the script works great thanks Fred added pic to show what I mean
Both width and height must be devisible by 16. Please check your source and the crop and resize parameters. The source and all other steps in the script must be checked.
Fred.
tonydokter
30th April 2013, 18:27
Thanks Fred just Got back was away will check that out and see if that gets rid of it a will let u know
stephen22
20th May 2013, 15:58
Any possibility of a version of the script with no trimming cropping stabilising or interpolation? I was very impressed by the improvement in picture quality, but I have some scanned 8mm film which is already expanded to 24fps and stabilised.
With all your interlinked variables I found it quite hard to separate out the unwanted bits. If you've already done this I would very much like a copy.
best wishes
Stephen
thomasmagnum
27th May 2013, 07:21
Hello,
at the moment I working on my old 8mm films. I got the films as picture sequence (every film frame as a jpg). My work flow starts with a small tool called PhotoLapse to create a avi File (msu lossless codec), for the second step I use the scripts from videoFred. This generates amazing results, so I only can say thanks for the scripts. The Problem is that some scenes are longer and I have to handle the 2GB avi Limit, so I had the idea to combine the two steps.
My question is: Can I combine these two steps, so that AviSynth open the jpg's and run videoFreds script in one single step? I am an absolutely AviSynth newbie, so I have not enough background to modify the scripts. May anybody can help me in these question.
Thanks for any hint in advance.
Thomas
videoFred
27th May 2013, 12:24
Hi Thomas,
What you need is ImageSource() . You can replace AviSource() in my script with ImageSource(). Please have a look at the documents for more information about ImageSource().
Fred.
videoFred
27th May 2013, 12:31
Any possibility of a version of the script with no trimming cropping stabilising or interpolation? I was very impressed by the improvement in picture quality, but I have some scanned 8mm film which is already expanded to 24fps and stabilised.
My script will not work properly if there are duplicate frames! If you do not want all the options then you better make a new script with cleaning and denoising only. But, again, both cleaning and denoising will not work if there are duplicate frames.
Fred.
anegroo
9th June 2013, 21:58
Hi,
I have found recently this topic in which I can see amazing results restoring old films. I have problem with a Super 8 material which I want to restore to its original framerate - I don`t know what is... I think it could be 18fps. The only sure is that it was shot in super 8. Now is NTSC encoded as DV and your script doesn`t work for me. Here is a sample video in mp4 (http://www.aspekt.ro/15/media/Super_8.mp4). Somebody can help me please?
I had a similar problem with Super8 already (badly) transferred to DVD, with a projector running at an unknown speed.
I described a solution that worked for me, in the thread I created about that experience, specifically in post #11:
http://forum.doom9.org/showthread.php?p=1505188#post1505188
HTH,
fp
anegroo
9th June 2013, 23:49
Thanks for the quick reply. I tried this script:
Bob(-.2,.6)
SRestore(frate=18)
I tried different values for Srestore. The result is not bad, but still remains a lot of blended frames. It`s interesting that the source has no duplicate frames, but every 4-5 frame is blended. I have no idea how to change the script for this particular source....
manono
10th June 2013, 02:13
The result is not bad, but still remains a lot of blended frames..
Maybe if you provided a better sample you'd get better suggestions. A man walking so far away that we can't see it clearly doesn't help a whole lot. Please provide a sample with steady movement, one where we can actually make out what goes on frame-by-frame, field-by-field.
Also, this thing went from Super 8 to VHS tape to DV to MP4? If so, why?
anegroo
10th June 2013, 10:58
Thanks for your response. The whole original shot is bad quality. Here (http://www.aspekt.ro/15/media/Super_8B.mp4) is another sample.The video is on a Hi8 cassette from which I captured through firewire to DV avi, and I transcoded for uploading to mp4 for a smaller filesize. I can upload a sample in DV avi if it helps.
manono
10th June 2013, 12:17
Please provide a sample with steady movement...
Another lousy sample. A man just standing there isn't 'steady movement'.
Maybe someone else will try and help. Good luck.
anegroo
10th June 2013, 13:49
Unfortunately there are no better parts in video, mostly the camera is moving. However the blended frames are quite a bit visible.
Because of missing the dulplicate frames I think the original Super 8 film was captured at higher speed (ex. 24fps) and after that was transformed to NTSC through blending every 4-5th frames. What do you think?
anegroo
12th June 2013, 02:24
Finally solved restoring the framerate with Yadif bob and SRestore (23.976) combined with image quality improvement with Film restoring script by videoFred. Thanks for all!
KinoLab
31st July 2013, 17:33
Hi, at the moment I'm working with a transfer that give me a 1624X1234, so now I've two questions:
1 - Can i use the script on WINDOWS 7 64bit ?? Or wich version of WIn is better to install?
2 - Did someone have use so bigframe size with Avisynth ?
Thanks
KinoLab
foxyshadis
31st July 2013, 22:48
Hi, at the moment I'm working with a transfer that give me a 1624X1234, so now I've two questions:
1 - Can i use the script on WINDOWS 7 64bit ?? Or wich version of WIn is better to install?
2 - Did someone have use so bigframe size with Avisynth ?
Thanks
KinoLab
That will be fine. Any Windows from XP to 8 will work. It'll run under a 32-bit environment only, not 64-bit, but that frame size is small enough that it hardly matters. x64 does give you better usage if you have 4GB+ of system memory, but as long as you have at least 2GB of extra memory it'll run fine.
KinoLab
1st August 2013, 20:49
Thanks for your fast answer...
I've installed WIN 7 Ultimate and it working... now I've some problem to open the script becau8se everytime there are some .dll that are missing...
I'm working on.
when I´ll have my first test I´ll post some frames...
Best
EM
KinoLab
3rd August 2013, 02:10
Now I've two questions>
1 did someone had problem with warpsharp.dll ? It's impossible for me to load this plugin..
2 did someone know where i can found a decompressor for fourcc v210?
thanks
KinoLab
3rd August 2013, 15:51
Ok... now I found a solution for both questions...
For the 1º I've installaed a copi of .dll in system32...
For the second one, you can download all the driver in the www.Aja.com/support in the Kona3 list of driver for WIN...
Now, there is something strange that happen. I'm using a .AVI generated in VirtualDub with Uncompressed RGB. When I open it with the script and I leave resize 720 X 576 everything is ok... but If I change the resize to the original size of the AVI : 1624 X 1234 it crash and said that is impossible to found the decompressor.
And if i open the single .AVI in VirtualDub without the script, it open...
Any idea ???
KinoLab
3rd August 2013, 17:50
Things goes on.... Now I-ve discover that with final crop size I can go up to 1150 for High, and it accept 1624 for Width.
If i put 1151, VD crash....
Any idea??
KinoLab
johnmeyer
3rd August 2013, 21:07
Things goes on.... Now I-ve discover that with final crop size I can go up to 1150 for High, and it accept 1624 for Width.
If i put 1151, VD crash....There are several plugins used in this script that require mod 4 (divisible by 4) numbers for height and width. 1151 is obviously not mod 4.
BTW, this is true of lots of AVISynth plugins so, speaking for myself, I've just gotten into the habit of always using mod 4 heights and widths.
hasso
4th August 2013, 23:35
Thanks for a wonderful script and the results are great for colour 8mm film. I've also got some black and white 8mm films as well. Haven't started on them as yet, but wondering if there are any special considerations when using the script for black and white films.
johnmeyer
5th August 2013, 01:00
Thanks for a wonderful script and the results are great for colour 8mm film. I've also got some black and white 8mm films as well. Haven't started on them as yet, but wondering if there are any special considerations when using the script for black and white films.My work is 50/50 between B&W & color. B&W is sure a lot easier to grade. I do all color and levels grading in my editing program (Vegas) prior to using the script. I generally don't use any of the script's color or level auto adjustments (i.e., I use the "4" option rather than 1, 2, or 3).
Even if you use one of the script's options for automatic grading, you certainly won't need to use the two that provide auto-white balance. Other than that, I can't think of any other tweaks or changes that is specific to B&W.
Here's a link to a five-second clip showing the before/after comparison on a B&W film I'm working on today.
1969 Football B&W Before/After (https://dl.dropboxusercontent.com/u/1561578/Before-After.mp4)
egekhter
20th September 2013, 06:04
Hope this isn't too off-topic.
We are using Canopus HQX as our intermediate codec before and after restoration using Fred's Film Restoration Script.
The codec holds up very well and is a great delivery format too for cross-platform compatibility with PC's and Mac's.
The only problem? There's no decoder for ffmpeg.
To avoid an extra step in the workflow, like writing out to UT Video which is decodable by FFMPeg, we are looking for a new codec that will serve us as well in the chain as Canopus HQX.
What's wrong with some alternatives like UT Video? Nothing - it's a great looking codec - however it's 6x the size of HQX (takes 6x the amount of time to copy to client's hard drive) AND, most importantly, is not trivial to install on a Mac.
So we are looking to go back to the drawing board:
Here are the requirements:
1. Fast Compression/Decompression
2. Reasonable file size (~60GB/hr - granted this doesn't say much, but this is about where HQX and Pro-res HQ lie)
3. 10 bit
4. 4:2:2
5. Intraframe
6. Can be decoded in Video Fred's AVISynth script
7. Can be encoded to in VirtualDub
8. Is decodable in ffmpeg
9. Is cross-platform compatible and is easy to install codec for average client on PC or Mac.
10. (This is on the bucket list) - No codec pack necessary to install for HD footage on client side to playback on PC or Mac.
Is there a single codec that fits the bill for all 9 of the above?
Maybe I'm asking for world peace here, who knows.
Thanks in advance,
Eugene
poisondeathray
20th September 2013, 16:01
egekhter - you're probably looking at prores or dnxhd
egekhter
20th September 2013, 16:17
egekhter - you're probably looking at prores or dnxhd
We actually start with a pro-res file.
I don't think we've been able to import the pro-res file directly into Fred's script (or any AVISynth script for that matter) - we usually transcode it to HQX. And then on the other end, since we're using VirtualDub for batch processing all the scripts, we can only output to an AVI file obviously.
Re: DNxHD...very compute heavy from my experience, and would have same problems as above I imagine.
Thanks for the suggestion.
poisondeathray
20th September 2013, 16:18
We actually start with a pro-res file.
I don't think we've been able to import the pro-res file directly into Fred's script (or any AVISynth script for that matter) - we usually transcode it to HQX. And then on the other end, since we're using VirtualDub for batch processing all the scripts, we can only output to an AVI file obviously.
Re: DNxHD...very compute heavy from my experience, and would have same problems as above I imagine.
Thanks for the suggestion.
You can import prores into avisynth using ffms2 or qtinput
You can use vdub with external encoder feature (you can link to ffmpeg for example, and export prores from vdub - basically anything ffmpeg can do) . There is a guide on the vdub forum
egekhter
20th September 2013, 18:29
You can import prores into avisynth using ffms2 or qtinput
You can use vdub with external encoder feature (you can link to ffmpeg for example, and export prores from vdub - basically anything ffmpeg can do) . There is a guide on the vdub forum
I will check it out for quality and speed.
Thanks for the suggestion!
egekhter
20th September 2013, 21:31
You can import prores into avisynth using ffms2 or qtinput
You can use vdub with external encoder feature (you can link to ffmpeg for example, and export prores from vdub - basically anything ffmpeg can do) . There is a guide on the vdub forum
qtinput does in fact work, but the audio stream is not being recognized. Any suggestions?
Turns out it does work!
source= qtinput(film, audio=1)
Now onto a different problem :-)
egekhter
20th September 2013, 22:26
qtinput does in fact work, but the audio stream is not being recognized. Any suggestions?
Turns out it does work!
source= qtinput(film, audio=1)
Now onto a different problem :-)
Here's my problem if anybody can figure out what in Fred's script is causing this to happen:
Good black:
http://s9.postimg.org/y67wlrzsf/good_black0.jpg
film= "X:\FlashScan HD\Capture\FTC_14799_Hack\14799_Hack-S8mm_3-7-01.mov" # source clip, you must specify the full path here
ffvideosource(film)
Bad black:
http://s9.postimg.org/ni45mxptb/bad_black0.jpg
# 8mm film restoration script by videoFred.
# www.super-8.be
# info@super-8.be
# version 01.A with frame interpolation
# release date: june 20, 2012
#============================================================================================
# august 2010: added removerdirtMC() as suggested by John Meyer
# october 2010: auto sharpening parameters
# march 2011: new autolevels.dll by Jim Battle
# www.thebattles.net/video/autolevels.html
# june 2012: improved stabilisation
#=============================================================================================
# cleaning, degraining, resizing, stabilizing, sharpening, auto-levels and auto-white balance.
#=============================================================================================
film= "X:\FlashScan HD\Capture\FTC_14799_Hack\14799_Hack-S8mm_3-7-01.mov" # source clip, you must specify the full path here
#PARAMETERS#----------------------------------------------------------------------------------------------------------------------------
result="result4" # specify the wanted output here
trim_begin=2 trim_end=10 play_speed=30 #trim frames and play speed (PAL: 16.6666 or 18.75)
numerator= 30 #numerator for the interpolator (final frame rate)
denumerator= 1 #denumerator example: 60000/1001= 59.94fps
#COLOR AND LEVELS
PARAMATERS#----------------------------------------------------------------------------------------------------------------------------
saturation=1 #for all outputs
gamma= 1 # for all outputs
blue= 0 red= 0 #manual color adjustment, when returning result3 or result4. Values can be positive or negative
black_level=0 white_level=255 output_black=0 output_white=255 # manual levels, when returning result4
#AUTO LEVELS
PARAMETERS#--------------------------------------------------------------------------------------------------------------------------------
autolev_low= 0 # limit of autolevels low output
autolev_high= 255 # limit of autolevels high output
#SIZE, CROP AND BORDERS
PARAMETERS#----------------------------------------------------------------------------------------------------------------------------
CLeft=32 CTop=24 CRight=32 CBottom=24 #crop values after Depan and before final resizing
W=1280 H=720 #final size after cropping
bord_left=0 bord_top=0 bord_right=0 bord_bot=0 #720p= borders 150
#STABILISING PARAMETERS, YOU REALY MUST USE RESULTS7 TO CHECK STABILISATION!
#----------------------------------------------------------------------------------------------------------------------------
maxstabH=20
maxstabV=20 #maximum values for the stabiliser (in pixels) 20 is a good start value
est_left=20 est_top=60 est_right=60 est_bottom=60 #crop values for special Estimate clip
trust_value= 1.0 # scene change detection, higher= more sensitive
cutoff_value= 0.5 # no need to change this, but you can play with it and see what you get
#CLEANING PARAMETERS#--------------------------------------------------------------------------------------------------------------
dirt_strenght=40 # set this lower for clean films.
#DENOISING PARAMETERS#----------------------------------------------------------------------------------------------------------------------------
denoising_strenght= 600 #denoising level of second denoiser: MVDegrainMulti()
denoising_frames= 3 #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()
# SHARPENING PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------
USM_sharp_ness= 23 USM_radi_us=3 #this is the start value for the unsharpmask sharpening
#do not set radius less then 3
#the script will automatically add two other steps with lower radius
last_sharp= 0.15 #final sharpening step after interpolation
last_blur= 0.12 #this smooths out the heavy sharpening effects
# END VARIABLES, BEGIN
SCRIPT#=================================================================================================================================
SetMemoryMax(800) #set this to 1/3 of the available memory
LoadPlugin("plugins/Deflicker.dll")
Loadplugin("plugins/Depan.dll")
LoadPlugin("plugins/DepanEstimate.dll")
Loadplugin("plugins/removegrain.dll")
LoadPlugin("plugins/removedirt.dll")
LoadPlugin("plugins/MVTools.dll")
LoadPlugin("plugins/MVTools2.dll")
Loadplugin("plugins/warpsharp.dll")
LoadPlugin("plugins/autolevels_06.dll")
Import("plugins/03_RemoveDirtMC.avs")
source= ffvideosource(film).assumefps(play_speed).trim(trim_begin,0)#.converttoYV12()
trimming= framecount(source)-trim_end
source1= trim(source,0,trimming)
#STABILIZING/CROPPING#.............................................................................................................................
..............
stab_reference= source1.crop(20,20,-20,-20).colorYUV(autogain=true).crop(est_left,est_top,-est_right,-est_bottom)
mdata=DePanEstimate(stab_reference,trust=trust_value,dxmax=maxstabH,dymax=maxstabV)
stab=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,mirror=15).deflicker()
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom)
stab3=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,info=true)
WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5)
#UNSHARPMASK
AUTO_PARAMETERS#-----------------------------------------------------------------------------------------------------------------------------------
--------
USM_sharp_ness1 = USM_sharp_ness
USM_sharp_ness2 = USM_sharp_ness+(USM_sharp_ness/2)
USM_sharp_ness3 = USM_sharp_ness*2
USM_radi_us1 = USM_radi_us
USM_radi_us2 = USM_radi_us-1
USM_radi_us3 = USM_radi_us2-1
#CLEANING/PRESHARPENING/RESIZING#..................................................................................................................
........................
noise_baseclip= stab2.levels(0,gamma,255,0,255).tweak(sat=saturation)
cleaned= noise_baseclip.unsharpmask(USM_sharp_ness1,USM_radi_us1,0).unsharpmask(USM_sharp_ness2,USM_radi_us2,0).Lanczos4Resize(W,H)
#DEGRAINING/SHARPENING#............................................................................................................................
.......................................
vectors= cleaned.MVAnalyseMulti(refframes=denoising_frames, pel=2, blksize=block_size, blksizev= block_size_v, overlap=block_over, idx=1)
denoised= cleaned.MVDegrainMulti(vectors, thSAD=denoising_strenght, SadMode=1, idx=2).unsharpmask(USM_sharp_ness3,USM_radi_us3,0)
#CHANGING FRAME RATE WITH
INTERPOLATION/FINALSHARPENING#.....................................................................................................................
.......................................
super= denoised.MSuper()
backward_vec= MAnalyse(super, blksize=block_size, blksizev= block_size_v, overlap=block_over, isb=true)
forward_vec= MAnalyse(super,blksize=block_size, blksizev= block_size_v, overlap=block_over, isb= false)
interpolated= denoised.MFlowFps(super, backward_vec, forward_vec, num=numerator, den= denumerator, ml=100).sharpen(last_sharp,mmx=false).sharpen
(last_sharp,mmx=false).blur(last_blur,mmx=false)
#RESULT1:
AUTOLEVELS,AUTOWHITE#..............................................................................................................................
........................................
result1= interpolated.autolevels(output_low= autolev_low, output_high= autolev_high).coloryuv(autowhite=true).addborders(bord_left, bord_top,
bord_right, bord_bot)
#RESULT2: MANUAL LEVELS, AUTOWHITE
#..................................................................................................................................................
....................
result2= interpolated.levels(black_level,1.0,white_level,0,255).coloryuv(autowhite=true)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
#RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
#..................................................................................................................................................
...................
result3= interpolated.coloryuv(off_U=blue,off_V=red).autolevels(output_low= autolev_low, output_high= autolev_high).addborders(bord_left, bord_top,
bord_right, bord_bot)
#RESULT4: MANUAL LEVELS, MANUAL COLOR CORRECTIONS
#..................................................................................................................................................
...................
result4= interpolated.coloryuv(off_U=blue,off_V=red).levels(black_level,1.0,white_level,0,255).addborders(bord_left, bord_top, bord_right,
bord_bot)
#RESULT5: SPECIAL SERVICE CLIP FOR RESULT S5
#..................................................................................................................................................
...................
result5= overlay(source1,greyscale(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
final_framerate= numerator/denumerator
source4=Lanczos4Resize(source1,W2,H2).changeFPS(final_framerate)
#COMPARISONS: ORIGINAL VS
RESULTS#...........................................................................................................................................
...........................
resultS1= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result1,"result1: autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result2,"result2: autowhite, manual levels
correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result3,"result3: autolevels, manual color
correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result4,"result4: manual colors and levels
correction",size=28,align=2))
resultS5= stackhorizontal(subtitle(result3,"result3: auto levels, manual color correction",size=28,align=2),subtitle(result4,"result4: manual
colors and levels correction",size=28,align=2))
resultS6= stackhorizontal(subtitle(result1,"result1: autolevels, autowhite",size=28,align=2),subtitle(result2,"result2: manual levels,
autowhite",size=28,align=2))
#SPECIAL COMPARISON CLIP FOR TESTING THE
STABILIZER#........................................................................................................................................
.................................
resultS7= 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)
egekhter
21st September 2013, 00:00
Here's my problem if anybody can figure out what in Fred's script is causing this to happen:
Good black:
http://s9.postimg.org/y67wlrzsf/good_black0.jpg
film= "X:\FlashScan HD\Capture\FTC_14799_Hack\14799_Hack-S8mm_3-7-01.mov" # source clip, you must specify the full path here
ffvideosource(film)
Bad black:
http://s9.postimg.org/ni45mxptb/bad_black0.jpg
# 8mm film restoration script by videoFred.
# www.super-8.be
# info@super-8.be
# version 01.A with frame interpolation
# release date: june 20, 2012
#============================================================================================
# august 2010: added removerdirtMC() as suggested by John Meyer
# october 2010: auto sharpening parameters
# march 2011: new autolevels.dll by Jim Battle
# www.thebattles.net/video/autolevels.html
# june 2012: improved stabilisation
#=============================================================================================
# cleaning, degraining, resizing, stabilizing, sharpening, auto-levels and auto-white balance.
#=============================================================================================
film= "X:\FlashScan HD\Capture\FTC_14799_Hack\14799_Hack-S8mm_3-7-01.mov" # source clip, you must specify the full path here
#PARAMETERS#----------------------------------------------------------------------------------------------------------------------------
result="result4" # specify the wanted output here
trim_begin=2 trim_end=10 play_speed=30 #trim frames and play speed (PAL: 16.6666 or 18.75)
numerator= 30 #numerator for the interpolator (final frame rate)
denumerator= 1 #denumerator example: 60000/1001= 59.94fps
#COLOR AND LEVELS
PARAMATERS#----------------------------------------------------------------------------------------------------------------------------
saturation=1 #for all outputs
gamma= 1 # for all outputs
blue= 0 red= 0 #manual color adjustment, when returning result3 or result4. Values can be positive or negative
black_level=0 white_level=255 output_black=0 output_white=255 # manual levels, when returning result4
#AUTO LEVELS
PARAMETERS#--------------------------------------------------------------------------------------------------------------------------------
autolev_low= 0 # limit of autolevels low output
autolev_high= 255 # limit of autolevels high output
#SIZE, CROP AND BORDERS
PARAMETERS#----------------------------------------------------------------------------------------------------------------------------
CLeft=32 CTop=24 CRight=32 CBottom=24 #crop values after Depan and before final resizing
W=1280 H=720 #final size after cropping
bord_left=0 bord_top=0 bord_right=0 bord_bot=0 #720p= borders 150
#STABILISING PARAMETERS, YOU REALY MUST USE RESULTS7 TO CHECK STABILISATION!
#----------------------------------------------------------------------------------------------------------------------------
maxstabH=20
maxstabV=20 #maximum values for the stabiliser (in pixels) 20 is a good start value
est_left=20 est_top=60 est_right=60 est_bottom=60 #crop values for special Estimate clip
trust_value= 1.0 # scene change detection, higher= more sensitive
cutoff_value= 0.5 # no need to change this, but you can play with it and see what you get
#CLEANING PARAMETERS#--------------------------------------------------------------------------------------------------------------
dirt_strenght=40 # set this lower for clean films.
#DENOISING PARAMETERS#----------------------------------------------------------------------------------------------------------------------------
denoising_strenght= 600 #denoising level of second denoiser: MVDegrainMulti()
denoising_frames= 3 #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()
# SHARPENING PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------
USM_sharp_ness= 23 USM_radi_us=3 #this is the start value for the unsharpmask sharpening
#do not set radius less then 3
#the script will automatically add two other steps with lower radius
last_sharp= 0.15 #final sharpening step after interpolation
last_blur= 0.12 #this smooths out the heavy sharpening effects
# END VARIABLES, BEGIN
SCRIPT#=================================================================================================================================
SetMemoryMax(800) #set this to 1/3 of the available memory
LoadPlugin("plugins/Deflicker.dll")
Loadplugin("plugins/Depan.dll")
LoadPlugin("plugins/DepanEstimate.dll")
Loadplugin("plugins/removegrain.dll")
LoadPlugin("plugins/removedirt.dll")
LoadPlugin("plugins/MVTools.dll")
LoadPlugin("plugins/MVTools2.dll")
Loadplugin("plugins/warpsharp.dll")
LoadPlugin("plugins/autolevels_06.dll")
Import("plugins/03_RemoveDirtMC.avs")
source= ffvideosource(film).assumefps(play_speed).trim(trim_begin,0)#.converttoYV12()
trimming= framecount(source)-trim_end
source1= trim(source,0,trimming)
#STABILIZING/CROPPING#.............................................................................................................................
..............
stab_reference= source1.crop(20,20,-20,-20).colorYUV(autogain=true).crop(est_left,est_top,-est_right,-est_bottom)
mdata=DePanEstimate(stab_reference,trust=trust_value,dxmax=maxstabH,dymax=maxstabV)
stab=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,mirror=15).deflicker()
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom)
stab3=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,info=true)
WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5)
#UNSHARPMASK
AUTO_PARAMETERS#-----------------------------------------------------------------------------------------------------------------------------------
--------
USM_sharp_ness1 = USM_sharp_ness
USM_sharp_ness2 = USM_sharp_ness+(USM_sharp_ness/2)
USM_sharp_ness3 = USM_sharp_ness*2
USM_radi_us1 = USM_radi_us
USM_radi_us2 = USM_radi_us-1
USM_radi_us3 = USM_radi_us2-1
#CLEANING/PRESHARPENING/RESIZING#..................................................................................................................
........................
noise_baseclip= stab2.levels(0,gamma,255,0,255).tweak(sat=saturation)
cleaned= noise_baseclip.unsharpmask(USM_sharp_ness1,USM_radi_us1,0).unsharpmask(USM_sharp_ness2,USM_radi_us2,0).Lanczos4Resize(W,H)
#DEGRAINING/SHARPENING#............................................................................................................................
.......................................
vectors= cleaned.MVAnalyseMulti(refframes=denoising_frames, pel=2, blksize=block_size, blksizev= block_size_v, overlap=block_over, idx=1)
denoised= cleaned.MVDegrainMulti(vectors, thSAD=denoising_strenght, SadMode=1, idx=2).unsharpmask(USM_sharp_ness3,USM_radi_us3,0)
#CHANGING FRAME RATE WITH
INTERPOLATION/FINALSHARPENING#.....................................................................................................................
.......................................
super= denoised.MSuper()
backward_vec= MAnalyse(super, blksize=block_size, blksizev= block_size_v, overlap=block_over, isb=true)
forward_vec= MAnalyse(super,blksize=block_size, blksizev= block_size_v, overlap=block_over, isb= false)
interpolated= denoised.MFlowFps(super, backward_vec, forward_vec, num=numerator, den= denumerator, ml=100).sharpen(last_sharp,mmx=false).sharpen
(last_sharp,mmx=false).blur(last_blur,mmx=false)
#RESULT1:
AUTOLEVELS,AUTOWHITE#..............................................................................................................................
........................................
result1= interpolated.autolevels(output_low= autolev_low, output_high= autolev_high).coloryuv(autowhite=true).addborders(bord_left, bord_top,
bord_right, bord_bot)
#RESULT2: MANUAL LEVELS, AUTOWHITE
#..................................................................................................................................................
....................
result2= interpolated.levels(black_level,1.0,white_level,0,255).coloryuv(autowhite=true)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
#RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
#..................................................................................................................................................
...................
result3= interpolated.coloryuv(off_U=blue,off_V=red).autolevels(output_low= autolev_low, output_high= autolev_high).addborders(bord_left, bord_top,
bord_right, bord_bot)
#RESULT4: MANUAL LEVELS, MANUAL COLOR CORRECTIONS
#..................................................................................................................................................
...................
result4= interpolated.coloryuv(off_U=blue,off_V=red).levels(black_level,1.0,white_level,0,255).addborders(bord_left, bord_top, bord_right,
bord_bot)
#RESULT5: SPECIAL SERVICE CLIP FOR RESULT S5
#..................................................................................................................................................
...................
result5= overlay(source1,greyscale(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
final_framerate= numerator/denumerator
source4=Lanczos4Resize(source1,W2,H2).changeFPS(final_framerate)
#COMPARISONS: ORIGINAL VS
RESULTS#...........................................................................................................................................
...........................
resultS1= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result1,"result1: autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result2,"result2: autowhite, manual levels
correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result3,"result3: autolevels, manual color
correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result4,"result4: manual colors and levels
correction",size=28,align=2))
resultS5= stackhorizontal(subtitle(result3,"result3: auto levels, manual color correction",size=28,align=2),subtitle(result4,"result4: manual
colors and levels correction",size=28,align=2))
resultS6= stackhorizontal(subtitle(result1,"result1: autolevels, autowhite",size=28,align=2),subtitle(result2,"result2: manual levels,
autowhite",size=28,align=2))
#SPECIAL COMPARISON CLIP FOR TESTING THE
STABILIZER#........................................................................................................................................
.................................
resultS7= 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)
Found the culprit!!!!!!
It was deflicker that was causing flickering between grey and black!!!!!
Hope this helps anyone that has noticed the same problem.
egekhter
22nd September 2013, 16:53
Ran into another snafu with the script.
After switching from HQX to Prores as the input file,
changed AVISource to qtinput or FFMPEGSource2 w/ audio...
Now when I save out to a new file in vdub the script hangs at 101 frames. If I do not include the audio as a parameter in the input source with the prores file, the script does not hang. But, going back to my old workflow, AVISource never gave me problems with including synced audio during restoration, so I feel like I am back to square one.
Some ideas I had:
1. run the qtinput/ffms2 script w/out audio and re-insert the audio from the original file in a separate step
2. Keep using old workflow -> creating an intermediate HQX file to feed into AVISource.
None of the above is ideal, ideas anyone?
johnmeyer
22nd September 2013, 18:53
I almost always use the killaudio() command in my scripts, specifically to avoid crashes. Many old hands in this forum have advised me that this isn't necessary, but that has not been my experience. With my particular editing workflow, I find that it takes absolutely zero effort (in my editing program, Vegas) to put the audio from the original source on the timeline below the video that results from the AVISynth script.
I know that's not the answer you were looking for, but I also wanted to let you know that you may find that you can't get stability with certain functions if you include the audio.
egekhter
25th September 2013, 17:27
I almost always use the killaudio() command in my scripts, specifically to avoid crashes. Many old hands in this forum have advised me that this isn't necessary, but that has not been my experience. With my particular editing workflow, I find that it takes absolutely zero effort (in my editing program, Vegas) to put the audio from the original source on the timeline below the video that results from the AVISynth script.
I know that's not the answer you were looking for, but I also wanted to let you know that you may find that you can't get stability with certain functions if you include the audio.
I figured out my problem.
The film was being captured at 50fps. The script was doing a framerate conversion to 18 fps.
The audio would finish before the video, and the frame processors did not like this.
After adding something to the attune of audio rate = 36% everything works like a charm.
I agree doing what you do is not a problem, but if we are going straight to hard drive, killing the audio and re-inserting it in a separate step is simply another step most people would like to avoid if possible.
Video is annoying - and rarely rewarding, but I do it anyways.
manono
25th September 2013, 20:30
...killing the audio and re-inserting it in a separate step is simply another step most people would like to avoid if possible.
I agree with johnmeyer. Keeping the audio in the script often leads to unnecessary difficulties. Some encoders only handle the video anyway (the ones I use only encode video). I never include it and always add it back later on. Maybe the quotation should read:
...killing the audio and re-inserting it in a separate step is simply another step some people would like to avoid if possible.
johnmeyer
25th September 2013, 22:32
killing the audio and re-inserting it in a separate step is simply another step most people would like to avoid if possible.
Maybe the quotation should read: "...killing the audio and re-inserting it in a separate step is simply another step some people would like to avoid if possible."As Abraham Lincoln once said (more or less):You can kill all the audio some of the time, and some of the audio all the time, but you cannot kill all the audio all the time.
StainlessS
26th September 2013, 02:05
JohnM Try 'KillAudio()' works pretty much 100% of the time. :) (Guess A.L., did not have Avisynth)
potmat
18th November 2013, 17:26
Hi All,
Pretty new to AviSynth, but very impressed with what videoFred's script can accomplish.
I have my grandfather's 8MM films scanned and the results given to me as image sequences. I'm able to use this script with only minor modifications.
I replaced AviSource with ImageSource
I have no desire to change the frame rate, the output can stay at 18fps - never transferring to DVD - so I removed all instances of .BlendFPS(final_framerate, frame_blend).
Everything works great with one interesting exception. The script comes with width and height as 720x576. This works fine even though my source images are 720x480. If I change H to 480 I get memory access violations at the degraining/sharpening step. I've tried newer versions of MVTools and MVTools2 but that actually seemed to make the problem worse.
If anyone has any ideas that'd be great.
videoFred
18th November 2013, 17:36
Hi Potmat,
Can you give us the error message you get?
Fred.
potmat
18th November 2013, 17:45
Avisynth read error: CAVIStreamSynth: System exception - Access Violation at 0x28ad680 reading from 0xae43d00.
Obviously the addresses will change each time you run. I should also point out that the problem is intermittent. It does occasionally work. I can live with re-trying over and over until it does, was just hoping someone had seen this before and go "ahh, you should change the block size....."
johnmeyer
18th November 2013, 18:07
Everything works great with one interesting exception. The script comes with width and height as 720x576. This works fine even though my source images are 720x480. If I change H to 480 I get memory access violations at the degraining/sharpening step. I've tried newer versions of MVTools and MVTools2 but that actually seemed to make the problem worse.I tried to duplicate your problem. I copied a fresh version of "01_C_Film_Restoring_Blending_Cleaning_Only.avs" from the June 2012 zip file. I then went through and made the minimum number of changes in order to match my project. Here are the changes I made:
film=
I changed this to point to my video file.
play_speed=
I changed this to 14.985, the speed of the film I transferred
final_framerate =
I changed this to the same as my play speed because, like you, I didn't want to make any speed changes.
W=720 H=480
As you can see, I changed this to match typical NTSC frame size, just like you were doing
That is all I changed. I then ran the script and got an error because it could not find one of the plugins. There is a reason for this, and I suspect it may point to the reason you are having a problem. The reason is that Fred's script uses very specific versions of certain plugins. In order to always make certain that I always use those plugins rather than newer or different plugins that I use for other scripts, I copied all of the plugins contained in his download to a unique folder, and then change all the "load" lines to point explicitly to that folder.
So, while I cannot duplicate your problem, I suspect that your problem may be caused by loading a different DLL than the one designed to work with Fred's script.
potmat
18th November 2013, 18:20
Doubtful, I only use the plugins that came with the script (except for when I briefly tried newer versions of MVTools, but quickly reverted).
Like I said the problem is intermittent, so it's not a show stopper. If I'm not doing something obviously wrong it's not likely we'll figure it out. Could be environmental, sometimes restarting virtualDub fixes it, sometimes restarting Windows does. Expecting a certain memory space to be unalllocated? It's been a long time since I've written any C and I hated it then, so if it's not obvious I'll just live with it. Trying to debug from source seems like a terrifying prospect:)
johnmeyer
18th November 2013, 18:39
Modifications to my version of the script
To salvage extraordinarily dirty film
I have posted elsewhere in this thread and in the companion thread Capturing and restoring old 8mm films (http://forum.doom9.org/showthread.php?p=1592567#post1592567) my alternative to Fred's script which does less sharpening, less color and levels corrections, but runs faster and does more dirt removal.
Because of a post on my YouTube page where I showed how to transfer Polaroid's "Polavision" instant movie film (Polavision Super8 Film Transfer and Restoration (https://www.youtube.com/watch?v=AfFj3dEw_nI)), I have been asked to transfer a lot of Polavision film. Because this film was developed in the cassette and then never removed from the cassette, it has been sitting in chemicals for thirty years and has huge, unremovable chemical stains which cover each and every frame. The normal script settings hardly touched this dirt. However, after extensive work, I was able to figure out how to modify the SAD, threshold, and scene changes in the RemoveDirt and RemoveDirtMC functions in order to remove most of this dirt. I then used an absurdly high removedirt setting of 93. The results, while far from perfect, are rather remarkable. Here is a sample of the result. In the "before," I have already removed the horrible vertical emulsion lines, and also have done extensive gamma and color correction. This example only shows dirt removal:
Polavision Before/After (https://www.youtube.com/watch?v=ud1XNIoh1P8)
Here are the modified remove dirt functions:
#Modified for Polavision film
#Mrecalculate thSAD changed from 100 to 20; scene thresholds added to MFlow
function RemoveDirtMC(clip,int "limit", bool "_grey")
{
_grey=default(_grey, false)
limit = default(limit,6)
prefiltered = RemoveGrain(clip,2)
superfilt = MSuper(prefiltered, hpad=32, vpad=32,pel=2)
super=MSuper(clip, hpad=32, vpad=32,pel=2)
bvec = MAnalyse(superfilt,isb=true, blksize=16, overlap=2,delta=1, truemotion=true)
fvec = MAnalyse(superfilt,isb=false, blksize=16, overlap=2,delta=1, truemotion=true)
# Increase thSAD if moving objects are being removed!!
bvec_re = Mrecalculate(super,bvec,blksize=8, overlap=0,thSAD=20)
fvec_re = Mrecalculate(super,fvec,blksize=8, overlap=0,thSAD=20)
backw = MFlow(clip,super,bvec_re,thSCD1=900,thSCD2=200)
forw = MFlow(clip,super,fvec_re,thSCD1=900,thSCD2=200)
clp=interleave(forw,clip,backw)
clp=clp.RemoveDirt(limit,_grey)
clp=clp.SelectEvery(3,1)
return clp
}
#pthreshold changed from 6 to 30
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=30,
\ cthreshold=8, gmthreshold=40,dist=3,dmode=2,debug=false,noise=limit,noisy=4, grey=_grey)
}
johnmeyer
18th November 2013, 18:51
Like I said the problem is intermittent, so it's not a show stopper. If I'm not doing something obviously wrong it's not likely we'll figure it out. Could be environmental, sometimes restarting virtualDub fixes it, sometimes restarting Windows does. Expecting a certain memory space to be unalllocated? Try adding this statement to the script:
SetMemoryMax(1000)
If it doesn't eliminate the crashes, try changing the number (I often use 768).
As shown, this sets the memory allocation for your script to 1 GB. I have found that this statement can sometimes reduce or eliminate pesky script hiccups and crashes. It doesn't really fix any underlying problem, but it often results in a script that will operate.
Gargamel
24th November 2013, 12:24
Modifications to my version of the script
To salvage extraordinarily dirty film
Congratulations John !
That special script is the missing tool in some extreme cases...
Thank you again for sharing.
GillesH
8th December 2013, 13:08
John, congratulations also for this new RemoveDirt.
Avid reader of this forum for many years, user of your scripts since 2012 and new member of the forum for a few days.
Two questions, please, about this new script :
- What is this new RemoveDirt replace old version or is it only for the Polavision film.
- Is that there are a range of MIN and MAX setting with any argument
thank you
johnmeyer
8th December 2013, 23:55
John, congratulations also for this new RemoveDirt ... What is this new RemoveDirt replace old version or is it only for the Polavision film.
There is nothing new in my post other than changing a few parameters. "RemoveDirt" itself has been used in both Fred's script and in my variations to his script since 2010. I have posted those variations both in this thread and in this somewhat parallel thread:
Capturing and restoring old 8mm films (http://forum.doom9.org/showthread.php?t=165975&highlight=8mm)
So, there is not any new version of RemoveDirt being used. As for the changes in the three settings in the RemoveDirt and RemoveDirtMC functions, you can certainly try them on your own film transfer and see if they are better or worse than the settings I provided before. If you do this, you obviously want to feed a more sensible value to the function (something less than 25 rather than something in the 90s).
One issue with RemoveDirt is that I haven't figured out a way to tell it to ignore dirt objects less than a certain size, or to only look at black or white objects. As a result, when I restore old football game films (I'm doing dozens of these for a major football film collector), I have to use the script twice, with the remove dirt function disabled on the second pass. Then, every time the ball is thrown or kicked, I have to switch to the version with the dirt removal turned off because RemoveDirt tends to remove the ball in flight.
I am afraid that I don't understand your question about MIN and MAX arguments.
manono
9th December 2013, 00:43
...or to only look at black or white objects.
Thanks to poisondeathray and jagabo, I just learned how to do that the other day:
http://forum.videohelp.com/threads/360678-Filter-white-specks-with-Avisynth
If yours are larger than 'specks', then substitute RemoveDirt at whatever settings for RemoveSpotsMC. Maybe it'll save you from having to use it on one pass and removing it for a different pass and then switching back and forth between the 2 different versions.
johnmeyer
9th December 2013, 00:50
Thanks to poisondeathray and jagabo, I just learned how to do that the other day:
http://forum.videohelp.com/threads/360678-Filter-white-specks-with-Avisynth
If yours are larger than 'specks', then substitute RemoveDirt at whatever settings for RemoveSpotsMC. Maybe it'll save you from having to use it on one pass and removing it for a different pass and then switching back and forth between the 2 different versions.Very, very useful. When I get back to my main computer tomorrow I'm going to try some of the ideas in that post. I'm restoring full-length NFL and NCAA football films from the 1940s through the 1960s and the two-step approach adds hours to the work on each film. Thanks!
GillesH
9th December 2013, 11:42
Thank you John (and Fred). I will do further testing with different versions.
Sorry, my English is not always TOP ...
MIN and MAX : I just wanted to know if there were some parameters on which you could play to increase or decrease the effectiveness of the filter limits and what are the min and max.
But I realized the Multi-Passes could solve certain situations.
Thank you.
joka
9th December 2013, 13:59
Johnmeyer,
in case it is possible to create a mask for the removed object, you can restore the object with the function below.
dw_rd is your cleaned clip
dw_rg is the original clip
dwrm is a black and white mask (white forces restoring)
No need for an exact mask, the white ares can be smaller than the object. The mask only starts the restoring. RestorMotionBlocks will paste the object seamless.
Function dw_Restore (clip dwrd, clip dwrg, clip dwrm, int "limit") {
# workarround - addborders/crop moves green artefacts on borders (???) out of visible area
limit = default(limit, 6)
dw_r1 = Interleave(dwrd, dwrd, dwrd).Addborders(16, 16, 16, 16, $000000)
dw_r2 = Interleave(dwrm.mt_lut(y=0, chroma="copy"), dwrg, dwrm).Addborders(16, 16, 16, 16, $000000)
Return RestoreMotionBlocks(dw_r1, dw_r2, noise=limit).SelectEvery(3, 1).crop(16, 16, -16, -16) }
Of course it is possible to use this function for dirt removal directly. This gives more possibilities to control the process by creating, filtering and combination of masks.
However, the main problem is still unsolved. The problem is to decide what is dirt (not to restore) and what is "uncompensated" motion (has to be restored). Motion compensation will fail on a fast moving ball, hand, ... .
jriker1
20th December 2013, 16:25
So if I have a old video from 1968 that I took off a remastered DVD and want to clean up the pixilation and lines and the like in it and just improve it overall, how would I use this script to clean it up. Not the source video is in MKV format.
Noticed the original zip in this thread has a number of scripts and was trying to figure what I would do in my own AVS file to run cleanup against my MKV file and in what software I would do it in. Generally I work in Adobe Premiere and Sony Vegas which don't support avisynth.
Thanks.
johnmeyer
20th December 2013, 16:48
You only use one of the scripts in the zip file. Choose the one that has the capabilities you require. For cleaning up film that has been put on DVD you may first have to do inverse telecine. The scripts will most definitely NOT work on telecined film. Once you have the pristine 24 fps film, just simply run it through the version of the script that has the features you want to use. Make sure to first change the settings to match the problems in your source footage. The "S" parameter in the "results" variable will give you a "before/after" view that is very helpful in tweaking the script parameters.
manono
20th December 2013, 21:01
Not the source video is in MKV format.
Not if it's off of your 'remastered DVD' it's not. Why not decrypt the DVD itself, rather than making things more difficult by sticking it into the MKV container?
jriker1
20th December 2013, 22:46
Not if it's off of your 'remastered DVD' it's not. Why not decrypt the DVD itself, rather than making things more difficult by sticking it into the MKV container?
It's not really encrypted. I happened to have MKVMake so just used it to convert to something else other than DVD format.
JR
manono
20th December 2013, 23:09
It's not really encrypted. I happened to have MKVMake so just used it to convert to something else other than DVD format.
Then you can just drag and drop it onto the computer. You didn't convert it; you repackaged it and many find MKVs more difficult to work with than DVD VOBs. For example, how are you opening the MKV? And don't answer DirectShowSource.
The script isn't really needed for a DVD and was designed for something else. You can use the needed filters on your own without having to rely on the script, including a possible IVTC as mentioned by johnmeyer, something not covered in the script at all. If you post a short sample you might get some more informed advice.
johnmeyer
21st December 2013, 00:33
The script isn't really needed for a DVD ...Actually, I have found that some commercial DVDs contain really bad film transfers. For instance I have a Kinescope of a "Herman's Hermits" performance in Australia back in the mid 1960s. It was transferred from an old print and was absolutely loaded with dirt. The script really helped remove gate weave, improve sharpness, and get rid of the dirt.
manono
21st December 2013, 00:36
Hehe, I doubt it's a kinescope. In fact, he even said it's been remastered. In additon, he is, apparently, not all that knowledgeable where AviSynth is concerned, doing most of his video work using other programs. And the scripts can't be used as-is but will need some serious modifactions, I think, something he may not be prepared to do himself. However, a sample will tell the tale.
frencher
12th January 2014, 02:38
Translated with google translation
Hello everyone,
I would only stabilize videos of my child but I do not know at all an expert in AviSynth script.
In fact I will wish the same Stablisation vReveal that 101% with a avisynth script as simple as possible.
Thank you in advance, these videos are important to me.
http://i44.tinypic.com/23wjthg.png
frencher
12th January 2014, 10:34
I'm ready for create GUI with your Avisynth script if i'm welcome ;)
Wolf
16th January 2014, 13:45
Dear VideoFred, dear friends,
my question is if it's possible to stabilize a clip without change the original footage, in other words correct only the frame jitter (which is caused by limit of camera film transport).
This may be possible, digitizing all the frame info (like perforation and top/bottom line) and after synchronize the perforation hole with the top or bottom line of the frame (Revival and other restoring software works in this way).
Thanks!
P.S. VideoFred your script is fantastic!
Please, sorry for my english.
johnmeyer
16th January 2014, 17:05
my question is if it's possible to stabilize a clip without change the original footage, in other words correct only the frame jitter (which is caused by limit of camera film transport).Just decrease the horizontal and vertical motion stabilization values to small numbers. When you do this, you can also reduce the amount of zoom applied after the stabilization.
johnmeyer
17th January 2014, 01:09
Let me be more specific. Try these much smaller values:
CLeft=12 CTop=12 CRight=12 CBottom=12
maxstabH=4
maxstabV=4
I understand your idea of just stabilizing by using the sprocket holes. That can certainly work. To do this, you would mask out the center of the frame, leaving just the holes. Use this frame to create the Depan stabilizing vectors. Finally, use those vectors to stabilize the un-masked version of the film.
However, I think you will find that simply changing the variables, as I have shown above, will get you 95% of the way towards the result you want, but with only about 2% of the effort.
Wolf
18th January 2014, 00:55
Thanks Johnmeyer!! :)
frencher
6th February 2014, 13:11
Hi all,
I search to fix my bad stabilisation (only)...
From original Script HERE (http://sj1000hd.blogspot.fr/2013/09/optimisation-de-la-video-avec-avisynth.html)
Remove the fish eye effect and vignetting.
Stabilization.
Improved color
How ?
Thanks for all ;)
Package here avs + plugins folder + video sample (http://ul.to/pnyoonyy)
http://i62.tinypic.com/2yv5fs9.png
LoadPlugin("Plugins\mvtools2.dll")
LoadPlugin("Plugins\asharp.dll")
LoadPlugin("Plugins\defish_mt.dll")
LoadPlugin("Plugins\DePan.dll")
LoadPlugin("Plugins\DePanEstimate.dll")
LoadPlugin("Plugins\Deflicker.dll")
video1 = DirectShowSource("Video.mkv", audio=false).ConvertToYV12()
video2 = Optimisation(video1).ConvertToYV12()
video=stackhorizontal(video1,video2)
return video
function Optimisation(clip c)
{
# defish (v1.1) MT for Avisynth 2.5
c = c.ConvertToRGB()
c = c.defish(fov=99, scaling="fitxy",threads=0).ConvertToYV12()
# DePan, DePanEstimate
dymax = 20
sup = c.MSuper()
vec = MAnalyse(sup, isb=false)
globalmotion = c.MDepan(vec, pixaspect=1, thSCD1=400)
c = c.DepanStabilize(data=globalmotion,cutoff=2.0,mirror=0,pixaspect=1,initzoom=1.1,dxmax=0,dymax=dymax,rotmax=360,method=0,info=true).deflicker()
# Autres
c = c.Asharp(1.5,2,0.20,true)
c = c.Tweak(sat=1.1)
return c.ConvertToRGB()
}
basil3w
9th April 2014, 18:07
Does anyone know if Avi Synth or CiniCap will run on a Windows 8.1 machine?
Thanks,
basil3w
flafla91
6th May 2014, 21:53
No problem with Avisynth and Virtualdub with Windows 8.1
Fabien
basil3w
2nd July 2014, 20:45
Fabien-
Sorry it took so long for me to reply, but Thanks Very Much for the response about Win 8!
-George
papcom
24th July 2014, 14:14
I have used and experimented with videofred's scripts since more than a year. No Problem so far. I used the scripts "as is", I made no changes, except the Video source an some slight Level adjustmens. The path's of the plugins I left untouched.
Alls Scripts are installed in a separate Folder on my harddisk as described in videofred's installing help.
Today I installed the new Version of virtualdub 1.10.4 and I installed avisynth 2.5.8 (after having correctely deinstalled the older avisynth Version). I restarted the PC correctely.
Since then I cannot process any scripts of videofred. There is always a load plugin error (unabble to load "plugins/deflicker.dll)
It doesent matter whether I use virtualdub oder AVSEditor Preview...the plugin error comes up.
I do not Change anything in the Installation!!!
Waht has happend? Can anyone help me.
videoh
24th July 2014, 14:24
When you reinstalled Avisynth, you wiped your plugins directory, which previously contained that DLL. Find it online and put it in the plugins directory. There may be others missing as well. If you kept a backup of your Avisynth plugins directory, just use that. If not, well, consider doing so whenever you uninstall Avisynth.
papcom
24th July 2014, 14:56
I don't think it's the Problem You describe. All the plugins which are needed by videofreds scripts are there, as described in the Installation Guide of viodeofred. The folders ar as mus be:
helpfiles
scripts (contains avs scripts and plugins folder with all DLL's)
sourcecode (with all plugins in it)
My Videofred's file installation is in a different Directory than the AVSynth installation in the Programm Folder. It does not touch anyhow the plugin Folder of AVS2.5.8
All DLL's are there at the correct place and also all plugins sources are there at the correct place. But anyhow the script cannot load any plugins which are listed in the script !!
videoh
24th July 2014, 16:03
OK, then can you post the script that does not work? Everything should have explicit loadplugin() calls if the Avisynth plugins dir is not used. Verify that the paths in those calls are correct.
papcom
24th July 2014, 16:56
OK, then can you post the script that does not work? Everything should have explicit loadplugin() calls if the Avisynth plugins dir is not used. Verify that the paths in those calls are correct.
here the relative code excerpt, which Shows the plugin calls. The paths are correct because the plugin Folder lies inside within the scritps: (it allways worked like this, and it is just like videofred's install guide)
# END VARIABLES, BEGIN SCRIPT
#====================================
SetMemoryMax(1000) #set this to 1/3 of the available memory
LoadPlugin("plugins/Deflicker.dll")
Loadplugin("plugins/Depan.dll")
LoadPlugin("plugins/DepanEstimate.dll")
Loadplugin("plugins/removegrain.dll")
LoadPlugin("plugins/removedirt.dll")
LoadPlugin("plugins/MVTools.dll")
LoadPlugin("plugins/MVTools2.dll")
Loadplugin("plugins/warpsharp.dll")
LoadPlugin("plugins/autolevels_06.dll")
LoadPlugin("plugins/Motion_06Dec05B.dll")
Import("plugins/03_RemoveDirtMC.avs")
source= AviSource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
trimming= framecount(source)-trim_end
source1= trim(source,0,trimming)
#STABILIZING/CROPPING
#..........................
videoh
24th July 2014, 17:10
See my post in your other thread.
papcom
25th July 2014, 11:49
for more information about the plugin load problem please read here:
http://forum.doom9.org/showthread.php?p=1687888#post1687888
or here:
http://forum.doom9.org/showthread.php?t=166492
papcom
27th July 2014, 23:53
For opening a QT MOV ProRes File with Avisynth, I use QTSource Plugin with the command "qtinput"...no problem
When I do the same in VideoFred's script I receive the following Script error:
"Invalid arguments to function "AVI Source" on line 146"
where the following is: source= AviSource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
What is my mistake?
johnmeyer
28th July 2014, 03:31
I don't know QTSource, but if the command is "qtinput," then I think all you do is use that in place of the AVISource statement:
source=qtinput(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
manono
28th July 2014, 09:06
What is my mistake?
Is 'Source' referred to later in the script? If not, will:
qtinput(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
by itself work?
papcom
28th July 2014, 16:57
thank You for Your answers.
I tried already with:
source= QTInput(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
but it does not work.
Other useres wrote before in this thread:
Originally Posted by poisondeathray View Post
You can import prores into avisynth using ffms2 or qtinput
johnmeyer
28th July 2014, 17:42
Is 'Source' referred to later in the script? If not, will:
qtinput(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
by itself work?Shouldn't the question be: "is film referred to later in the script? The variable film points to the actual video file, and if it was referred to again, then that reference would also have to be changed. However, once "source" contains the video stream, I think it should be usable elsewhere in the script.
If you temporarily change the script so that the final statement is:
return(source)
does it play correctly? I would certainly begin my troubleshooting by making sure that the QuickTime reader can actually read your source.
papcom
28th July 2014, 17:57
The script I use is the original script 01_A by videofred. I just would like to Import a ProRes422 QT Mov instead of the AVI.
From the principle QTSource works fine for importing my QT MOV with other scripts, which refer to the original plugin Directory within avisynth.
I just wasen't successful with QT MOV and videofred's script. As I have read in this very thread other users have imported QT Mov in videofred's script successfully.. so I think it's just a manner of how to.
Perhaps the users "poisondeathray" or "egekhtr" can explain how they did it. This would be very helpful.
johnmeyer
28th July 2014, 19:59
From the principle QTSource works fine for importing my QT MOV with other scripts, which refer to the original plugin Directory within avisynth. If any of your plugins are NOT in the original plugin directory, then you must load them explicitly. Since your earlier posts described a problem with plugins not loading, then perhaps this is the issue.
For example: loadPlugin("c:\Program Files\AviSynth 2.5\plugins\QTSource.dll")I started programming in the 1960s, and back then, you always had to load everything explicitly. While modern programming languages don't require that, sometimes the assumptions made by the program about where to search for things that it loads implicitly end up making the wrong assumption and grab the wrong thing.
Also, I just tried using the QTSource plugin to load a QuickTime file on my computer, but I got an error because I don't have QuickTime installed on this computer. So it appears that this plugin relies on QuickTime for some of what it does. This then reminds me of problems I have seen reported in other forums many times over the past few years, namely that many plugins are very sensitive as to what version of QuickTime is installed.
[edit]Also, not all QuickTime files are created the same. Perhaps you should try loading this particular MOV file into one of the scripts that has worked with other MOV files.
Reel.Deel
28th July 2014, 20:05
For MOV files LSMASHVideoSource (http://avisynth.nl/index.php/LSMASHSource/LSMASHVideoSource) works great (at least with a few files I tried it on).
manono
28th July 2014, 20:58
Shouldn't the question be: "is film referred to later in the script?
No.
If you temporarily change the script so that the final statement is:
return(source)
does it play correctly?
My point exactly. Once the 'QTSource(Film...' is replaced by 'Source', you have to refer to that film in any future lines by 'Source'. Or maybe we're saying the same thing in different words.
I don't use the script and don't know how it opens a video. My only point was that if he uses 'Source=', in the future he has to continue to use it unless it's replaced by something else. To begin to diagnose the problem I'd stick 'return(source)' right after the first 'Source=' line, open the script in VDub to see if the video gets opened, and then go on from there.
johnmeyer
28th July 2014, 21:03
To begin to diagnose the problem I'd stick 'return(source)' right after the first 'Source=' line, open the script in VDub to see if the video gets opened, and then go on from there.Yes, I think we are definitely saying the same thing, in different words. I agree 100% with your recommendation that I quoted.
papcom
28th July 2014, 23:28
If any of your plugins are NOT in the original plugin directory, then you must load them explicitly. Since your earlier posts described a problem with plugins not loading, then perhaps this is the issue.
I am using the script and installation of videofred and he is using a proprietary plugin Folder and source Folder which are not within the avisynth Installation.
Anyway in videofred's scripts there is no explicit plugin path indicated for his plugins in use ...and this works normally.
LoadPlugin("plugins/Deflicker.dll")
Loadplugin("plugins/Depan.dll")
LoadPlugin("plugins/Depa.......
What I do not understand is the fact that normally the plugins of avisynth are in the avisynth plugin folder (as QTSource.dll, DirectShowSource.dll etc) but the plugins for videofred scripts are in his special folder outside of the avisyth Installation?
Why can't the filter plugins and sources for videofred's script not be within the avisynth directory as all other plugins?
Re QT ... I have QT on my WIN7 PC and I use QTSource sucessfully to open MOV's in avisynth (except for videofred's script)
raffriff42
29th July 2014, 04:35
Why can't the filter plugins and sources for videofred's script not be within the avisynth directory as all other plugins?Because DLL Hell (https://en.wikipedia.org/wiki/DLL_Hell). VideoFred does not want to support all versions, past and future, of the plugins he uses. A wise decision.
I wonder if your problem occurs at this line in the script: film= "C:\Users\You\Documents\Yourfile.avi" # source clip, you must specify the full path here
papcom
29th July 2014, 12:08
Because DLL Hell (https://en.wikipedia.org/wiki/DLL_Hell). VideoFred does not want to support all versions, past and future, of the plugins he uses. A wise decision.
I wonder if your problem occurs at this line in the script: film= "C:\Users\You\Documents\Yourfile.avi" # source clip, you must specify the full path here
That's this section I actually use:
#film= "E:\myvideo.avi" # source clip, you must specify the full path here
# YUY2 (default)
film= QTInput("E:\S8_kaltersee_.mov", color=2)
johnmeyer
29th July 2014, 15:44
The way the script is written, the variable "film" simply points the file that contains your film/video. Then, later in the script, this variable is fed to the AVISource function that then reads the video from that file.
What you have done -- and this definitely will cause problems -- is to change the "film" variable into something different: it now actually contains the video rather than simply containing the file name of the video. When this different type of variable then later gets fed to the AVISource function, it doesn't know what to do with it.
The correct way to modify the script in order to have it work with a QuickTime video is to leave the "film = ..." line alone (keep it the way Fred wrote it) and instead modify the AVISource line in the way that I already described in my previous post.
I didn't realize that you had modified other parts of the script, and that's why my earlier advice didn't work for you.
papcom
29th July 2014, 16:04
thanks to all of You for the help - it made click and now it's running with my ProRes MOV's.
the following lines in my script solved the QT Mov Import:
film= "E:\S8_kaltersee_.mov" # source clip, you must specify the full path here
and
source= QTInput(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
papcom
29th July 2014, 23:43
I notice that I have a slight aspect problem with my videofiles processing with videofred's script: The video is slightly squeezed, (/a circle is a slight Ellipse in heigh)
My Input video is 720x576(rect.pixelformat) and has about 10pixel black on left and right side (this blanking comes from the capture camera).
I guess that if I could crop this 10px left/right the aspect could be corrected. But I did not yet find out where to adjust this parameter.
When I alter the values in the script at "size crop and borders Parameter" I always have issues with the Stabilisation. (large green/black artefacts on the side)
Has anybody a hint for me, where exactely I could correct this aspect problem?
johnmeyer
30th July 2014, 01:07
OK, I'm glad you got the first problem fixed.
Most (although not all) of the cropping and re-sizing parameters must be done in MOD4 (divisible by four). Therefore you will probably have problems cropping 10 pixels from each side. Try instead doing 8 or 12 pixels.
johnmeyer
30th July 2014, 01:18
Also, the "size crop and borders parameters" actually contains three sets of variables. Which ones are you altering? The Cleft, Ctop, etc. are designed to remove the black borders introduced by the Depan stabilization. They are NOT what you want to use if you are attempting to remove black borders that are in the original video. I actually re-wrote Fred's script, and have posted my changes elsewhere in this thread. I documented in those other posts all the things that I changed (I changed a LOT of things), but one thing I added was an additional set of crop variable to handle film transfers that already contained black borders. I use a NTSC DV camera (720x480) for my captures, and it captures more or less a 4:3 aspect ratio. However, while Super 8 film is this same aspect ratio, regular 8mm film is closer to 1:1 and therefore has black vertical bars on each side. You can't simply crop these out and expand the resulting footage because you will then end up with very fat people (i.e., everything is stretched horizontally). If you don't do anything, these black pillars end up wandering around because of the motion stabilization. What I instead had to do was temporarily crop the video, then motion stabilize, and then add back the black borders.
papcom
31st July 2014, 17:11
@johnmeyer - I found Your script and I am trying to work with it but still have some slight loading difficulties:
In Your script You use the following plugins which differ from videofred's script resp. are absent there:
autolevels.dll
mt_masktools.dll
RemoveDirtSSE2.dll
RemoveGrainSSE2.dl
Actually I try to find these plugins (DLL and sources) on the net.
1. I can only find autolevels_06... Do I have to rename it to "autolevels.dll ?!
2. unfortunately I cannot acquire RemoveGrainSSE2.dll - (site down)... Is there an alternative?
I assume to put the plugins in the same plugin folder as videofred's plugins?
johnmeyer
31st July 2014, 19:40
Here's a link to my version of Fred's script. I have included the plugins you requested. These are the versions used by my script. I did not include MVTools2, because you should easily be able to get that elsewhere, and I don't think anything my script is doing is dependent on minor version changes in that DLL.
johnmeyer version of Fred's script, with needed DLLs (https://dl.dropboxusercontent.com/u/1561578/JHM%20Restoration%20based%20on%20film%20restoration%20(revised)_01.zip)
Please note that my script significantly departs from what Fred has been doing, and does not contain many of the enhancements he made in his last interation, most notably some of the changes he has made to autolevels and color correction. I choose to do those things instead inside of my editing program (Sony Vegas).
Just to reiterate what I've said in earlier posts, the main reason I chose to revise his work is that I found that his version adds too much sharpening for the kinds of films I have to deal with, most of which are very old and full of dirt. Too much sharpening does not work well with those films. I also spent a LOT of time changing things to improve performance, and if you can utilize the multi-thread features of my script, you should be able to get at least a 2-3x performance improvement.
Finally, even though I significantly decreased the amount of sharpening, I still often reduce it even further from the default settings that the version of the script I'm posting uses. You should most definitely look at each set of variables in the script and decide if you want to change any of them. Also, the "result=" line is set to "4" which means it uses no autolevels or autowhite functions, and does not provide a "before & after" side-by-side comparison. Change "4" to "S4" if you want that feature. If you want to have deflicker capability, just search on that word, and you'll find two almost identical lines, one after the other, one of which is commented out that contains the deflicker function. Just comment out the line that doesn't have that function, and use the other line instead.
papcom
1st August 2014, 10:14
thank You very much John Meyer for your help. I will go through all of this now.
The first Thing I noticed is the NTSC Format You use. Therefore I will will have to adapt the script to 720x576 and 25 fps.
Where do the plugins belong? Do You have the same Folder structure as videofreds Installation? (I have my diffictulies in makingh the script work because it cannot load the dll's as long as the script is not in the same folder as the plugins.)
Also I do have a script error : there is no function named mtsetmode ...
johnmeyer
1st August 2014, 18:32
The first Thing I noticed is the NTSC Format You use. Therefore I will will have to adapt the script to 720x576 and 25 fps.Just change the numbers in the variables section. That's all you have to do.
Where do the plugins belong?My recommendation is to put them wherever you want to put them, and then change the "load" statements to include the entire path, for example:
Loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")
I said this in an earlier post, but let me reiterate: it is good programming practice to explicitly load your plugins by specifying the exact location. There is no downside to doing this, other than having to include these statements in the script. It completely avoids the all-too-common occurrence of having the wrong version of a DLL loaded and then experiencing mystery problems that no one in the forum can help you fix.
Also I do have a script error : there is no function named mtsetmode ...First of all, the error is probably SetMTMode, not mtsetmode. Second, if you want to take advantage of the multi-threading capabilities of my version of Fred's script, you must use the multi-threaded version of AVISynth. If you don't change the AVISynth version, you will get this error.
If you don't want to change the AVISynth version and don't want to use multi-threading, you can simply comment out the SetMTMode lines (there are four of them) and you won't get this error message. However, quite frankly, if you are not going to use the multi-threading capabilities of my script, then I recommend that you stick with Fred's script and just add the appropriate crop and resize statements to take care of your black bars. The main reason to use my script is that it is several times faster than his, but only if you use multi-threading.
papcom
3rd August 2014, 17:18
Your script (@JHM) is running fine here. I have switched to the MT- capable avisynth 2.6. Unfortunately the script makes my Vdub 1.9.11 crash relatively often. It shows a An out-of-bounds memory access (access violation) occurred in module 'ntdll'...
I muted all four SetMTMode, and tried again with the Standard non MT Anisynth, but also here I have relatively often the crashing and always after quitting the program.
Other issues:
how can I achieve that I do not have any FPS Adaptation? Can I just set 25 FPS instead of 18 for the playspeed. I would like that my films stay 25 FPS without any Change.
I do not quite understand the denumerator. Why there is 60'000:1001=59.94? What does this mean? My films are progressive 25fps, and I want them to stay 100% like that. How should I set the denumerator line?
Do You have any FlipHorizontal filter in this script? I feed a Clip, and after Your script it is flipped 180degrees (horizontally).
johnmeyer
3rd August 2014, 20:26
Your script (@JHM) is running fine here. I have switched to the MT- capable avisynth 2.6. Unfortunately the script makes my Vdub 1.9.11 crash relatively often. It shows a An out-of-bounds memory access (access violation) occurred in module 'ntdll'...
Yes, it is not 100% stable, probably because of the old RemoveDirt plugin which was written long before MT was invented. It is actually amazing that it works at all.
I have developed some workarounds that work quite well, and should let you get around any stability issues. First, when I am looking at a film and want to make sure I have all the settings just right (you should customize the settings for each film), I comment out the SetMTMode lines. This removes the multi-threading and should give you a totally stable system, albeit much slower. Multi-threading is the source of the instability.
When I am ready to actually create the video, I close VD, add the SetMTMode lines back to the script, open my film, and immediately save the AVI file. Most of the instability seems to happen only when seeking forwards or backward (i.e., jumping by many frames at a time, rather than reading each frame in sequence).
Since the whole point of my version of the script is to improve performance, you really should add back the SetMTMode statements before you create the video. If you don't, you should just stick with Fred's version.
The SetMemoryMax function will make a difference in stability. Try slightly larger or smaller numbers (e.g., 1024 or 512).
Finally, change the number of threads. I have an 8-core computer, but I never set threads higher than 6 for this script. If I have a problem with stability, I'll decrease this to some number between 3 & 5.
Again, the stability isn't an issue with the specific features of this script but instead is due to using several older plugins that aren't very "happy" playing in the multi-threaded environment.
Other issues:
how can I achieve that I do not have any FPS Adaptation? Can I just set 25 FPS instead of 18 for the playspeed. I would like that my films stay 25 FPS without any Change.Yes, just set the fps to the playback speed you want. That variable is fed to the "AssumeFPS()" function and does nothing more than change the playback speed: no frames are added or deleted in order to achieve the different playback speed.
I do not quite understand the denumerator. Why there is 60'000:1001=59.94? What does this mean? My films are progressive 25fps, and I want them to stay 100% like that. How should I set the denumerator line?NTSC video, prior to the early 1950s, was 30 fps. Then, in 1953, the NTSC group added color to the B&W TV standard, but in doing so, had to change the frame rate slightly. You have probably seen the number "29.97" as the frame rate for NTSC TV. The real NTSC frame rate is the result of the way in which the color signal was added, and that function involved the fraction: (1000/1001) * 30 = 29.97002997003 ...
As you can see, even though it is an irrational number, 29.97 is pretty close. However, when you want to be totally accurate, you should compute the number as shown above.
This same calculation is involved when creating the framerate for film shown on an NTSC TV, which is 23.976 rather than 24.
The reason for creating a rate that is double the desired rate (59.94) is that the code was written for interlaced video, and when doing that, you create video at double the rate, and then use a SelectEvery() function to assemble the final video by using the upper field from one frame and the lower field from the next frame. This gives you a temporal difference between fields, while maintaining the correct spatial difference between fields.
So, if you want to take a film transfer and play it on an interlaced TV set by manufacturing intermediate fields, you want to first convert to double the frame rate (50 fps for your PAL video), and then do a SeparateFields() followed by SelectEvery() followed by Weave().
For progressive video, you don't need to double the frame rate.
As for the playback rate, for your PAL video, just set the numerator to 25 and the denominator to 1 because (you lucky dog), your frame rates are nice, simple integers.
Finally, FWIW, I almost never use the frame interpolation function for film. The temporal gaps in 16 fps or 18 fps amateur film are so large that the interpolation almost always screws up and gives you horrible morphing artifacts on some scenes (such as people's legs when walking across the field of view). I much prefer the traditional approach of adding pulldown frames, and that is what I always recommend people use. I've spent a HUGE number of hours over the past decade working with various motion estimation software, including commercial programs like Twixtor, trying to find settings that minimize or eliminate these artifacts, but the technology doesn't yet exist that can give you clean estimated frames in all circumstances. When it works, it is magic, but when it doesn't it looks awful.
papcom
4th August 2014, 17:41
Thank You @JHM, Your extensive explanations are very helpful.
I understand, that there is no Interpolation function enabled in Your script anymore, and the video plays out with a 16 or an 18 or a 24 fps Header, without adding frames for pulldown. - Also there is no blending anymore in the scrtipt ---> Is this correct?
I love not too much to sharpen the image, but I like to Degrain the film more. Where would You recommend me to do that in order to receive less filmgrain? I tryed to set the "denoising strength" to 1200, but this doesen't Change a lot?
I do not yet understand why and how You adapted the Denoising Section. The Part with the MVDegrain is muted out?!?
where do I change the color of the characters in the compare-view (S1-S4)?
johnmeyer
5th August 2014, 01:33
I understand, that there is no Interpolation function enabled in Your script anymore, and the video plays out with a 16 or an 18 or a 24 fps Header, without adding frames for pulldown. - Also there is no blending anymore in the scrtipt ---> Is this correct?Yes. I do no frame blending, frame interpolation, or even any pulldown. This is purely a personal workflow decision on my part, but I almost always still want to do more with the restored version of the film, like adding titles, more color grading, etc. and therefore since I am going to put it back into my editing program (Sony Vegas) it is just as easy to let Vegas do the pulldown. Vegas can do both pulldown and frame blending, and do it exactly as well as AVISynth.
I did include, but have commented out, three different ways to do motion interpolation, if you want to add frames using that technology. The first uses the MVTools2 function, MFlowFPS. These lines are almost straight from the MVTools2 documentation, although I did increase the block size. I find that large block sizes generally produce fewer morphing artifacts when used on low-fps film rates (YMMV).
I then included two separate ways to do the same thing using SmoothFPS2 plugin. The first example uses it directly, and the second uses it via the InterFrame script. The advantage of SmoothFPS2 is primarily speed. In my tests, I general have gotten better visual quality using MFlowFPS.
I love not too much to sharpen the image, but I like to Degrain the film more. Where would You recommend me to do that in order to receive less filmgrain? I tryed to set the "denoising strength" to 1200, but this doesen't Change a lot?I included three different sets of denoising settings, with two of those blocks commented out. The version of the script I sent to you had these settings enabled:denoising_strength= 600
block_size= 8
block_size_v= 8
block_over= 4
The block size and overlap can make a difference. You could try the block_size=16 group of settings, or go the other direction by using block_size=4. The only block_sizes you can use are 4, 8, & 16 (maybe 32, but that wouldn't do much). The overlap parameter must divide evenly into block_size (I think).
There is one other thing that you can try, which I describe in answer to your next question.I do not yet understand why and how You adapted the Denoising Section. The Part with the MVDegrain is muted out?!? It may at first look like I did that, but look again and you'll find that I did not. First of all, there is a big block of commented-out code that I should have removed. It is left over from the first iteration of the script I posted, before I started using MRecalculate. I kept it around to remind me of the earlier way I did things, but I should have removed it before I sent it to you. So, you can remove these lines:#super = stabcrop.MSuper(pel=2)
#bvec1 = MAnalyse(super, isb = true, delta = 1, blksize=block_size, overlap=block_over,dct=0)
#fvec1 = MAnalyse(super, isb = false, delta = 1, blksize=block_size, overlap=block_over,dct=0)
#bvec2 = MAnalyse(super, isb = true, delta = 2, blksize=block_size, overlap=block_over,dct=0)
#fvec2 = MAnalyse(super, isb = false, delta = 2, blksize=block_size, overlap=block_over,dct=0)
#bvec3 = MAnalyse(super, isb = true, delta = 3, blksize=block_size, overlap=block_over,dct=0)
#fvec3 = MAnalyse(super, isb = false, delta = 3, blksize=block_size, overlap=block_over,dct=0)After you remove these lines, this comment will make more sense:#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.
Actually, that line is still confusing, because once I added MRecalculate, there are actually now four lines that you would have to un-comment. The whole point is that MDegrain can actually use three sets of motion estimation vectors (MDegrain3) rather than two (MDegrain2), and may be able to do a better job (which is what you want). I never saw any real advantage, so after I did some initial tests I never enabled this. As the script is written now (look carefully this time) MDegrain is being called on this line:
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)If you want to enable the three-level degraining, then change the denoising section to this:#DENOISING
#................................................
input_to_removedirt=stab.crop(CLeft,CTop,-CRight,-CBottom)
stabcrop=RemoveDirtMC(input_to_removedirt,dirt_strength,false)
prefiltered = RemoveGrain(stabcrop,2)
superfilt = MSuper(prefiltered, hpad=32, vpad=32,pel=2)
super= MSuper(stabcrop, hpad=32, vpad=32,pel=2)
halfblksize= (block_size>4) ? block_size/2 : 4
halfoverlap= (block_over>2) ? block_over/2 : 2
bvec1 = MAnalyse(superfilt, isb = true, delta = 1, blksize=block_size, overlap=block_over,dct=0)
bvec1 = MRecalculate(super, bvec1, blksize=halfblksize, overlap=halfoverlap,thSAD=100)
fvec1 = MAnalyse(superfilt, isb = false, delta = 1, blksize=block_size, overlap=block_over,dct=0)
fvec1 = MRecalculate(super, fvec1, blksize=halfblksize, overlap=halfoverlap,thSAD=100)
bvec2 = MAnalyse(superfilt, isb = true, delta = 2, blksize=block_size, overlap=block_over,dct=0)
bvec2 = MRecalculate(super, bvec2, blksize=halfblksize, overlap=halfoverlap,thSAD=100)
fvec2 = MAnalyse(superfilt, isb = false, delta = 2, blksize=block_size, overlap=block_over,dct=0)
fvec2 = MRecalculate(super, fvec2, blksize=halfblksize, overlap=halfoverlap,thSAD=100)
bvec3 = MAnalyse(superfilt, isb = true, delta = 2, blksize=block_size, overlap=block_over,dct=0)
bvec3 = MRecalculate(super, bvec3, blksize=halfblksize, overlap=halfoverlap,thSAD=100)
fvec3 = MAnalyse(superfilt, isb = false, delta = 2, blksize=block_size, overlap=block_over,dct=0)
fvec3 = MRecalculate(super, fvec3, blksize=halfblksize, overlap=halfoverlap,thSAD=100)
denoised=stabcrop.MDegrain3(super, bvec1,fvec1,bvec2,fvec2,bvec3,fvec3,thSAD=denoising_strength) \
.tweak(sat=saturation).unsharpmask(PRE_sharp_ness,PRE_radi_us,0)
I just did a little quick testing and got slightly better results on one test clip by using the three level degraining with the block size set to 16. However, when I raised the denoising_strength from 600 to 1600, various things started disappearing from view.
You'll just have to play around with this. There is no perfect solution to degraining. where do I change the color of the characters in the compare-view (S1-S4)?I actually have no idea without looking it up. I'm 99% certain you do it by setting the text_color and halo_color values in the Subtitle calls in the "COMPARISONS: ORIGINAL VS RESULTS" section of the script.
papcom
5th August 2014, 20:12
thank You again @JHM for all the detail-help. I appreciate it very much.
I like the way to export the film without any frame blending, frame interpolation, or pulldown. This is how I work. I use Premiere CS6 or Apple FCP7 or FCPX.
I saw that You are working with sony vegas. That's one of the Tools i am very interested in. I recently read a test about it, which highly recommended this soft.
Actually I am trying with different parameters and different source material. The results are encouraging. I am testing 768x576 progressive source material, which looks nice after processing. Soon I will start to check images with my other transfer system, which is a modified Bauer525 for frame by frame capturing via a machine vision camera with 1024x768pixels.
btw - I found the way to modify the characters in the comparison view via text_color etc. ..thanks for your hint.
Ultimist
11th August 2014, 23:14
Can someone tell me which version of Avisynth these scripts are compatible with? I've tried the 2.5 and 2.6 MT versions... and Avisynth+, but I keep getting multiple errors and crashes no matter what I try.
Any help would be appreciated. Thanks!
johnmeyer
11th August 2014, 23:20
I use AVISynth 2.60, build:Mar 9, 2013 (2000-2011 Ben Rudiak-Gould). It works with both Fred's script, as well as my multi-threaded script that is an offshoot of his work.
Reel.Deel
12th August 2014, 02:55
Can someone tell me which version of Avisynth these scripts are compatible with? I've tried the 2.5 and 2.6 MT versions... and Avisynth+, but I keep getting multiple errors and crashes no matter what I try.
The plugins that this script requires (and supplies) are all Avisynth 2.5 plugins so the script should work with 2.5.8, 2.6, and Avisynth+ without any problems (I use 2.6 Alpha5 (http://forum.doom9.org/showthread.php?t=168764)/2.6 MT (http://forum.doom9.org/showthread.php?t=148782) and it works). Maybe it would best if you can post the exact error messages.
Ultimist
12th August 2014, 04:32
Most programs I've tried (Virtualdub, etc.) just crash out without giving me much info.
But AvsPmod generates the following error messages using johnmeyer's altered script on a video:
Traceback (most recent call last):
File "avsp.pyo", line 9379, in OnMenuVideoToggle
File "avsp.pyo", line 14234, in ShowVideoFrame
File "avisynth.pyo", line 464, in GetFrame
WindowsError: exception: access violation reading 0xFFFFFFFF
This happens no matter which version of Avisynth I have installed, it seems.
Could the problem be that I'm on Windows 8.1 x64? Maybe Avisynth doesn't work with this OS?
Reel.Deel
12th August 2014, 04:50
Are you using the plugins provided with the script in the first post?
Ultimist
12th August 2014, 19:01
Yes, I even double checked to be sure. I'm using the provided plugins & dll's.
I'm wondering if it is K-Lite Codec pack or that damn LAV Decoder/Splitter/Virus
I've tried enabling and disabling all sorts of codecs/splitters, etc. using the codec tweak tool from K-Lite.
The video I'm trying to use with Avisynth is compressed with Lagarith, no audio. In Windows 7 x64 it worked just fine with Avisynth (same video) but since upgrading to Windows 8.1 x64 (clean install) I can't get these cleaning scripts to work... also having trouble with QTGMC and AnimeIVTC as well. Ugh... I want to pull all my hair out. I *need* these to work.
foxyshadis
12th August 2014, 22:25
Using what source? FFVideoSource, LWLibavVideoSource, and Avisource (with Lagarith VFW installed) would be preferred for that; DirectShowSource is generally the option of last resort. (That's the only way K-Lite or Lav filters would be used.)
jriker1
15th October 2014, 17:23
If I wanted to use Fred's or John's modified version of the script and my video won't load properly using AVISource and needs DirectShowSource can the script be modded to work? I know using AVISource and just passing .killaudio() works, but there must be something in the script stopping it from working. Have seen in the past with DV content that DirectShowSource usually loads better for me. If I try loading the avs file in Windows Media Player it just crashes.
Note the computer I'm working on has no working soundcard so have seen it cause issues in the past but not sure if that's the case here when as mentioned AVISource works fine with the killaudio flag, just not here.
Another note, loads in VirtualDub but the minute I try to move thru the video it crashes with "An out-of-bounds memory access (access violation) occurred in module 'ntdll'...
... reading address DDDDDDDD."
If I open it in VirtualDubMOD I get: "Couldn't locate decompressor for format 'YV12' (unknown)". Then also get a memory error.
JR
videoFred
16th October 2014, 11:02
If I open it in VirtualDubMOD I get: "Couldn't locate decompressor for format 'YV12' (unknown)". Then also get a memory error.
JR
Simple solution: install a YV12 decompressor. :)
Hint: Helix ;)
Fred.
papcom
17th October 2014, 17:10
I have processed several 8mm movies with the scripts of Videofred and JohnMeyer. I am really astonished about the good results I get with my 8mm films and these script-processing. I was able to restore, decoloured, grainy, shakey, jittery films with great success. Thanks to VideoFred and JohnMeyer.
But one thing bothers me often: I always get a certain halo of not removed grain around all moving objects (faces, hands, cars etc.) . This can be very ugly. Especially if I recompress the uncompressed AVI source to and MPEG2 DVD file. Then these sequences are not anymore usable. The grainy halo is strongly visible, which is very nasty.
I tried to lower the degrain but the good Overall Impression gets worse, which is a pitty.
Has anyone a remedy against this "halo - thing"? Thank You for Your estimated help.
johnmeyer
17th October 2014, 17:37
It's the sharpening. VideoFred processes film that is very pristine and new, and the initial sharpening settings in his script are designed for that source material. For many other types of film, you need to reduce the sharpening settings, sometimes by quite a lot. The degrain and dirt removal are different than the sharpening, so you may not need to reduce those. Try setting all the sharpening settings to zero, or near-zero and see if you like the results better. I think in VideoFred's latest scripts the sharpening parameters are in the section of the script labeled "Four step sharpening parameters."
Less is more.
videoFred
17th October 2014, 19:08
It's the sharpening.
Yep ;)
Fred.
papcom
17th October 2014, 19:59
i noticed the difference with the sharpening when I used JohnMeyer's Script instead of VideoFred's.. The halo effect was almost gone, but of course the sharpness too.
It would be very helpfull if You could provide certain values regarding the sharpening. Actually I use the following (see below), which is fairly near to my the original captured film. Although I would prefer a bit more sharpness, how can I achive it without the halo's?
Generally spoken I sometimes prefer using Videofred's Script because it does not Crash so often! Sorry John Meyer, dont get me wrong... on the other side Your script has more explanations and produces very nice results... Also when I use 2.6 Multithreading it it kills the process on my WIN7 machine too often.
#FOUR STEP SHARPENING PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------
PRE_sharp_ness= 120 PRE_radi_us= 3 #presharpening (UnsharpMask) just after first denoising
#PRE_sharp_ness= 85 PRE_radi_us= 3 #presharpening (UnsharpMask) just after first denoising
LSF_sharp_ness=160 LSF_radi_us=2 LSF_sub=1.5 #second sharpening parameters (LimitedSharpenFaster) sub=subsampling
#Sharp_Strength = 0.4
Sharp_Strength = 0.1
probably I do note quite understand everything the right way, and there could be eliminated some passages out of the code of JohnMyer's script in order to Speed up the Rendering process. My source is a uncompressed video with 25 fps, 720x576 Pixel size, progressive, where each videoframe represents a filmframe!
johnmeyer
17th October 2014, 20:29
It would be very helpfull if You could provide certain values regarding the sharpening. Actually I use the following (see below), which is fairly near to my the original captured film. Although I would prefer a bit more sharpness, how can I achive it without the halo's? Every reel of film is different, and therefore you have to change the settings to fit your particular situation.
Sharpening without creating halos is the holy grail of sharpening, and so far such a creature does not exist. However, you might try removing the sharpening used by the existing script and use instead a more sophisticated sharpener, like the LimitedSharpenFaster.avs script created by Didée.
Generally spoken I prefer using Videofred's Script because it does not crash all the time and it is 5 time faster JMH's script! Sorry John Meyer. Your script has more and clearer Information and produces very nice results... Parts of what you say are puzzling to me. I'll admit that my version of the script can be a little unstable, although usually only when you seek on the timeline. The instability is due to the multi-threading, and the fact that some of the plugins used in the script were not designed with multi-threading in mind. So what I do to avoid the instability is temporarily comment out the SetMTMode() statements while doing my tweaking for each reel of film, but then put them back in just before doing the render. Also, you have to use a version of AVISynth that is compatible with multi-threading if you want the multi-threading to work.
The part of your statement that is puzzling, however, is your claim that my script is slower. The whole reason I created my version of the script, and added the multi-threading was to improve performance, and in that effort, I succeeded. I did extensive tests several years ago, and my version should be about 2-3 times faster, i.e., a very big difference.
The fact that you are getting slower performance with my version of the script leads me to believe that you don't have your system set up correctly to use multi-threading. Only certain versions of AVISynth work with the SetMTMode() architecture.
VideoFred's version has a lot more settings for color correction and sharpening which I didn't take forward into my version.
You pays your money and you takes your choice.
papcom
18th October 2014, 00:13
@John Meyer - thank You for Your reply.
If You check my posting before, You see that i did not write anything about speed. (message edited!)
Actually I completely refrain from using any script in a MT - environnement (AVISynth 2.6). I had too much difficulties, and I could not find out why. So I use Your script and VideoFred's script both in the normal manner.
When I load Your script in Vdub 1.9.x it does the Job if I do not scrub on the timeline, but it crashes immediately when I click reopen video (e.g. after editing the script in AVSedit.)... also it crashes when I quit VDub.
Unfortunately I do not understand Your Phrase: "You pays your money and you takes your choice. "
It would be really helpful if there would be some kind of manual for these scripts, how to use all the Parameters and how they correspond. The inline help is good, and in Your script even more informative, so I learned a lot. On this base I have worked for many dozens of hours with the scripts, but I always have my difficulties with the sharpening and the denoising Parameters, as I have written in my posting before.
johnmeyer
18th October 2014, 01:49
If You check my posting before, You see that i did not write anything about speed. (message edited!) OK, so you removed the part of your post that I quoted.
Actually I completely refrain from using any script in a MT - environnement (AVISynth 2.6). I had too much difficulties, and I could not find out why. So I use Your script and VideoFred's script both in the normal manner. That is fine, but if you don't use the MT features, then you really should not bother using my version of the script because, as I stated before, that was one of the main reasons I undertook the re-write. I also added the dirt removal using RemoveDirt(), and in my latest version, I spent a LOT of time fine-tuning the function to improve the quality of the dirt removal. VideoFred did adopt some of that original dirt-removal code, but I don't know if he adopted any of my later changes and improvements.
Unfortunately I do not understand Your Phrase: "You pays your money and you takes your choice. "Sorry, that is my fault. I forget that this is an international forum, and many people aren't familiar with American idioms. It means that it is up to you to make a commitment ("pay your money") and at that point, you are going to get the benefits -- or the problems -- associated with that choice.
It was a lame attempt at being light-hearted.
It would be really helpful if there would be some kind of manual for these scripts, how to use all the Parameters and how they correspond.I won't defend my documentation -- or lack of it -- but I will say that I think VideoFred did a much better job documenting his work than what I have found in most scripts posted here. Each section is well-labeled. Also, he did an excellent job of grouping the various settings so, for example, if you need to reduce sharpening, just go to that section of the script and set everything to zero, or almost zero.
Speaking of sharpening, which is your main problem, I just searched VideoFred's entire script using the search term "sharp" and in addition to three "USM_sharp_ness" parameters (all of which I'd recommend you set to 1, until you get sharpening you like) there is what looks like a "hard-wired" sharpening step in this line:
stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5)
I'd delete everything to the right of the period, i.e., remove:
.sharpen(0.5)
papcom
18th October 2014, 10:12
Thank You JMH for Your hints.
I'll go on trying different parameters on the sharpening etc. Anyway I am feeling a little bit in the mist, because I do not understand it. Why use 16 in blocksize and 8 in blockover ...and not 11 and 7 ?. What is the explanation behind this figures. These dependencies I am interested in.
The similar Problem I do have with the Auto Level Parameters: What is X and X2 ... I tried extreme values like 50 and 100 but I did not see any difference.
Another Thing ist the Output videoformat. Which one is the recommended Output Format?
I do not understand the relation to YV12 in the script? I thought YV12 is 8bit Yuv Format but finally it is e.g. Vdub which determines the Output ...isn't it? So what is the reason and/or the function of YV12 in the script?
Until today I choose the Output Format in the Video Compression of Vdub and I save the AVI with the choosen compression or lossless uncompressed.
As I often work on a Mac I need to import the Output file from Vdub Win PC to Mac which can be very tricky because the Mac does not accept any Format. E.g. I was not able to Import an uncompressed AVI and use it in the Mac.
It worked with BMD-422-10bit codec, because I have BMD devices in both Computers and this codec is on the machine. But of course I would prefer uncompressed .
Does anyone have any suggestions?
johnmeyer
18th October 2014, 17:26
You have a lot of different questions, and I don't think I can answer them all, but I'll try to answer a few of them.
Block Size and Block Overlap are used by the MVTools (or MVTools2 for my script) motion estimation code. These functions analyze groups of pixels ("blocks") that are 4x4, 8x8, or 16x16 size. These are the only values allowed (4, 8, 16). Thus, you cannot use numbers like 7 or 11.
The "overlap" parameter causes the estimation to create blocks of pixels which overlap each other so that you get smoother results (i.e., no discontinuity between blocks of pixels). The more overlap, the slower the script. It can be no larger than one half the block size. I either use no overlap, or the smallest overlap allowed. In my latest version of the script, I do a two-step version of motion estimation, using two different block sizes. This seems to operate slightly faster, and provide very slight improvement in results.
X2 is a parameter that temporarily creates a small border around the video prior to applying the Autolevels filter. This border is then immediately removed after applying that filter. It provides a way to "fool" the Autolevels filter into creating the correct levels by creating a pure black reference around the frame. VideoFred later completely re-wrote his script to change how the automatic levels are created. So, his script no longer uses the Autolevels filter, and therefore no longer uses this variable. I have still never found any auto level filter that works consistently well, and therefore edit levels by hand in my editing program (Sony Vegas Pro) before exporting the video to the script, so I never use this function, and therefore never spent any time trying to improve on VideoFred's work. If you want to use the Autolevels function, then you should use his versions of the script, not mine.
All that is needed is to create a border, so changing the values of X2 and X will not do anything useful. I am therefore not sure why VideoFred created these as a variables.
The color space that you use depends, first of all, on the filters in the script. Most AVISynth filters require YV12. Many codecs work with this color space, so I usually don't need to make any further color conversions.
I always avoid using uncompressed. There are so many good alternatives, that I see no reason to ever do this. For me, I always use frame serving to pass video from one process to another. That provides all the benefits of uncompressed, without the two major downsides: disk performance bottlenecks, and disk space.
The simplest alternative to uncompressed is to use a lossless codec, like HuffYUV or its newer alternative, Lagarith. Better yet, there are some very high quality lossy codecs that are so good that they are called "intermediate codecs," meaning that they are designed to be visually "virtually lossless," meaning that it will be very difficult to see any visual difference between the original and the rendered result, even when the video is rendered several times. The GoPro company purchased the best-known of these intermediates, Cineform, and this can be downloaded for free from the GoPro site as part of their small GoPro Studio editing package.
Since I don't use a Mac, I am not familiar with what codec types it accepts, and how easy it is to add additional codecs. However, I am pretty sure you can get Cineform codec if you download the Mac version of the GoPro Studio editing software. That should let you exchange video between your PC and Mac using video rendered using the Cineform codec. Once you install Studio, the Cineform codec will show up in VirtualDub as one of the compression codecs.
poisondeathray
18th October 2014, 17:40
Another option for Mac is to use the vdub external encoder feature with ffmpeg. This allows you to export a variety of formats, including MOV, prores, etc... If you still want uncompressed 8bit 4:2:2, Mac's are picky about which fourcc's and planar arrangements they will accept. "2vuy" or "uyvy" tend to be the most compatible
If you are using avs only, (nothing in vdub like deshaker or other filters), then you can use the avs directly with ffmpeg and skip vdub altogether to export various MOV formats
It worked with BMD-422-10bit codec, because I have BMD devices in both Computers and this codec is on the machine. But of course I would prefer uncompressed .
v210 IS uncompressed. It's 10bit 422 uncompresse
creaothceann
18th October 2014, 20:42
Another thing is the output video format. Which one is the recommended output format?
I do not understand the relation to YV12 in the script? I thought YV12 is 8-bit YUV format but finally it is e.g. VirtualDub which determines the output... isn't it? So what is the reason and/or the function of YV12 in the script?
Until today I chose the output format in the video compression of VirtualDub and I save the AVI with the chosen compression or lossless uncompressed.
Note that a lossless codec is like using WinRAR or 7zip, but optimized for video data. It should always be preferred unless you can't open the format on another computer.
VirtualDub by default converts all video data to RGB because its filters can only operate in RGB color space. You need to set it to "fast recompress" (http://i.imgur.com/dVlEk06.png) ("direct stream copy" would just save the raw data to a file) so that it passes the input data without changes to the encoder (e.g. Lagarith in YV12 mode or x264vfw in lossless mode). The encoder is the one who determines the color space.
(Personally I use VirtualDubMod because it lets me save the "fast recompress" option so that I don't have to select it every time.)
papcom
19th October 2014, 09:54
@JMH - thank You for all the Details. I am constantly learning and Your hints help a lot.
My actual "problem zone" always is that grainy "halo" around faster moving objects (e.g waving Hands, or a fast moving head in front of a blue sky etc). I tried to reduce sharpness, or degrain or both, but at the end I could not yet get a satisfying solution for this.
BTW ... how can I adjust the Blacks and the Whites for the autoloevels in Your script? I could not find it yet. (In Videofred's script there are the parameters: "autolev_low and _high)
What denoising parameters do you use? I operated with values such between 90 and 600 (strenght) and 6 (denoising Frames). I adjusted it from a subjective point of view.
@poisondeathry - thank You for the hint with the ffmpeg. I wonder whether it will be able to output a prores mov file from within a Win PC?
Thanks to @creaothceann too. I will try fast recompress
johnmeyer
19th October 2014, 16:37
If you are only seeing problems around moving objects, it could be the RemoveDirt plugin. You could try reducing the dirt setting down to 1.
As for recommended starting point for settings, the values in my version of VideoFred's script are the values I always start with. If I make any changes, those changes are almost always reductions. I generally reduce the sharpening settings down to about 1/2 of those starting values. I also often use 1/2 the motion stabilization settings, and also reduce the stabilization crop values by the same proporation so as not so lose too much of the border.
The following link takes you to some of my film transfers. Only those uploaded in the last two years have been put through these restoration scripts, so make sure to check the upload date before playing the film. Those uploaded from 2011 and earlier are just transfers, without restoration.
John Meyer Film Transfers (https://www.youtube.com/playlist?list=PL230DED9513ECA2CB)
poisondeathray
19th October 2014, 17:42
@poisondeathry - thank You for the hint with the ffmpeg. I wonder whether it will be able to output a prores mov file from within a Win PC?
Yes, that's what I said above, prores. From PC, Linux or Mac
"This allows you to export a variety of formats, including MOV, prores, etc..."
Note, the ffmpeg / ffmbc variant of prores isn't "Apple certified". It's essentially a "hacked" version. It works fine in most Mac programs like FCP/ FCPX, but some have problems with it (e.g. Resolve), some have gamma issues with it. So make sure you test your end to end workflow on a sample first
papcom
19th October 2014, 22:07
does anybody have a verified link to the most new stable Version of Virtual Dub Mod?
The links I tried always lead to some unknown sources which all ask for the installation of "Corona" whatever this is?!
creaothceann
20th October 2014, 00:04
http://virtualdubmod.sourceforge.net/
http://www.videohelp.com/tools/VirtualdubMOD
StainlessS
20th October 2014, 00:05
I dont know which is the most stable, all I can say is that I'm using the most stable that I'm aware of, that be 1.5.10.3, build 2550
which had the Fizick (I think) fix for the script editor. (Some earlier builds screwed up the editor, ie edits made in VDdub, mis-inserted in
avisynth [all out by one frame]).
What I really do want to know is, WHERE IS SOURCE FOR VDUBMOD 1.5.10.3 BUILD 2550. (Just 1.5.10.2/3 would do, I have the patch).
EDIT: I wanted to try to insert DubMod editor into current VDub.
EDIT: There is a (I think) French VDubMod of about v1.7, but they also ****ed up the Vdub avisynth script editor.
EDIT: French version was 1.7.8 (with bad script editor), [think they called it '......ModPlus'].
EDIT: Suggest creaothceann's VdubMod link, Videohelp one, 3rd link down ie "More download options: Download VirtualdubMOD 1.5.10.3 (direct link)", I would not touch any others, all probably broken.
johnmeyer
20th October 2014, 01:09
BTW ... how can I adjust the Blacks and the Whites for the autoloevels in Your script? I could not find it yet. (In Videofred's script there are the parameters: "autolev_low and _high)
What denoising parameters do you use? I operated with values such between 90 and 600 (strenght) and 6 (denoising Frames). I adjusted it from a subjective point of view.I think you really should be using VideoFred's script rather than my adaptation. I've already made my point that without MT my script has very few advantages. Also, you obviously want to use autolevels and, as I mentioned before, VideoFred spent a lot of time improving that in his latest scripts. However, I didn't port over any of that to my version of his scripts.
So, forget that my script exists, and use his instead.
szabi
20th October 2014, 07:11
Hi
I have a 8mm film transfer in canopus DV-AVI format, with this parameters: 720×576@16.66fps.
Now I try to use "01_B_Film_Restoring_Frame_Blending.avs" script to improve it.
In script only modified this parameters:
trim_begin=0 trim_end=0 play_speed= 16.6666
This is the outcome:
http://abload.de/img/01_b_film_restoring_fjjoza.png
The quality is away from the sample videos which demonstrating the power of this script (http://vimeo.com/user678523/videos).
What else did I miss?
bye
szabi
papcom
20th October 2014, 14:54
@szabi - a canopus dv avi cannot have 16.666 fps. Also You cannot process interlaced material in this script. It makes a mess. And the canopus DV AVi Codec is interlaced with lower fields priority. Will not work like this.
Anyway the Color Result You Show is not correct but even better than the original, although I am not sure whether this amount of color correction You'd like can be made with this script.
johnmeyer
20th October 2014, 16:57
1. Your film transfer must be frame accurate (one frame of video for each frame of film). If you have any frame blends, or any temporal difference between fields (interlacing), the script will not work, at all.
2. For your initial work with the script, make sure that the frame rate you specify in the script matches the source frame rate. You do not want to confuse the issue by blending, synthesizing, or duplicating frames. You can add that feature at the end of your work, just before you render.
3. Turn down all the sharpening parameters. There is too much sharpening in your clip.
4. Forget about the color and level corrections. Use "S4" which removes both of these features. They are not working at all on this clip and are making a mess of things.
johnmeyer
20th October 2014, 17:14
P.S.
Here is a link to one of my initial posts in this thread where I first discover that the default sharpening settings in the script can create chaos when applied to film that is old, dirty, and grainy. Remember, VideoFred's settings are designed for modern film that is in really good shape. The still shots I post in the link below show what happens when those settings are used on old, dirty, grainy film. I think you will see some of the same problems in my snapshots that are seen in the post above.
Too Much Sharpening in Film Restoration Script (http://forum.doom9.org/showthread.php?p=1405197#post1405197)
szabi
20th October 2014, 19:28
I know what the input requirement, and my source is fullfill it.
I did read your linked post. It was written year 2010.
Since that, Fred implement "RemoveDirt" which active with "result1" setting.
Now I try variant of parameters how to get better output, but not easy.
bye
szabi
johnmeyer
20th October 2014, 19:49
If you can post a few seconds of your source film, I can try to find some settings which work better than what you are doing.
szabi
20th October 2014, 21:32
Yes, I appreciate your help, link sent via PM.
Hopefully it can be downloaded.
Thnx.
bye
szabi
johnmeyer
20th October 2014, 22:09
I've downloaded it, but I don't have the ffvh codec. I can play it in VLC, but can't edit it. I'm working on trying to get that codec without having to install a "codec pack," something that should be avoided at all costs.
I'll post again if I can get your video into my editing system.
creaothceann
20th October 2014, 23:04
I'm working on trying to get that codec without having to install a "codec pack," something that should be avoided at all costs.
But... why? (http://haruhichan.com/KCP )
Anyway, just convert it e.g. with mencoder.
johnmeyer
20th October 2014, 23:16
[url=http://haruhichan.com/KCP ]But... why?Because of dozens of posts in the Sony Vegas forum about major malware (or at least adware) issues with codec packs such as K-Lite.
I am unable to open the video or to transcode it with VLC. In order to at least do a little something with it, I'm uploading it to YouTube and then will download from there, basically using it as a transcoding engine.
johnmeyer
20th October 2014, 23:31
Well, I'm stumped. I can't figure out how to install the codec, or how to convert the file into something I can edit.
So, I am sorry, I won't be able to help on this one.
creaothceann
20th October 2014, 23:36
Even mencoder (mplayer)?
StainlessS
20th October 2014, 23:54
John, this will convert pretty much anything to either HuffYUV or UT_Video
setlocal
REM Where to Find ffmpeg
set FFMPEG="C:\BIN\ffmpeg.exe"
REM Where to get input file, No terminating Backslash, "." = current directory (ie where this *.BAT file is)
set INDIR="."
REM Where to place output file, No terminating Backslash.
set OUTDIR="D:\AVI"
FOR %%A IN (*.wmv *.mpg *.avi *.flv *.mov *.mp4 *.m4v *.RAM *.RM) DO (
%FFMPEG% -i "%INDIR%\%%A" -vcodec huffyuv -acodec pcm_s16le "%OUTDIR%\%%~nxA.AVI"
REM %FFMPEG% -i "%INDIR%\%%A" -vcodec utvideo -acodec pcm_s16le "%OUTDIR%\%%~nxA.AVI"
)
Pause
You can probably add a few extensions of choice to the 'FOR %%A IN'
line and if UT_Video required then REM out the HuffYUV line and un-REM the UT_Video line.
The rest should be straight forward.
poisondeathray
21st October 2014, 00:14
or You can probably use ffms2 to open it in avisynth
Nothing to install or convert, just a LoadPlugin for the .dll (or LoadCPlugin if using 2.6.x version)
FFVideoSource("video.avi")
johnmeyer
21st October 2014, 00:30
StainlessS,
Thanks for the ffmpeg info. I figured out the same thing for myself while you were posting and was able to convert the file to uncompressed.
I then did color correction in Vegas (it's really hard to do proper color correction programatically in AVISynth) and fed the result to my version of VideoFred's film restoration script, but heavily modified to deal with Polavision film. This is the instant movie film created by Polaroid in the late 1970s. The film sits in the cassette in which it was developed, and over the years, you get huge chemical stains all over the film similar to what you see in this clip. I've never published this version of the script. I significantly modified the RemoveDirtMC function. Here is a snapshot of the result:
https://i.imgur.com/gOooqOJ.jpg
[edit] Photobucket is working again, so I edited the post to include the image inside the post.
johnmeyer
21st October 2014, 00:38
Here is a link to the "fixed" video:
Fixed Video (https://dl.dropboxusercontent.com/u/1561578/Fixed.avi)
szabi
22nd October 2014, 08:32
Thnx, now the differences can be compared.
http://abload.de/img/originalnxbxf.pnghttp://abload.de/img/fred_result1n6bod.png
http://abload.de/img/my_variantcolr6.pnghttp://abload.de/img/johnmz9rx1.png
Last is your result.
Seems we can improve the quality but far behind of demo videos.
May I ask you to insert script here?
This is mine:
AVISource("8mm_test_16fps.avi",audio=false)
converttoyv12(matrix="rec709")
vectors=MSuper().MAnalyse(search=5)
globalmotion=MDepan(vectors,pixaspect=1)
DepanStabilize(data=globalmotion, mirror=15, blur=30, method=1)
super = MSuper(pel=2)
backward_vec = MAnalyse(super, search = 3, isb = true)
forward_vec = MAnalyse(super, search = 3, isb = false)
MFlowFps(super, backward_vec, forward_vec, num=25, den=1)
RemoveDirtMC(30)
DeGrainMedian(limitY=2,limitUV=3,mode=1)
ColorYUV(autowhite=true,autogain=true)
Autolevels(output_low=4, output_high=220)
Tweak(sat=1.1,cont=1.1)
LSFmod()
Blur(-0.1)
Subtitle("my variant",size=28,align=2)
bye
szabi
videoFred
22nd October 2014, 09:52
The quality is away from the sample videos which demonstrating the power of this script (http://vimeo.com/user678523/videos).
What else did I miss?
bye
szabi
A good transfer ;)
Fred.
joka
22nd October 2014, 12:28
@szabi
You have to apply the temporal filters (RemoveDirtMC, DeGrainMedian) before MFlowFps.
papcom
22nd October 2014, 12:49
I experiment with autowhite in VideoFred's script. Can anyone tell me where I can have influence on the weighting of the autowhite function? I find the result has an tendency to cold colours (slightly blueish). I would like to influence the autowhite in order it tends to rather warm colors.
szabi
22nd October 2014, 17:03
A good transfer ;)
Fred.
A picture was taken about every single frame.
These lots of picture were converted to DV-AVI.
As I know that is the best process of 8mm digitalization.
I do not have equipment for this so I had to find someone to do. (it wasn't cheap anyway)
All others I found here, doing digitalization by camcorder, which gives worse result.
@szabi
You have to apply the temporal filters (RemoveDirtMC, DeGrainMedian) before MFlowFps.
Thnx, I will check it.
bye
szabi
videoFred
22nd October 2014, 17:31
A picture was taken about every single frame.
These lots of picture were converted to DV-AVI.
As I know that is the best process of 8mm digitalization.
With a machine vision camera with trigger, there is no need to capture an image sequence (only if you want more than 8 bits). Also, DV AVI is only 720x576 pixels. We need more pixels to capture the full quality of well made 8mm film.
Anyhow, the Avisynth build in autowhite with colorYUV(autowhite=true) is not so good. Please use Auto Adjust from Lato instead. It can be found here on the forum.
Fred.
szabi
22nd October 2014, 17:58
Hi
I have to check what "machine vision camera with trigger" is. :cool:
I am not familiar enough with this part.
I do my part when digit is on hard drive. :)
I will check this "Auto Adjust from Lato". Thnx.
bye
szabi
johnmeyer
22nd October 2014, 18:51
Seems we can improve the quality but far behind of demo videos.VideoFred mentioned only one of two things which are essential for a good result, namely a good transfer. However, the other major thing which lets him achieve such stellar results is to have really good film. If your film is dirty, full of chemical residue, poorly exposed, and has major color correction issues, you will not be able to get anything close to what you see in the demos.
However, you can still achieve significant improvement, and that is what you should be expecting.
For instance, here is some film that was in almost as bad shape as your film: it was filled with embedded dirt which could not be wiped off with a cloth and cleaning solution. The "after" result in this example does not look anything like the quality that VideoFred demonstrates in his clips, but compared to the original, it is a stunning improvement:
https://www.youtube.com/watch?v=4Gy9ZG23TTk
papcom
22nd October 2014, 19:20
Anyhow, the Avisynth build in autowhite with colorYUV(autowhite=true) is not so good. Please use Auto Adjust from Lato instead. It can be found here on the forum. Fred.
I have "LaTo auto adjust" on my WinPC but unfortunately I have no idea how to integrate it into VideoFred's script. I would be interested in doing so but I deed some hints how and where in the script I shall put it with which commands:
AutoAdjust ( [clip], external_clip,
auto_gain,
dark_limit, bright_limit, gamma_limit,
dark_exclude, bright_exclude,
gain_mode, chroma_process, avg_safety,
input_tv, output_tv,
auto_balance,
chroma_limit, balance_str,
scd_threshold, temporal_radius, change_status,
use_interp, use_dither,
high_quality, high_bitdepth,
threads_count, asm_opt,
debug_view )
Reel.Deel
23rd October 2014, 01:59
@papcom
I see your sig says you're still using the old AviSynth 2.5.8, if you want to use the latest AutoAdjust (http://forum.doom9.org/showthread.php?t=167573)(v2.50) I strongly recommend that you update to the latest AviSynth 2.6 Alpha 5 (http://forum.doom9.org/showthread.php?t=168764) (or AviSynth+ (http://forum.doom9.org/showthread.php?t=168856)).
AutoAdjust dropped support for 2.5.8 a while back. If for some reason you need AviSynth 2.5.8, then there's an older version to download (v1.02) but YMMV; latest version is much more stable and includes new features, bugfixes, and definitely much faster.
szabi
23rd October 2014, 08:00
Hi
I did all recommendation.
Processing order changed, autoadjust is used now.
script:
AVISource("8mm_test_16fps.avi",audio=false)
#-----stabilisation-------------------------------------------------
converttoyv12(matrix="rec709")
vectors=MSuper().MAnalyse(search=5)
globalmotion=MDepan(vectors,pixaspect=1)
DepanStabilize(data=globalmotion, mirror=15, blur=30, method=1)
#-----remove dirt and grain---------------------------------------------
RemoveDirtMC(30)
DeGrainMedian(limitY=2,limitUV=3,mode=1)
#-----FPS conversion------------------------------------------------
super = MSuper(pel=2)
backward_vec = MAnalyse(super, search = 3, isb = true)
forward_vec = MAnalyse(super, search = 3, isb = false)
MFlowFps(super, backward_vec, forward_vec, num=25, den=1)
#-----color correction----------------------------------------------
AutoAdjust(high_quality=true, auto_gain=true, auto_balance=true)
Tweak(sat=1.1,cont=1.1)
LSFmod()
Blur(-0.1)
Subtitle("my variant2, AutoAdjust, auto_gain auto_balance", size=28, align=2)
The outcome:
http://abload.de/img/my_variant26bojf.pnghttp://abload.de/img/johnmz9rx1.png
Second picture is john's achievement.
Usage of "AutoAdjust" can not help here, due to not only 1 or 2 frame have a problem but all. :(
VideoFred mentioned only one of two things which are essential for a good result, namely a good transfer. However, the other major thing which lets him achieve such stellar results is to have really good film. If your film is dirty, full of chemical residue, poorly exposed, and has major color correction issues, you will not be able to get anything close to what you see in the demos.
However, you can still achieve significant improvement, and that is what you should be expecting.
For instance, here is some film that was in almost as bad shape as your film: it was filled with embedded dirt which could not be wiped off with a cloth and cleaning solution. The "after" result in this example does not look anything like the quality that VideoFred demonstrates in his clips, but compared to the original, it is a stunning improvement:
https://www.youtube.com/watch?v=4Gy9ZG23TTk
I can not reproduce this quality improvement.
Can you :script: ? ;)
bye
szabi
papcom
27th October 2014, 10:40
I still have visible grainy halo's around fast moving objects. I reduced the sharpness, I experimented with different dirt_strengh and with differen setting on denoising. Any way there is a certain amopunt of grainy halo's around fast moving objects. Also I tried with full HD progressive S8 sources. but the halo effects remain. I scaled it down to 720p but it's there.
The Problem is, that whe I encode the result e.g. to a DVD (Mpeg2) the halo's get more and more visible due to compression, so the result is not usable, especially visible on a large TV Screen.
joka
27th October 2014, 13:12
May be it helps if you change RemoveGrain(2) to RemoveGrain(4) inside RemoveDirt. RemoveGrain(2) is may be not strong enought for HD. The RemoveGrain() filters the areas restored by RestoreMotionBlock. These areas are not filtered with Clense() (= Median-Filter) and so you can see a difference.
johnmeyer
27th October 2014, 19:28
I still have visible grainy halo's around fast moving objects. I reduced the sharpness, I experimented with different dirt_strengh and with differen setting on denoising. Any way there is a certain amopunt of grainy halo's around fast moving objects. Also I tried with full HD progressive S8 sources. but the halo effects remain. I scaled it down to 720p but it's there.
The Problem is, that whe I encode the result e.g. to a DVD (Mpeg2) the halo's get more and more visible due to compression, so the result is not usable, especially visible on a large TV Screen.In case you missed it, I provided a link last week to my initial post in this thread where I reported similar problems, and provided some examples of those issues:
Too Much Sharpening in Film Restoration Script (http://forum.doom9.org/showthread.php?p=1405197#post1405197)
That post was made in response to VideoFred's initial script, and he has revised it substantially since then. However, many of the sharpening steps remain.
As a result of the conversation which followed that post, I created my own branch of VideoFred's script which was not only designed to operate faster, but also reduce the amount of sharpening. Because the sharpening is embedded in several places, you can't simply reduce the sharpening values, but instead have to change the script itself. I've had pretty good luck on old, grainy film, using my variation of VideoFred's script, but even with my version of his script, I often find myself reducing the sharpening considerably before I get a good result.
A little sharpening goes a LONG way when you are dealing with either dirty or grainy film. VideoFred gets his fantastic results because he appears to be transferring film which is in really good shape, and relatively fine-grained.
papcom
1st November 2014, 11:45
thx JMH - I have exactely these Noise-Halo - issues You show in Your thread of June 2010. Actually I try with Your script on my freshly setup PC with Avisynth 2.6MT. I altered the parameters regarding sharpness , denoising and dirt but I can't get completely rid of these halo's. They are still visible and multiply as soon as I do encode the masterfile to a compressed Distribution Video..
I understand that it is also a matter of the original film resp. video source. My transfer is grainy, dirty and only 768x576 Pixel. But I have no other. This is the basematerial! ==>> Where is the Limit of this script restauration method... what is possible with the source material I have?
I have to admit, that the main grain halo is obviously visible after I encoded it to Mpeg2 on a DVD. I know that this encoding process adds oder amplifies the problem with the noise and grain. Anyway... the DVD is the destination medium I want to use. I think there should be a method to reduce the grainy halo's in the final Video.
Pls could You explain me which parameter in the following scriptstage You would adjust to which values, with dirty, grainy film as the base?
What is the difference between blocksize of 16 or 8 or 4 ...as well as blockover. I did not notice a difference?
denoising_strength= 600
block_size= 8
block_size_v= 8
block_over= 4
dirt_strength=30
#FOUR STEP SHARPENING PARAMETERS
#-----------------------------------------------------------------
PRE_sharp_ness= 80 PRE_radi_us= 3 #presharpening (UnsharpMask) just after first denoising
LSF_sharp_ness=160 LSF_radi_us=2 LSF_sub=1.5 #second sharpening parameters (LimitedSharpenFaster) sub=subsampling
Sharp_Strength = 0.1
johnmeyer
1st November 2014, 15:23
thx JMH - I have exactely these Noise-Halo - issues You show in Your thread of June 2010. Actually I try with Your script on my freshly setup PC with Avisynth 2.6MT. I altered the parameters regarding sharpness , denoising and dirt but I can't get completely rid of these halo's. They are still visible and multiply as soon as I do encode the masterfile to a compressed Distribution Video.. You have made at least half a dozen posts about your grain and halo issues, but you have not provided any pictures, and have not provided a short, original clip. It is therefore impossible to know whether you have a real problem, or whether you simply have expectations for improvement that are unrealistic.
So, it is impossible to give any advice without seeing your "before" and "after," shots, and without having a short clip.
papcom
1st November 2014, 17:02
@JMH - you're right. - I'll prepare an example with the comparison view and post it here asap.
papcom
1st November 2014, 18:08
Here the comparison Image. Please see the edges around the head of the left boy and see also the artefacts in the water.
szabi
1st November 2014, 21:20
...
However, you can still achieve significant improvement, and that is what you should be expecting.
For instance, here is some film that was in almost as bad shape as your film: it was filled with embedded dirt which could not be wiped off with a cloth and cleaning solution. The "after" result in this example does not look anything like the quality that VideoFred demonstrates in his clips, but compared to the original, it is a stunning improvement:
https://www.youtube.com/watch?v=4Gy9ZG23TTk
Whatever is done I could not achieve the same quality improvement like you did: click (http://forum.doom9.org/showthread.php?p=1697555#post1697555)
One week since I asked so again, can you help me how did you do that?
bye
szabi
johnmeyer
2nd November 2014, 00:34
Here the comparison Image. Please see the edges around the head of the left boy and see also the artefacts in the water.Yes, I do see some minor artifacts around the boy's head. I also see a LOT of grain reduction, and also see a lot of waves which have disappeared. I don't think these are sharpening issues. Instead, I think you have the denoising (i.e., degraining) and dirt removal set too aggressively.
If you are using my version of the script, try cutting the denoising_strength value in half, from 600 to 300. Also, if you are using the default dirt_strength=23, try setting that to 15 instead. You might also experiment with the two alternative denoising sections which use smaller and larger block sizes. Sometimes these alternatives provide better results.
Always remember that your goal is to reduce the grain, not remove it. Also, you want to remove as much dirt as possible, but not if it means removing actual detail. One of the most difficult scenes for these scripts to deal with is open water. The random wave motion fools the algorithms, and you often end up with lots of detail being removed from the water.
FWIW, compared to what I showed in that old post I linked to, where I found the sharpening in the original script too strong for old, dirty film, your results actually look pretty good. I think you have done 85% of what you are likely to be able to do, even with the settings you are using now.
johnmeyer
2nd November 2014, 00:47
Whatever is done I could not achieve the same quality improvement like you did: click (http://forum.doom9.org/showthread.php?p=1697555#post1697555)
One week since I asked so again, can you help me how did you do that?I didn't answer via another post because I already answered your question in my previous post. To repeat what I said, I did the color correction in Sony Vegas (my video editing program), not in the script.
I have not seen any "autowhite" function in AVISynth that can produce good color correction and in fact, they are all quite bad. If you want good color, you have to do the "color grading" yourself within your video editing program. This is especially true with faded film, such as you have, where one or more of the color layers have faded, leaving mostly just the yellow, blue or, most often, the red layer.
As for the dirt removal, I also responded to you about that in the same post above: I used a variation of my script which I modified for Polavision film, a technology that is grotesquely mottled with chemical stains from the development process. Since I have previously posted that version of the script in this thread, I didn't think I needed to do so again.
(Remember, the search function is your friend ...) :)
However, to save you from having to use the search function, here is a link to that post:
Modifications to my version of the script to salvage extraordinarily dirty film (http://forum.doom9.org/showpost.php?p=1654018&postcount=760)
szabi
2nd November 2014, 14:11
I didn't answer via another post because I already answered your question in my previous post. To repeat what I said, I did the color correction in Sony Vegas (my video editing program), not in the script.
I have not seen any "autowhite" function in AVISynth that can produce good color correction and in fact, they are all quite bad. If you want good color, you have to do the "color grading" yourself within your video editing program. This is especially true with faded film, such as you have, where one or more of the color layers have faded, leaving mostly just the yellow, blue or, most often, the red layer.
Hi
Seems you are right.
Whatever I tried for color correction via script, the result is not good.
I missed you used sony vegas.
As for the dirt removal, I also responded to you about that in the same post above: I used a variation of my script which I modified for Polavision film, a technology that is grotesquely mottled with chemical stains from the development process. Since I have previously posted that version of the script in this thread, I didn't think I needed to do so again.
(Remember, the search function is your friend ...) :)
However, to save you from having to use the search function, here is a link to that post:
Modifications to my version of the script to salvage extraordinarily dirty film (http://forum.doom9.org/showpost.php?p=1654018&postcount=760)
I did not find your modified RemoveDirtMC, thnx.
But something else was found what gives a satisfactory result. Your modified script (http://forum.doom9.org/showthread.php?p=1698105#post1698105)
It works without oversharpening and noise removal is better, additionally stabilisation is working with less lost of original scene.
It should have been linked earlier. ;)
If you still have an other hidden everyproblemsolved script do not hesitate to post it. :)
bye
szabi
johnmeyer
2nd November 2014, 23:03
If you still have an other hidden everyproblemsolved script do not hesitate to post it.Yes, I have exactly the function you want:AVISournce("myvideo.avi")
RemoveAllTheBadStuff()
papcom
3rd November 2014, 18:11
@johnmeyer - I tried a lot of different parameters, lowered the dirt_strength, lowered sharpening to almost zero, and took the denoising strenght down to 150 ...but I cannot get an artefact free zone around the faster moving objects.
Here another pic of my actual try. (pls don't judge the color... I will do this in FCPX as soon as the video is clean)
StainlessS
3rd November 2014, 18:27
Papcom, try eg PhotoBucket.com next time, saves a lot of time waiting for a moderator to wake up :)
EDIT: You have to have an account (I think), takes just a couple of mins to create, upload pic, insert URL into post and et voila.
John, thats sounds like a very useful function, where can I get it or are you keeping it all to yourself ?
@Feisty2 below:
Now you're just being silly, best keep as separate functions for maximum flexibility ie
RemoveAllTheBadStuff().MakeAllTheGoodStuffBetter().ConvertToImax()
is better option.
feisty2
3rd November 2014, 18:46
clearly removeallthebadstuff aint good enough
shouldn't "converttoimax" be even better?
:p
creaothceann
3rd November 2014, 19:29
Papcom, try eg PhotoBucket.com next time, saves a lot of time waiting for a moderator to wake up :)
EDIT: You have to have an account (I think), takes just a couple of mins to create, upload pic, insert URL into post and et voila.
Or imgur: no account required, just upload or drag & drop a file / Ctrl+V bitmap in clipboard / Ctrl+V URL in clipboard.
johnmeyer
3rd November 2014, 20:32
Since I can't view your image, for the reasons given in the posts above, I can't comment on the problems you are seeing.
When trying to track down the cause of an unwanted artifact, it usually helps to temporarily modify the script to return video at some intermediate point in the process. If you are using my version of the script, I would temporarily replace the Eval(result) line with one of the following, starting with the first one:
Return Source1 #This shouldn't show any artifacts whatsoever, and should look identical to your original video. If it doesn't, then something is really wrong.
Return stab #If depanstabilize is causing problems, you will see artifacts here
Return stabcrop #If RemoveDirt is causing problems, you will see artifacts here
Return denoised #If MDegrain is causing problems, you will see artifacts here
Return sharp1 #If the sharpening is the problem, you will see artifacts here
Make sure to pick a specific frame where you see the worst problems, and do this test by looking at the results of the script in VirtualDub (or whatever you use to look at the results of the script) before you encode the video.
Do it in the order I just gave, and when you see the artifacts, but didn't see them with the previous Return statement, you will have pinpointed the cause of the problem.
szabi
4th November 2014, 08:47
Yes, I have exactly the function you want:AVISournce("myvideo.avi")
RemoveAllTheBadStuff()
That is I looked for. :D
Anyway, I read your script was a MT supported one, but who linked it removed that.
I tried to insert back, but doing something wrong because all time get a crash.
Can you be so kind to insert the original one?
Or if you have any updated version since (2012 october) it would be even better. :)
:thanks:
ADD:
Here you can see papcom's picture:
http://abload.de/img/attachmentjqr8b.jpg
bye
szabi
joka
4th November 2014, 08:57
@papcom
The artifacts are produced by RemoveDirt. This is the first degraining step. RemoveDirt is a heavy (lossy) temporal filter. If the previouse and following frame are different (often in case of motion, the motion compensation can not compensate all motion) the areas will be restored by RestoreMotionBlocks with the spatial (RemoveGrain(2)) degrained original. You can clearly see this areas. They have more grain than the others. You have to use a more strong spatial filter instead of RemoveGrain(2) inside RemoveDirt to reduce the grain.
The stronger filter will make the difference of the grain less visible. The bad news - a spatial filter cannot remove the dirt in this areas.
For demonstating the effect you can add
.blur(1.5).blur(1.5).blur(1.5)
to the RemoveGrain inside RemoveDirt().
papcom
4th November 2014, 12:03
hi everyone - before I continue, I think I have a basic problem with uploading Images?!
I did upload the Picture by the help of the "attach files" function here in this forum. Is this wrong?
Why do some People see the pic and others not. I can see it in all browsers and platforms, everywhere, also my fellows here in the area can see the pics. Why it is unvisible for some of You?
Thank You for Your explanation
creaothceann
4th November 2014, 12:29
Use imgur.com or minus.com.
papcom
4th November 2014, 16:00
Here is a link to 3 secs of the grainy, false colored raw-videofile, which is in ProRes422HQ-576p
https://www.dropbox.com/s/28ew4nrrm82mvog/papcoS8_runner_falsecolor.mov?dl=0
videoFred
5th November 2014, 13:51
Papcom,
I assume this is old Agfa film, right?
Anyhow, what you realy need is a good transfer. ;)
Fred.
papcom
6th November 2014, 00:31
Papcom,
I assume this is old Agfa film, right?
Anyhow, what you realy need is a good transfer. ;)
Fred.
What is not ok with this transfer, besides it is an SD Transfer and the film is damaged?
johnmeyer
6th November 2014, 01:35
You simply need to turn down the sharpening. I used my version of the script, and kept the Degraining parameters the same as the defaults, but reduced the several sharpening parameters down to 25-50% of the defaults. I did the color correction outside of the script (see my previous posts on why auto-color correction doesn't work well for faded film). Here is a before/after for frame 15:
https://i.imgur.com/IHoEV0e.jpg
Here is a small portion of that same frame:
https://i.imgur.com/qYEBOC4.jpg
You can see that the grain has been reduced but, at least to my eye, I don't see any halos or sharpening artifacts.
papcom
6th November 2014, 09:30
You simply need to turn down the sharpening. I used my version of the script, and kept the Degraining parameters the same as the defaults, but reduced the several sharpening parameters down to 25-50% of the defaults.
Which values did You use for Degraining?
Which value for Dirt_Strength?
What do You mean with "several sharpening parameters"?
I only have:
PRE_sharp_ness= 40 PRE_radi_us= 3
and
Sharp_Strength = 0.0
and nothing more... did You mean these?
papcom
6th November 2014, 13:50
Here is frame 15 in original size (768x576) with denoising_strength=300 / dirt_strength=25 / pre_sharp_ness=10 / sharp_strenth=0 in JMH's Scipt Version
https://www.dropbox.com/s/vibrmd5gbgw9sq6/runner_degrained.JPG?dl=0
Groucho2004
6th November 2014, 15:11
@papcom
Somehow the various hints about using an external image host are not sinking in.
If you attach a file here, a moderator has to approve the attachment first which can take a while.
So, as mentioned several times before, use postimg, imgur or something else.
papcom
6th November 2014, 17:51
@papcom
Somehow the various hints about using an external image host are not sinking in.
If you attach a file here, a moderator has to approve the attachment first which can take a while.
So, as mentioned several times before, use postimg, imgur or something else.
Yes definitely they are sinking in! I tried to do so. EVERY service wants a registration and tracks down other things.
I do not understand where exactely the problem with the moderator and the approvement is? Is it a question of speed or endeavor or what?
a propos...If doom9-forum does not want to have attachements to its forumthreads why not simply shut off the possibility to upload
attachements. Are You @groucho2004 a forum moderator?
Groucho2004
6th November 2014, 18:07
EVERY service wants a registration and tracks down other things.
Not my experience. For example - goto postimg.org or postimg.com, upload image, grab the link. Takes 10 seconds or less.
Are You @groucho2004 a forum moderator?
No.
papcom
6th November 2014, 18:18
I put it into my "dropbox" ...here the link again
https://www.dropbox.com/s/vibrmd5gbgw9sq6/runner_degrained.JPG?dl=0
poisondeathray
6th November 2014, 18:53
I do not understand where exactely the problem with the moderator and the approvement is? Is it a question of speed or endeavor or what?
a propos...If doom9-forum does not want to have attachements to its forumthreads why not simply shut off the possibility to upload
attachements.
In the past, this function has been abused. Put you mind in the gutter for a second and think of what nasty things you could upload. Because it's happened before.
So attachments now have to be reviewed. Obviously, moderators have real lives and cannot review everything immediately, so there is a lag time
On the other hand, some image hosts delete their content after "x" months . So if I go looking for some old threads, often some of the examples, images are missing. Keeping attachments within forum host should preserve them indefinitely
Anyways this is offtopic and if you want to disucuss it , it should be done in the feedback section
foxyshadis
13th November 2014, 01:35
Reporting your own post is the fastest way to get approval, since that emails us. PMing a mod is another option, but depends on the mod coming back in a timely manner. About the only reason it'll be rejected is being way too big, being adult content, or rule 6.
footageforpro
7th December 2014, 20:52
Hi guys. I use Freddy's script in 2 of my laptops and get incredible results with it. As the rendering time takes days and I have a big collection of 8 mm films I recently bought a third PC and run the script after installing AVIsynth and VirtualDubMod. If I try to open the interpolation script I get this error message: LoadPlugin: unable to load "plugins/removegrain.dll", error=0x7e
If I try to open, let's say, a simple video without using scripts that works perfectly.
In the last few days I've tried to search in this forum and in the whole internet, but I can't undestand what's wrong with my new PC. The main different I can find with the other 2 working computers of mine is that I run a 32 bit version of windows in the new one (Windows 7, while in the others I have Windows 7 64 bit and Windows 8 64 bit), Anyone can suggest what do I have to do? Thanks in advance, my friend.
Reel.Deel
7th December 2014, 20:56
If I try to open the interpolation script I get this error message: LoadPlugin: unable to load "plugins/removegrain.dll", error=0x7e
You're missing the runtime dependencies, what version of RemoveGrain are you using?
Edit: Read this post here (https://www.doom9.org/showpost.php?p=1700245&postcount=33).
johnmeyer
7th December 2014, 22:11
Hi guys. I use Freddy's script in 2 of my laptops and get incredible results with it. As the rendering time takes days and I have a big collection of 8 mm films I recently bought a third PC and run the script after installing AVIsynth and VirtualDubMod. You are welcome to try my version of VideoFred's script:
film restoration script, based on work by videoFred. (http://forum.doom9.org/showthread.php?p=1595607#post1595607)
It is 4-6 times faster, but only if you are able to use the MT version of AVISynth.
footageforpro
7th December 2014, 23:35
Thank you very much for your answers my friends. John: I'll have a look at your script as soon as possible. Reel.Deel: first forgive me but I'm not so good in using AVIsynth, so my answer can not be the right one. I'm using RemoveGrain dated 10th January 2006, if the date is the one of RemoveGrain DLL situated inside the plugins folder inside the script folder of Freddy's dezipped file.
johnmeyer
8th December 2014, 02:28
If you do use my script, you should read my post immediately above the one I linked to above. It provides information on what changes I made to both Fred's script and also to my earlier revision of his script:
http://forum.doom9.org/showthread.php?p=1595606#post1595606
footageforpro
8th December 2014, 09:48
Thank you John, I've tried to load your script and I get almost the same error as the one I had with Fred's, but this time with mvtools2.dll, so I finally think that all of this has something to do with the loading of plugins I have in the plugin subfolder of the script folder. Any suggestion?
StainlessS
8th December 2014, 17:59
Point this at the mvtools2.dll that you are using, it will tell you what it relies upon (supplied by MS in Visual Studio).
http://www.dependencywalker.com/
EDIT: Think may also be supplied on Windows CD/DVD in Support Tools (not sure, EDIT: Yes it is for XP/Server 2003).
footageforpro
9th December 2014, 10:56
Thank you very much StainlessS, with your suggestion I solved the issue with Loading plugin I had with Freddy script (not the one with JM's but I will handle it soon). Now I have another problem. I use to work with uncompressed FULL hd videos: with my other 2 computers everything works, importing and exporting. If I try to do that with my new PC I get this message while trying to open "Error decompressing video frame 0: The source image format is not acceptable. (error code -2)." It means that I have no preview of the video. When I try to export it I get this error "The decompression codec cannon decompress to an RGB format. This is very unusual. Check that nay "Force YUY2" options are not enabled in the codec's properties." The strange thing is that if I try to open that same AVI and export it without using the script but just using "File/Open video file" of VirtualDubMod everything works. Any suggestion?
StainlessS
9th December 2014, 15:09
By "uncompressed" I take it you mean RGB (24/32) and not eg uncompressed YV12.
Suggest post script and MediaInfo output.
Those symptoms might happen if eg YV12 and not mod 4 resolution.
VDub has its own (EDIT: built-in) decompression codecs which can quite often handle awkward sources.
footageforpro
9th December 2014, 19:39
Thank you very much Stainless. I see you're from London, please have a look at this 8 mm footage I restored: it's about your city in the 60's during Christmas time:
http://youtu.be/2gVMGTK6l4c
Talking about the script. This is my workflow: I scan frame by frame films with Moviestuff Retro 8 and finally have a jpg sequence. I transform that sequence in an AVI file uncompressed RGB, 16 of 18 fps, using VirtualDubMod without any software error. I finally have a 100 Gb file for a 200 ft reel. Then I open it using the script, for restoration and for interpolating 18 frames to 25. It's almost like the original Freddy's, exept the resolution and few other things. In my opinion it's about setting the right memory, because with my 2 other newer PC I don't get the same software crash.
Anyway here's my script:
# 8mm film restoration script by videoFred.
# www.super-8.be
# info@super-8.be
# version 01.A with frame interpolation
# release date: june 20, 2012
#============================================================================================
# august 2010: added removerdirtMC() as suggested by John Meyer
# october 2010: auto sharpening parameters
# march 2011: new autolevels.dll by Jim Battle
# www.thebattles.net/video/autolevels.html
# june 2012: improved stabilisation
#=============================================================================================
# cleaning, degraining, resizing, stabilizing, sharpening, auto-levels and auto-white balance.
#=============================================================================================
film= "F:\166-2.avi" # source clip, you must specify the full path here
#PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
result="result1" # specify the wanted output here
trim_begin=0 trim_end=0 play_speed=18 #trim frames and play speed (PAL: 16.6666 or 18.75)
numerator= 25 #numerator for the interpolator (final frame rate)
denumerator= 1 #denumerator example: 60000/1001= 59.94fps
#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 or result4. Values can be positive or negative
black_level=0 white_level=255 output_black=0 output_white=255 # manual levels, when returning result4
#AUTO LEVELS PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------
autolev_low= 6 # limit of autolevels low output
autolev_high= 225 # limit of autolevels high output
#SIZE, CROP AND BORDERS PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
CLeft=32 CTop=32 CRight=32 CBottom=32 #crop values after Depan and before final resizing
W=1920 H=1080 #final size after cropping
bord_left=0 bord_top=0 bord_right=0 bord_bot=0 #720p= borders 150
#STABILISING PARAMETERS, YOU REALY MUST USE RESULTS7 TO CHECK STABILISATION!
#----------------------------------------------------------------------------------------------------------------------------
maxstabH=20
maxstabV=20 #maximum values for the stabiliser (in pixels) 20 is a good start value
est_left=40 est_top=40 est_right=40 est_bottom=40 #crop values for special Estimate clip
trust_value= 1.0 # scene change detection, higher= more sensitive
cutoff_value= 0.5 # no need to change this, but you can play with it and see what you get
#CLEANING PARAMETERS
#--------------------------------------------------------------------------------------------------------------
dirt_strenght=30 # set this lower for clean films.
#DENOISING PARAMETERS
#----------------------------------------------------------------------------------------------------------------------------
denoising_strenght= 300 #denoising level of second denoiser: MVDegrainMulti()
denoising_frames= 3 #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()
# SHARPENING PARAMETERS
#--------------------------------------------------------------------------------------------------------------------------------
USM_sharp_ness= 40 USM_radi_us=3 #this is the start value for the unsharpmask sharpening
#do not set radius less then 3
#the script will automatically add two other steps with lower radius
last_sharp= 0.1 #final sharpening step after interpolation
last_blur= 0.1 #this smooths out the heavy sharpening effects
# END VARIABLES, BEGIN SCRIPT
#=================================================================================================================================
SetMemoryMax(800) #set this to 1/3 of the available memory
LoadPlugin("plugins/Deflicker.dll")
Loadplugin("plugins/Depan.dll")
LoadPlugin("plugins/DepanEstimate.dll")
Loadplugin("plugins/removegrain.dll")
LoadPlugin("plugins/removedirt.dll")
LoadPlugin("plugins/MVTools.dll")
LoadPlugin("plugins/MVTools2.dll")
Loadplugin("plugins/warpsharp.dll")
LoadPlugin("plugins/autolevels_06.dll")
Import("plugins/03_RemoveDirtMC.avs")
source= AviSource(film).assumefps(play_speed).trim(trim_begin,0).converttoYV12()
trimming= framecount(source)-trim_end
source1= trim(source,0,trimming)
#STABILIZING/CROPPING
#...........................................................................................................................................
stab_reference= source1.crop(20,20,-20,-20).colorYUV(autogain=true).crop(est_left,est_top,-est_right,-est_bottom)
mdata=DePanEstimate(stab_reference,trust=trust_value,dxmax=maxstabH,dymax=maxstabV)
stab=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,mirror=15).deflicker()
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom)
stab3=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,info=true)
WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5)
#UNSHARPMASK AUTO_PARAMETERS
#-------------------------------------------------------------------------------------------------------------------------------------------
USM_sharp_ness1 = USM_sharp_ness
USM_sharp_ness2 = USM_sharp_ness+(USM_sharp_ness/2)
USM_sharp_ness3 = USM_sharp_ness*2
USM_radi_us1 = USM_radi_us
USM_radi_us2 = USM_radi_us-1
USM_radi_us3 = USM_radi_us2-1
#CLEANING/PRESHARPENING/RESIZING
#..........................................................................................................................................
noise_baseclip= stab2.levels(0,gamma,255,0,255).tweak(sat=saturation)
cleaned= RemoveDirtMC(noise_baseclip,dirt_strenght).unsharpmask(USM_sharp_ness1,USM_radi_us1,0)\
.unsharpmask(USM_sharp_ness2,USM_radi_us2,0).Lanczos4Resize(W,H)
#DEGRAINING/SHARPENING
#...................................................................................................................................................................
vectors= cleaned.MVAnalyseMulti(refframes=denoising_frames, pel=2, blksize=block_size, blksizev= block_size_v, overlap=block_over, idx=1)
denoised= cleaned.MVDegrainMulti(vectors, thSAD=denoising_strenght, SadMode=1, idx=2).unsharpmask(USM_sharp_ness3,USM_radi_us3,0)
#CHANGING FRAME RATE WITH INTERPOLATION/FINALSHARPENING
#............................................................................................................................................................
super= denoised.MSuper()
backward_vec= MAnalyse(super, blksize=block_size, blksizev= block_size_v, overlap=block_over, isb=true)
forward_vec= MAnalyse(super,blksize=block_size, blksizev= block_size_v, overlap=block_over, isb= false)
interpolated= denoised.MFlowFps(super, backward_vec, forward_vec, num=numerator, den= denumerator, ml=100)\
.sharpen(last_sharp,mmx=false).sharpen(last_sharp,mmx=false).blur(last_blur,mmx=false)
#RESULT1: AUTOLEVELS,AUTOWHITE
#......................................................................................................................................................................
result1= interpolated.converttoRGB24().autolevels(output_low= autolev_low, output_high= autolev_high)\
.converttoYV12().coloryuv(autowhite=true).addborders(bord_left, bord_top, bord_right, bord_bot)
#RESULT2: MANUAL LEVELS, AUTOWHITE
#......................................................................................................................................................................
result2= interpolated.levels(black_level,1.0,white_level,0,255).coloryuv(autowhite=true)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
#RESULT3: AUTOLEVELS, MANUAL COLOR CORRECTIONS
#.....................................................................................................................................................................
result3= interpolated.coloryuv(off_U=blue,off_V=red).converttoRGB24().autolevels(output_low= autolev_low, output_high= autolev_high)\
.converttoYV12().addborders(bord_left, bord_top, bord_right, bord_bot)
#RESULT4: MANUAL LEVELS, MANUAL COLOR CORRECTIONS
#.....................................................................................................................................................................
result4= interpolated.coloryuv(off_U=blue,off_V=red).levels(black_level,1.0,white_level,0,255)\
.addborders(bord_left, bord_top, bord_right, bord_bot)
#RESULT5: SPECIAL SERVICE CLIP FOR RESULT S5
#.....................................................................................................................................................................
result5= overlay(source1,greyscale(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
final_framerate= numerator/denumerator
source4=Lanczos4Resize(source1,W2,H2).changeFPS(final_framerate)
#COMPARISONS: ORIGINAL VS RESULTS
#......................................................................................................................................................................
resultS1= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result1,"result1: autolevels, autowhite",size=28,align=2))
resultS2= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result2,"result2: autowhite, manual levels correction",size=28,align=2))
resultS3= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result3,"result3: autolevels, manual color correction",size=28,align=2))
resultS4= stackhorizontal(subtitle(source4,"original",size=28,align=2),subtitle(result4,"result4: manual colors and levels correction",size=28,align=2))
resultS5= stackhorizontal(subtitle(result3,"result3: auto levels, manual color correction",size=28,align=2),subtitle(result4,"result4: manual colors and levels correction",size=28,align=2))
resultS6= stackhorizontal(subtitle(result1,"result1: autolevels, autowhite",size=28,align=2),subtitle(result2,"result2: manual levels, autowhite",size=28,align=2))
#SPECIAL COMPARISON CLIP FOR TESTING THE STABILIZER
#.........................................................................................................................................................................
resultS7= 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)).converttoYUY2()
Eval(result)#.converttoRGB24()
Where do you think I have to change the script?
StainlessS
9th December 2014, 20:44
I see you're from London
Good God no! :eek: [just live there]
I, is from that magical Kingdom Of Northumbria, unfortunately they moved it further north a few miles (Tyne & Wear just dont have that same magic).http://en.wikipedia.org/wiki/Kingdom_of_Northumbria
(well they moved Northumberland) http://en.wikipedia.org/wiki/Northumberland
I use neither Freds nor Johns scripts, so I shall leave suggestions for those that do, as you posted a sample they probably dont need MediaInfo output.
johnmeyer
9th December 2014, 21:11
I am not sure why you decided to use uncompressed. You sure don't need it in order to preserve fine details! :)
I would recommend using any decent codec that supports variable frame rates and compresses each frame individually, i.e., stay away from GOP codecs like AVC, MPEG-2 etc. Good codecs are Cineform (free from GoPro), DV (MainConcept sells one), MJPEG, or any of the free lossless codecs like HuffYUV or its newer cousin, Lagarith. Using a codec will not only save a huge amount of disk space, but should also make the playback during editing much smoother.
As for London, here is some much older footage that I transferred for a friend:
1930s London (http://www.youtube.com/watch?v=NR55kyQj098)
StainlessS
9th December 2014, 21:33
Nice clip John, also liked to catch a glimpse of the Hindenburg in your other NY clip [not in flames].
UT_Video is also a good codec.
johnmeyer
9th December 2014, 21:37
Nice clip John, also liked to catch a glimpse of the Hindenburg in you other NY clip.They are actually both from the same source: a German who owned a movie camera factory in Dresden, prior to the war. He knew how to use a camera, and took lots of movies until he had to flee the country in 1938 (for the usual reasons). He settled here in the USA, and many years later, also took these amazing nightime NYC movies:
1957 New York Times Square at Night (silent film) (https://www.youtube.com/watch?v=TIPnMB_KOsM)
StainlessS
9th December 2014, 21:55
HaHa great stuff, especially the Puffin' Bilko ad, cant even drag on an electronic ciggy here today in public (crazy PC-ness)
footageforpro
10th December 2014, 10:01
Well John, congratulation for the home movies you posted. I have a big collection, but it's difficult for me to buy so great footage because there are no garage sales here in Italy and also transport cost and taxes for Ebay american auctions are usually too much for my small budget.
Anyway, I use to work with uncompressed AVI files because after restoring footage with AVI synth I transform them with MPEG streamclip in Apple Prores to edit in Final Cut Pro. My idea is that is not fine to have to compress videos with 2 different codecs. I can work with Photojpeg or Mjpeg, they will save me a lot of time and space but I feel more confortable with uncompressed. Anyway, my workflow is fine with my 2 laptops (8 Gb and 6 Gb Ram), but it crashes with my Desktop with only 2 Gb Ram. Where do you think I can change settings of the script to make it work?
johnmeyer
10th December 2014, 17:03
In my version of the script, change SetMemoryMax(). In Fred's script, I don't know.
A lot depends on whether it crashes right away; whether it crashes after just a few frames, or whether it makes it most of the way and then crashes. Crashes that happen later usually indicate some sort of memory issue. Crashes that happen right away often indicate that a DLL conflicts with the version of AVISynth you are using.
I think you have already made sure that you are using only the plugins that came bundled with Fred's script. If your system has other versions of the plugins, you must make sure your script doesn't "grab" those instead. Loading the DLLs explicitly (drive and path) is the ultimate way to ensure that the proper plugins get loaded.
BTW, none of the film I posted is stock footage that I purchased. Instead, these are film transfers that I have done for friends and clients.
wdwms
8th April 2015, 18:08
Sorry to dig up an old thread, but I wanted to thank everyone for their efforts on these scripts. I've been lurking here for at least 1.5 years, queitly absorbing everything.
Now I'd like to show people what I have been doing and the results of everyone's input and efforts.
I've taken johnmeyers script, watered it down a bit, paired it with my own scripts, virtualdub plugins and then added in the full paid version of Neat Video. It is a two step process (three if you count the compression with handbrake), but the results are nothing but amazing.
All of the films I've restored are on YouTube and Vimeo:
https://vimeo.com/retrowdw/videos
https://www.youtube.com/c/retrodisneyworld
Our most popular films, and the best in terms of restoration are:
http://www.retrodisneyworld.com/imageworks/films/a-pristine-magic-kingdom-from-nov-71-restored-home-movie-footage
http://www.retrodisneyworld.com/imageworks/films/1972-wdw-home-movie-in-hd-final-restoration
http://www.retrodisneyworld.com/imageworks/films/a-gift-to-all-my-personal-1980-wdw-film-30-minutes
I've struggled a bit when the color is really bad. We haven't found a plugin for virtualdub or avisynth that can auto color correct well with scene changes. So if you have any ideas please let me know. A few of the restoration are less than perfect when it comes to color.
We also have blog setup on my website that discusses each film in detail that we restore:
http://www.retrodisneyworld.com/imageworks/films
I have nearly 15,000 feet of personal film to restore, but I've been buying disney world footage from ebay and restoring it as well. So i've been busy to say the least!
With that said, again thank you to all who have put in their time and efforts in participating in this thread, much appreciated!
Todd
www.retrodisneyworld.com
johnmeyer
8th April 2015, 19:44
... I wanted to thank everyone for their efforts on these scripts. I've been lurking here for at least 1.5 years, queitly absorbing everything ... I've struggled a bit when the color is really bad. We haven't found a plugin for virtualdub or avisynth that can auto color correct well with scene changes. So if you have any ideas please let me know. A few of the restoration are less than perfect when it comes to color.Your color restoration actually looks amazing. In my experience, there is no "auto white balance" plugin that works very well. This includes free plugins for VirtualDub, as well as high-end paid plugins for NLEs. The best path is to do the color correction scene-by-scene using your NLE's color balance tools. Hopefully it lets you balance the shadows, highlights, and midtones using separate settings.
What I'd like to know is exactly what did you do to get such great color correction results? I just tried to do a better job, using your "before" clip from Vimeo, and couldn't get close to the color quality that you achieved. I too do this for a living, so if you had to use some sort of commercial product, I'd be willing to buy it. Please share!
Finally, I want to commend you on your restoration sensibilities. You resisted the temptation to turn up the "knobs" on each restoration step, and as a result ended up with a very natural-looking result, even though it still has a little dirt, and a little motion. The only thing I would have done differently was to do a little more motion stabilization to get rid of the gate weave. It looks as though you decided to do very little motion stabilization, perhaps none at all.
John
P.S. This is my attempt to restore some "red and white" 8mm footage that someone purchased in 1962 at the Seattle Worlds Fair. Like most print movie film, everything except for the red dye layer was very unstable and had faded. This result was the best I could do, but nowhere near as good as the result you achieved:
1962 Seattle Worlds Fair (stock shots) (https://www.youtube.com/watch?v=Yjot8XeQ3Jg)
wdwms
8th April 2015, 20:26
john,
Thanks for the comments! Its been a lot of trial and error, let me type up a quick few comments here; if you want a more detailed dive into the process and scripts, please let me know.
For color correction I am using ColorMill for Virtualdub. Believe it or not, the color adjustments you see are 100% done by eye. I sit there and move the sliders inside ColorMill until I am satisfied. I generally apply a color correction that works for 90% of the film. I don't have the time to break each film into scenes and color correct each one. Generally most 3 minute reels were shot within the same day so exposure and such is generally balanced. Its the commercial films from Disney that are a disaster to work on, not only are the dyes crap, but each scene had different exposure and color saturation to begin with.
Thanks for realizing I didn't crank up the knobs. You have to be delicate with this, too much sharpness brings out artifacts and increases grain. There is a fine balance between all as I've learned.
For dirt, i'm using the RemoveDirtSSE2.dll avisynth plugin in conjunction with the RemoveDirtMC function. I usually set that between 60 and 80. Each film is different and some are so far gone.
Neat Video is the other secret weapon. It removes grain, and does a basic sharpen, but I purposely don't crank it up. Leaving some grain and nostalgic feel. Again, the final sharpen then has to be carefully done in order to not make the grain that is left look artifical.
Motion stabilization is on maxstabH=6 and maxstabV=8. I found that higher was actually causing artificial gate weave - my films are scanned on some crazy $100k machine and there is 0 gate weave when I get the uncompressed files from Pixcel.com Higher stab #s were also causing very odd artifacts and motion issues especially on horizontal pans. I probably could crop a bit more, I'm possibly too much of a fan of seeing everything and need to get over that and crop another 10 pixels all around.
The end result that I'm going for is not one that turns film into video, i still want a bit of older fee, some grain, but it to be nostalgic, colorful and clear. if that makes sense. I had a hard time debating leaving them at 18fps or moving to 24 or 29.97fps. In the end, they looked best at 29.97 for the medium we now view these on as much as pained me to nearly double the frame rate and make fake frames. :)
I can try to see what i can do to your seattle clip, however what is on youtube has lost much of its color information. Do you have the original scan perhaps? I can see what I can do with it. Seems to be in much better shape than this one that I restored:
http://www.retrodisneyworld.com/images/imageworks/compared.jpg
Red doesn't have to be dead! :)
Todd
papcom
1st June 2015, 13:51
...I had a hard time debating leaving them at 18fps or moving to 24 or 29.97fps. In the end, they looked best at 29.97 for the medium we now view these on as much as pained me to nearly double the frame rate and make fake frames. :)Todd
@todd - nice work You do. Congratulation.
I do not really understand what You did with the 18fps and what You mean with the "double Frame rate" and the "fake Frames". I am searching for an effective method to bring my 18 films into a good and fluent Motion flow .
johnmeyer
1st June 2015, 16:54
I do not really understand what You did with the 18fps and what You mean with the "double Frame rate" and the "fake Frames". I am searching for an effective method to bring my 18 films into a good and fluent Motion flow .You have four choices:
1. Encode at 18 fps and play back on a device that accepts that frame rate. Your computer can play back any frame rate, and most modern TV sets can also play back at any frame rate if you play from a memory stick inserted into the TV's USB port.
2. Add pulldown frames to play at the standard 29.97 (NTSC) or 25 (PAL) frame rate. This is the traditional way of doing it and has the advantage that you introduce zero spatial artifacts. Each frame will be just as clear and sharp as the original. The downside is that the natural judder of the low 18 fps frame rate will be accentuated, and horizontal camera panning will look quite jumpy.
3. Synthesize additional, new frames in order to bring the frame rate to 25, 29.97, 50, or 59.94 fps. This will provide very fluid, smooth motion, but you almost always create significant spatial artifacts on some scenes. Also, the result will no longer "feel" like film, but instead will feel like video. People have strong opinions and preferences both ways, and in the end the "feel" part of the decision to synthesize these frames is an artistic one. Be warned however, that when this technology fails, it often fails spectacularly, with people's legs "breaking" as they walk quickly across the frame, and picket fences warping and breaking as the camera pans horizontally across the fence.
4. Blend adjacent frames in order to create the additional frames needed to play more frames per second. This creates no surprise artifacts, and does create smoother motion. However, because the new frames are simply blends of adjacent frames, you can get very fuzzy results on fast motion.
I always use #1 when I can. It is the easiest and produces no new artifacts.
When I encode for DVD or any other situation where the playback has to be at one of the traditional TV standard frame rates, I use #2. Why? It just plain works. Yes, it results in judder, but judder has always been an issue with film, and if you use a little motion stabilization, that technology also smooths the panning so that the judder isn't quite as noticeable.
Once in awhile, when I have a lot of panning, I will create two versions, one with pulldown fields (#2) and the other with motion estimation (#3) and I switch between them, using the motion estimation for horizontal panning, and the pulldown fields elsewhere.
I have occasionally used #3 (motion estimation) for entire clips when the frame rate of the original was really low, and the amount of horizontal panning was unusually high. Here is an example of a 1930 15 fps original clip. I increased the frame rate to 30 fps, which means that half of the frames are exactly the same as the original. You'd need to see the original to be able to appreciate the huge difference, but when I originally uploaded this clip to YouTube at 15 fps, it was almost unwatchable.
1930s San Francisco (https://www.youtube.com/watch?v=2moHDbxUodk)
Skip ahead to the 1:05 mark to see the most interesting scenes.
The parts of the clip where the camera pans wildly across the streetcars at the intersection of Embarcadero and Market was particularly hard to follow at the native 15 fps.
The difference between 15 fps and 18 fps is actually quite large, and I seldom feel like I need to do motion estimation when doing 18 or 24 fps film transfers.
I should also point out that because of all the dirt on film, if you can't get each frame perfectly clean, any technique which synthesizes additional frames, rather than simply repeating fields or frames, will produce really nasty surprises.
papcom
1st June 2015, 18:28
@johnmeyer - thank you for the listing of all possibilities.
Usually I use method 2, because it preserves the quality of the original Picture. Unfortunately Scenes with movements in the film are displayed rather juddery.(as You write)
I experimented with lots of other methods, e.g. with After Effects, or Dynapel, or Optical Flow on macs. Some results are almost perfect others are not satisfying. The reason You explained very well in Your post.
A good method is the small script You posted some time ago, as:
AssumeFPS(16.0)
ChangeFPS(50,1)
AssumeTFF() # or BFF, as required
SeparateFields()
SelectEvery(4, 0, 3)
Weave()
This method works fine for interlaced material for a DVD.
Now I saw the post of @wdwms, and I took a look to his sample Videoclip, which has a fairly good fluent movement. So I am interested to know how he did this.
johnmeyer
1st June 2015, 18:56
He describes his process, in detail, on this page:
Restoration Process (http://www.retrodisneyworld.com/imageworks/restoration-process)
He is a little vague on which of the options I listed he is actually using. Here is what he says on that page:
The computer software uses interpolation, that is it actually creates those 6 frames by comparing the 18 it already knows about. Confused? Don't be, it works and the end result is great!
Since he is using much of the code developed by VideoFred, and later modified by me, and since VideoFred's code uses motion interpolation, my educated guess is that he is using MVFLowFPS or MFlowFPS to interpolate new intermediate frames. As I already mentioned, this works great for large objects and for camera panning, but can break down rather badly not only with the situations I already mentioned, but even more so when something enters or leaves the frame close to the camera.
I've used Twixtor, Dynapel (MotionPerfect), and MVTools2, and have also seen the results from AE. They all suffer from the same problems, to one degree or another. One advantage of MVTools2 is that you can modify a lot of internal options that, under some circumstances, can make quite a dramatic difference. In most circumstances, I have found that using a large block size reduces artifacts. I have published some of my settings in various thread elsewhere in this forum. There is no "one size fits all" script, and you have to tune your settings for each film or video.
wdwms
2nd June 2015, 13:11
I'm actually using Interframe to do all my 18->24 or 18-> 29.97 conversion. Very little of Fred or Johns' code is left, in fact I think just the dirt removal and stabilization are the only components. The rest is all through my own scripts, majority of it being in virtualdub plugins.
Interframe is here: http://www.spirton.com/interframe/
All my FPS upconversion is done after the initial cleaning. Here is how my restoration works:
Pass #1
Stabilize (avisynth), dirt removal (avisynth), color adjustment (ColorMill in VD), grain removal (NeatVideo in VD), minor sharpening (VD) - Save as full frame AVI
Pass #2
Interframe to 30pfs (avisynth), Crop, resize, final sharpen - Save as Lossless AVI via Lagarith codec - Archived as "restored"
Pass #3
Handbrake with custom settings to compress for distribution. Uses H.264 and outputs as Mp4 - Archived as "distribution file" to share with friends/family
I plan on changing it to this soon:
Pass #1
Stabilize (avisynth), dirt removal (avisynth), color adjustment (ColorMill in VD), grain removal (NeatVideo in VD), minor sharpening (VD), Crop/resize/final sharpen (VD), Save as full frame AVI, uncompressed as "RESTORED"
Pass #2
Interframe to 30pfs (avisynth), Save as Lossless AVI via Lagarith codec - Archived as Restored/Upconverted
Pass #3
Handbrake with custom settings to compress for distribution. Uses H.264 and outputs as Mp4 - Archived as "distribution file" to share with friends/family
johnmeyer
2nd June 2015, 16:34
Just to be clear, so Papcom is not confused, Interframe is, at its core, the same thing as MVTools2.
MVTools was updated by its author to MVTools2. That code was then re-written by someone else to run on certain GPUs, thus allowing real-time interpolation. Finally, someone wrote a front end to SVP called Interframe which shields the user from the slightly convoluted SVP syntax. Read about it here:
InterFrame (http://forum.doom9.org/showthread.php?t=160226)
The reason I post this is to point out that the results from Interframe will be nearly identical (perhaps exactly identical ??) to what you get with MVTools2, if you set the MVTools2 settings to be the same.
The reason I don't use either SVP or Interframe (although I do include the commented out code in my version of Fred's scripts) is that I found that the Interframe front end made it difficult for me to adjust several parameters which I found made a huge improvement when interpolating low frame rate film transfers. Remember that the main point for the existence of the SVP and Interframe extensions was to improve the speed of motion interpolation for real time interpolation while watching normal TV. I put that in italics to emphasize the point that the settings have been tuned for fairly high frame rate material, and you therefore may not get good results with material that contains large temporal gaps between adjacent frames.
As I noted in my previous posts, I find wdwms' results to be really excellent, especially his custom color corrections. However, the motion estimation is neither better, nor worse, than what I've seen elsewhere. It contains all of the usual advantages as well as the usual artifacts.
So, my recommendation is to use MVTools2 and modify the MAnalyze and MFlowFPS settings to reduce the inevitable interpolation artifacts.
FWIW, here is the commented out code in my scripts, showing all three versions: MVTools2/MFlowFPS; SVP; and Interframe.
#FRAME INTERPOLATION (optional)
#...................................................................................................................................................................
#superfps= MSuper(PreBorderFrame,pel=2)
#backward_vec2 = MAnalyse(superfps, isb = true,blksize=16)
#forward_vec2 = MAnalyse(superfps, isb = false,blksize=16)
#PreBorderFrame = MFlowFps(PreBorderFrame,superfps, backward_vec2, forward_vec2, num=60000, den=1001, ml=200).SeparateFields().SelectEvery(4, 0, 3).Weave()
#...................................................................................................................................................................
#The following alternative can provide synthesized frames for hi-def material that causes MSuper to choke
#////// Begin alternative to MFlowFPS ////
#super_params="{pel:2,gpu:1}"
#analyse_params="""{block:{w:32,h:32},
# main:{search:{coarse:{distance:-10}}},
# refine:[{thsad:200}]
# }"""
#smoothfps_params="{rate:{num:60,den:16,abs:false},scene:{mode:0,limits:{scene:8500}},algo:21,cubic:1}"
#...................................................................................................................................................................
#The following provides smooth output
#super = SVSuper(PreBorderFrame,super_params)
#vectors = SVAnalyse(super, analyse_params)
#PreBorderFrame = SVSmoothFps(PreBorderFrame,super, vectors, smoothfps_params, url="www.svp-team.com", mt=threads).SeparateFields().SelectEvery(4, 0, 3).Weave().assumefps(29.97)
#////// End alternative to MFlowFPS ////
#...................................................................................................................................................................
#The following is another alternative that can provide synthesized frames for hi-def material that causes MSuper to choke. Probably better than the one above.
#////// Begin alternative to MFlowFPS ////
#PreBorderFrame=InterFrame(NewNum=30000,NewDen=1001,PreBorderFrame,GPU=true,Cores=threads)
#////// End alternative to MFlowFPS ////
wdwms
2nd June 2015, 16:43
Thanks John, i'll give your code a whirl in my next project to see how it goes
wdwms
4th November 2015, 03:58
Just wanted to share with you all some more comparisons, this is not final but wanted to show you what i'm doing with some 16mm I just got digitally transferred and I'm almost done with the restoration... This time around I think i've been able to restore the color even better than the last film I did..
I'll make a full length comparison film so you can see the side by side..
-t
http://www.retrodisneyworld.com/images/tease/comparenew1.jpg
http://www.retrodisneyworld.com/images/tease/comparenew2.jpg
http://www.retrodisneyworld.com/images/tease/comparenew3.jpg
http://www.retrodisneyworld.com/images/tease/comparenew4.jpg
http://www.retrodisneyworld.com/images/tease/comparenew5.jpg
http://www.retrodisneyworld.com/images/tease/comparenew6.jpg
videoFred
5th November 2015, 14:04
Your Colormill color correction is incredible! I will have a closer look at this filter myself.
Fred.
johnmeyer
5th November 2015, 16:48
As I've said in countless posts in both this thread and elsewhere, automatic white balance is a noble goal, but one that remains elusive. I have yet to see anything that doesn't fail (make the video worse) as often as it succeeds.
When he posted the last time, and said he got his amazing results using just the Colormill plugin, I was amazed by his results, so I downloaded and used Colormill. Here's what I found: there is nothing unusual or different about it, and in fact it does the same thing that I do inside of Vegas with the color corrector included in that NLE.
So, why is he able to get such stunning results? I think there are three reason these results look so good:
1. The Colormill plugin provides the necessary controls, although nothing more than standard color channel sliders.
2. The samples chosen still have enough residual color in the two faded channels that the color can be recovered. This is extremely important. I've dealt with a LOT of red&white, blue&white, and yellow&white film to know that sometimes there simply isn't any color left in the other channels.
3. The guy doing this has a great eye, and understands what he's doing.
#3 is the key. People who do "color timing" for movies are skilled artisans, and the quality of their work could not be duplicated by me, or most other people, even if we had access to the same tools.
This guy is good!! Hire him for your next film project.
wdwms
6th November 2015, 01:21
John,
Thanks for #3, humbled by your comments. Maybe my monitor and eye are configured to work in harmony, or I may have gotten lucky w/the films I'm restoring that they have just the right amount of color left. I love doing this and bringing films back to life!
I will say that I've tried other color plugins, none gave me the adjustments I needed to get the color just right. Also I've been doing the color restoration in 2 steps. In the final I had to adjust the hue a bit after the initial correction.
I work in the red gamma first, bringing that down, then I adjust the dark-mid-light for each channel. Final tweaks are the contrast and brightness and such, as well as saturation.
Now if i could just do something about those scratches! (aside from frame by frame restoration).
Would you guys like to see a full side by side comparison of the 30 minute film?
-t
StainlessS
6th November 2015, 01:39
Now if i could just do something about those scratches! (aside from frame by frame restoration).
Perhaps this could assist if using Descratch, AreaOp() limit affect to an area of frame.
http://forum.doom9.org/showthread.php?p=1603343#post1603343
wdwms
6th November 2015, 03:04
Perhaps this could assist if using Descratch, AreaOp() limit affect to an area of frame.
http://forum.doom9.org/showthread.php?p=1603343#post1603343
I tried descratch and it was a mess, the scratches are so bad that it really isn't salvageable.. :(
johnmeyer
6th November 2015, 03:13
I'm always interested in before/after footage, although I wouldn't be able to watch all 30 minutes.
As for scratches, go ahead and try StainlessS' suggestion, but don't expect much. The problem with scratches is that, unlike dirt, they persists from frame to frame, so you can't use the tricks used by RemoveDirtMC which looks at adjacent frames to determine what to remove, and then fills in the removed mark with material from those frames (at least that is how I think it works).
If scratches were in precisely the same place from frame-to-frame, like a TV logo, then they could be removed using masking technology, like Delogo. However, as you well know, they tend to wander around, left to right, and also change length from one frame to the next. The only thing you can count on, because of how they are created, is that they are almost perfectly vertical.
The only solution I know of that works is to do a wet gate transfer. This involves coating the film with a slow drying solution that physically fills in the scratches. You can Google "wet gate transfer" and see how amazingly effective this technique is. You will probably find several posts by VideoFred because he uses wet gate transfer for his amazing film transfers.
wdwms
6th November 2015, 03:15
At this point we are going to leave the restoration as it is. Maybe someday I'll find a better print. But as it was, the cost was pretty high to get this xferred, and we did it via a crowdfunding effort by our followers...
johnmeyer
6th November 2015, 03:45
P.S. Here is a link to a before/after showing the significant improvement from a wet gate transfer:
Wet Gate Transfer (https://www.youtube.com/watch?v=xNu0LpoKLVM)
Even if you don't want to re-transfer for this project, you should know about this for the future.
greg
14th December 2015, 18:28
Hi,
I just got my reels (2 hours) of regular 8 film (recorded in the 70s with a Yashica UL Power Zoom camera) professionally transferred with the MWA Flashscan HD telecine. I'd like to clean them with Fred's script or JohnMeyer's one but I have three main problems:
-The video files I have are ProRes 422 .mov, uncompressed. I tried QTReader plugin and I opened the avs. file with VirtualDubMod, but I see the frame upside down and if I press play I get the error "Couldn't initialize timer!"
-The original filming speed was 16 fps, but now the .mov file is 25 fps progressive. I can see there are duplicate frames and I know I have to delete them with Avisynth but I can't understand which plugin I have to use (Decimate? Decomb?) and I don't know the parameters
-The video files I have are HD 16:9 so there are black pillarboxes on the sides. How can I crop them with Avisynth? Do I have to use ''AutoCrop''?
I uploaded on Dropbox some samples if you want to see them (uncompressed, same format I have on my PC).
Here's the link to the folder: https://www.dropbox.com/sh/vbe5vggru0rp20o/AAD-T5mkQFGjREsSlKi6BXgha?dl=0
If someone can help me, I'd really appreciate it.
Thanks in advance
manono
14th December 2015, 20:51
Hello and welcome to the forum,
I used FFVideoSource (part of FFmpegSource (http://avisynth.nl/index.php/FFmpegSource)) to open the first sample in Virtual Dub and had no problem.
I used TDecimate (part of the TIVTC (http://avisynth.nl/index.php/TIVTC) filter) to remove the duplicate frames and return it to 16fps:
TDecimate(Cycle=25,CycleR=9)
I suppose you could use Autocrop, but I do such things like this:
Crop(240,0,-240,0)
That crops to 1440x1080 (1.33:1) but doesn't remove all the black. You can play around with it yourself. It's all explained in the Crop (http://avisynth.nl/index.php/Crop) page on the AviSynth site.
johnmeyer
14th December 2015, 22:50
[edit]My TDecimate logic (below) is wrong. Manono's (directly above) is correct.[/end edit]
I used ffmpeg to convert to uncompressed, and then imported that. You can also use ffmpeg to convert to lossless or other formats that consume less disc space. This is an example of how to convert to uncompressed:
ffmpeg -i "8mm sample_01.mov" -an -vcodec rawvideo -pix_fmt yuv420p -y output.avi
I looked at your film, and every other frame is a repeat. Thus, the pulldown that was added was NOT trying to go from 16 fps to 25 fps, but simply to get the file to play back at 25 fps. Therefore, the TFM/TDecimate parameters given in that previous post actually are not what you want to use. Instead, use this:
TDecimate(Cycle=3,CycleR=1)
AssumeFPS(16)
This will recover the original frames, so you have a frame accurate result, and then the AssumeFPS will cause those frames to be played back at 16 fps, the common speed for 8mm and silent 16mm film.
You can then add a crop, as needed:
Crop(250,0,-260,0)
This seemed to be about right for your first example (the only one I downloaded).
manono
15th December 2015, 00:49
I looked at your film, and every other frame is a repeat.
Maybe you meant to say every third frame is a repeat? Either you're not decoding it correctly, or I'm not (always possible), or you're not counting enough cycles to be sure what it is. greg said it was converted from 16->25fps with the addition of duplicate frames which is what I see. You seem to be saying one of three frames is a duplicate. I'm seeing sometimes one of four frames being a duplicate. Every eighth cycle comprises four frames and not three. You're seeing 16.67fps and I'm seeing 16fps. Here's what I get with the script I suggested:
https://mega.nz/#!ThQCGLZR!yi1UrDGj0KyPcEQWtSeBNMb90qgrQfkPsS0z3o6ErWI
johnmeyer
15th December 2015, 04:00
I went back and looked at "8mm sample_01.mov" again, and I clearly didn't "walk" far enough through the clip to see the more complex pattern. I looked at fields (just in case in was telecined for interlaced viewing) and got this field pattern:
4-2-4-2-4-2-4-2-2
Translating to frames:
2-1-2-1-2-1-2-1-1
So in each group of thirteen frames, each of the "2's" must be decimated. There are 13 frames total (Cycle) and 4 that must be decimated (CycleR).
TDecimate(Cycle=13,CycleR=4)
However, after my previous error, I wanted to test this code, so I walked through the entire clip, using the above decimation.
Darn, I still found several repeats.
I am an idiot.
So the OP should definitely follow Manono's advice because I haven't had the time to walk the entire clip and pick up on what is a more complex pattern than I initially expected.
His code will exactly translate a 25 fps clip back to 16 fps, and some of you may wonder why I didn't just go with that to begin with. After all, the math is trivial (25 - 9 = 16). The reason is that I've done enough film transfers to know that the playback speed set for the frame accurate transfer (16 fps in this case) and for the playback (25 fps) don't necessarily have to reflect the speed of the original film, and the telecine sometimes first gets done, and then the playback speed adjusted, or the speed is first adjusted to something other than 16 fps, and then the telecine is done. So, sometimes these "oddball" telecines don't go according to the math.
This one did.
I'll edit my original post so no one gets misled.
manono
18th December 2015, 08:02
I came back to have a look and something didn't seem right and I began counting again and realized I had been wrong, too. There's a large cycle of 25 frames before everything repeats again, and within the grand cycle are eight 'mini-cycles', like so:
3 3 3 3 3 3 3 4
Each number represents the number of unique frames plus a duplicate. The '3's represent 122 (unique, unique, dupe), and the '4' 1233 (unique, unique, unique, dupe). It's a different counting convention than yours, johnmeyer, so I'm not sure it makes sense to you. All those 3s and 4s total up the the 'grand cycle' of 25 frames and there are 8 'mini-cycles' which also tells you that within the 25 frame cycles there are 8 duplicate frames. The correct TDecimate line should be:
TDecimate(Cycle=25,CycleR=8)
That makes 17fps and greg can use an AssumeFPS line to slow it to 16fps as you showed earlier, if he wishes. I'm an idiot, too. :)
greg
19th December 2015, 11:56
Thanks for helping me!
EDIT: Problem below solved
--------------------------------------------------------------------------------------------------------------------------------
I seem to have problems with the basics: I tried using FFmpeg source, but once opened the .avs file with the command
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\ffms2.dll")
FFVideoSource("D:\8mm sample_1.mov")
with VirtualDubMod, I get the error
Avisynth open failure. Evaluate: System exception - Acces Violation (C:\Users\Giacomo\Desktop\test.avs, line 2)
To install the FFmpeg source plugin I downloaded the file ''ffms2-2.22-msvc.7z'' from here https://github.com/FFMS/ffms2/releases (I got the link through this page http://avisynth.nl/index.php/FFmpegSource), then I just unzipped it and copied the files in the folder "x86" (there's a .dll) into Avisynth plugins folder.
Is that the right way to install the plugin?
--------------------------------------------------------------------------------------------------------------------------------
The other question is: how do I know that the telecine duplication cycle pattern always starts at the same point in every .mov file?
I mean, maybe in a .mov file the video starts when the cycle pattern is already halfway through, in that particular case the command
TDecimate(Cycle=25,CycleR=8)
will not work?
Thanks again
Groucho2004
19th December 2015, 12:17
with VirtualDubMod, I get the error
To install the FFmpeg source plugin I downloaded the file ''ffms2-2.22-msvc.7z'' from here https://github.com/FFMS/ffms2/releases (I got the link through this page http://avisynth.nl/index.php/FFmpegSource), then I just unzipped it and copied the files in the folder "x86" (there's a .dll) into Avisynth plugins folder.
Is that the right way to install the plugin?
That version (2.22) crashes for me as well with various files. Try the previous one (2.21).
Also, either put the plugin into the auto-load directory or use an explicit "loadplugin()", not both.
Edit: 2.22 doesn't crash if I use "threads = 1" in the ffvideosource() call.
greg
19th December 2015, 13:18
That version (2.22) crashes for me as well with various files. Try the previous one (2.21).
Also, either put the plugin into the auto-load directory or use an explicit "loadplugin()", not both.
Edit: 2.22 doesn't crash if I use "threads = 1" in the ffvideosource() call.
Wow thanks! I just tried the 2.21 version and it works!
Now I can open and play the .mov video in VirtualDubMod
greg
19th December 2015, 13:56
Ok, I tried this
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\ffms2.dll")
FFVideoSource("D:\8mm sample_1.mov")
LoadPlugin("C:\Program Files (x86)\AviSynth\plugins\TIVTC.dll")
TDecimate(Cycle=25,CycleR=8)
AssumeFPS(16)
Crop(250,0,-260,0)
and it works, I can play it in VirtualDubMod.
Now I'd like to run some Fred's scripts. What should I do to save the video in .AVI?
File->Save As... -> Video Mode: Full processing mode? Compression: Uncompressed RGB?
Sorry but I'm a total newbie
StainlessS
19th December 2015, 14:42
Also, either put the plugin into the auto-load directory or use an explicit "loadplugin()", not both.
Mobile:
You are still doing it.
Assuming yv12, select fast recompress, select eg huffyuv (yuy2) or ut_video codec (search) , then saveas.
Saving as rgb is not lossless due to conversion, and file sizes would be huge.
Groucho2004
19th December 2015, 15:07
Mobile:
You are still doing it.
Huh? What?
StainlessS
19th December 2015, 15:53
Not you g2004, the op [EDIT: Not 'op', I meant that greg was ignoring Groucho2004 advise].
manono
19th December 2015, 20:30
how do I know that the telecine duplication cycle pattern always starts at the same point in every .mov file?
It doesn't have to. No matter where it begins, in every 25-frame cycle 8 duplicates will be removed. This assumes the other files were like the first, which was the only one I looked at. Now that you know how to do the counting, you can check them yourself. Pick any place to start and count off 25 frames and there should be 8 duplicate frames within those 25 frames.
StainlessS
20th December 2015, 06:42
@Greg, Clarification: decimators will leave out the frames that are most similar to their previous frames, there is however
an exception in FDecimate, which just throws away the earliest frames that are below a difference threshold. FDecimate is perhaps best
avoided, as even the author is not too impressed with it.
Pol Fieldman
25th February 2016, 23:09
:thanks:
Many thanks to Video Fred for sharing your Avisynth work!
it was a great help to complete my telecine DIY project.
See : https://www.youtube.com/watch?v=eZniFhJR17M
Pol
johnmeyer
26th February 2016, 01:14
Amazingly well-done, both the hardware capture rig (wow what a lot of work!), and the various software steps. I really appreciate the excellent gamma transfer, preserving highlights, midtones, and shadows. Also, I appreciate that you didn't turn up the sharpening controls too much. Your results look very natural.
EHarlen
26th February 2016, 16:22
Sharpening introduce halo artifacts and there is a good sharpening result in VideoFred's example clips
But I can't see any halo artifacts.How is it possible even though he don't use any dehalo filter.
feisty2
26th February 2016, 16:42
Sharpening introduce halo artifacts.
nah nah nah nah nah, some kernels do that, and some kernels don't, generally non-linear kernel (median, bilateral, etc) based sharpeners never ever produce halos, but they do feature the risk of enhancing those already existed halos
How is it possible even though he don't use any dehalo filter.
even if the kernel itself gives halos, it's possible still, you can always just non-linearize the sharpening diff with sigmoidal like expressions to remove halos at the cost of some sharpness
johnmeyer
26th February 2016, 21:13
Sharpening introduce halo artifacts and there is a good sharpening result in VideoFred's example clips
But I can't see any halo artifacts.How is it possible even though he don't use any dehalo filter.The sharpening functions used in VideoFred's scripts are the ones that do introduce halos, so the absence of halos indicates, to me, that sharpening was not used, or used very sparingly (i.e., he used really small -- or zero -- values for the sharpening parameters).
Pol Fieldman
26th February 2016, 23:00
@John :
Thank you for the compliment.
In total it took me about three months to build the machine and convert about 11 hours of film.
You are absolutely right about being conservative on the sharpening. In the examples shown I use USM_sharp_ness= 30 .For lower quality movies (I had a few that were almost transparent) I used even less sharpening.
I don’t know about halos, but if the sharpening is too high you get noise that appears around fast moving objects, something I find very annoying.
To maintain a good dynamic range, the program slowly adjusts the exposure time frame-to-frame to push the histogram as high as possible without saturating.
For movies that show almost no degradation ( like the examples I shown) I use a gamma correction of 0.5 during capture ( 12bit raw -> 12bit gamma corrected -> 8bit final (drop 4 lsb bits) ).
Pol
EHarlen
27th February 2016, 14:39
The sharpening functions used in VideoFred's scripts are the ones that do introduce halos
johnmeyer is right.
so the absence of halos indicates, to me, that sharpening was not used, or used very sparingly (i.e., he used really small -- or zero -- values for the sharpening parameters).
johnmeyer is wrong.
Watch this:
https://vimeo.com/13173031
As you can see there is a pretty good sharpening. But no halo artifacts.
johnmeyer
27th February 2016, 18:41
johnmeyer is wrong.
Watch this:
https://vimeo.com/13173031
As you can see there is a pretty good sharpening. But no halo artifacts.I am more than capable of being wrong, but not in this case.
From that video:
Before:
https://i.imgur.com/TVDDhHD.jpg
After
https://i.imgur.com/CSJSpnR.jpg
That halo above the leaf was not there in the original.
Stereodude
29th February 2016, 19:13
:thanks:
Many thanks to Video Fred for sharing your Avisynth work!
it was a great help to complete my telecine DIY project.
See : https://www.youtube.com/watch?v=eZniFhJR17M
Pol
:eek: Wow! Your digitization rig is very impressive and the results are outstanding. :cool:
maks-lee
6th March 2016, 16:19
Hi!
I have an industrial camera which can shoot 1600x1200 (or less) RGB32 @ 20, 15, 7.5, 3.75 fps.
I have Eumig mark 610d with obturator fan cut-off
I am trying to capture avi at 20 fps on camera, with 6 fps set on Eumig (8 mm film normal)
i am using this script with getdups
Avisource("E:\test\1.avi")
loadplugin("GetDups.dll")
fc=Framecount()
AssumeTFF()
ConvertToYV12()
GetDups(mode=0)
AssumeFps(16)
ChangeFps(25)
Trim(0, fc*2/3)
Here is what i've got after the script:
https://vimeo.com/99840540
The speed is not normal, and it's twitchy
The question is: maybe i can use modified (somehow) Fred's script (or any other) to get the normal speed ?
(actually, i dont need any cleaning or stabilizing of the film due to time it takes, only speed normalization, if it is possible). Thanks!
johnmeyer
6th March 2016, 18:34
Well, whatever that script is doing, it sure is creating a mess. There are all sorts of missing frames (i.e., frames that are NOT dups that have been removed). You need to take a completely different approach to removing duplicates. I use TFM and TDecimate, using some very unusual settings, in order to recover good frames from a 24 fps sound film projector captured with a Sony FX1 NTSC camcorder with the shutter speed set to 1/1000 second.
Your situation is far, far easier, and you should be able to use fairly standard settings for TFM and TDecimate. All you need to do is get the Cycle and CycleR parameters set correctly.
Fizick
14th March 2016, 23:55
The speed is not normal, and it's twitchy
1. what do you get without ChangeFPS(25) ?
if resulted frame sequence is not smooth (dubbed or missed frames), try tune GetDups parameters (BTW, new version 0.94 is out with additional parameters)
2. then we can help you with framerate conversion (or without it) :)
Please provide also input video (before getdups).
johnmeyer, the existense of GetPups is due to situation is NOT far, far easier ( IMO). In particular not-stable projection speed.
johnmeyer
15th March 2016, 03:14
I didn't see any reference to a changing projector speed.
mpxman
12th July 2016, 12:38
Why video is cropped second time by using est_left est_top est_right and est_bottom? Can left, top right and bottom parts be harmful for depanning?
est_left=20 est_top=60 est_right=60 est_bottom=60 #crop values for special Estimate clip
stab_reference= source1.crop(20,20,-20,-20).colorYUV(autogain=true).crop(est_left,est_top,-est_right,-est_bottom)
For me cropping causes that FFT windows size is halved and stabilizing stops working because trust value increases.
Be default
winx - number of columns (width) of fft window (default = 0 for maximum power of 2 within frame width).
winy - number of rows (height) of fft window (default = 0 for maximum power of 2 within frame height).
Could the FFT window be expanded to match stab_reference or is this avoidable? Would this cropping be ok?
est_left=20 est_top=20 est_right=20 est_bottom=20 #crop values for special Estimate clip
stab_reference= source1.crop(est_left,est_top,-est_right,-est_bottom).colorYUV(autogain=true)
data=DePanEstimate(stab_reference,trust=trust_value,dxmax=maxstabH,dymax=maxstabV, winx=stab_reference.Width , winy=stab_reference.Height)
Grayscale image is not centralized because the crop(20,20,-20,-20).
result5= overlay(source1,greyscale(stab_reference),x=est_left,y=est_top).addborders(2,2,2,2,$FFFFFF).Lanczos4Resize(WS,HS)
videoFred
12th July 2016, 12:57
Why video is cropped second time by using est_left est_top est_right and est_bottom? Can left, top right and bottom parts be harmful for depanning?
It depends on the original capturing. For example if frame borders or sprocket holes are captured. (we are talking about super-8 film here). And with this region of interest setting, you can do the opposite too: analysing sprocket holes only for example. To eliminate projector jitter for example.
Fred.
johnmeyer
15th September 2016, 23:48
I'm still using more or less the same script I posted a few years ago. This fall I hope to spend a little time improving it by using some of the things VideoFred and StainlessS created for improving color balance.
Here's a sample of some of the improvements I made on some 16mm film I did for a client last spring:
16mm Before & After (https://www.youtube.com/watch?v=tBAHzO7rJS0)
color
2nd October 2016, 21:17
I'm still a bit new at this. I get the script working but there is only comparing, I try to modify the avs-files in the download to get the result, but I just can't get it to work. Can someone post the scripts with only the result? I realy want to try it out. :D
johnmeyer
3rd October 2016, 02:34
Just remove the letter "S" from the Result= line.
[edit]
Side-by-side ("before/after")
result="resultS4"
No before/after
result="result4"
myte187
5th February 2017, 03:59
First of all, i want to say a big thanks for this script.
I am doing real time telecine at 25fps.
I seen some warnings about this script is for frame by frame.
Here is my comparison video https://vimeo.com/201580895
I know how to remove the split screen by removing the "S"
But i want a full screen result as here in the comparison with NO interpolation because its 25 fps recorded with camera.
Anyone here getting some good results with real time?
thank you
videoFred
5th February 2017, 14:09
I am doing real time telecine at 25fps.
I seen some warnings about this script is for frame by frame.
Hello mythe187,
If your file contains duplicate frames, denoising will not work as it should be. If possible remove duplicate frames before using my script.
I know how to remove the split screen by removing the "S"
But i want a full screen result as here in the comparison with NO interpolation because its 25 fps recorded with camera.
Anyone here getting some good results with real time?
You can disable interpolation by setting numerator and play_speed both to the same value.
Fred.
wdwms
21st February 2017, 16:50
Didn't embed, see next post
wdwms
21st February 2017, 16:52
Wanted to show you all another one of our color restorations.. this one was horrid to say the least.. here is a split side by side comparison..
(I'm aware of the slow frame rate, was fixed in our final non-comparison release)
I'm semi-satisfied w/the results..the saturation isn't where it should be, but because so much color was gone it was hard to pump it up anymore w/out it looking fake.
https://vimeo.com/195723437
This was prior to building a new PC and new workflow. We're going to use less avisynth and more Virtualdub plugins. The newest version of the plugin we use uses Nvida Cuda and we have a new video card (nvidia GTX 1070) enroute to speed that up. Couple it with the new i7 6800k and 2x SSDs in RAID 0 - we're cookin'!
-t
johnmeyer
21st February 2017, 17:24
I couldn't get the video to play ("No video with supported format and MME type found"). I am able to see a single frame thumbnail, but that thumbnail looks very "muddy." However, perhaps it is "dimmed," as thumbnails often are.
wdwms
21st February 2017, 17:33
I couldn't get the video to play ("No video with supported format and MME type found"). I am able to see a single frame thumbnail, but that thumbnail looks very "muddy." However, perhaps it is "dimmed," as thumbnails often are.
Go here: https://vimeo.com/retrowdw/videos
Second video down on in the right column, its a split screen comparison.
wdwms
21st February 2017, 17:39
You may be interested in this short montage I put together as well. Has footage from many of the films we've restored over the past 2-3 years:
https://vimeo.com/184415788
johnmeyer
21st February 2017, 21:18
Very nice restorations.
You didn't say (or I didn't see) any description of what method you used for color restoration. I ask because VideoFred worked with StainlessS to produce some newer color correction tools that might be able to do a slightly better job. There is still some residual color in some of the white highlights (like the water foam).
wdwms
22nd February 2017, 18:01
Very nice restorations.
You didn't say (or I didn't see) any description of what method you used for color restoration. I ask because VideoFred worked with StainlessS to produce some newer color correction tools that might be able to do a slightly better job. There is still some residual color in some of the white highlights (like the water foam).
Using Colormill, I'd like to see what these new tools are that they created. Where are they avail for DL?
The past few films we did had such poor color and dyes that if i adjusted one color it would screw up something else on the film.
A more true example of what we've been able to do is here:
https://vimeo.com/204823084/f2b67232cb
-t
johnmeyer
22nd February 2017, 20:18
Here is the thread where StainlessS and VideoFred work together on an automated color correction tool for film:
GamMac v1.02 - 17 July 2016 (https://forum.doom9.org/showthread.php?t=173695)
videoFred
22nd February 2017, 22:22
@wdwms:
Color correction is good, but can you not upload better quality?
Also, can we download an original, not manupulated file somewhere? That would be fine to test GamMac on it.
@ John:
I know you are working with MT. Have you tested the latest Avisynth Plus? The MT option is incredible: sometimes 3-4 times faster.
@ Everybody :)
DePanStabilize() works a LOT better when motion vectors are created with MDepan() from the MVTools2 package.
Fred.
wdwms
22nd February 2017, 22:45
@wdwms:
Color correction is good, but can you not upload better quality?
Also, can we download an original, not manupulated file somewhere? That would be fine to test GamMac on it.
These film stocks are pretty "soft" to start with, so the quality is pretty crappy to start. Look at some of my films from a few months ago, the source material was much better. These last 6 souvenir films are junk quality.
My finals are lagartith lossless and I then Mp4 encode them, whatever Vimeo does to them after that, i'm not sure.
All my sources from the transfers are v210 lossless AVIs at 1080, 18fsp. Most are in the 20-60gb file range. I can get you a few clips together you can try your color correction on. Would Lagarith be ok?
-t
johnmeyer
22nd February 2017, 23:22
@ John:
I know you are working with MT. Have you tested the latest Avisynth Plus? The MT option is incredible: sometimes 3-4 times faster.
@ Everybody :)
DePanStabilize() works a LOT better when motion vectors are created with MDepan() from the MVTools2 package.Fred,
Can you be specific about which AVISynth Plus build I should try? I'd really like to try that out. Also, have you posted the code where you use MDepan from MVTools2 to created the stabilization? I must have missed that.
videoFred
22nd February 2017, 23:32
My finals are lagartith lossless and I then Mp4 encode them, whatever Vimeo does to them after that, i'm not sure.
I use Xvid, high bitrate (8000) for uploading. Both Vimeo and youtube are showing fine (even HD) quality.
All my sources from the transfers are v210 lossless AVIs at 1080, 18fsp. Most are in the 20-60gb file range. I can get you a few clips together you can try your color correction on. Would Lagarith be ok?
Yes, Lagarith would be fine, looking forwards for testing.
Fred.
videoFred
22nd February 2017, 23:46
Fred,
Can you be specific about which AVISynth Plus build I should try? I'd really like to try that out.
I'm using the 34 bits build that comes with Groucho's exellent 7 versions installer. I can highly recommend this installer and also Avs Meter, these are both great tools.
Also, have you posted the code where you use MDepan from MVTools2 to created the stabilization? I must have missed that.
No, I have not posted it yet. But I do it now: :p
vectors= yourclip.MSuper().MAnalyse(isb=false)
mdata= MDepan(yourclip,vectors,rot=false, zoom=false)
stabilized=yourclip.DePanStabilize(data=mdata,cutoff=0.5, dxmax=60,dymax=60,zoommax=0,rotmax=0,method=0,info=true)
Dxmax and dymax can be set according to your source and what you want. If you get false scene detections (base!) , it can help to increase these values.
Fred.
johnmeyer
23rd February 2017, 01:46
Many thanks. I'm in the middle of a large videotape transfer project, but I'll update everything when I'm finished with that.
johnmeyer
23rd February 2017, 22:09
I did briefly use Groucho's installer and installed the 32-bit version of AVISynth+. I immediately got errors stating that SetMTMode was not supported. I thought that multi-threading was supported, but since it isn't, and since I was mostly interested in the possibility of this version being faster, I immediately uninstalled it, because I'm working against a deadline.
When I have more time, perhaps I'll try it again.
videoFred
23rd February 2017, 22:20
I did briefly use Groucho's installer and installed the 32-bit version of AVISynth+. I immediately got errors stating that SetMTMode was not supported. I thought that multi-threading was supported, but since it isn't, and since I was mostly interested in the possibility of this version being faster, I immediately uninstalled it, because I'm working against a deadline.
When I have more time, perhaps I'll try it again.
But there are different rules in Avysynth+.
http://avisynth.nl/index.php/AviSynth%2B#Guidelines_on_choosing_the_correct_MT_mode
Please remove all SetMTMode() calls from your script.
They are not recognised in Avisynth+.
Then put this at the beginning of your script:
SetFilterMTMode("DEFAULT_MT_MODE", 2)
And this at the end of your script:
Prefetch(4)
Fred.
johnmeyer
23rd February 2017, 23:36
Fred,
Thanks for that. It will save me a lot of reading. I just didn't have the time to research it while trying to finish a big video transfer project for a bride and groom.
hydra3333
1st April 2017, 01:15
Not sure where to post this ... Raspberry Pi used for capture.
https://www.raspberrypi.org/magpi-issues/MagPi56.pdf page 30
https://www.youtube.com/watch?v=57OWBpZ3eN4
https://www.youtube.com/watch?v=zeYRGvWeYXo
johnmeyer
1st April 2017, 02:08
Not sure where to post this ... Raspberry Pi used for capture.It looks pretty good!
JoeSuper8
22nd August 2017, 02:10
Recently completed a new 8mm Cine2Digits based transfer system and am trying to make sure everything is as good as possible before continuing the transfers.
https://vimeo.com/229795621
Any recommendations to improve the capture or the results? Happy to offer frames files for testing.
VideoFred’s script with no interpolation/frame blending is running at 0.4 fps (the settings I changed are below). Any way to improve it without sacrificing output quality? My custom built PC is fairly new with an i7-6700K processor, 16GB RAM, and an Intel 750 series SSD. The final frame size is fairly large at 1664 x 1264 which contributes to some of the slowness. I tried JohnMeyer’s script and it also ran at 0.4fps. Changed JohnMeyer options: maxstabH 15, maxstabV 20, dirt strength 15, threads 3, increased max memory.
Also how should I add the GamMac script to VideoFred’s script? I am not sure how to use the FredAverage and without it, using VideoFred and GamMac’s script is resulting in noticeable color banding as mentioned elsewhere.
Would changing the plastic diffuser on the Cine2Digits to an opal glass diffuser improve blooming or anything else in the transfer?
Setup:
1. Eumig Mark 610D, projector blades removed, gate widened, set to 6fps capture. Hall effect sensor with magnet attached to the cam (?) inside
2. Point Grey Machine Vision camera CM3-U3-31S4C-CS Chameleon3 3.2 MP Color USB3 Vision (Sony IMX265) + Point Grey 9 pin 0.15m GPIO Cable with JST Connector
3. Schneider Componon 50mm f/2.8 lens, set to f/5.6
4. Kulicke Soffa Multi-axis linear positioning xyz stage for focus and framing adjustment of the camera
5. Flim cleaned with Edwal anti-stat; no wetgate transfer (above example is Oct. 1965 Kodachrome Regular 8mm)
6. Cine2Digits Lighting System and Capture Program, RGB dials set to 1.47, capturing to 16 bit TIFF, highlights restored with lightroom and saved to 8 bit TIFF and then converted to 16fps uncompressed AVI (is there a way to adjust the capture in Cine2Digits to replicate the restoration of highlights in a 16 bit capture – maybe with adjusting the LUT graph?). Trigger delay 70ms. Auto levels, no custom color correction.
camera settings:
source format bayerRG16 Bilinear HQ
analog gain 0 auto off
black level 0
white balance :
red auto off, set to 1.8
blue auto off, set to 1.1
7. Processing with VideoFred’s script. Changed options: dirt_strength 15, denoising strength 150, USM sharpness 10, last_sharp 0.2, last_blur 0.05. No interpolation or frame blending (interpolation slowed down the script to 0.1fps from 0.4fps).
johnmeyer
22nd August 2017, 03:40
Something is wrong if you used my script and got less than 0.4 fps. My system uses an HD camcorder for capture but I down-res in the camera to 720x480 and use that for restoration. I usually get between 10 and 15 fps. You should try higher and lower resolutions and then compare the capture results. For 8mm, I doubt very, very much that you will get one additional ounce of detail by going above 720x480, but you need to try it yourself with your own equipment.
Even when restoring higher resolution captures, I seem to remember performance numbers considerably higher than yours. Can you upload about 10-15 seconds of one of your original captures and I'll run it through my latest script and tell you what I get.
I don't know anything about the sensor/camera you are using. It sounds similar to VideoFred's equipment. I don't know what sort of gamma control you have, nor do I know if you can monitor the capture while it is happening and tell if you are blowing out highlights. I say this because, on my computer, the Vimeo version of your transfer looks like you've lost a lot of detail in the highlights. Remember that the mantra in film transfer is "expose for the highlights." This may result in a dark capture, but you can gain that in post and then reduce any noise in the shadows using the MDegrain portion of VideoFred's script (and my adaptation of that script). I use a regular camcorder (Sony FX1) for my captures, and use its zebra controls to tell me when to alter the exposure from the default. Also, it has a "spotlight" function that is designed to keep from overexposing a stage actor in a spotlight, surrounded by a dark stage. It works wonders during most film captures.
Here is a link to my 1940 Flint Michigan parade footage. I offer it because it too is a parade, and you can compare the highlights on the flag, drum heads, white flowers on the floats, etc. In most cases, you can see plenty of detail in these bright areas.
1940 Flint Michigan Parade (https://www.youtube.com/watch?v=t8HjRN0rw5M)
As you can tell, I used motion interpolation on that clip to make it smoother. I am generally not a big fan of doing this, but the judder on that particular 16 fps capture was pretty bad. Here is another parade, this one from 8mm film, that I kept at the original 15 fps:
1971 Tournament of Roses Parade (https://www.youtube.com/watch?v=-jP5_MOR3Dc)
There is a little loss of detail on some of the dresses.
JoeSuper8
22nd August 2017, 03:55
Here is a link to a JPG image sequence, one frame per capture for about 15 seconds: https://www.dropbox.com/s/us621w1arhwbz02/Joe%20clip.zip?dl=0
videoFred
22nd August 2017, 11:06
Hi Joe,
Welcome here :)
First of all, please try to capture as good as possible. Later, we can talk about Gammac etc....
About the Jpeg image sequence: you have not captured the full 0-255 range. It's more like 0-125. You have set red auto and blue auto off. Why? One of the great benefits of C2D is the exellent auto exposure feature. If you set the limit to 245 you will almost never get blown out whites.
Sharpness can be better also. Have you tried to find the 'sweet spot' from your lens? Every lens has a sweet spot. Easy to check: in C2D, use internal flashing and play with the lens aperture. At a certain point the image will look sharpest. This is your sweet spot. Leave it there forever. :) Then you can fine focus with your camera slide.
Also, there is no need to save as image sequence. I always save straight to AVI, at 15fps! I'm using the Canopus HQX codec for this but Lagarith etc.. will work fine too. Uncompressed is also an option but it creates huge files and why would we do it.. You will see no visual difference.
About the speed from the script: downscaling the source will speed up the script a lot. You can upscale again at the very end of the script.
https://forum.doom9.org/showthread.php?p=1810955#post1810955
many greetings,
Fred.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.