Log in

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


Pages : [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

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.